MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::itl::noisy_iteration< Real > Class Template Reference

Prints residual at every iteration (cyclic_iteration with cycle = 1). More...

#include <noisy_iteration.hpp>

Inheritance diagram for mtl::itl::noisy_iteration< Real >:
mtl::itl::cyclic_iteration< Real > mtl::itl::basic_iteration< Real >

Public Member Functions

template<Vector V>
 noisy_iteration (const V &r0, int max_iter, Real rtol, Real atol=Real(0), std::ostream &out=std::cout)
 noisy_iteration (Real norm_r0, int max_iter, Real rtol, Real atol=Real(0), std::ostream &out=std::cout)
Public Member Functions inherited from mtl::itl::cyclic_iteration< Real >
template<Vector V>
 cyclic_iteration (const V &r0, int max_iter, Real rtol, int cycle=100, Real atol=Real(0), std::ostream &out=std::cout)
 cyclic_iteration (Real norm_r0, int max_iter, Real rtol, int cycle=100, Real atol=Real(0), std::ostream &out=std::cout)
template<Vector V>
bool finished (const V &r)
 Test convergence; print residual every cycle iterations.
bool finished (Real r)
int error_code () const
 The error code, printing the summary the first time it is asked for.
 operator int () const
template<Vector V>
void reset (const V &r0)
 basic_iteration::reset, and the summary is printed again for the next solve (it printed only for the first, issue 888).
void reset (Real norm_r0)
Public Member Functions inherited from mtl::itl::basic_iteration< Real >
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

Additional Inherited Members

Static Public Attributes inherited from mtl::itl::basic_iteration< Real >
static constexpr int non_finite = 6
 Error code of a residual that is NaN or infinite.
static constexpr int not_positive_definite = 7
 Error code of a preconditioner found not to be positive definite: a v^H M^{-1} v negative beyond rounding, in a solver that requires an SPD (HPD) M.
Protected Member Functions inherited from mtl::itl::basic_iteration< Real >
bool converged (Real r) const
Static Protected Member Functions inherited from mtl::itl::cyclic_iteration< Real >
static int checked_cycle (int cycle)
Protected Attributes inherited from mtl::itl::cyclic_iteration< Real >
int cycle_
std::ostream & out_
bool reported_ = false
Protected Attributes inherited from mtl::itl::basic_iteration< Real >
int i_
int max_iter_
Real rtol_
Real atol_
Real my_norm_r0_
Real resid_
int error_
bool is_finished_

Detailed Description

template<typename Real>
class mtl::itl::noisy_iteration< Real >

Prints residual at every iteration (cyclic_iteration with cycle = 1).

Constructor & Destructor Documentation

◆ noisy_iteration() [1/2]

template<typename Real>
template<Vector V>
mtl::itl::noisy_iteration< Real >::noisy_iteration ( const V & r0,
int max_iter,
Real rtol,
Real atol = Real(0),
std::ostream & out = std::cout )
inline

◆ noisy_iteration() [2/2]

template<typename Real>
mtl::itl::noisy_iteration< Real >::noisy_iteration ( Real norm_r0,
int max_iter,
Real rtol,
Real atol = Real(0),
std::ostream & out = std::cout )
inline

The documentation for this class was generated from the following file: