gko::solver::Cgs#
Conjugate gradient squared. Replaces Bicg’s Aᵀ apply with another
apply of A, doubling the per-iteration residual reduction but
amplifying numerical noise. Cheap per iteration but less robust than
Bicgstab; useful when A is well conditioned.
-
template<typename ValueType = default_precision>
class Cgs # Inherits from
public gko::EnableLinOp<Cgs<default_precision>>
public gko::solver::EnablePreconditionedIterativeSolver<default_precision, Cgs<default_precision>>
public gko::Transposable
CGS or the conjugate gradient square method is an iterative type Krylov subspace method which is suitable for general systems.
CGS rests on the identity that BiCG produces a residual of the form \( r_k^{\mathrm{BiCG}} = \psi_k(A)\, r_0 \), where \( \psi_k \) is the residual polynomial. Squaring this polynomial yields the CGS residual
\[ r_k^{\mathrm{CGS}} = \psi_k(A)^2\, r_0, \]so the iteration avoids the explicit \( A^H \) apply that BiCG requires. The trade-off is that residuals lose monotonicity and can exhibit large oscillations on poorly-conditioned systems — when this matters in practice, BiCGSTAB stabilises the same idea at the cost of one extra matrix-vector product per iteration.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 CGS are merged into 3 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>