Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Feel::LU< MatrixType > Class Template Reference

#include <lu.hpp>

Detailed Description

template<typename MatrixType>
class Feel::LU< MatrixType >

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.

Public Types

typedef MatrixType matrix_type
 
typedef MatrixType::value_type value_type
 
typedef
boost::numeric::ublas::vector
< value_type > 
vector_type
 
typedef
boost::numeric::ublas::vector
< uint > 
vector_uint_type
 

Public Member Functions

value_type det ()
 
matrix_type getL ()
 
vector_uint_type getPivot ()
 
matrix_type getU ()
 
void inverse (matrix_type &__inv)
 
uint isNonsingular ()
 
 LU (const matrix_type &A)
 
matrix_type solve (const matrix_type &B)
 
vector_type solve (const vector_type &b)
 

Constructor & Destructor Documentation

template<typename MatrixType>
Feel::LU< MatrixType >::LU ( const matrix_type &  A)
inline

LU Decomposition

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

Member Function Documentation

template<typename MatrixType>
value_type Feel::LU< MatrixType >::det ( )
inline

Compute determinant using LU factors.

Returns
determinant of A, or 0 if A is not square.
template<typename MatrixType>
matrix_type Feel::LU< MatrixType >::getL ( )
inline

Return lower triangular factor

Returns
L
template<typename MatrixType>
vector_uint_type Feel::LU< MatrixType >::getPivot ( )
inline

Return pivot permutation vector

Returns
piv
template<typename MatrixType>
matrix_type Feel::LU< MatrixType >::getU ( )
inline

Return upper triangular factor

Returns
U portion of LU factorization.
template<typename MatrixType>
uint Feel::LU< MatrixType >::isNonsingular ( )
inline

Is the matrix nonsingular?

Returns
1 (true) if upper triangular factor U (and hence A) is nonsingular, 0 otherwise.
template<typename MatrixType>
matrix_type Feel::LU< MatrixType >::solve ( const matrix_type &  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.

References Feel::LU< MatrixType >::isNonsingular().

template<typename MatrixType>
vector_type Feel::LU< MatrixType >::solve ( const vector_type &  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.

References Feel::LU< MatrixType >::isNonsingular().


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

Generated on Sun Oct 20 2013 08:25:08 for Feel++ by doxygen 1.8.4