LLT< MatrixType > Class Template Reference

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

List of all members.

Public Member Functions

void compute (const MatrixType &matrix)
bool isPositiveDefinite (void) const
 LLT (const MatrixType &matrix)
 LLT ()
 Default Constructor.
Part< MatrixType, LowerTriangular > matrixL (void) const
template<typename RhsDerived , typename ResultType >
bool solve (const MatrixBase< RhsDerived > &b, ResultType *result) const
template<typename Derived >
bool solveInPlace (MatrixBase< Derived > &bAndX) const

Protected Attributes

bool m_isInitialized
bool m_isPositiveDefinite
MatrixType m_matrix

Detailed Description

template<typename MatrixType>
class Eigen::LLT< MatrixType >

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

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

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&).


Member Function Documentation

void compute ( const MatrixType &  a  )  [inline]

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

bool isPositiveDefinite ( void   )  const [inline]
Part<MatrixType, LowerTriangular> matrixL ( void   )  const [inline]
Returns:
the lower triangular matrix L
bool solve ( const MatrixBase< RhsDerived > &  b,
ResultType *  result 
) const [inline]

Computes the solution x of $ A x = b $ using the current decomposition of A. The result is stored in result

Returns:
true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD.

In other words, it computes $ b = A^{-1} b $ with $ {L^{*}}^{-1} L^{-1} b $ from right to left.

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), &xy);
cout << xy << endl;

Output:

2.02
2.97
See also:
LLT::solveInPlace(), MatrixBase::llt()
bool solveInPlace ( MatrixBase< Derived > &  bAndX  )  const [inline]

This is the in-place version of solve().

Parameters:
bAndX represents both the right-hand side matrix b and result x.
Returns:
true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD.

This version avoids a copy when the right hand side matrix b is not needed anymore.

See also:
LLT::solve(), MatrixBase::llt()

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

Generated by  doxygen 1.6.2