ParGeMSLR
Public Member Functions | List of all members
pargemslr::FlexGmresClass< MatrixType, VectorType, DataType > Class Template Reference

The real flexgmres solver class. More...

#include <fgmres.hpp>

Inheritance diagram for pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >:
pargemslr::SolverClass< MatrixType, VectorType, DataType >

Public Member Functions

 FlexGmresClass ()
 The constructor. More...
 
 FlexGmresClass (const FlexGmresClass< MatrixType, VectorType, DataType > &solver)
 The copy constructor. More...
 
 FlexGmresClass (FlexGmresClass< MatrixType, VectorType, DataType > &&solver)
 The move constructor. More...
 
FlexGmresClass< MatrixType, VectorType, DataType > & operator= (const FlexGmresClass< MatrixType, VectorType, DataType > &solver)
 The = operator. More...
 
FlexGmresClass< MatrixType, VectorType, DataType > & operator= (FlexGmresClass< MatrixType, VectorType, DataType > &&solver)
 The = operator. More...
 
int Clear ()
 Free function. More...
 
 ~FlexGmresClass ()
 The destructor. More...
 
virtual int Setup (VectorType &x, VectorType &rhs)
 Setup the solver phase, include building the preconditioner, call this function before Solve, after SetPreconditioner. More...
 
virtual int Solve (VectorType &x, VectorType &rhs)
 Solve phase. Call this function after Setup. More...
 
virtual int SetSolveLocation (const int &location)
 Set the data location that the solver apply to. More...
 
virtual int SetWithParameterArray (double *params)
 Setup with parameter array. More...
 
template<typename T >
int SetTolerance (T tol)
 Set the tolorance for stop the iteration. More...
 
int SetMaxNumberIterations (int maxits)
 Set the maximum number of iterations. More...
 
int SetKrylovSubspaceDimension (int kdim)
 Set the maximum number of flexible GMRES inner iterations per cycle. More...
 
int SetAbsoluteTol (bool option)
 Set if we use absolute threshold ||r|| or ||r||/||b||. More...
 
std::conditional< PargemslrIsDoublePrecision< DataType >::value, double, float >::type GetFinalRelativeResidual () const
 Get the final relative residual. More...
 
int GetNumberIterations () const
 Get the number of iterations. More...
 
std::conditional< PargemslrIsDoublePrecision< DataType >::value, vector_seq_double, vector_seq_float >::type & GetRelativeResidual ()
 Get the relative residual at each step as a vector. More...
 
- Public Member Functions inherited from pargemslr::SolverClass< MatrixType, VectorType, DataType >
 SolverClass ()
 The constructor of solver class. More...
 
 SolverClass (const SolverClass< MatrixType, VectorType, DataType > &solver)
 The copy constructor of solver class. More...
 
 SolverClass (SolverClass< MatrixType, VectorType, DataType > &&solver)
 The move constructor of solver class. More...
 
SolverClass< MatrixType, VectorType, DataType > & operator= (const SolverClass< MatrixType, VectorType, DataType > &solver)
 The = operator of solver class. More...
 
SolverClass< MatrixType, VectorType, DataType > & operator= (SolverClass< MatrixType, VectorType, DataType > &&solver)
 The = operator of solver class. More...
 
virtual ~SolverClass ()
 The destructor of solver class. More...
 
virtual int Solve (DenseMatrixClass< DataType > &x, DenseMatrixClass< DataType > &rhs)
 Solve phase with multiple right-hand-sides. Call this function after Setup. More...
 
virtual long int GetNumNonzeros ()
 Get the total number of nonzeros. More...
 
MatrixType * GetMatrix ()
 Get pointer to the matrix. More...
 
SolverClass< MatrixType, VectorType, DataType > * GetPreconditioner ()
 Get pointer to the preconditioner. More...
 
int SetMatrix (MatrixType &matrix)
 Set the target matrix for the current solver. More...
 
int SetMatrixP (MatrixType *matrix)
 Set the target matrix for the current solver. More...
 
