class to compute the Cholesky decomposition of a matrix
class to compute the Cholesky decomposition of a symmetric positive definite matrix
provides routines to check if the decomposition succeeded (i.e. if matrix is positive definite and non-singular), to solve a linear system for the given matrix and to obtain its inverse
the actual functionality is implemented in templated helper classes which have specializations for dimensions N = 1 to 6 to achieve a gain in speed for common matrix sizes
usage example:
Definition at line 95 of file CholeskyDecomp.h.
Public Member Functions | |
template<class M > | |
CholeskyDecomp (const M &m) | |
perform a Cholesky decomposition | |
template<typename G > | |
CholeskyDecomp (G *m) | |
perform a Cholesky decomposition | |
template<typename G > | |
bool | getL (G *m) const |
obtain the decomposed matrix L | |
template<class M > | |
bool | getL (M &m) const |
obtain the decomposed matrix L | |
template<typename G > | |
bool | getLi (G *m) const |
obtain the inverse of the decomposed matrix L | |
template<class M > | |
bool | getLi (M &m) const |
obtain the inverse of the decomposed matrix L | |
template<typename G > | |
bool | Invert (G *m) const |
place the inverse into m | |
template<class M > | |
bool | Invert (M &m) const |
place the inverse into m | |
bool | ok () const |
returns true if decomposition was successful | |
operator bool () const | |
returns true if decomposition was successful | |
template<class V > | |
bool | Solve (V &rhs) const |
solves a linear system for the given right hand side | |
Private Attributes | |
F | fL [N *(N+1)/2] |
lower triangular matrix L | |
bool | fOk |
flag indicating a successful decomposition | |
#include <Math/CholeskyDecomp.h>
|
inline |
perform a Cholesky decomposition
perform a Cholesky decomposition of a symmetric positive definite matrix m
this is the constructor to uses with an SMatrix (and objects that behave like an SMatrix in terms of using operator()(int i, int j) for access to elements)
Definition at line 114 of file CholeskyDecomp.h.
|
inline |
perform a Cholesky decomposition
perform a Cholesky decomposition of a symmetric positive definite matrix m
this is the constructor to use in special applications where plain arrays are used
NOTE: the matrix is given in packed representation, matrix element m(i,j) (j <= i) is supposed to be in array element (i * (i + 1)) / 2 + j
Definition at line 132 of file CholeskyDecomp.h.
|
inline |
obtain the decomposed matrix L
NOTE: the matrix is given in packed representation, matrix element m(i,j) (j <= i) is supposed to be in array element (i * (i + 1)) / 2 + j
Definition at line 234 of file CholeskyDecomp.h.
|
inline |
obtain the decomposed matrix L
This is the method to use with a plain array.
Definition at line 207 of file CholeskyDecomp.h.
|
inline |
obtain the inverse of the decomposed matrix L
NOTE: the matrix is given in packed representation, matrix element m(j,i) (j <= i) is supposed to be in array element (i * (i + 1)) / 2 + j
Definition at line 288 of file CholeskyDecomp.h.
|
inline |
obtain the inverse of the decomposed matrix L
This is the method to use with a plain array.
Definition at line 255 of file CholeskyDecomp.h.
|
inline |
place the inverse into m
This is the method to use with a plain array.
NOTE: the matrix is given in packed representation, matrix element m(i,j) (j <= i) is supposed to be in array element (i * (i + 1)) / 2 + j
Definition at line 189 of file CholeskyDecomp.h.
|
inline |
place the inverse into m
This is the method to use with an SMatrix.
Definition at line 170 of file CholeskyDecomp.h.
returns true if decomposition was successful
Definition at line 141 of file CholeskyDecomp.h.
|
inline |
returns true if decomposition was successful
Definition at line 144 of file CholeskyDecomp.h.
|
inline |
solves a linear system for the given right hand side
Note that you can use both SVector classes and plain arrays for rhs. (Make sure that the sizes match!). It will work with any vector implementing the operator [i]
Definition at line 155 of file CholeskyDecomp.h.
lower triangular matrix L
lower triangular matrix L, packed storage, with diagonal elements pre-inverted
Definition at line 100 of file CholeskyDecomp.h.
flag indicating a successful decomposition
Definition at line 102 of file CholeskyDecomp.h.