Feel++ 0.91.0
Public Types | Public Member Functions
Feel::LU< MatrixType > Class Template Reference

#include <lu.hpp>

List of all members.

Public Types

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

Public Member Functions

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

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.


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.

Referenced by Feel::GeoND< Dim, GEOSHAPE, T, GeoElement0D< Dim, SubFaceOfNone, T > >::isAnticlockwiseOriented().

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.

Referenced by Feel::LU< MatrixType >::solve().

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().

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().