Theoretica
Mathematical Library
Loading...
Searching...
No Matches
theoretica::iter_result< Type > Class Template Reference

A structure returned by iterative algorithms containing the computed value, convergence information, and diagnostics. More...

#include <iter_result.h>

Public Member Functions

 iter_result ()
 Construct with default values.
 
 iter_result (const Type &val)
 Construct with final result for reporting success.
 
 iter_result (const Type &value, unsigned int iterations)
 Construct with final result for reporting success.
 
 iter_result (const Type &value, unsigned int iterations, real residual)
 Construct with final result for reporting success.
 
 iter_result (ConvergenceStatus status, unsigned int iterations=0)
 Construct with convergence status for reporting failure.
 
 iter_result (ConvergenceStatus status, unsigned int iterations, real residual)
 Construct with convergence status for reporting failure.
 
 operator Type () const
 Implicit conversion to result type, allows code like: Type res = algorithm();.
 
bool converged () const
 Check if the algorithm converged successfully.
 
 operator bool () const
 Explicit conversion to boolean (converged status), allows code like: if (result) { ... }.
 
std::string status_string () const
 Get a human-readable string description of the status of convergence of an iterative algorithm.
 
std::string to_string () const
 Convert the iter_result number to string representation.
 

Public Attributes

Type value
 Best estimate of the result.
 
ConvergenceStatus status = ConvergenceStatus::Success
 Status code indicating reason for termination.
 
unsigned int iterations = 0
 Number of iterations performed.
 
real residual = inf()
 Final error or residual norm (exact meaning depends on the algorithm)
 

Friends

std::ostream & operator<< (std::ostream &out, const iter_result< Type > &obj)
 Stream the complex number in string representation to an output stream (std::ostream)
 

Detailed Description

template<typename Type = real>
class theoretica::iter_result< Type >

A structure returned by iterative algorithms containing the computed value, convergence information, and diagnostics.

Features implicit conversion to the result type.

Template Parameters
TThe type of the computed result (usually real or vec<real, N>)

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