TBCI Numerical high perf. C++ Library 2.8.0
bd_lu_solver.h File Reference

LU solver for TBCI::BdMatrix class (TBCI::lu_decomp). More...

#include "tbci/vector.h"
#include "tbci/band_matrix.h"
#include "tbci/matrix.h"
Include dependency graph for bd_lu_solver.h:

Go to the source code of this file.

Macros

#define BDMLU_MINVAL   1e-16
#define BDMLU_RES_WARN   1e-11

Functions

template<typename T>
NAMESPACE_TBCI int lu_decomp (BdMatrix< T > &mat)
 LU decompose a TBCI::BdMatrix.
template<typename T>
TVector< TLU_fwd_subst (const BdMatrix< T > &lu, const Vector< T > &y)
template<typename T>
TVector< TLU_bkw_subst (const BdMatrix< T > &lu, const Vector< T > &y)
template<typename T>
TVector< TLU_solve (const BdMatrix< T > &lu, const Vector< T > &b)
 Solve the equation Ax = b where A IS already LU decomposed.
template<typename T>
TVector< Tlu_solve (BdMatrix< T > &mat, const Vector< T > &b)
 Solve the equation Ax = b where A still needs to be LU decomposed.
template<typename T>
TMatrix< TLU_solve (const BdMatrix< T > &lu, const Matrix< T > &b)
template<typename T>
TMatrix< Tlu_solve (BdMatrix< T > &mat, const Matrix< T > &b)
template<typename T>
T LU_det (const BdMatrix< T > &lu)
 calculates determinant of an already LU decomposed BdMatrix
template<typename T>
T lu_det (BdMatrix< T > &mat)
 calculates the determinant of a BdMatrix by doing an LU decomposition
template<typename T>
TMatrix< TLU_invert (const BdMatrix< T > &lu)
 return the inverse Matrix for an already LU decomposed BdMatrix
template<typename T>
TMatrix< Tlu_invert (BdMatrix< T > &mat)
 return the inverse Matrix for a BdMatrix by doing an LU decomposition

Detailed Description

LU solver for TBCI::BdMatrix class (TBCI::lu_decomp).

LU decomposizes a BdMatrix and solves the Vector equation Ax = b

Definition in file bd_lu_solver.h.

Macro Definition Documentation

◆ BDMLU_MINVAL

#define BDMLU_MINVAL   1e-16

Definition at line 33 of file bd_lu_solver.h.

Referenced by lu_decomp().

◆ BDMLU_RES_WARN

#define BDMLU_RES_WARN   1e-11

Definition at line 38 of file bd_lu_solver.h.

Referenced by lu_solve().

Function Documentation

◆ LU_bkw_subst()

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

◆ lu_decomp()

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

LU decompose a TBCI::BdMatrix.

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

Note
The BdMatrix passed will be changed!

Definition at line 57 of file bd_lu_solver.h.

References ALIGN2, BCHK, BDMLU_MINVAL, BdMatrix< T >::expand(), fabs(), BdMatrix< T >::get(), BdMatrix< T >::getmaxoff(), i, lu_decomp(), MATH__, MAX, MIN, MIN_ALIGN2, REGISTER, BdMatrix< T >::rows(), BdMatrix< T >::setval(), STD__, T, and UNLIKELY.

Referenced by lu_det(), lu_invert(), lu_solve(), and lu_solve().

◆ LU_det()

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

calculates determinant of an already LU decomposed BdMatrix

Definition at line 317 of file bd_lu_solver.h.

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

Referenced by lu_det().

◆ lu_det()

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

calculates the determinant of a BdMatrix by doing an LU decomposition

Definition at line 329 of file bd_lu_solver.h.

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

◆ LU_fwd_subst()

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

◆ LU_invert()

template<typename T>
TMatrix< T > LU_invert ( const BdMatrix< T > & lu)

return the inverse Matrix for an already LU decomposed BdMatrix

Definition at line 338 of file bd_lu_solver.h.

References BdMatrix< T >::columns(), inv(), LU_solve(), BdMatrix< T >::rows(), T, and y.

Referenced by TMatrix< T >::FGD, and lu_invert().

◆ lu_invert()

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

return the inverse Matrix for a BdMatrix by doing an LU decomposition

Definition at line 355 of file bd_lu_solver.h.

References lu_decomp(), and LU_invert().

Referenced by TMatrix< T >::FGD.

◆ LU_solve() [1/2]

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

Definition at line 279 of file bd_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 BdMatrix< T > & lu,
const Vector< T > & b )
inline

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

Definition at line 246 of file bd_lu_solver.h.

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

Referenced by TMatrix< T >::FGD, LU_invert(), lu_solve(), and lu_solve().

◆ lu_solve() [1/2]

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

Definition at line 295 of file bd_lu_solver.h.

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

◆ lu_solve() [2/2]

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

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

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

Definition at line 260 of file bd_lu_solver.h.

References b, BDMLU_RES_WARN, BVector< T >::copy(), fabs(), lu_decomp(), LU_solve(), MATH__, res, STD__, UNLIKELY, and x.