|
| template<Vector V> |
| | basic_iteration (const V &r0, int max_iter, Real rtol, Real atol=Real(0)) |
| | Construct from initial residual vector r0.
|
| | basic_iteration (Real norm_r0, int max_iter, Real rtol, Real atol=Real(0)) |
| | Construct from precomputed norm of r0.
|
| template<Vector V> |
| void | reset (const V &r0) |
| | Prepare the object for another solve (issue 888): the iteration count back to 0, the tolerance's reference norm to ||r0||, the residual, error and finished state cleared.
|
| void | reset (Real norm_r0) |
| | reset from a precomputed norm of r0, as the second constructor takes.
|
| template<Vector V> |
| bool | finished (const V &r) |
| | Test convergence given residual vector r.
|
| bool | finished (Real r) |
| | Test convergence given scalar residual norm.
|
| template<Vector V> |
| bool | converged_now (const V &r) |
| | Convergence test only, without the iteration-limit test: for a check in the middle of an iteration (bicgstab's half step, bicgstab_ell's BiCG part), where reaching max_iter must not cut the iteration short (issue 866).
|
| bool | converged_now (Real r) |
| basic_iteration & | operator++ () |
| | Pre-increment iteration counter.
|
| basic_iteration | operator++ (int) |
| | Post-increment iteration counter.
|
| bool | first () const |
| | Returns true if this is the first iteration (i <= 1).
|
| | operator int () const |
| | Error code: 0 = converged, 1 = max_iter exceeded, 2-5 breakdown, 6 = non-finite residual.
|
| int | error_code () const |
| int | iterations () const |
| Real | resid () const |
| Real | relresid () const |
| Real | tol () const |
| Real | atol () const |
| Real | norm_r0 () const |
| void | fail (int code, const std::string &) |
| | Signal solver breakdown or other failure.
|
| bool | is_finished () const |
template<typename Real>
class mtl::itl::basic_iteration< Real >
Convergence controller: tracks iteration count, residual, and tolerance.
Convergence test: resid <= rtol * norm_r0 || resid <= atol
Error codes: 0 converged, 1 max_iter reached, 2 to 5 a solver's breakdown (see the solver), non_finite (6) when a residual handed to finished() is NaN or infinite, and not_positive_definite (7) when a solver that requires an SPD (HPD) preconditioner finds that M is not (minres, cg; #949).
template<typename Real>
template<Vector V>
Convergence test only, without the iteration-limit test: for a check in the middle of an iteration (bicgstab's half step, bicgstab_ell's BiCG part), where reaching max_iter must not cut the iteration short (issue 866).
Finishes, with error code 0, only when r converged.
template<typename Real>
template<Vector V>
Prepare the object for another solve (issue 888): the iteration count back to 0, the tolerance's reference norm to ||r0||, the residual, error and finished state cleared.
Without reset, an object reused for a second solve keeps counting toward max_iter (a budget over all the solves) and measures the relative tolerance against the first r0's norm (#866 made reuse work, and pins that behaviour); a solver can't reset it, because what r0 means (b, b - A x0, ...) is the caller's.