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

#include <tnt_linalg.h>

Collaboration diagram for TNT::Linear_Algebra::LU< Real >:
[legend]

List of all members.

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)

Private Member Functions

Matrix< Real > permute_copy (const Matrix< Real > &A, const Vector< int > &piv, int j0, int j1)
Vector< Real > permute_copy (const Vector< Real > &A, const Vector< int > &piv)

Private Attributes

Matrix< Real > LU_
int m
int n
int pivsign
Vector< int > piv


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.

Definition at line 1251 of file tnt_linalg.h.


Constructor & Destructor Documentation

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

LU Decomposition

Parameters:
A Rectangular matrix
Returns:
LU Decomposition object to access L, U and piv.

Definition at line 1301 of file tnt_linalg.h.


Member Function Documentation

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.

Definition at line 1438 of file tnt_linalg.h.

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

Return lower triangular factor

Returns:
L

Definition at line 1391 of file tnt_linalg.h.

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

Return pivot permutation vector

Returns:
piv

Definition at line 1429 of file tnt_linalg.h.

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

Return upper triangular factor

Returns:
U portion of LU factorization.

Definition at line 1411 of file tnt_linalg.h.

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.

Definition at line 1379 of file tnt_linalg.h.

template<class Real >
Vector<Real> TNT::Linear_Algebra::LU< Real >::permute_copy ( const Vector< Real > &  A,
const Vector< int > &  piv 
) [inline, private]

Definition at line 1277 of file tnt_linalg.h.

template<class Real >
Matrix<Real> TNT::Linear_Algebra::LU< Real >::permute_copy ( const Matrix< Real > &  A,
const Vector< int > &  piv,
int  j0,
int  j1 
) [inline, private]

Definition at line 1262 of file tnt_linalg.h.

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:
b a 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.

Definition at line 1505 of file tnt_linalg.h.

template<class Real >
Matrix<Real> TNT::Linear_Algebra::LU< Real >::solve ( const Matrix< Real > &  B  )  [inline]

Solve A*X = B

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

Definition at line 1455 of file tnt_linalg.h.


Member Data Documentation

template<class Real >
Matrix<Real> TNT::Linear_Algebra::LU< Real >::LU_ [private]

Definition at line 1257 of file tnt_linalg.h.

template<class Real >
int TNT::Linear_Algebra::LU< Real >::m [private]

Definition at line 1258 of file tnt_linalg.h.

template<class Real >
int TNT::Linear_Algebra::LU< Real >::n [private]

Definition at line 1258 of file tnt_linalg.h.

template<class Real >
Vector<int> TNT::Linear_Algebra::LU< Real >::piv [private]

Definition at line 1259 of file tnt_linalg.h.

template<class Real >
int TNT::Linear_Algebra::LU< Real >::pivsign [private]

Definition at line 1258 of file tnt_linalg.h.


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

Generated on Fri Feb 6 13:30:19 2009 for CorAL by  doxygen 1.5.8