1 #ifndef STAN_MATH_REV_MAT_FUN_LDLT_FACTOR_HPP 2 #define STAN_MATH_REV_MAT_FUN_LDLT_FACTOR_HPP 46 template <
int R,
int C>
69 inline void compute(
const Eigen::Matrix<var, R, C> &A) {
85 #if EIGEN_VERSION_AT_LEAST(3, 3, 0) 86 template <
typename Rhs>
87 inline const Eigen::Solve<Eigen::LDLT<Eigen::Matrix<double, R, C> >, Rhs>
88 solve(
const Eigen::MatrixBase<Rhs> &b)
const {
89 return alloc_->ldlt_.solve(b);
92 template <
typename Rhs>
93 inline const Eigen::internal::solve_retval<
94 Eigen::LDLT<Eigen::Matrix<double, R, C> >, Rhs>
95 solve(
const Eigen::MatrixBase<Rhs> &b)
const {
96 return alloc_->ldlt_.solve(b);
107 ret = alloc_->N_ != 0;
108 ret = ret && alloc_->ldlt_.info() == Eigen::Success;
109 ret = ret && alloc_->ldlt_.isPositive();
110 ret = ret && (alloc_->ldlt_.vectorD().array() > 0).all();
121 inline Eigen::VectorXd
vectorD()
const {
return alloc_->ldlt_.vectorD(); }
123 inline size_t rows()
const {
return alloc_->N_; }
124 inline size_t cols()
const {
return alloc_->N_; }
LDLT_factor(const Eigen::Matrix< var, R, C > &A)
void compute(const Eigen::Matrix< var, R, C > &A)
Use the LDLT_factor object to factorize a new matrix.
void check_square(const char *function, const char *name, const matrix_cl &y)
Check if the matrix_cl is square.
This object stores the actual (double typed) LDLT factorization of an Eigen::Matrix<var> along with p...
const Eigen::internal::solve_retval< ldlt_t, Rhs > solve(const Eigen::MatrixBase< Rhs > &b) const
Independent (input) and dependent (output) variables for gradients.
void compute(const matrix_t &A)
bool success() const
Determine whether the most recent factorization succeeded.
LDLT_factor is a thin wrapper on Eigen::LDLT to allow for reusing factorizations and efficient autodi...
const Eigen::internal::solve_retval< Eigen::LDLT< Eigen::Matrix< double, R, C > >, Rhs > solve(const Eigen::MatrixBase< Rhs > &b) const
Compute the actual numerical result of inv(A)*b.
LDLT_alloc< R, C > * alloc_
The LDLT_alloc object actually contains the factorization but is derived from the chainable_alloc cla...
Eigen::VectorXd vectorD() const
The entries of the diagonal matrix D.
LDLT_factor()
Default constructor.