1 #ifndef STAN__AGRAD__REV__MATRIX__LDLT_ALLOC_HPP
2 #define STAN__AGRAD__REV__MATRIX__LDLT_ALLOC_HPP
19 template<
int R,
int C>
32 inline void compute(
const Eigen::Matrix<var,R,C> &A) {
33 Eigen::Matrix<double,R,C> Ad(A.rows(),A.cols());
36 _variA.resize(A.rows(),A.cols());
38 for (
size_t j = 0; j <
N_; j++) {
39 for (
size_t i = 0; i <
N_; i++) {
40 Ad(i,j) = A(i,j).val();
50 return _ldlt.vectorD().array().log().sum();
54 Eigen::LDLT<Eigen::Matrix<double,R,C> >
_ldlt;
double log_abs_det() const
Compute the log(abs(det(A))). This is just a convenience function.
This object stores the actual (double typed) LDLT factorization of an Eigen::Matrix<var> along with poi...
Eigen::Matrix< vari *, R, C > _variA
LDLT_alloc(const Eigen::Matrix< var, R, C > &A)
A chainable_alloc is an object which is constructed and destructed normally but the memory lifespan i...
void compute(const Eigen::Matrix< var, R, C > &A)
Compute the LDLT factorization and store pointers to the vari's of the matrix entries to be used when...
Eigen::LDLT< Eigen::Matrix< double, R, C > > _ldlt