latest version v1.9 - last update 10 Apr 2010 |
LU decomposition functor. More...
#include <ltiMatrixDecomposition.h>
Public Member Functions | |
luDecomposition () | |
luDecomposition (const matrix< T > &m) | |
virtual | ~luDecomposition () |
bool | apply (matrix< T > &theMatrix, vector< int > &permutation, bool store=true) |
bool | apply (const matrix< T > &theMatrix, matrix< T > &decompositon, vector< int > &permutation) |
luDecomposition< T > & | copy (const luDecomposition< T > &other) |
virtual functor * | clone () const |
virtual const char * | getTypeName () const |
matrix< T > | getL () const |
matrix< T > | getU () const |
void | getL (matrix< T > &l) const |
void | getU (matrix< T > &u) const |
T | det () const |
T | det (const matrix< T > &theMatrix) |
bool | isRegular () const |
bool | isRegular (const matrix< T > &theMatrix) |
LU decomposition functor.
Computes the LU decomposition of a square matrix.
The decomposition will fail if the matrix is singular or close to being singular.
lti::luDecomposition< T >::luDecomposition | ( | ) |
default constructor
lti::luDecomposition< T >::luDecomposition | ( | const matrix< T > & | m | ) |
Constructs a LU decomposition for the given matrix The functor internally stores the decomposition, so you can get the derived parts with getL, getU and det.
The matrix itself is not changed, so if you need the LU decomposition in the given matrix itself, you will have to use one of the apply methods.
m | the matrix that gets decomposed. |
virtual lti::luDecomposition< T >::~luDecomposition | ( | ) | [virtual] |
destructor
bool lti::luDecomposition< T >::apply | ( | const matrix< T > & | theMatrix, | |
matrix< T > & | decompositon, | |||
vector< int > & | permutation | |||
) |
onCopy version of apply.
Given a matrix theMatrix[0..n-1][0..n-1], this routine returns a matrix decomposition[0..n-1][0..n-1] which contains the LU decomposition of a rowwise permutation of theMatrix. permutation[0..n-1] is an output vector that records the row permutation effected by the partial pivoting. The function returns +/-1 depending on whether the number of row interchanges was even or odd, respectively. The functor internally stores a copy of the last decomposition, so you can use it for det and getL and getU.
bool lti::luDecomposition< T >::apply | ( | matrix< T > & | theMatrix, | |
vector< int > & | permutation, | |||
bool | store = true | |||
) |
onPlace version of apply.
Given a matrix theMatrix[0..n-1][0..n-1], this routine replaces it by the LU decomposition of a rowwise permutation of itself. permutation[0..n-1] is an output vector that records the row permutation effected by the partial pivoting. The function returns +/-1 depending on whether the number of row interchanges was even or odd, respectively. The functor internally stores a copy of the last decomposition, so you can use it for det and getL and getU.
virtual functor* lti::luDecomposition< T >::clone | ( | ) | const [inline, virtual] |
returns a pointer to a clone of the functor.
Implements lti::functor.
luDecomposition<T>& lti::luDecomposition< T >::copy | ( | const luDecomposition< T > & | other | ) |
copy data of "other" functor.
Reimplemented from lti::functor.
T lti::luDecomposition< T >::det | ( | const matrix< T > & | theMatrix | ) |
returns the determinant of the given matrix
T lti::luDecomposition< T >::det | ( | ) | const |
returns the determinant of the last given matrix
void lti::luDecomposition< T >::getL | ( | matrix< T > & | l | ) | const |
returns a new Matrix which contains the "L" part of the last performed decomposition.
This is much faster than the on copy version.
matrix<T> lti::luDecomposition< T >::getL | ( | ) | const |
returns a new Matrix which contains the "L" part of the last performed decomposition.
virtual const char* lti::luDecomposition< T >::getTypeName | ( | void | ) | const [inline, virtual] |
returns the name of this type
Reimplemented from lti::linearAlgebraFunctor.
void lti::luDecomposition< T >::getU | ( | matrix< T > & | u | ) | const |
returns a new Matrix which contains the "L" part of the last performed decomposition.
This is much faster than the on copy version
matrix<T> lti::luDecomposition< T >::getU | ( | ) | const |
returns a new Matrix which contains the "U" part of the last performed decomposition.
bool lti::luDecomposition< T >::isRegular | ( | const matrix< T > & | theMatrix | ) |
returns true if the given matrix was regular, i.e. non-singular
bool lti::luDecomposition< T >::isRegular | ( | ) | const |
returns true if the last given matrix was regular, i.e. non-singular