gko::stop::Criterion#
Abstract base for all stopping criteria. The factory takes the system
matrix, the right-hand side, the initial guess, and any implicit
residual estimate; the resulting Criterion is queried with check()
on every iteration of the consuming solver.
-
class Criterion #
Inherits from
public EnableAbstractPolymorphicObject<Criterion>
The Criterion class is a base class for all stopping criteria. It contains a factory to instantiate criteria. It is up to each specific stopping criterion to decide what to do with the data that is passed to it.
Note that depending on the criterion, convergence may not have happened after stopping.
Public Functions
- inline bool check(
- uint8 stopping_id,
- bool set_finalized,
- array<stopping_status> *stop_status,
- bool *one_changed,
- const Updater &updater,
This checks whether convergence was reached for a certain criterion. The actual implantation of the criterion goes here.
- Parameters:
stopping_id – id of the stopping criterion
set_finalized – Controls if the current version should count as finalized or not
stop_status – status of the stopping criterion
one_changed – indicates if the status of a vector has changed
updater – the Updater object containing all the information
- Returns:
whether convergence was completely reached
-
class Updater#
The Updater class serves for convenient argument passing to the Criterion’s check function. The pattern used is a Builder, except Updater builds a function’s arguments before calling the function itself, and does not build an object. This allows calling a Criterion’s check in the form
stop_criterion->update() .num_iterations(num_iterations) .ignore_residual_check(ignore_residual_check) .residual_norm(residual_norm) .implicit_sq_residual_norm(implicit_sq_residual_norm) .residual(residual) .solution(solution) .check(converged);
If there is a need for a new form of data to pass to the Criterion, it should be added here.