Automatic Differentiation
 
Loading...
Searching...
No Matches
log_determinant.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_LOG_DETERMINANT_HPP
2#define STAN_MATH_PRIM_FUN_LOG_DETERMINANT_HPP
3
7
8namespace stan {
9namespace math {
10
20template <typename EigMat,
21 require_eigen_vt<std::is_arithmetic, EigMat>* = nullptr>
22inline value_type_t<EigMat> log_determinant(const EigMat& m) {
23 if (m.size() == 0) {
24 return 0;
25 }
26 check_square("log_determinant", "m", m);
27 return m.colPivHouseholderQr().logAbsDeterminant();
28}
29
30} // namespace math
31} // namespace stan
32
33#endif
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
value_type_t< EigMat > log_determinant(const EigMat &m)
Returns the log absolute determinant of the specified square matrix.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9