bpp-core
2.2.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 throw (BadIntegerException, ZeroDivisionException) |
Solve A*X = B. More... | |
Real | solve (const std::vector< Real > &b, std::vector< Real > &x) const throw (BadIntegerException, ZeroDivisionException) |
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 70 of file LUDecomposition.h.
|
inline |
LU Decomposition.
A | Rectangular matrix |
Definition at line 195 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::m, bpp::LUDecomposition< Real >::n, bpp::LUDecomposition< Real >::piv, and bpp::LUDecomposition< Real >::pivsign.
|
inline |
Compute determinant using LU factors.
Definition at line 313 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::m, bpp::LUDecomposition< Real >::n, and bpp::LUDecomposition< Real >::pivsign.
|
inline |
Return lower triangular factor.
Definition at line 250 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 302 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::piv.
|
inline |
Return upper triangular factor.
Definition at line 278 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::n, and bpp::LUDecomposition< Real >::U_.
|
inlinestaticprivate |
Definition at line 82 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::piv, and bpp::Matrix< Scalar >::resize().
Referenced by bpp::LUDecomposition< Real >::solve().
|
inlinestaticprivate |
Definition at line 97 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::piv.
|
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 338 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::m, bpp::LUDecomposition< Real >::n, bpp::LUDecomposition< Real >::permuteCopy(), bpp::LUDecomposition< Real >::piv, 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 412 of file LUDecomposition.h.
References bpp::LUDecomposition< Real >::LU, bpp::LUDecomposition< Real >::m, bpp::LUDecomposition< Real >::n, bpp::LUDecomposition< Real >::permuteCopy(), bpp::LUDecomposition< Real >::piv, and bpp::NumConstants::SMALL().
|
private |
Definition at line 75 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::getL().
|
private |
Definition at line 74 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 77 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::det(), bpp::LUDecomposition< Real >::getL(), bpp::LUDecomposition< Real >::LUDecomposition(), and bpp::LUDecomposition< Real >::solve().
|
private |
Definition at line 77 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 79 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::getPivot(), bpp::LUDecomposition< Real >::LUDecomposition(), bpp::LUDecomposition< Real >::permuteCopy(), and bpp::LUDecomposition< Real >::solve().
|
private |
Definition at line 78 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::det(), and bpp::LUDecomposition< Real >::LUDecomposition().
|
private |
Definition at line 76 of file LUDecomposition.h.
Referenced by bpp::LUDecomposition< Real >::getU().