int SetPreconditioner (SolverClass< MatrixType, VectorType, DataType > &precond)
 Set the preconditioner for the current solver. More...
 
int SetPreconditionerP (SolverClass< MatrixType, VectorType, DataType > *precond)
 Set the preconditioner for the current solver. More...
 
bool IsReady () const
 Check if the solver is ready to be used. More...
 
int SetOwnMatrix (bool own_matrix)
 Set if the matrix is owned by this solver, if so, matrix is freed when free the solver. More...
 
int SetOwnPreconditioner (bool own_preconditioner)
 Set if the preconditioner is owned by this solver, if so, preconditioner is freed when free the solver. More...
 
int SetPrintOption (int print_option)
 Set the print option. More...
 
PrecisionEnum GerPrecision () const
 Get the precision. More...
 
SolverTypeEnum GetSolverType () const
 Get the solver type. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pargemslr::SolverClass< MatrixType, VectorType, DataType >
int CheckReadySetups (const char *str) const
 Return error is the preconditioner is ready. More...
 
- Protected Attributes inherited from pargemslr::SolverClass< MatrixType, VectorType, DataType >
PrecisionEnum _solver_precision
 The precision of the solver. More...
 
SolverTypeEnum _solver_type
 The type of the solver. More...
 
bool _is_mixed
 Is the preconditioner a mixed precision preconditioner? More...
 
MatrixType * _matrix
 The matrix. More...
 
bool _own_matrix
 If the matrix is owned by this solver, default is false. More...
 
SolverClass< MatrixType, VectorType, DataType > * _preconditioner
 The preconditioner. More...
 
bool _own_preconditioner
 If the preconditioner is owned by this solver, default is false. More...
 
VectorType * _solution
 Pointer to the solution, note that this vector is not going to be freed. More...
 
VectorType * _right_hand_side
 Pointer to the right-hand-size, note that this vector is not going to be freed. More...
 
bool _ready
 If the solver is ready. More...
 
int _print_option
 The print option. More...
 

Detailed Description

template<class MatrixType, class VectorType, typename DataType>
class pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >

The real flexgmres solver class. MatrixType is the type of the matrix, VectorType is the type of the vector, DataType is the data type.
MatrixType required function: SetupVectorPtrStr, Matvec, GetMpiInfo (for PARGEMSLR_TIMING).

Constructor & Destructor Documentation

◆ FlexGmresClass() [1/3]

template<class MatrixType , class VectorType , typename DataType >
pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::FlexGmresClass ( )
inline

The constructor.

◆ FlexGmresClass() [2/3]

template<class MatrixType , class VectorType , typename DataType >
pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::FlexGmresClass ( const FlexGmresClass< MatrixType, VectorType, DataType > &  solver)
inline

The copy constructor.

Parameters
[in]solverThe solver.

◆ FlexGmresClass() [3/3]

template<class MatrixType , class VectorType , typename DataType >
pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::FlexGmresClass ( FlexGmresClass< MatrixType, VectorType, DataType > &&  solver)
inline

The move constructor.

Parameters
[in]solverThe solver.

◆ ~FlexGmresClass()

template<class MatrixType , class VectorType , typename DataType >
pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::~FlexGmresClass ( )
inline

The destructor.

Member Function Documentation

◆ Clear()

template<class MatrixType , class VectorType , typename DataType >
int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::Clear ( )
inlinevirtual

Free function.

Returns
Return error message.

Reimplemented from pargemslr::SolverClass< MatrixType, VectorType, DataType >.

◆ GetFinalRelativeResidual()

template<class MatrixType , class VectorType , typename DataType >
std::conditional<PargemslrIsDoublePrecision<DataType>::value, double, float>::type pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::GetFinalRelativeResidual ( ) const
inline

Get the final relative residual.

Returns
Return the final relative residual.

◆ GetNumberIterations()

template<class MatrixType , class VectorType , typename DataType >
int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::GetNumberIterations ( ) const
inline

Get the number of iterations.

Returns
Return the number of iterations.

◆ GetRelativeResidual()

