gko::stop::ResidualNorm#

Residual-norm tolerance criteria. The baseline factory parameter picks how the threshold is interpreted (relative to the right-hand side, relative to the initial residual, or absolute); see the class docstring for the three modes.

Two flavours:

  • ResidualNorm: tests the residual \(\|r_k\|_2 = \|b - A x_k\|_2\). The norm comes from the residual vector or residual norm that the solver passes to the criterion; when the solver passes neither (MINRES, Multigrid), the criterion evaluates \(b - A x_k\) with a matrix-vector product.

  • ImplicitResidualNorm: uses the squared residual-norm estimate the solver maintains internally (typically an inner product that is already computed each iteration). For CG-type solvers this saves the global reduction that the norm of the residual vector needs, and it never needs a matrix-vector product, at the cost of a quantity that can drift from the true residual norm on long runs.

template<typename ValueType = default_precision>
class ResidualNorm #

Inherits from

The ResidualNorm class is a stopping criterion which stops the iteration process when the actual residual norm is below a certain threshold relative to

  1. the norm of the right-hand side, norm(residual) $\leq$ < threshold * norm(right_hand_side).

  2. the initial residual, norm(residual) $\leq$ threshold * norm(initial_residual).

  3. one, norm(residual) $\leq$ threshold.

For better performance, the checks are run on the executor where the algorithm is executed.

Note

To use this stopping criterion there are some dependencies. The constructor depends on either b or the initial_residual in order to compute their norms. If this is not correctly provided, an exception ::gko::NotSupported() is thrown.

struct parameters_type#

Public Members

remove_complex<ValueType> reduction_factor{5 * std::numeric_limits<remove_complex<ValueType>>::epsilon()}#

Residual norm reduction factor

mode baseline#

The quantity the reduction is relative to. Choices include “mode::rhs_norm”, “mode::initial_resnorm” and “mode::absolute”

template<typename ValueType = default_precision>
class ImplicitResidualNorm #

Inherits from

The ImplicitResidualNorm class is a stopping criterion which stops the iteration process when the implicit residual norm is below a certain threshold relative to

  1. the norm of the right-hand side, implicit_resnorm $\leq$ < threshold * norm(right_hand_side)

  2. the initial residual, implicit_resnorm $\leq$ threshold * norm(initial_residual) .

  3. one, implicit_resnorm $\leq$ threshold.

Note

To use this stopping criterion there are some dependencies. The constructor depends on either b or the initial_residual in order to compute their norms. If this is not correctly provided, an exception ::gko::NotSupported() is thrown.

struct parameters_type#

Public Members

remove_complex<ValueType> reduction_factor{5 * std::numeric_limits<remove_complex<ValueType>>::epsilon()}#

Implicit Residual norm goal

mode baseline#

The quantity the reduction is relative to. Choices include “mode::rhs_norm”, “mode::initial_resnorm” and “mode::absolute”

template<typename ValueType>
class ResidualNormBase #

Inherits from

The ResidualNormBase class provides a framework for stopping criteria related to the residual norm. These criteria differ in the way they initialize starting_tau_, so in the value they compare the residual norm against. The provided check_impl uses the actual residual to check for convergence.