Template Numerical Library version main:e6bb26f
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TNL::Solvers::Linear::TFQMR< Matrix > Class Template Reference

Iterative solver of linear systems based on the Transpose-free quasi-minimal residual (TFQMR) method. More...

#include <TNL/Solvers/Linear/TFQMR.h>

Inheritance diagram for TNL::Solvers::Linear::TFQMR< Matrix >:
Inheritance graph
[legend]
Collaboration diagram for TNL::Solvers::Linear::TFQMR< Matrix >:
Collaboration graph
[legend]

Public Types

using ConstVectorViewType = typename Base::ConstVectorViewType
 Type for constant vector view.
 
using DeviceType = typename Base::DeviceType
 Device where the solver will run on and auxillary data will alloacted on.
 
using IndexType = typename Base::IndexType
 Type for indexing.
 
using RealType = typename Base::RealType
 Floating point type used for computations.
 
using VectorViewType = typename Base::VectorViewType
 Type for vector view.
 
- Public Types inherited from TNL::Solvers::Linear::LinearSolver< Matrix >
using ConstVectorViewType = typename Traits< Matrix >::ConstVectorViewType
 Type for constant vector view.
 
using DeviceType = typename Matrix::DeviceType
 Device where the solver will run on and auxillary data will alloacted on. More...
 
using IndexType = typename Matrix::IndexType
 Type for indexing.
 
using MatrixPointer = std::shared_ptr< std::add_const_t< MatrixType > >
 Type of shared pointer to the matrix.
 
using MatrixType = Matrix
 Type of the matrix representing the linear system.
 
using PreconditionerPointer = std::shared_ptr< std::add_const_t< PreconditionerType > >
 Type of shared pointer to the preconditioner.
 
using PreconditionerType = Preconditioners::Preconditioner< MatrixType >
 Type of preconditioner.
 
using RealType = typename Matrix::RealType
 Floating point type used for computations.
 
using VectorViewType = typename Traits< Matrix >::VectorViewType
 Type for vector view.
 
- Public Types inherited from TNL::Solvers::IterativeSolver< Matrix::RealType, Matrix::IndexType >
using SolverMonitorType = IterativeSolverMonitor< Matrix::RealType, Matrix::IndexType >
 Type of an object used for monitoring of the convergence.
 

Public Member Functions

bool solve (ConstVectorViewType b, VectorViewType x) override
 Method for solving of a linear system. More...
 
- Public Member Functions inherited from TNL::Solvers::Linear::LinearSolver< Matrix >
virtual ~LinearSolver ()
 Default destructor.
 
void setMatrix (const MatrixPointer &matrix)
 Set the matrix of the linear system. More...
 
void setPreconditioner (const PreconditionerPointer &preconditioner)
 Set the preconditioner. More...
 
virtual bool setup (const Config::ParameterContainer &parameters, const String &prefix="")
 Method for setup of the linear iterative solver based on configuration parameters. More...
 
virtual bool solve (ConstVectorViewType b, VectorViewType x)=0
 Method for solving a linear system. More...
 
- Public Member Functions inherited from TNL::Solvers::IterativeSolver< Matrix::RealType, Matrix::IndexType >
 IterativeSolver ()=default
 Default constructor.
 
bool checkConvergence ()
 Checks whether the convergence occurred already. More...
 
bool checkNextIteration ()
 Checks if the solver is allowed to do the next iteration. More...
 
const Matrix::RealType & getConvergenceResidue () const
 Gets the the convergence threshold. More...
 
const Matrix::RealType & getDivergenceResidue () const
 Gets the limit for the divergence criterion. More...
 
const Matrix::IndexType & getIterations () const
 Gets the number of iterations performed by the solver so far. More...
 
const Matrix::IndexType & getMaxIterations () const
 Gets the maximal number of iterations the solver is allowed to perform. More...
 
const Matrix::IndexType & getMinIterations () const
 Gets the minimal number of iterations the solver is supposed to do. More...
 
const Matrix::RealType & getResidue () const
 Gets the residue reached at the current iteration. More...
 
