Automatic Differentiation
 
Loading...
Searching...
No Matches
log_determinant_ldlt.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_LOG_DETERMINANT_LDLT_HPP
2#define STAN_MATH_PRIM_FUN_LOG_DETERMINANT_LDLT_HPP
3
5
6namespace stan {
7namespace math {
8
16template <typename T, require_not_rev_matrix_t<T>* = nullptr>
18 if (A.matrix().size() == 0) {
19 return 0;
20 }
21
22 return sum(log(A.ldlt().vectorD().array()));
23}
24
25} // namespace math
26} // namespace stan
27
28#endif
LDLT_factor is a structure that holds a matrix of type T and the LDLT of its values.
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
value_type_t< T > log_determinant_ldlt(LDLT_factor< T > &A)
Returns log(abs(det(A))) given a LDLT_factor of A.
fvar< T > log(const fvar< T > &x)
Definition log.hpp:18
auto sum(const std::vector< T > &m)
Return the sum of the entries of the specified standard vector.
Definition sum.hpp:23
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...