CUSP
Loading...
Searching...
No Matches

Configurable convergence monitors for iterative solvers. More...

Classes

class  cusp::monitor< ValueType >
 Implements standard convergence criteria and reporting for iterative solvers. More...
 
class  cusp::convergence_monitor< ValueType >
 Deprecated convergence monitor. More...
 
class  cusp::default_monitor< ValueType >
 Deprecated default monitor. More...
 
class  cusp::verbose_monitor< ValueType >
 Deprecated verbose monitor. More...
 

Typedefs

typedef cusp::norm_type< ValueType >::type cusp::monitor< ValueType >::Real
 A real-valued type used for norms and tolerances.
 
typedef Parent::Real cusp::convergence_monitor< ValueType >::Real
 A real-valued type used for norms and tolerances.
 
typedef Parent::Real cusp::default_monitor< ValueType >::Real
 A real-valued type used for norms and tolerances.
 
typedef Parent::Real cusp::verbose_monitor< ValueType >::Real
 A real-valued type used for norms and tolerances.
 

Functions

template<typename VectorType >
 cusp::monitor< ValueType >::monitor (const VectorType &b, const size_t iteration_limit=500, const Real relative_tolerance=1e-5, const Real absolute_tolerance=0, const bool verbose=false)
 Constructs a monitor for a given right-hand-side b.
 
void cusp::monitor< ValueType >::operator++ (void)
 Increments the iteration count.
 
bool cusp::monitor< ValueType >::converged (void) const
 Indicates whether the last tested residual satisfies the convergence tolerance.
 
Real cusp::monitor< ValueType >::residual_norm (void) const
 Euclidean norm of last residual.
 
size_t cusp::monitor< ValueType >::iteration_count (void) const
 Returns the number of iterations that the monitor has executed.
 
size_t cusp::monitor< ValueType >::iteration_limit (void) const
 Returns the maximum number of iterations.
 
Real cusp::monitor< ValueType >::relative_tolerance (void) const
 Returns the relative tolerance.
 
Real cusp::monitor< ValueType >::absolute_tolerance (void) const
 Returns the absolute tolerance.
 
Real cusp::monitor< ValueType >::tolerance (void) const
 Return the tolerance equal to absolute_tolerance() + relative_tolerance() * ||b||.
 
template<typename Vector >
bool cusp::monitor< ValueType >::finished (const Vector &r)
 Applies convergence criteria to determine whether iteration is finished.
 
template<typename DerivedPolicy , typename Vector >
bool cusp::monitor< ValueType >::finished (thrust::execution_policy< DerivedPolicy > &exec, const Vector &r)
 Applies convergence criteria using an explicit execution policy.
 
void cusp::monitor< ValueType >::set_verbose (bool verbose_=true)
 Sets the verbosity level of the monitor.
 
bool cusp::monitor< ValueType >::is_verbose (void)
 Gets the verbosity level of the monitor.
 
template<typename Vector >
void cusp::monitor< ValueType >::reset (const Vector &b)
 Resets the monitor using same convergence criteria.
 
void cusp::monitor< ValueType >::print (void)
 Prints the number of iterations and convergence history information.
 
Real cusp::monitor< ValueType >::immediate_rate (void)
 Returns the immediate convergence rate.
 
Real cusp::monitor< ValueType >::geometric_rate (void)
 Returns the geometric convergence rate.
 
Real cusp::monitor< ValueType >::average_rate (void)
 Returns the average convergence rate.
 
template<typename VectorType >
CUSP_DEPRECATED cusp::convergence_monitor< ValueType >::convergence_monitor (const VectorType &b, const size_t iteration_limit=500, const Real relative_tolerance=1e-5, const Real absolute_tolerance=0)
 Constructs a convergence_monitor for a given right-hand-side b.
 
template<typename VectorType >
CUSP_DEPRECATED cusp::default_monitor< ValueType >::default_monitor (const VectorType &b, const size_t iteration_limit=500, const Real relative_tolerance=1e-5, const Real absolute_tolerance=0)
 Constructs a default_monitor for a given right-hand-side b.
 