bool nextIteration ()
 Proceeds to the next iteration. More...
 
void resetIterations ()
 Sets the the number of the current iterations to zero.
 
void setConvergenceResidue (const Matrix::RealType &convergenceResidue)
 Sets the threshold for the convergence. More...
 
void setDivergenceResidue (const Matrix::RealType &divergenceResidue)
 Sets the residue limit for the divergence criterion. More...
 
void setMaxIterations (const Matrix::IndexType &maxIterations)
 Sets the maximal number of iterations the solver is allowed to perform. More...
 
void setMinIterations (const Matrix::IndexType &minIterations)
 Sets the minimal number of iterations the solver is supposed to do. More...
 
void setRefreshRate (const Matrix::IndexType &refreshRate)
 Sets the refresh rate (in milliseconds) for the solver monitor. More...
 
void setResidue (const Matrix::RealType &residue)
 Sets the residue reached at the current iteration. More...
 
void setSolverMonitor (SolverMonitorType &solverMonitor)
 Sets the solver monitor object. More...
 
bool setup (const Config::ParameterContainer &parameters, const String &prefix="")
 Method for setup of the iterative solver based on configuration parameters. More...
 

Protected Member Functions

void setSize (const VectorViewType &x)
 

Protected Attributes

Traits< Matrix >::VectorType Au
 
Traits< Matrix >::VectorType d
 
Traits< Matrix >::VectorType M_tmp
 
Traits< Matrix >::VectorType r
 
Traits< Matrix >::VectorType r_ast
 
Traits< Matrix >::VectorType u
 
Traits< Matrix >::VectorType v
 
Traits< Matrix >::VectorType w
 
- Protected Attributes inherited from TNL::Solvers::Linear::LinearSolver< Matrix >
MatrixPointer matrix = nullptr
 
PreconditionerPointer preconditioner = nullptr
 
- Protected Attributes inherited from TNL::Solvers::IterativeSolver< Matrix::RealType, Matrix::IndexType >
Matrix::RealType convergenceResidue
 
Matrix::IndexType currentIteration
 
Matrix::RealType currentResidue
 
Matrix::RealType divergenceResidue
 
Matrix::IndexType maxIterations
 
Matrix::IndexType minIterations
 
Matrix::IndexType refreshRate
 
std::ofstream residualHistoryFile
 
String residualHistoryFileName
 
IterativeSolverMonitor< Matrix::RealType, Matrix::IndexType > * solverMonitor
 

Additional Inherited Members

- Static Public Member Functions inherited from TNL::Solvers::Linear::LinearSolver< Matrix >
static void configSetup (Config::ConfigDescription &config, const String &prefix="")
 This method defines configuration entries for setup of the linear iterative solver. More...
 
- Static Public Member Functions inherited from TNL::Solvers::IterativeSolver< Matrix::RealType, Matrix::IndexType >
static void configSetup (Config::ConfigDescription &config, const String &prefix="")
 This method defines configuration entries for setup of the iterative solver. More...
 

Detailed Description

template<typename Matrix>
class TNL::Solvers::Linear::TFQMR< Matrix >

Iterative solver of linear systems based on the Transpose-free quasi-minimal residual (TFQMR) method.

See (Wikipedia)[https://second.wiki/wiki/algoritmo_tfqmr] for more details.

See TNL::Solvers::Linear::LinearSolver for example of showing how to use the linear solvers.

Template Parameters
Matrixis type of matrix describing the linear system.

Member Function Documentation

◆ solve()

template<typename Matrix >
bool TNL::Solvers::Linear::TFQMR< Matrix >::solve ( ConstVectorViewType  b,
VectorViewType  x 
)
overridevirtual

Method for solving of a linear system.

See LinearSolver::solve for more details.

Parameters
bvector with the right-hand side of the linear system.
xvector for the solution of the linear system.
Returns
true if the solver converged.
false if the solver did not converge.

Implements TNL::Solvers::Linear::LinearSolver< Matrix >.


The documentation for this class was generated from the following files: