Essentia  2.1-beta5-dev
Cholesky< Real > Class Template Reference

#include <jama_cholesky.h>

Public Member Functions

 Cholesky ()
 
 Cholesky (const Array2D< Real > &A)
 
Array2D< Real > getL () const
 
Array1D< Real > solve (const Array1D< Real > &B)
 
Array2D< Real > solve (const Array2D< Real > &B)
 
int is_spd () const
 

Private Attributes

Array2D< Real > L_
 
int isspd
 

Detailed Description

template<class Real>
class JAMA::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:

     Array2D<double> A(n,n);
     Array2D<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

◆ Cholesky() [1/2]

Cholesky ( )

◆ Cholesky() [2/2]

Cholesky ( const Array2D< Real > &  A)

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.

References Array2D< T >::dim1(), Array2D< T >::dim2(), Cholesky< Real >::isspd, and Cholesky< Real >::L_.

Member Function Documentation

◆ getL()

Array2D< Real > getL ( ) const
Returns
the lower triangular factor, L, such that L*L'=A.

References Cholesky< Real >::L_.

◆ is_spd()

int is_spd ( ) const
Returns
1, if original matrix to be factored was symmetric positive-definite (SPD).

References Cholesky< Real >::isspd.

◆ solve() [1/2]

Array1D< Real > solve ( const Array1D< Real > &  b)

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

Parameters
BA 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 (0x0) array is returned.

References Array1D< T >::copy(), Array2D< T >::dim1(), Array1D< T >::dim1(), and Cholesky< Real >::L_.

◆ solve() [2/2]

Array2D< Real > solve ( const Array2D< Real > &  B)

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

Parameters
BA 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 (0x0) array is returned.

References Array2D< T >::copy(), Array2D< T >::dim1(), Array2D< T >::dim2(), and Cholesky< Real >::L_.

Member Data Documentation

◆ isspd

int isspd
private

◆ L_


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