Loading...
Searching...
No Matches
terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT > Class Template Reference

Flexible GMRES (FGMRES) iterative solver for nonsymmetric linear systems. More...

#include <fgmres.hpp>

Public Types

using OperatorType = OperatorT
 Operator type to be solved.
 
using SolutionVectorType = SrcOf< OperatorType >
 Solution vector type.
 
using RHSVectorType = DstOf< OperatorType >
 Right-hand side vector type.
 
using ScalarType = typename SolutionVectorType::ScalarType
 Scalar type for computations.
 

Public Member Functions

 FGMRES (const std::vector< SolutionVectorType > &tmp, const FGMRESOptions< ScalarType > &options={}, const std::shared_ptr< util::Table > &statistics=nullptr, const PreconditionerT preconditioner=IdentitySolver< OperatorT >())
 Construct an FGMRES solver with a custom preconditioner.
 
void set_tag (const std::string &tag)
 Set a tag string for statistics output identification.
 
void set_restart (int m)
 Set the number of inner iterations before restart (FGMRES(m)).
 
void solve_impl (OperatorType &A, SolutionVectorType &x, const RHSVectorType &b)
 Solve the linear system \( Ax = b \) using flexible GMRES with restarts.
 

Detailed Description

template<OperatorLike OperatorT, SolverLike PreconditionerT = IdentitySolver< OperatorT >>
class terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT >

Flexible GMRES (FGMRES) iterative solver for nonsymmetric linear systems.

FGMRES allows for varying (flexible) preconditioning at each iteration, making it suitable for use with inexact or variable preconditioners.

Reference:

Saad, Y. (1993).
A flexible inner-outer preconditioned GMRES algorithm.
SIAM Journal on Scientific Computing, 14(2), 461-469.

Satisfies the SolverLike concept (see solver.hpp). Supports optional right preconditioning via the flexible framework.

Template Parameters
OperatorTOperator type (must satisfy OperatorLike).
PreconditionerTPreconditioner type (must satisfy SolverLike, defaults to IdentitySolver).

Member Typedef Documentation

◆ OperatorType

template<OperatorLike OperatorT, SolverLike PreconditionerT = IdentitySolver< OperatorT >>
using terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT >::OperatorType = OperatorT

Operator type to be solved.

◆ RHSVectorType

template<OperatorLike OperatorT, SolverLike PreconditionerT = IdentitySolver< OperatorT >>
using terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT >::RHSVectorType = DstOf< OperatorType >

Right-hand side vector type.

◆ ScalarType

template<OperatorLike OperatorT, SolverLike PreconditionerT = IdentitySolver< OperatorT >>
using terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT >::ScalarType = typename SolutionVectorType::ScalarType

Scalar type for computations.

◆ SolutionVectorType

template<OperatorLike OperatorT, SolverLike PreconditionerT = IdentitySolver< OperatorT >>
using terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT >::SolutionVectorType = SrcOf< OperatorType >

Solution vector type.

Constructor & Destructor Documentation

◆ FGMRES()

template<OperatorLike OperatorT, SolverLike PreconditionerT = IdentitySolver< OperatorT >>
terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT >::FGMRES ( const std::vector< SolutionVectorType > &  tmp,
const FGMRESOptions< ScalarType > &  options = {},
const std::shared_ptr< util::Table > &  statistics = nullptr,
const PreconditionerT  preconditioner = IdentitySolver< OperatorT >() 
)
inline

Construct an FGMRES solver with a custom preconditioner.

Parameters
tmpTemporary vectors for workspace. Must contain at least 2*restart + 4 vectors:
  • tmp[0]: residual vector r
  • tmp[1 .. restart+1]: Arnoldi basis vectors V_0..V_restart
  • tmp[restart+2 .. 2*restart+1]: preconditioned directions Z_0..Z_{restart-1}
  • tmp[2*restart+2]: work vector w for A*z
  • tmp[2*restart+3]: accumulator vector for solution update
optionsFGMRES solver parameters (restart, tolerances, max iterations).
statisticsShared pointer to statistics table for logging iteration progress (optional).
preconditionerPreconditioner solver (defaults to identity).

Member Function Documentation

◆ set_restart()

template<OperatorLike OperatorT, SolverLike PreconditionerT = IdentitySolver< OperatorT >>
void terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT >::set_restart ( int  m)
inline

Set the number of inner iterations before restart (FGMRES(m)).

Parameters
mRestart parameter (must be at least 1).

◆ set_tag()

template<OperatorLike OperatorT, SolverLike PreconditionerT = IdentitySolver< OperatorT >>
void terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT >::set_tag ( const std::string &  tag)
inline

Set a tag string for statistics output identification.

Parameters
tagTag string to identify this solver instance in statistics.

◆ solve_impl()

template<OperatorLike OperatorT, SolverLike PreconditionerT = IdentitySolver< OperatorT >>
void terra::linalg::solvers::FGMRES< OperatorT, PreconditionerT >::solve_impl ( OperatorType A,
SolutionVectorType x,
const RHSVectorType b 
)
inline

Solve the linear system \( Ax = b \) using flexible GMRES with restarts.

Uses right preconditioning: solves \( A M^{-1} y = b \) where \( x = M^{-1} y \). The preconditioner M can vary at each iteration (flexibility).

The method builds an Arnoldi basis via modified Gram-Schmidt orthogonalization, applies Givens rotations to minimize the least-squares residual in the Krylov subspace, and updates the solution. If convergence is not achieved within the restart window, the process restarts with the updated solution until max_iterations is reached or convergence criteria are satisfied.

Parameters
AOperator (matrix) to solve with.
xSolution vector (input: initial guess, output: final solution).
bRight-hand side vector (input).

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