bpp-core3
3.0.0
|
LU Decomposition. More...
#include <Bpp/Numeric/Matrix/LUDecomposition.h>
Public Member Functions | |
LUDecomposition (const Matrix< Real > &A) | |
LU Decomposition. More... | |
const RowMatrix< Real > & | getL () |
Return lower triangular factor. More... | |
const RowMatrix< Real > & | getU () |
Return upper triangular factor. More... | |
std::vector< size_t > | getPivot () const |
Return pivot permutation vector. More... | |
Real | det () const |
Compute determinant using LU factors. More... | |
Real | solve (const Matrix< Real > &B, Matrix< Real > &X) const |
Solve A*X = B. More... | |
Real | solve (const std::vector< Real > &b, std::vector< Real > &x) const |
Solve A*x = b, where x and b are vectors of length equal to the number of rows in A. More... | |
Static Private Member Functions | |
static void | permuteCopy (const Matrix< Real > &A, const std::vector< size_t > &piv, size_t j0, size_t j1, Matrix< Real > &X) |
static void | permuteCopy (const std::vector< Real > &A, const std::vector< size_t > &piv, std::vector< Real > &X) |
Private Attributes | |
RowMatrix< Real > | LU |
RowMatrix< Real > | L_ |
RowMatrix< Real > | U_ |
size_t | m |
size_t | n |
int | pivsign |
std::vector< size_t > | piv |
LU Decomposition.
[This class and its documentation is adpated from the C++ port of the JAMA library.]
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 36 of file LUDecomposition.h.
|
inline |
LU Decomposition.
A | Rectangular matrix |
Definition at line 161 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::m, bpp::LUDecomposition< Real >::n, and bpp::LUDecomposition< Real >::pivsign.
|
inline |
Compute determinant using LU factors.
Definition at line 279 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::LU, and bpp::LUDecomposition< Real >::n.
|
inline |
Return lower triangular factor.
Definition at line 216 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::L_, bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::m, and bpp::LUDecomposition< Real >::n.
|
inline |
Return pivot permutation vector.
Definition at line 268 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::piv.
|
inline |
Return upper triangular factor.
Definition at line 244 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::n, and bpp::LUDecomposition< Real >::U_.
|
inlinestaticprivate |
Definition at line 48 of file LUDecomposition.h.
References bpp::Matrix< Scalar >::resize().
Referenced by bpp::LUDecomposition< Real >::solve().
|
inlinestaticprivate |
Definition at line 63 of file LUDecomposition.h.
|
inline |
Solve A*X = B.
B | [in] A Matrix with as many rows as A and any number of columns. |
X | [out] A RowMatrix that will be changed such that L*U*X = B(piv,:). |
If B is nonconformant or LU is singular, an Exception is raised.
Definition at line 304 of file LUDecomposition.h.
References bpp::Matrix< Scalar >::getNumberOfColumns(), bpp::Matrix< Scalar >::getNumberOfRows(), bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::m, bpp::LUDecomposition< Real >::n, bpp::LUDecomposition< Real >::permuteCopy(), and bpp::NumConstants::SMALL().
|
inline |
Solve A*x = b, where x and b are vectors of length equal to the number of rows in A.
b | [in] a vector (Array1D> of length equal to the first dimension of A. |
x | [out] a vector that will be changed so that so that L*U*x = b(piv). |
If B is nonconformant or LU is singular, an Exception is raised.
Definition at line 378 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::m, bpp::LUDecomposition< Real >::n, bpp::LUDecomposition< Real >::permuteCopy(), and bpp::NumConstants::SMALL().
|
private |
Definition at line 41 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::getL().
|
private |
Definition at line 40 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::det(), bpp::LUDecomposition< Real >::getL(), bpp::LUDecomposition< Real >::getU(), bpp::LUDecomposition< Real >::LUDecomposition(), and bpp::LUDecomposition< Real >::solve().
|
private |
Definition at line 43 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::getL(), bpp::LUDecomposition< Real >::LUDecomposition(), and bpp::LUDecomposition< Real >::solve().
|
private |
Definition at line 43 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::det(), bpp::LUDecomposition< Real >::getL(), bpp::LUDecomposition< Real >::getU(), bpp::LUDecomposition< Real >::LUDecomposition(), and bpp::LUDecomposition< Real >::solve().
|
private |
Definition at line 45 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::getPivot().
|
private |
Definition at line 44 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::LUDecomposition().
|
private |
Definition at line 42 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::getU().