1 #ifndef STAN_MATH_PRIM_FUN_DETERMINANT_HPP 2 #define STAN_MATH_PRIM_FUN_DETERMINANT_HPP 3 4 #include <stan/math/prim/err.hpp> 5 #include <stan/math/prim/meta.hpp> 6 #include <stan/math/prim/fun/Eigen.hpp> 7 8 namespace stan { 9 namespace math { 10 11 /** 12 * Returns the determinant of the specified square matrix. 13 * 14 * @tparam T type of the matrix (must be derived from \c Eigen::MatrixBase) 15 * 16 * @param m Specified matrix. 17 * @return Determinant of the matrix. 18 * @throw std::domain_error if matrix is not square. 19 */ 20 template <typename T, require_eigen_vt<std::is_arithmetic, T>* = nullptr> determinant(const T & m)21inline value_type_t<T> determinant(const T& m) { 22 check_square("determinant", "m", m); 23 return m.determinant(); 24 } 25 26 } // namespace math 27 } // namespace stan 28 29 #endif 30