template<typename VectorType >
CUSP_DEPRECATED cusp::verbose_monitor< ValueType >::verbose_monitor (const VectorType &b, const size_t iteration_limit=500, const Real relative_tolerance=1e-5, const Real absolute_tolerance=0)
 Constructs a verbose_monitor for a given right-hand-side b.
 

Variables

cusp::array1d< Real, cusp::host_memory > cusp::monitor< ValueType >::residuals
 Array holding the residuals per iteration.
 

Detailed Description

Configurable convergence monitors for iterative solvers.

Typedef Documentation

◆ Real [1/4]

template<typename ValueType >
typedef cusp::norm_type<ValueType>::type cusp::monitor< ValueType >::Real

A real-valued type used for norms and tolerances.

Definition at line 105 of file monitor.h.

◆ Real [2/4]

template<typename ValueType >
typedef Parent::Real cusp::convergence_monitor< ValueType >::Real

A real-valued type used for norms and tolerances.

Definition at line 281 of file monitor.h.

◆ Real [3/4]

template<typename ValueType >
typedef Parent::Real cusp::default_monitor< ValueType >::Real

A real-valued type used for norms and tolerances.

Definition at line 320 of file monitor.h.

◆ Real [4/4]

template<typename ValueType >
typedef Parent::Real cusp::verbose_monitor< ValueType >::Real

A real-valued type used for norms and tolerances.

Definition at line 359 of file monitor.h.

Function Documentation

◆ absolute_tolerance()

template<typename ValueType >
Real cusp::monitor< ValueType >::absolute_tolerance ( void  ) const

Returns the absolute tolerance.

Returns
absolute_tolerance set for monitor

◆ average_rate()

template<typename ValueType >
Real cusp::monitor< ValueType >::average_rate ( void  )

Returns the average convergence rate.

Returns
average convergence rate.

◆ converged()

template<typename ValueType >
bool cusp::monitor< ValueType >::converged ( void  ) const

Indicates whether the last tested residual satisfies the convergence tolerance.

Returns
Boolean convergence indicator

◆ convergence_monitor()

template<typename ValueType >
template<typename VectorType >
CUSP_DEPRECATED cusp::convergence_monitor< ValueType >::convergence_monitor ( const VectorType &  b,
const size_t  iteration_limit = 500,
const Real  relative_tolerance = 1e-5,
const Real  absolute_tolerance = 0 
)
inline

Constructs a convergence_monitor for a given right-hand-side b.

Template Parameters
VectorTypeType of initial vector
Parameters
bright-hand-side of the linear system A x = b
iteration_limitmaximum number of solver iterations to allow
relative_tolerancedetermines convergence criteria
absolute_tolerancedetermines convergence criteria
Deprecated:
As of v0.4.0 monitors have been unified. Use monitor instead.

Definition at line 298 of file monitor.h.

◆ default_monitor()

template<typename ValueType >
template<typename VectorType >
CUSP_DEPRECATED cusp::default_monitor< ValueType >::default_monitor ( const VectorType &  b,
const size_t  iteration_limit = 500,
const Real  relative_tolerance = 1e-5,
const Real  absolute_tolerance = 0 
)
inline

Constructs a default_monitor for a given right-hand-side b.

Template Parameters
VectorTypeType of initial vector
Parameters
bright-hand-side of the linear system A x = b
iteration_limitmaximum number of solver iterations to allow
relative_tolerancedetermines convergence criteria
absolute_tolerancedetermines convergence criteria
Deprecated:
As of v0.4.0 monitors have been unified. Use monitor instead.

Definition at line 337 of file monitor.h.

◆ finished() [1/2]

template<typename ValueType >
template<typename Vector >
bool cusp::monitor< ValueType >::finished ( const Vector &  r)

Applies convergence criteria to determine whether iteration is finished.

Template Parameters
Vectorvector
Parameters
rresidual vector of the linear system (r = b - A x)

◆ finished() [2/2]

template<typename ValueType >
template<typename DerivedPolicy , typename Vector >
bool cusp::monitor< ValueType >::finished ( thrust::execution_policy< DerivedPolicy > &  exec,
const Vector &  r 
)

