1 #ifndef STAN_MATH_PRIM_MAT_FUN_LDLT_FACTOR_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_LDLT_FACTOR_HPP 7 #include <boost/shared_ptr.hpp> 62 template <
typename T,
int R,
int C>
65 typedef Eigen::Matrix<T, Eigen::Dynamic, 1>
vector_t;
67 typedef Eigen::LDLT<matrix_t>
ldlt_t;
84 if (
ldltP_->info() != Eigen::Success)
86 if (!(
ldltP_->isPositive()))
88 vector_t ldltP_diag(
ldltP_->vectorD());
89 for (
int i = 0; i < ldltP_diag.size(); ++i)
90 if (ldltP_diag(i) <= 0 ||
is_nan(ldltP_diag(i)))
97 inline void inverse(matrix_t& invA)
const {
99 ldltP_->solveInPlace(invA);
102 #if EIGEN_VERSION_AT_LEAST(3, 3, 0) 103 template <
typename Rhs>
104 inline const Eigen::Solve<ldlt_t, Rhs>
solve(
105 const Eigen::MatrixBase<Rhs>& b)
const {
109 template <
typename Rhs>
110 inline const Eigen::internal::solve_retval<ldlt_t, Rhs>
solve(
111 const Eigen::MatrixBase<Rhs>& b)
const {
124 inline size_t rows()
const {
return N_; }
125 inline size_t cols()
const {
return N_; }
ldlt_t matrixLDLT() const
Eigen::Matrix< T, R, C > matrix_t
matrix_t solveRight(const matrix_t &B) const
void check_square(const char *function, const char *name, const matrix_cl &y)
Check if the matrix_cl is square.
void inverse(matrix_t &invA) const
const Eigen::internal::solve_retval< ldlt_t, Rhs > solve(const Eigen::MatrixBase< Rhs > &b) const
void compute(const matrix_t &A)
LDLT_factor is a thin wrapper on Eigen::LDLT to allow for reusing factorizations and efficient autodi...
LDLT_factor(const matrix_t &A)
boost::shared_ptr< ldlt_t > ldltP_
matrix_cl transpose(const matrix_cl &src)
Takes the transpose of the matrix on the OpenCL device.
Eigen::Matrix< T, Eigen::Dynamic, 1 > vector_t
int is_nan(const fvar< T > &x)
Returns 1 if the input's value is NaN and 0 otherwise.
Eigen::LDLT< matrix_t > ldlt_t