My Project
Loading...
Searching...
No Matches
TNT::Linear_Algebra::LU< Real > Class Template Reference

#include <tnt_linalg.h>

Public Member Functions

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

Detailed Description

template<class Real>
class TNT::Linear_Algebra::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()

template<class Real >
TNT::Linear_Algebra::LU< Real >::LU ( const Matrix< Real > & A)
inline

LU Decomposition

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

Member Function Documentation

◆ det()

template<class Real >
Real TNT::Linear_Algebra::LU< Real >::det ( )
inline

Compute determinant using LU factors.

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

◆ getL()

template<class Real >
Matrix< Real > TNT::Linear_Algebra::LU< Real >::getL ( )
inline

Return lower triangular factor

Returns
L

◆ getPivot()

template<class Real >
Vector< int > TNT::Linear_Algebra::LU< Real >::getPivot ( )
inline

Return pivot permutation vector

Returns
piv

◆ getU()

template<class Real >
Matrix< Real > TNT::Linear_Algebra::LU< Real >::getU ( )
inline

Return upper triangular factor

Returns
U portion of LU factorization.

◆ isNonsingular()

template<class Real >
int TNT::Linear_Algebra::LU< Real >::isNonsingular ( )
inline

Is the matrix nonsingular?

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

◆ solve() [1/2]

template<class Real >
Matrix< Real > TNT::Linear_Algebra::LU< Real >::solve ( const Matrix< 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 Real(0.0) (null) array.

◆ solve() [2/2]

template<class Real >
Vector< Real > TNT::Linear_Algebra::LU< Real >::solve ( const Vector< 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 (Vector> of length equal to the first dimension of A.
Returns
x a vector (Vector> so that L*U*x = b(piv), if B is nonconformant, returns Real(0.0) (null) array.

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