PLaSK library
Loading...
Searching...
No Matches
JAMA::LU< Real > Class Template Reference

LU Decomposition. More...

#include <solvers/gain/wasiak/wzmocnienie/jama/jama_lu.h>

Public Member Functions

 LU (const Array2D< Real > &A)
 LU Decomposition.
 
int isNonsingular ()
 Is the matrix nonsingular?
 
Array2D< Real > getL ()
 Return lower triangular factor.
 
Array2D< Real > getU ()
 Return upper triangular factor.
 
Array1D< int > getPivot ()
 Return pivot permutation vector.
 
Real det ()
 Compute determinant using LU factors.
 
Array2D< Real > solve (const Array2D< Real > &B)
 Solve A*X = B.
 
Array1D< Real > solve (const Array1D< Real > &b)
 Solve A*x = b, where x and b are vectors of length equal
to the number of rows in A.
 

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 decomposition 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 27 of file jama_lu.h.

Constructor & Destructor Documentation

◆ LU()

template<class Real >
JAMA::LU< Real >::LU ( const Array2D< Real > &  A)
inline

LU Decomposition.

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

Definition at line 77 of file jama_lu.h.

Member Function Documentation

◆ det()

template<class Real >
Real JAMA::LU< Real >::det ( )
inline

Compute determinant using LU factors.

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

Definition at line 214 of file jama_lu.h.

◆ getL()

template<class Real >
Array2D< Real > JAMA::LU< Real >::getL ( )
inline

Return lower triangular factor.

Returns
L

Definition at line 167 of file jama_lu.h.

◆ getPivot()

template<class Real >
Array1D< int > JAMA::LU< Real >::getPivot ( )
inline

Return pivot permutation vector.

Returns
piv

Definition at line 205 of file jama_lu.h.

◆ getU()

template<class Real >
Array2D< Real > JAMA::LU< Real >::getU ( )
inline

Return upper triangular factor.

Returns
U portion of LU factorization.

Definition at line 187 of file jama_lu.h.

◆ isNonsingular()

template<class Real >
int JAMA::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 155 of file jama_lu.h.

◆ solve() [1/2]

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

Definition at line 281 of file jama_lu.h.

◆ solve() [2/2]

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

Definition at line 231 of file jama_lu.h.


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