15 #ifndef TBCI_SOLVER_DIAGPRECOND_H
16 #define TBCI_SOLVER_DIAGPRECOND_H
18 #include "tbci/solver/precond.h"
26 template <
typename T,
typename MatrixType = BdMatrix<T> >
44 const unsigned int rw = A.rows();
45 if (invDiag.
size() != A.rows())
47 BCHK(invDiag.
size() == 0,
VecErr,
"DiagPrecond::update: NULL ptr", 0,);
50 for (
unsigned int j = 0; j < rw; ++j)
51 EXPCHK(A.get(j,j) ==
T(0.0),
VecErr,
"DiagPrecond::update: Diagonal ZERO", j,);
53 for (
unsigned int i = 0;
i < rw; ++
i)
54 invDiag.
set(
i) =
T(1.0) / A.get(
i,
i);
68 const unsigned long sz = invDiag.
size();
Abstract base class for all Preconditioners.
provides basic Vector functionality but arithmetic operators (+=, - , *, /...).
const T & getcref(const unsigned long idx) const
TVector< T > solve(const Vector< T > &v) const
unsigned long size() const HOT
#define BCHK(cond, exc, txt, ind, rtval)
TVector< T > transSolve(const Vector< T > &v) const
friend class SystemMatrix
DiagPreconditioner(const MatrixType &A)
Temporary Base Class Idiom: Class TVector is used for temporary variables.
T & setval(const unsigned long i) const
T & set(const unsigned long idx) HOT
#define EXPCHK(cond, exc, txt, ind, rtval)
BVector< T > & resize(const BVector< T > &)
Actually it's a resize and copy (some people would expect the assignment op to do this) ...
unsigned int do_expcheck()
TVector< T > solve(TVector< T > tv) const
TVector< T > transSolve(TVector< T > tv) const
void update(const MatrixType &A)