Public Member Functions
LLT< _MatrixType, _UpLo > Class Template Reference

Standard Cholesky decomposition (LL^T) of a matrix and associated features. More...

List of all members.

Public Member Functions

LLTcompute (const MatrixType &matrix)
ComputationInfo info () const
 Reports whether previous computation was successful.
 LLT (Index size)
 Default Constructor with memory preallocation.
 LLT ()
 Default Constructor.
Traits::MatrixL matrixL () const
const MatrixType & matrixLLT () const
Traits::MatrixU matrixU () const
MatrixType reconstructedMatrix () const
template<typename Rhs >
const internal::solve_retval
< LLT, Rhs > 
solve (const MatrixBase< Rhs > &b) const

Detailed Description

template<typename _MatrixType, int _UpLo>
class Eigen::LLT< _MatrixType, _UpLo >

Standard Cholesky decomposition (LL^T) of a matrix and associated features.

Parameters:
MatrixTypethe 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.

See also:
MatrixBase::llt(), class LDLT

Constructor & Destructor Documentation

LLT ( ) [inline]

Default Constructor.

The default constructor is useful in cases in which the user intends to perform decompositions via LLT::compute(const MatrixType&).

LLT ( Index  size) [inline]

Default Constructor with memory preallocation.

Like the default constructor but with preallocation of the internal data according to the specified problem size.

See also:
LLT()

Member Function Documentation

LLT< MatrixType, _UpLo > & compute ( const MatrixType &  a)

Computes / recomputes the Cholesky decomposition A = LL^* = U^*U of matrix

Returns:
a reference to *this
ComputationInfo info ( ) const [inline]

Reports whether previous computation was successful.

Returns:
Success if computation was succesful, NumericalIssue if the matrix.appears to be negative.
Traits::MatrixL matrixL ( void  ) const [inline]
Returns:
a view of the lower triangular matrix L
const MatrixType& matrixLLT ( ) const [inline]
Returns:
the LLT decomposition matrix

TODO: document the storage layout

Traits::MatrixU matrixU ( ) const [inline]
Returns:
a view of the upper triangular matrix U
MatrixType reconstructedMatrix ( ) const
Returns:
the matrix represented by the decomposition, i.e., it returns the product: L L^*. This function is provided for debug purpose.
const internal::solve_retval<LLT, Rhs> solve ( const MatrixBase< Rhs > &  b) const [inline]
Returns:
the solution x of $ A x = b $ using the current decomposition of A.

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:

2.02
2.97
See also:
solveInPlace(), MatrixBase::llt()

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