gko::solver::Fcg#
Flexible conjugate gradient. A CG variant that tolerates a changing preconditioner across iterations — necessary when the preconditioner itself is inexact (inner iterative solve, randomized smoothers, …). Costs one extra inner product per iteration over plain CG.
-
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, which uses the Fletcher-Reeves formula
\[ \beta_k = \frac{\langle r_k,\, z_k \rangle} {\langle r_{k-1},\, z_{k-1} \rangle}, \]the flexible CG uses the Polak-Ribière formula\[ \beta_k = \frac{\langle r_k - r_{k-1},\, z_k \rangle} {\langle r_{k-1},\, z_{k-1} \rangle} \]for the next search direction. This requires one additional inner product per iteration but allows the preconditioner \( M \) (and therefore \( z = M r \)) to change between iterations — useful when the preconditioner is itself an inner iterative solve, a randomized smoother, or otherwise not a fixed linear operator.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>