Standard Cholesky decomposition (LL^T) of a matrix and associated features. More...
#include <LLT.h>
Public Types | |
enum | { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime } |
enum | { PacketSize = internal::packet_traits<Scalar>::size, AlignmentMask = int(PacketSize)-1, UpLo = _UpLo } |
typedef MatrixType::Index | Index |
typedef _MatrixType | MatrixType |
typedef NumTraits< typename MatrixType::Scalar >::Real | RealScalar |
typedef MatrixType::Scalar | Scalar |
typedef internal::LLT_Traits < MatrixType, UpLo > | Traits |
Public Member Functions | |
Index | cols () const |
LLT & | compute (const MatrixType &matrix) |
ComputationInfo | info () const |
Reports whether previous computation was successful. | |
LLT () | |
Default Constructor. | |
LLT (Index size) | |
Default Constructor with memory preallocation. | |
LLT (const MatrixType &matrix) | |
Traits::MatrixL | matrixL () const |
const MatrixType & | matrixLLT () const |
Traits::MatrixU | matrixU () const |
MatrixType | reconstructedMatrix () const |
Index | rows () const |
template<typename Rhs > | |
const internal::solve_retval < LLT, Rhs > | solve (const MatrixBase< Rhs > &b) const |
template<typename Derived > | |
void | solveInPlace (MatrixBase< Derived > &bAndX) const |
Protected Attributes | |
ComputationInfo | m_info |
bool | m_isInitialized |
MatrixType | m_matrix |
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
MatrixType | the type of the matrix of which we are computing the LL^T Cholesky decomposition |
This class performs a LL^T Cholesky decomposition of a symmetric, positive definite matrix A such that A = LL^* = U^*U, where L is lower triangular.
While the Cholesky decomposition is particularly useful to solve selfadjoint problems like D^*D x = b, for that purpose, we recommend the Cholesky decomposition without square root which is more stable and even faster. Nevertheless, this standard Cholesky decomposition remains useful in many other situations like generalised eigen problems with hermitian matrices.
Remember that Cholesky decompositions are not rank-revealing. This LLT decomposition is only stable on positive definite matrices, use LDLT instead for the semidefinite case. Also, do not use a Cholesky decomposition to determine whether a system of equations has a solution.
typedef _MatrixType LLT< _MatrixType, _UpLo >::MatrixType |
typedef NumTraits<typename MatrixType::Scalar>::Real LLT< _MatrixType, _UpLo >::RealScalar |
typedef MatrixType::Scalar LLT< _MatrixType, _UpLo >::Scalar |
typedef internal::LLT_Traits<MatrixType,UpLo> LLT< _MatrixType, _UpLo >::Traits |
anonymous enum |
anonymous enum |
Default Constructor.
The default constructor is useful in cases in which the user intends to perform decompositions via LLT::compute(const MatrixType&).
LLT< _MatrixType, _UpLo >::LLT | ( | const MatrixType & | matrix | ) | [inline] |
LLT< MatrixType, _UpLo > & LLT< MatrixType, _UpLo >::compute | ( | const MatrixType & | a | ) |
ComputationInfo LLT< _MatrixType, _UpLo >::info | ( | ) | const [inline] |
const MatrixType& LLT< _MatrixType, _UpLo >::matrixLLT | ( | ) | const [inline] |
MatrixType LLT< MatrixType, _UpLo >::reconstructedMatrix | ( | ) | const |
const internal::solve_retval<LLT, Rhs> LLT< _MatrixType, _UpLo >::solve | ( | const MatrixBase< Rhs > & | b | ) | const [inline] |
Since this LLT class assumes anyway that the matrix A is invertible, the solution theoretically exists and is unique regardless of b.
Example:
typedef Matrix<float,Dynamic,2> DataMatrix; // let's generate some samples on the 3D plane of equation z = 2x+3y (with some noise) DataMatrix samples = DataMatrix::Random(12,2); VectorXf elevations = 2*samples.col(0) + 3*samples.col(1) + VectorXf::Random(12)*0.1; // and let's solve samples * [x y]^T = elevations in least square sense: Matrix<float,2,1> xy = (samples.adjoint() * samples).llt().solve((samples.adjoint()*elevations)); cout << xy << endl;
Output:
void LLT< MatrixType, _UpLo >::solveInPlace | ( | MatrixBase< Derived > & | bAndX | ) | const |
ComputationInfo LLT< _MatrixType, _UpLo >::m_info [protected] |
bool LLT< _MatrixType, _UpLo >::m_isInitialized [protected] |
MatrixType LLT< _MatrixType, _UpLo >::m_matrix [protected] |