1 #ifndef STAN__AGRAD__REV__MATRIX__LDLT_FACTOR_HPP
2 #define STAN__AGRAD__REV__MATRIX__LDLT_FACTOR_HPP
44 template<
int R,
int C>
55 :
_alloc(new stan::agrad::LDLT_alloc<R,C>()) {
67 inline void compute(
const Eigen::Matrix<stan::agrad::var,R,C> &A) {
83 template<
typename Rhs>
84 inline const Eigen::internal::solve_retval<Eigen::LDLT< Eigen::Matrix<double,R,C> >, Rhs>
85 solve(
const Eigen::MatrixBase<Rhs>& b)
const {
86 return _alloc->_ldlt.solve(b);
97 ret = ret &&
_alloc->_ldlt.info() == Eigen::Success;
98 ret = ret &&
_alloc->_ldlt.isPositive();
99 ret = ret && (
_alloc->_ldlt.vectorD().array() > 0).all();
111 return _alloc->_ldlt.vectorD();
Eigen::VectorXd vectorD() const
The entries of the diagonal matrix D.
log_determinant_spd_alloc< R, C > * _alloc
This object stores the actual (double typed) LDLT factorization of an Eigen::Matrix<var> along with poi...
bool success() const
Determine whether the most recent factorization succeeded.
stan::agrad::LDLT_alloc< R, C > * _alloc
The LDLT_alloc object actually contains the factorization but is derived from the chainable_alloc cla...
void compute(const Eigen::Matrix< stan::agrad::var, R, C > &A)
Use the LDLT_factor object to factorize a new matrix.
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.
Independent (input) and dependent (output) variables for gradients.
stan::agrad::var value_type
LDLT_factor()
Default constructor.
LDLT_factor(const Eigen::Matrix< stan::agrad::var, R, C > &A)
bool check_square(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is square.