gko::solver::Fcg#

Flexible conjugate gradient. A CG variant that tolerates a changing preconditioner across iterations, which is necessary when the preconditioner itself is inexact (inner iterative solve, randomized smoothers, …). Costs one extra inner product per iteration over plain CG. Suited to symmetric positive-definite matrices.

The update coefficient is computed as the Polak-Ribière form \(\langle r_k - r_{k-1}, z_k\rangle / \langle r_{k-1}, z_{k-1}\rangle\), the choice that keeps the search directions conjugate under a changing preconditioner, even though the class documentation below names Fletcher-Reeves; see the concept page FCG.

template<typename ValueType = default_precision>
class Fcg #

Inherits from

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

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

  • public gko::Transposable

FCG or the flexible conjugate gradient method is an iterative type Krylov subspace method which is suitable for symmetric positive definite methods.

Though this method performs very well for symmetric positive definite matrices, it is in general not suitable for general matrices.

In contrast to the standard CG based on the Polack-Ribiere formula, the flexible CG uses the Fletcher-Reeves formula for creating the orthonormal vectors spanning the Krylov subspace. This increases the computational cost of every Krylov solver iteration but allows for non-constant preconditioners.

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 FCG are merged into 2 separate steps.

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.

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>