Stan Math Library: stan::math::LDLT_factor< T, R, C > Class Template Reference

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Public Attributes | List of all members
stan::math::LDLT_factor< T, R, C > Class Template Reference

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 size_t | size_type
typedef double | value_type

## Public Member Functions
| LDLT_factor ()
| LDLT_factor (const Eigen::Matrix< T, R, C > &A)
void | compute (const Eigen::Matrix< T, R, C > &A)
bool | success () const
T | log_abs_det () const
void | inverse (Eigen::Matrix< T, R, C > &invA) const
template<typename Rhs >
const Eigen::internal::solve_retval< Eigen::LDLT< Eigen::Matrix< T, R, C > >, Rhs > | solve (const Eigen::MatrixBase< Rhs > &b) const
Eigen::Matrix< T, R, C > | solveRight (const Eigen::Matrix< T, R, C > &B) const
Eigen::Matrix< T, Eigen::Dynamic, 1 > | vectorD () const
Eigen::LDLT< Eigen::Matrix< T, R, C > > | matrixLDLT () const
size_t | rows () const
size_t | cols () const

## Public Attributes
size_t | N_
boost::shared_ptr< Eigen::LDLT< Eigen::Matrix< T, R, C > > > | _ldltP

## Detailed Description

### template<int R, int C, typename T>
class stan::math::LDLT_factor< T, R, C >

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.

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:

- ~~~ Eigen::Matrix<T, R, C> A1, A2;

  LDLT_factor<T, R, C> ldlt_A1(A1); LDLT_factor<T, R, C> ldlt_A2; ldlt_A2.compute(A2);

- ~~~

  Now, 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.

  Now, the caller can use the LDLT_factor objects as needed. For instance

- ~~~ x1 = mdivide_left_ldlt(ldlt_A1, b1); x2 = mdivide_right_ldlt(b2, ldlt_A2);

  d1 = log_determinant_ldlt(ldlt_A1); d2 = log_determinant_ldlt(ldlt_A2);

- ~~~

Definition at line 58 of file LDLT_factor.hpp.

## Member Typedef Documentation

template<int R, int C, typename T >

typedef size_t stan::math::LDLT_factor< T, R, C >::size_type

Definition at line 125 of file LDLT_factor.hpp.

template<int R, int C, typename T >

typedef double stan::math::LDLT_factor< T, R, C >::value_type

Definition at line 126 of file LDLT_factor.hpp.

## Constructor & Destructor Documentation

template<int R, int C, typename T >

stan::math::LDLT_factor< T, R, C >::LDLT_factor | ( |  | ) |
| inline

Definition at line 60 of file LDLT_factor.hpp.

template<int R, int C, typename T >

stan::math::LDLT_factor< T, R, C >::LDLT_factor | ( | const Eigen::Matrix< T, R, C > & | A | ) |
| inlineexplicit

Definition at line 63 of file LDLT_factor.hpp.

## Member Function Documentation

template<int R, int C, typename T >

size_t stan::math::LDLT_factor< T, R, C >::cols | ( |  | ) | const
| inline

Definition at line 123 of file LDLT_factor.hpp.

template<int R, int C, typename T >

void stan::math::LDLT_factor< T, R, C >::compute | ( | const Eigen::Matrix< T, R, C > & | A | ) |
| inline

Definition at line 68 of file LDLT_factor.hpp.

template<int R, int C, typename T >

void stan::math::LDLT_factor< T, R, C >::inverse | ( | Eigen::Matrix< T, R, C > & | invA | ) | const
| inline

Definition at line 97 of file LDLT_factor.hpp.

template<int R, int C, typename T >

T stan::math::LDLT_factor< T, R, C >::log_abs_det | ( |  | ) | const
| inline

Definition at line 93 of file LDLT_factor.hpp.

template<int R, int C, typename T >

Eigen::LDLT<Eigen::Matrix<T, R, C> > stan::math::LDLT_factor< T, R, C >::matrixLDLT | ( |  | ) | const
| inline

Definition at line 118 of file LDLT_factor.hpp.

template<int R, int C, typename T >

size_t stan::math::LDLT_factor< T, R, C >::rows | ( |  | ) | const
| inline

Definition at line 122 of file LDLT_factor.hpp.

template<int R, int C, typename T >
template<typename Rhs >

const Eigen::internal::solve_retval<Eigen::LDLT< Eigen::Matrix<T, R, C> >, Rhs> stan::math::LDLT_factor< T, R, C >::solve | ( | const Eigen::MatrixBase< Rhs > & | b | ) | const
| inline

Definition at line 105 of file LDLT_factor.hpp.

template<int R, int C, typename T >

Eigen::Matrix<T, R, C> stan::math::LDLT_factor< T, R, C >::solveRight | ( | const Eigen::Matrix< T, R, C > & | B | ) | const
| inline

Definition at line 110 of file LDLT_factor.hpp.

template<int R, int C, typename T >

bool stan::math::LDLT_factor< T, R, C >::success | ( |  | ) | const
| inline

Definition at line 74 of file LDLT_factor.hpp.

template<int R, int C, typename T >

Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::LDLT_factor< T, R, C >::vectorD | ( |  | ) | const
| inline

Definition at line 114 of file LDLT_factor.hpp.

## Member Data Documentation

template<int R, int C, typename T >

boost::shared_ptr< Eigen::LDLT< Eigen::Matrix<T, R, C> > > stan::math::LDLT_factor< T, R, C >::_ldltP

Definition at line 129 of file LDLT_factor.hpp.

template<int R, int C, typename T >

size_t stan::math::LDLT_factor< T, R, C >::N_

Definition at line 128 of file LDLT_factor.hpp.

The documentation for this class was generated from the following file:

- stan/math/prim/mat/fun/LDLT_factor.hpp

[ Stan Home Page ] © 2011–2016, Stan Development Team.