TBCI Numerical high perf. C++ Library 2.8.0
lu_solver.h File Reference
#include "tbci/matrix.h"
#include "tbci/vector.h"
Include dependency graph for lu_solver.h:

Go to the source code of this file.

Macros

#define MLU_MINVAL   5e-16
#define MLU_RES_WARN   1e-11

Functions

template<typename T>
NAMESPACE_TBCI int lu_decomp (Matrix< T > &mat)
 LU decomposes the TBCI::Matrix mat.
template<typename T>
TVector< TLU_fwd_subst (const Matrix< T > &lu, const Vector< T > &y)
template<typename T>
TVector< TLU_bkw_subst (const Matrix< T > &lu, const Vector< T > &y)
template<typename T>
TVector< TLU_solve (const Matrix< T > &lu, const Vector< T > &b)
template<typename T>
TVector< Tlu_solve (Matrix< T > &mat, const Vector< T > &b)
template<typename T>
TMatrix< TLU_solve (const Matrix< T > &lu, const Matrix< T > &b)
template<typename T>
TMatrix< Tlu_solve (Matrix< T > &mat, const Matrix< T > &b)
template<typename T>
T LU_det (const Matrix< T > &lu)
 calculates determinant of an already LU decomposed Matrix
template<typename T>
T lu_det (Matrix< T > &mat)
 calculates determinant of a Matrix by LU decomposition
template<typename T>
TMatrix< TLU_invert (const Matrix< T > &mat)
 Returns the inverse of a already LU decomposed Matrix.
template<typename T>
TMatrix< Tlu_invert (Matrix< T > &mat)
 Returns the inverse of a Matrix by performing a LU decomposition.

Detailed Description

LU solver implementation (TBCI::lu_decomp)

LU decomposizes a TBCI::Matrix and solves the vector equation Ax = b

LU_xxxx operates on an already LU decomposed Matrix, whereas lu_xxxx does decompose it and then does * the requested action (eg. determinant calculation ...)

NOTE: the matrix passed as argument to lu_xxxx will be modified!

Date
23.06.97
Author
Kurt Garloff
Version
Id
lu_solver.h,v 1.15.2.23 2022/11/03 17:28:12 garloff Exp

License: GNU LGPL

Definition in file lu_solver.h.

Macro Definition Documentation

◆ MLU_MINVAL

#define MLU_MINVAL   5e-16

Definition at line 32 of file lu_solver.h.

Referenced by lu_decomp().

◆ MLU_RES_WARN

#define MLU_RES_WARN   1e-11

Definition at line 37 of file lu_solver.h.

Referenced by lu_solve().

Function Documentation

◆ LU_bkw_subst()

template<typename T>
TVector< T > LU_bkw_subst ( const Matrix< T > & lu,
const Vector< T > & y )

Definition at line 205 of file lu_solver.h.

References ALIGN2, BCHK, TMatrix< T >::get(), i, MIN_ALIGN2, REGISTER, TMatrix< T >::rows(), T, x, and y.

Referenced by LU_solve(), and LU_solve().

◆ lu_decomp()

template<typename T>
NAMESPACE_TBCI int lu_decomp ( Matrix< T > & mat)

LU decomposes the TBCI::Matrix mat.

Decomposition is compactly stored in one Matrix The diagonal elements of the lower Matrix are all 1 (this is a feature of the algorithm).

Note
The Matrix passed will be changed!

Definition at line 94 of file lu_solver.h.

References ALIGN2, BCHK, TMatrix< T >::columns(), EL_PER_CL, err, fabs(), TMatrix< T >::get(), TMatrix< T >::getcref(), i, LIKELY, MATH__, MAX, MIN, MIN_ALIGN2, MLU_MINVAL, PREFETCH_R, REGISTER, TMatrix< T >::rows(), TMatrix< T >::setval(), T, and UNLIKELY.

Referenced by BdMatrix< T >::FGDT, lu_decomp(), lu_det(), lu_invert(), lu_solve(), and lu_solve().

◆ LU_det()

template<typename T>
T LU_det ( const Matrix< T > & lu)

calculates determinant of an already LU decomposed Matrix

Definition at line 281 of file lu_solver.h.

References ALIGN2, BCHK, TMatrix< T >::columns(), TMatrix< T >::get(), i, MIN_ALIGN2, REGISTER, TMatrix< T >::rows(), and T.

Referenced by lu_det().

◆ lu_det()

template<typename T>
T lu_det ( Matrix< T > & mat)
inline

calculates determinant of a Matrix by LU decomposition

Definition at line 293 of file lu_solver.h.

References lu_decomp(), LU_det(), and T.

◆ LU_fwd_subst()

template<typename T>
TVector< T > LU_fwd_subst ( const Matrix< T > & lu,
const Vector< T > & y )

Definition at line 183 of file lu_solver.h.

References ALIGN2, BCHK, TMatrix< T >::get(), i, MIN_ALIGN2, REGISTER, TMatrix< T >::rows(), T, x, and y.

Referenced by LU_solve(), and LU_solve().

◆ LU_invert()

template<typename T>
TMatrix< T > LU_invert ( const Matrix< T > & mat)

Returns the inverse of a already LU decomposed Matrix.

Definition at line 303 of file lu_solver.h.

References BCHK, TMatrix< T >::columns(), inv(), LU_solve(), TMatrix< T >::rows(), TVector< T >::setval(), T, and y.

Referenced by lu_invert().

◆ lu_invert()

template<typename T>
TMatrix< T > lu_invert ( Matrix< T > & mat)
inline

Returns the inverse of a Matrix by performing a LU decomposition.

Definition at line 320 of file lu_solver.h.

References lu_decomp(), and LU_invert().

◆ LU_solve() [1/2]

template<typename T>
TMatrix< T > LU_solve ( const Matrix< T > & lu,
const Matrix< T > & b )

Definition at line 258 of file lu_solver.h.

References b, i, LU_bkw_subst(), LU_fwd_subst(), x, and y.

◆ LU_solve() [2/2]

template<typename T>
TVector< T > LU_solve ( const Matrix< T > & lu,
const Vector< T > & b )
inline

Solve the equation Ax = b where A IS already LU decomposed

Definition at line 225 of file lu_solver.h.

References b, LU_bkw_subst(), LU_fwd_subst(), and y.

Referenced by LU_invert(), lu_solve(), and lu_solve().

◆ lu_solve() [1/2]

template<typename T>
TMatrix< T > lu_solve ( Matrix< T > & mat,
const Matrix< T > & b )
inline

Definition at line 272 of file lu_solver.h.

References b, lu_decomp(), and LU_solve().

◆ lu_solve() [2/2]

template<typename T>
TVector< T > lu_solve ( Matrix< T > & mat,
const Vector< T > & b )

Solve the equation Ax = b where A still needs to be LU decomposed

Note
The Matrix passed will be changed by the LU decomposition!

Definition at line 240 of file lu_solver.h.

References b, BCHK, BVector< T >::copy(), fabs(), lu_decomp(), LU_solve(), MATH__, MLU_RES_WARN, res, and x.