TooN::Cholesky< Size, Precision > Class Template Reference [Matrix decompositions]

`#include <Cholesky.h>`

List of all members.

Public Member Functions

template<int Size2, int C2, class P2 , class B2 >
Matrix< Size, C2, Precision > backsub (const Matrix< Size2, C2, P2, B2 > &m) const
template<int Size2, class P2 , class B2 >
Vector< Size, Precision > backsub (const Vector< Size2, P2, B2 > &v) const
Run time is O(N^2).
Cholesky (int size)
Constructor for Size=Dynamic.
template<class P2 , class B2 >
Cholesky (const Matrix< Size, Size, P2, B2 > &m)
Cholesky ()
template<class P2 , class B2 >
void compute (const Matrix< Size, Size, P2, B2 > &m)
Precision determinant ()
Compute the determinant.
Matrix< Size, Size, Precision > get_D () const
Matrix< Size, Size, Precision > get_inverse ()
Matrix< Size, Size, Precision > get_L () const
Matrix< Size, Size, Precision > get_unscaled_L () const
template<int Size2, typename P2 , typename B2 >
Precision mahalanobis (const Vector< Size2, P2, B2 > &v) const

Private Member Functions

void do_compute ()

Private Attributes

Matrix< Size, Size, Precision > my_cholesky

Detailed Description

template<int Size = Dynamic, class Precision = DefaultPrecision> class TooN::Cholesky< Size, Precision >

Decomposes a positive-semidefinite symmetric matrix A (such as a covariance) into L*D*L^T, where L is lower-triangular and D is diagonal. Also can compute the classic A = L*L^T, with L lower triangular. The LDL^T form is faster to compute than the classical Cholesky decomposition. Use get_unscaled_L() and get_D() to access the individual matrices of L*D*L^T decomposition. Use get_L() to access the lower triangular matrix of the classic Cholesky decomposition L*L^T. The decomposition can be used to compute A^-1*x, A^-1*M, M*A^-1*M^T, and A^-1 itself, though the latter rarely needs to be explicitly represented. Also efficiently computes det(A) and rank(A). It can be used as follows:

```// Declare some matrices.
Matrix<3> A = ...; // we'll pretend it is pos-def
Matrix<2,3> M;
Matrix<2> B;
Vector<3> y = make_Vector(2,3,4);
// create the Cholesky decomposition of A
Cholesky<3> chol(A);
// compute x = A^-1 * y
x = cholA.backsub(y);
//compute A^-1
Matrix<3> Ainv = cholA.get_inverse();
```

Cholesky decomposition of a symmetric matrix. Only the lower half of the matrix is considered This uses the non-sqrt version of the decomposition giving symmetric M = L*D*L.T() where the diagonal of L contains ones

Parameters:
 Size the size of the matrix Precision the precision of the entries in the matrix and its decomposition

Definition at line 69 of file Cholesky.h.

Constructor & Destructor Documentation

template<int Size = Dynamic, class Precision = DefaultPrecision>
 TooN::Cholesky< Size, Precision >::Cholesky ( ) ` [inline]`

Definition at line 71 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
template<class P2 , class B2 >
 TooN::Cholesky< Size, Precision >::Cholesky ( const Matrix< Size, Size, P2, B2 > & m ) ` [inline]`

Construct the Cholesky decomposition of a matrix. This initialises the class, and performs the decomposition immediately. Run time is O(N^3)

Definition at line 77 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
 TooN::Cholesky< Size, Precision >::Cholesky ( int size ) ` [inline]`

Constructor for Size=Dynamic.

Definition at line 84 of file Cholesky.h.

Member Function Documentation

template<int Size = Dynamic, class Precision = DefaultPrecision>
template<int Size2, int C2, class P2 , class B2 >
 Matrix TooN::Cholesky< Size, Precision >::backsub ( const Matrix< Size2, C2, P2, B2 > & m ) const` [inline]`

Definition at line 161 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
template<int Size2, class P2 , class B2 >
 Vector TooN::Cholesky< Size, Precision >::backsub ( const Vector< Size2, P2, B2 > & v ) const` [inline]`

Run time is O(N^2).

Compute x = A^-1*v

Definition at line 126 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
template<class P2 , class B2 >
 void TooN::Cholesky< Size, Precision >::compute ( const Matrix< Size, Size, P2, B2 > & m ) ` [inline]`

Compute the LDL^T decomposition of another matrix. Run time is O(N^3)

Definition at line 89 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
 Precision TooN::Cholesky< Size, Precision >::determinant ( ) ` [inline]`

Compute the determinant.

Definition at line 202 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
 void TooN::Cholesky< Size, Precision >::do_compute ( ) ` [inline, private]`

Definition at line 97 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
 Matrix TooN::Cholesky< Size, Precision >::get_D ( ) const` [inline]`

Definition at line 227 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
 Matrix TooN::Cholesky< Size, Precision >::get_inverse ( ) ` [inline]`

Compute A^-1 and store in M Run time is O(N^3)

Definition at line 196 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
 Matrix TooN::Cholesky< Size, Precision >::get_L ( ) const` [inline]`

Definition at line 237 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
 Matrix TooN::Cholesky< Size, Precision >::get_unscaled_L ( ) const` [inline]`

Definition at line 215 of file Cholesky.h.

template<int Size = Dynamic, class Precision = DefaultPrecision>
template<int Size2, typename P2 , typename B2 >
 Precision TooN::Cholesky< Size, Precision >::mahalanobis ( const Vector< Size2, P2, B2 > & v ) const` [inline]`

Definition at line 211 of file Cholesky.h.

Member Data Documentation

template<int Size = Dynamic, class Precision = DefaultPrecision>
 Matrix TooN::Cholesky< Size, Precision >::my_cholesky` [private]`

Definition at line 252 of file Cholesky.h.

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

libtoon
Author(s): Florian Weisshardt
autogenerated on Fri Jan 11 10:09:49 2013