TNT::Linear_Algebra::Cholesky< Real > Class Template Reference

#include <tnt_linalg.h>

Public Member Functions

 Cholesky (const Matrix< Real > &A)
Matrix< Real > getL () const
Vector< Real > solve (const Vector< Real > &B)
Matrix< Real > solve (const Matrix< Real > &B)
int is_spd () const

Detailed Description

template<class Real>
class TNT::Linear_Algebra::Cholesky< Real >

For a symmetric, positive definite matrix A, this function computes the Cholesky factorization, i.e. it computes a lower triangular matrix L such that A = L*L'. If the matrix is not symmetric or positive definite, the function computes only a partial decomposition. This can be tested with the is_spd() flag.

Typical usage looks like:

	Matrix<double> A(n,n);
	Matrix<double> L;
	 ...
	Cholesky<double> chol(A);
	if (chol.is_spd())
		L = chol.getL();
  	else
		cout << "factorization was not complete.\n";
	

(Adapted from JAMA, a Java Matrix Library, developed by jointly by the Mathworks and NIST; see http://math.nist.gov/javanumerics/jama).


Constructor & Destructor Documentation

template<class Real >
TNT::Linear_Algebra::Cholesky< Real >::Cholesky ( const Matrix< Real > &  A  )  [inline]

Constructs a lower triangular matrix L, such that L*L'= A. If A is not symmetric positive-definite (SPD), only a partial factorization is performed. If is_spd() evalutate true (1) then the factorizaiton was successful.


Member Function Documentation

template<class Real >
Matrix< Real > TNT::Linear_Algebra::Cholesky< Real >::getL (  )  const [inline]
Returns:
the lower triangular factor, L, such that L*L'=A.
template<class Real >
int TNT::Linear_Algebra::Cholesky< Real >::is_spd (  )  const [inline]
Returns:
1, if original matrix to be factored was symmetric positive-definite (SPD).
template<class Real >
Matrix< Real > TNT::Linear_Algebra::Cholesky< Real >::solve ( const Matrix< Real > &  B  )  [inline]

Solve a linear system A*X = B, using the previously computed cholesky factorization of A: L*L'.

Parameters:
B A Matrix with as many rows as A and any number of columns.
Returns:
X so that L*L'*X = B. If B is nonconformat, or if A was not symmetric posidtive definite, a null (Real(0.0)) array is returned.
template<class Real >
Vector< Real > TNT::Linear_Algebra::Cholesky< Real >::solve ( const Vector< Real > &  b  )  [inline]

Solve a linear system A*x = b, using the previously computed cholesky factorization of A: L*L'.

Parameters:
b matrix with as many rows as A and any number of columns.
Returns:
x so that L*L'*x = b. If b is nonconformat, or if A was not symmetric posidtive definite, a null (Real(0.0)) array is returned.

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Functions Variables Typedefs

Generated on 22 Sep 2009 for Cali Cam by  doxygen 1.6.1