Prec< T_ > Class Template Reference

To set a preconditioner. More...

#include <Prec.h>

Public Member Functions

 Prec ()
 Default constructor.
 
 Prec (int type)
 Constructor that chooses preconditioner.
 
 Prec (const SpMatrix< T_ > &A, int type=DIAG_PREC)
 Constructor using matrix of the linear system to precondition.
 
 Prec (const Matrix< T_ > *A, int type=DIAG_PREC)
 Constructor using matrix of the linear system to precondition.
 
 ~Prec ()
 Destructor.
 
void setType (int type)
 Define preconditioner type.
 
void setMatrix (const Matrix< T_ > *A)
 Define pointer to matrix for preconditioning (if this one is abstract)
 
void setMatrix (const SpMatrix< T_ > &A)
 Define the matrix for preconditioning.
 
void solve (Vect< T_ > &x) const
 Solve a linear system with preconditioning matrix.
 
void solve (const Vect< T_ > &b, Vect< T_ > &x) const
 Solve a linear system with preconditioning matrix.
 
void TransSolve (Vect< T_ > &x) const
 Solve a linear system with transposed preconditioning matrix.
 
void TransSolve (const Vect< T_ > &b, Vect< T_ > &x) const
 Solve a linear system with transposed preconditioning matrix.
 
T_ & getPivot (size_t i) const
 Return i-th pivot of preconditioning matrix.
 

Detailed Description

template<class T_>
class OFELI::Prec< T_ >

To set a preconditioner.

The preconditioner type is chosen in the constructor

Template Parameters
<T_>Data type (real_t, float, complex<real_t>, ...)
Author
Rachid Touzani

Constructor & Destructor Documentation

◆ Prec() [1/3]

template<class T_ >
Prec ( int  type)

Constructor that chooses preconditioner.

Parameters
[in]typePreconditioner type:
  • IDENT_PREC: Identity preconditioner (No preconditioning)
  • DIAG_PREC: Diagonal preconditioner
  • DILU_PREC: Diagonal Incomplete factorization preconditioner
  • ILU_PREC: Incomplete factorization preconditioner
  • SSOR_PREC: SSOR (Symmetric Successive Over Relaxation) preconditioner

◆ Prec() [2/3]

template<class T_ >
Prec ( const SpMatrix< T_ > &  A,
int  type = DIAG_PREC 
)

Constructor using matrix of the linear system to precondition.

Parameters
[in]AMatrix to precondition
[in]typePreconditioner type:
  • IDENT_PREC: Identity preconditioner (No preconditioning)
  • DIAG_PREC: Diagonal preconditioner
  • DILU_PREC: Diagonal Incomplete factorization preconditioner
  • ILU_PREC: Incomplete factorization preconditioner
  • SSOR_PREC: SSOR (Symmetric Successive Over Relaxation) preconditioner

◆ Prec() [3/3]

template<class T_ >
Prec ( const Matrix< T_ > *  A,
int  type = DIAG_PREC 
)

Constructor using matrix of the linear system to precondition.

Parameters
[in]APointer to abstract Matrix class to precondition
[in]typePreconditioner type:
  • IDENT_PREC: Identity preconditioner (No preconditioning)
  • DIAG_PREC: Diagonal preconditioner
  • DILU_PREC: Diagonal Incomplete factorization preconditioner
  • ILU_PREC: Incomplete factorization preconditioner
  • SSOR_PREC: SSOR (Symmetric Successive Over Relaxation) preconditioner

Member Function Documentation

◆ setMatrix() [1/2]

template<class T_ >
void setMatrix ( const Matrix< T_ > *  A)

Define pointer to matrix for preconditioning (if this one is abstract)

Parameters
[in]AMatrix to precondition

◆ setMatrix() [2/2]

template<class T_ >
void setMatrix ( const SpMatrix< T_ > &  A)

Define the matrix for preconditioning.

Parameters
[in]AMatrix to precondition (instance of class SpMatrix)

◆ setType()

template<class T_ >
void setType ( int  type)

Define preconditioner type.

Parameters
[in]typePreconditioner type:
  • IDENT_PREC: Identity preconditioner (No preconditioning)
  • DIAG_PREC: Diagonal preconditioner
  • DILU_PREC: Diagonal Incomplete factorization preconditioner
  • ILU_PREC: Incomplete factorization preconditioner
  • SSOR_PREC: SSOR (Symmetric Successive Over Relaxation) preconditioner

◆ solve() [1/2]

template<class T_ >
void solve ( const Vect< T_ > &  b,
Vect< T_ > &  x 
) const

Solve a linear system with preconditioning matrix.

Parameters
[in]bRight-hand side
[out]xSolution vector

◆ solve() [2/2]

template<class T_ >
void solve ( Vect< T_ > &  x) const

Solve a linear system with preconditioning matrix.

Parameters
[in,out]xRight-hand side on input and solution on output.

◆ TransSolve() [1/2]

template<class T_ >
void TransSolve ( const Vect< T_ > &  b,
Vect< T_ > &  x 
) const

Solve a linear system with transposed preconditioning matrix.

Parameters
[in]bRight-hand side vector
[out]xSolution vector

◆ TransSolve() [2/2]

template<class T_ >
void TransSolve ( Vect< T_ > &  x) const

Solve a linear system with transposed preconditioning matrix.

Parameters
[in,out]xRight-hand side in input and solution in output.