gko::solver::Gmres#

Generalised minimal residual. Builds an orthonormal Krylov basis and minimises the residual over it; the most robust general-purpose non-symmetric Krylov method. Memory grows linearly with iteration count, so it is typically run with restart (the krylov_dim factory parameter).

template<typename ValueType = default_precision>
class Gmres #

Inherits from

  • public gko::EnableLinOp<Gmres<default_precision>>

  • public gko::solver::EnablePreconditionedIterativeSolver<default_precision, Gmres<default_precision>>

  • public gko::Transposable

GMRES or the generalized minimal residual method is an iterative type Krylov subspace method which is suitable for nonsymmetric linear systems.

The Arnoldi process builds an orthonormal basis \( V_m \) of the Krylov subspace

\[ \mathcal{K}_m(A, r_0) = \mathrm{span}\{r_0,\, A r_0,\, A^2 r_0,\, \ldots,\, A^{m-1} r_0\}, \]
and produces an upper Hessenberg matrix \( \bar H_m \) satisfying the Arnoldi relation \( A V_m = V_{m+1} \bar H_m \). GMRES then chooses the approximate solution \( x_m = x_0 + V_m y_m \) with \( y_m \) minimising the residual norm over the subspace,
\[ y_m = \arg\min_{y \in \mathbb{R}^m} \| \beta\, e_1 - \bar H_m\, y \|_2, \qquad \beta = \| r_0 \|_2. \]

The implementation in Ginkgo makes use of the merged kernel to make the best use of data locality. The inner operations in one iteration of GMRES are merged into 2 separate steps. Modified Gram-Schmidt is used.

Template Parameters:

ValueType – precision of matrix elements

Public Functions

virtual std::unique_ptr<LinOp> transpose() const override#

Returns a LinOp representing the transpose of the Transposable object.

Returns:

a pointer to the new transposed object

virtual std::unique_ptr<LinOp> conj_transpose() const override#

Returns a LinOp representing the conjugate transpose of the Transposable object.

Returns:

a pointer to the new conjugate transposed object

inline bool apply_uses_initial_guess() const override#

Return true as iterative solvers use the data in x as an initial guess.

Returns:

true as iterative solvers use the data in x as an initial guess.

inline size_type get_krylov_dim() const#

Gets the Krylov dimension of the solver

Returns:

the Krylov dimension

inline void set_krylov_dim(size_type other)#

Sets the Krylov dimension

Parameters:

other – the new Krylov dimension

Public Static Functions

static parameters_type parse(
const config::pnode &config,
const config::registry &context,
const config::type_descriptor &td_for_child = config::make_type_descriptor<ValueType>(),
)#

Create the parameters from the property_tree. Because this is directly tied to the specific type, the value/index type settings within config are ignored and type_descriptor is only used for children configs.

Parameters:
  • config – the property tree for setting

  • context – the registry

  • td_for_child – the type descriptor for children configs. The default uses the value type of this class.

Returns:

parameters

struct parameters_type #

Inherits from

  • public gko::solver::enable_preconditioned_iterative_solver_factory_parameters<parameters_type, Factory>

Public Members

size_type krylov_dim#

Krylov subspace dimension/restart value.

bool flexible#

Flexible GMRES

gmres::ortho_method ortho_method#

Orthogonalization method