Automatic Differentiation
 
Loading...
Searching...
No Matches
log_determinant.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_FWD_FUN_LOG_DETERMINANT_HPP
2#define STAN_MATH_FWD_FUN_LOG_DETERMINANT_HPP
3
11
12namespace stan {
13namespace math {
14
15template <typename EigMat, require_eigen_vt<is_fvar, EigMat>* = nullptr>
16inline value_type_t<EigMat> log_determinant(const EigMat& m) {
17 check_square("log_determinant", "m", m);
18
19 return log(fabs(determinant(m)));
20}
21
22} // namespace math
23} // namespace stan
24#endif
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
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.
fvar< T > log(const fvar< T > &x)
Definition log.hpp:15
value_type_t< EigMat > determinant(const EigMat &m)
fvar< T > fabs(const fvar< T > &x)
Definition fabs.hpp:15
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...