![]() |
Stan Math Library
2.15.0
reverse mode automatic differentiation
|
LDLT_factor is a thin wrapper on Eigen::LDLT to allow for reusing factorizations and efficient autodiff of things like log determinants and solutions to linear systems. More...
#include <LDLT_factor.hpp>
Public Types | |
typedef Eigen::Matrix< T, Eigen::Dynamic, 1 > | vector_t |
typedef Eigen::Matrix< T, R, C > | matrix_t |
typedef Eigen::LDLT< matrix_t > | ldlt_t |
typedef size_t | size_type |
typedef double | value_type |
Public Member Functions | |
LDLT_factor () | |
LDLT_factor (const matrix_t &A) | |
void | compute (const matrix_t &A) |
bool | success () const |
T | log_abs_det () const |
void | inverse (matrix_t &invA) const |
template<typename Rhs > | |
const Eigen::internal::solve_retval< ldlt_t, Rhs > | solve (const Eigen::MatrixBase< Rhs > &b) const |
matrix_t | solveRight (const matrix_t &B) const |
vector_t | vectorD () const |
ldlt_t | matrixLDLT () const |
size_t | rows () const |
size_t | cols () const |
Public Attributes | |
size_t | N_ |
boost::shared_ptr< ldlt_t > | ldltP_ |
LDLT_factor is a thin wrapper on Eigen::LDLT to allow for reusing factorizations and efficient autodiff of things like log determinants and solutions to linear systems.
Memory is allocated in the constructor and stored in a boost::shared_ptr
, which ensures that is freed when the object is released.
After the constructor and/or compute() is called users of LDLT_factor are responsible for calling success() to check whether the factorization has succeeded. Use of an LDLT_factor object (e.g., in mdivide_left_ldlt) is undefined if success() is false.
It's usage pattern is:
The caller should check that ldlt_A1.success() and ldlt_A2.success() are true or abort accordingly. Alternatively, call check_ldlt_factor().
Note that ldlt_A1 and ldlt_A2 are completely equivalent. They simply demonstrate two different ways to construct the factorization.
The caller can use the LDLT_factor objects as needed. For instance
This class is conceptually similar to the corresponding Eigen class. Any symmetric, positive-definite matrix A can be decomposed as LDL' where L is unit lower-triangular and D is diagonal with positive diagonal elements.
Definition at line 63 of file LDLT_factor.hpp.
typedef Eigen::LDLT<matrix_t> stan::math::LDLT_factor< T, R, C >::ldlt_t |
Definition at line 67 of file LDLT_factor.hpp.
typedef Eigen::Matrix<T, R, C> stan::math::LDLT_factor< T, R, C >::matrix_t |
Definition at line 66 of file LDLT_factor.hpp.
typedef size_t stan::math::LDLT_factor< T, R, C >::size_type |
Definition at line 68 of file LDLT_factor.hpp.
typedef double stan::math::LDLT_factor< T, R, C >::value_type |
Definition at line 69 of file LDLT_factor.hpp.
typedef Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::LDLT_factor< T, R, C >::vector_t |
Definition at line 65 of file LDLT_factor.hpp.
|
inline |
Definition at line 71 of file LDLT_factor.hpp.
|
inlineexplicit |
Definition at line 73 of file LDLT_factor.hpp.
|
inline |
Definition at line 131 of file LDLT_factor.hpp.
|
inline |
Definition at line 77 of file LDLT_factor.hpp.
|
inline |
Definition at line 99 of file LDLT_factor.hpp.
|
inline |
Definition at line 95 of file LDLT_factor.hpp.
|
inline |
Definition at line 126 of file LDLT_factor.hpp.
|
inline |
Definition at line 130 of file LDLT_factor.hpp.
|
inline |
Definition at line 113 of file LDLT_factor.hpp.
|
inline |
Definition at line 118 of file LDLT_factor.hpp.
|
inline |
Definition at line 83 of file LDLT_factor.hpp.
|
inline |
Definition at line 122 of file LDLT_factor.hpp.
boost::shared_ptr<ldlt_t> stan::math::LDLT_factor< T, R, C >::ldltP_ |
Definition at line 135 of file LDLT_factor.hpp.
size_t stan::math::LDLT_factor< T, R, C >::N_ |
Definition at line 134 of file LDLT_factor.hpp.