template<class MatrixType , class VectorType , typename DataType >
std::conditional<PargemslrIsDoublePrecision<DataType>::value, vector_seq_double, vector_seq_float>::type& pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::GetRelativeResidual ( )
inline

Get the relative residual at each step as a vector.

Returns
Return the relative residual at each step as a vector.

◆ operator=() [1/2]

template<class MatrixType , class VectorType , typename DataType >
FlexGmresClass<MatrixType, VectorType, DataType>& pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::operator= ( const FlexGmresClass< MatrixType, VectorType, DataType > &  solver)
inline

The = operator.

Parameters
[in]solverThe solver.
Returns
Return the solver.

◆ operator=() [2/2]

template<class MatrixType , class VectorType , typename DataType >
FlexGmresClass<MatrixType, VectorType, DataType>& pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::operator= ( FlexGmresClass< MatrixType, VectorType, DataType > &&  solver)
inline

The = operator.

Parameters
[in]solverThe solver.
Returns
Return the solver.

◆ SetAbsoluteTol()

template<class MatrixType , class VectorType , typename DataType >
int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::SetAbsoluteTol ( bool  option)
inline

Set if we use absolute threshold ||r|| or ||r||/||b||.

Parameters
[in]optionThe bool of new option.
Returns
Return error message.

◆ SetKrylovSubspaceDimension()

template<class MatrixType , class VectorType , typename DataType >
int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::SetKrylovSubspaceDimension ( int  kdim)
inline

Set the maximum number of flexible GMRES inner iterations per cycle.

Parameters
[in]maxitsThe maximum number of flexible GMRES inner iterations per cycle.
Returns
Return error message.

◆ SetMaxNumberIterations()

template<class MatrixType , class VectorType , typename DataType >
int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::SetMaxNumberIterations ( int  maxits)
inline

Set the maximum number of iterations.

Parameters
[in]maxitsThe maximum number of iterations.
Returns
Return error message.

◆ SetSolveLocation()

template<class MatrixType , class VectorType , typename DataType >
virtual int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::SetSolveLocation ( const int &  location)
inlinevirtual

Set the data location that the solver apply to.

Parameters
[in]locationThe target solver location.
Returns
Return error message.

Implements pargemslr::SolverClass< MatrixType, VectorType, DataType >.

◆ SetTolerance()

template<class MatrixType , class VectorType , typename DataType >
template<typename T >
int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::SetTolerance ( tol)
inline

Set the tolorance for stop the iteration.

Parameters
[in]tolThe tolorance for stopping the iteration.
Returns
Return error message.

◆ Setup()

template<class MatrixType , class VectorType , typename DataType >
virtual int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::Setup ( VectorType &  x,
VectorType &  rhs 
)
inlinevirtual

Setup the solver phase, include building the preconditioner, call this function before Solve, after SetPreconditioner.

Parameters
[in]xThe initial guess.
[in]rhsThe right-hand-side.
Returns
Return error message.

Implements pargemslr::SolverClass< MatrixType, VectorType, DataType >.

◆ SetWithParameterArray()

template<class MatrixType , class VectorType , typename DataType >
virtual int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::SetWithParameterArray ( double *  params)
inlinevirtual

Setup with parameter array.
Entry used: PARGEMSLR_IO_SOLVER_TOL, PARGEMSLR_IO_SOLVER_MAXITS, PARGEMSLR_IO_SOLVER_KDIM, and PARGEMSLR_IO_GENERAL_PRINT_LEVEL.

Parameters
[in]paramsThe parameter array.
Returns
Return error message.

Reimplemented from pargemslr::SolverClass< MatrixType, VectorType, DataType >.

◆ Solve()

template<class MatrixType , class VectorType , typename DataType >
virtual int pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >::Solve ( VectorType &  x,
VectorType &  rhs 
)
inlinevirtual

Solve phase. Call this function after Setup.

Parameters
[in,out]xThe initial guess.
[in]rhsThe right-hand-side.
Returns
Return error message.

Implements pargemslr::SolverClass< MatrixType, VectorType, DataType >.


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