1#ifndef STAN_MATH_REV_FUN_LOG_DETERMINANT_HPP
2#define STAN_MATH_REV_FUN_LOG_DETERMINANT_HPP
13template <
typename T, require_rev_matrix_t<T>* =
nullptr>
22 auto m_hh = arena_m.val().colPivHouseholderQr();
23 auto arena_m_inv_transpose =
to_arena(m_hh.inverse().transpose());
24 var log_det = m_hh.logAbsDeterminant();
27 arena_m.adj() += log_det.adj() * arena_m_inv_transpose;
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.
void reverse_pass_callback(F &&functor)
Puts a callback on the autodiff stack to be called in reverse pass.
arena_t< T > to_arena(const T &a)
Converts given argument into a type that either has any dynamic allocation on AD stack or schedules i...
typename internal::arena_type_impl< std::decay_t< T > >::type arena_t
Determines a type that can be used in place of T that does any dynamic allocations on the AD stack.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...