Essentia  2.1-beta6-dev
LU< Real > Class Template Reference

#include <jama_lu.h>

Public Member Functions

 LU (const Array2D< Real > &A)
 
int isNonsingular ()
 
Array2D< Real > getL ()
 
Array2D< Real > getU ()
 
Array1D< int > getPivot ()
 
Real det ()
 
Array2D< Real > solve (const Array2D< Real > &B)
 
Array1D< Real > solve (const Array1D< Real > &b)
 

Private Member Functions

Array2D< Real > permute_copy (const Array2D< Real > &A, const Array1D< int > &piv, int j0, int j1)
 
Array1D< Real > permute_copy (const Array1D< Real > &A, const Array1D< int > &piv)
 

Private Attributes

Array2D< Real > LU_
 
int m
 
int n
 
int pivsign
 
Array1D< int > piv
 

Detailed Description

template<class Real>
class JAMA::LU< Real >

LU Decomposition.

For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U, and a permutation vector piv of length m so that A(piv,:) = L*U. If m < n, then L is m-by-m and U is m-by-n.

The LU decompostion with pivoting always exists, even if the matrix is singular, so the constructor will never fail. The primary use of the LU decomposition is in the solution of square systems of simultaneous linear equations. This will fail if isNonsingular() returns false.

Constructor & Destructor Documentation

◆ LU()

LU ( const Array2D< Real > &  A)
inline

LU Decomposition

Parameters
ARectangular matrix
Returns
LU Decomposition object to access L, U and piv.

Member Function Documentation

◆ det()

Real det ( )
inline

Compute determinant using LU factors.

Returns
determinant of A, or 0 if A is not square.

◆ getL()

Array2D<Real> getL ( )
inline

Return lower triangular factor

Returns
L

◆ getPivot()

Array1D<int> getPivot ( )
inline

Return pivot permutation vector

Returns
piv

◆ getU()

Array2D<Real> getU ( )
inline

Return upper triangular factor

Returns
U portion of LU factorization.

◆ isNonsingular()

int isNonsingular ( )
inline

Is the matrix nonsingular?

Returns
1 (true) if upper triangular factor U (and hence A) is nonsingular, 0 otherwise.

◆ permute_copy() [1/2]

Array1D<Real> permute_copy ( const Array1D< Real > &  A,
const Array1D< int > &  piv 
)
inlineprivate

References Array1D< T >::dim().

◆ permute_copy() [2/2]

Array2D<Real> permute_copy ( const Array2D< Real > &  A,
const Array1D< int > &  piv,
int  j0,
int  j1 
)
inlineprivate

References Array1D< T >::dim().

◆ solve() [1/2]

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

Solve A*x = b, where x and b are vectors of length equal
to the number of rows in A.

Parameters
ba vector (Array1D> of length equal to the first dimension of A.
Returns
x a vector (Array1D> so that L*U*x = b(piv), if B is nonconformant, returns 0x0 (null) array.

References Array1D< T >::dim1().

◆ solve() [2/2]

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

Solve A*X = B

Parameters
BA Matrix with as many rows as A and any number of columns.
Returns
X so that L*U*X = B(piv,:), if B is nonconformant, returns 0x0 (null) array.

References Array2D< T >::dim1(), and Array2D< T >::dim2().

Member Data Documentation

◆ LU_

Array2D<Real> LU_
private

◆ m

int m
private

◆ n

int n
private

◆ piv

Array1D<int> piv
private

◆ pivsign

int pivsign
private

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