Applies convergence criteria using an explicit execution policy.

Template Parameters
DerivedPolicyexecution policy
Vectorvector
Parameters
execthe execution policy
rresidual vector of the linear system (r = b - A x)

◆ geometric_rate()

template<typename ValueType >
Real cusp::monitor< ValueType >::geometric_rate ( void  )

Returns the geometric convergence rate.

Returns
geometric convergence rate.

◆ immediate_rate()

template<typename ValueType >
Real cusp::monitor< ValueType >::immediate_rate ( void  )

Returns the immediate convergence rate.

Returns
immediate convergence rate.

◆ is_verbose()

template<typename ValueType >
bool cusp::monitor< ValueType >::is_verbose ( void  )

Gets the verbosity level of the monitor.

Returns
verbosity of this monitor.

◆ iteration_count()

template<typename ValueType >
size_t cusp::monitor< ValueType >::iteration_count ( void  ) const

Returns the number of iterations that the monitor has executed.

Returns
Number of iterations

◆ iteration_limit()

template<typename ValueType >
size_t cusp::monitor< ValueType >::iteration_limit ( void  ) const

Returns the maximum number of iterations.

Returns
Maximum number of allowed iterations

◆ monitor()

template<typename ValueType >
template<typename VectorType >
cusp::monitor< ValueType >::monitor ( const VectorType &  b,
const size_t  iteration_limit = 500,
const Real  relative_tolerance = 1e-5,
const Real  absolute_tolerance = 0,
const bool  verbose = false 
)

Constructs a monitor for a given right-hand-side b.

Template Parameters
VectorTypeType of initial vector
Parameters
bright-hand-side of the linear system A x = b
iteration_limitmaximum number of solver iterations to allow
relative_tolerancedetermines convergence criteria
absolute_tolerancedetermines convergence criteria
verboseControls printing status updates during execution

◆ relative_tolerance()

template<typename ValueType >
Real cusp::monitor< ValueType >::relative_tolerance ( void  ) const

Returns the relative tolerance.

Returns
absolute_tolerance set for monitor

◆ reset()

template<typename ValueType >
template<typename Vector >
void cusp::monitor< ValueType >::reset ( const Vector &  b)

Resets the monitor using same convergence criteria.

Template Parameters
Vectorvector
Parameters
binitial right hand side

◆ residual_norm()

template<typename ValueType >
Real cusp::monitor< ValueType >::residual_norm ( void  ) const

Euclidean norm of last residual.

Returns
The residual norm

◆ set_verbose()

template<typename ValueType >
void cusp::monitor< ValueType >::set_verbose ( bool  verbose_ = true)

Sets the verbosity level of the monitor.

Parameters
verbose_If true print convergence messages during iterations.

◆ tolerance()

template<typename ValueType >
Real cusp::monitor< ValueType >::tolerance ( void  ) const

Return the tolerance equal to absolute_tolerance() + relative_tolerance() * ||b||.

Returns
tolerance set for monitor

◆ verbose_monitor()

template<typename ValueType >
template<typename VectorType >
CUSP_DEPRECATED cusp::verbose_monitor< ValueType >::verbose_monitor ( const VectorType &  b,
const size_t  iteration_limit = 500,
const Real  relative_tolerance = 1e-5,
const Real  absolute_tolerance = 0 
)
inline

Constructs a verbose_monitor for a given right-hand-side b.

Template Parameters
VectorTypeType of initial vector
Parameters
bright-hand-side of the linear system A x = b
iteration_limitmaximum number of solver iterations to allow
relative_tolerancedetermines convergence criteria
absolute_tolerancedetermines convergence criteria
Deprecated:
As of v0.4.0 monitors have been unified. Use monitor instead.

Definition at line 376 of file monitor.h.

Variable Documentation

◆ residuals

template<typename ValueType >
cusp::array1d<Real,cusp::host_memory> cusp::monitor< ValueType >::residuals

Array holding the residuals per iteration.

Definition at line 249 of file monitor.h.