Stokhos  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Types | List of all members
Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP > Class Template Reference
Inheritance diagram for Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >:
Inheritance graph
[legend]
Collaboration diagram for Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >:
Collaboration graph
[legend]

Public Types

typedef Sacado::MP::Vector
< Storage > 
ScalarType
 
typedef Teuchos::ScalarTraits
< ScalarType >::magnitudeType 
MagnitudeType
 The type of the magnitude (absolute value) of a ScalarType.
 

Public Member Functions

Constructors and destructor.
 StatusTestImpResNorm (MagnitudeType Tolerance, int quorum=-1, bool showMaxResNormOnly=false)
 Constructor. More...
 
virtual ~StatusTestImpResNorm ()
 Destructor (virtual for memory safety).
 
Form and parameter definition methods.
int defineResForm (NormType TypeOfNorm)
 Define form of the residual, its norm and optional weighting vector. More...
 
int defineScaleForm (ScaleType TypeOfScaling, NormType TypeOfNorm, MagnitudeType ScaleValue=Teuchos::ScalarTraits< MagnitudeType >::one())
 Define form of the scaling, its norm, its optional weighting vector, or, alternatively, define an explicit value. More...
 
int setTolerance (MagnitudeType tolerance)
 Set the value of the tolerance. More...
 
int setQuorum (int quorum)
 
int setShowMaxResNormOnly (bool showMaxResNormOnly)
 Set whether the only maximum residual norm is displayed when the print() method is called.
 
Status methods
StatusType checkStatus (Iteration< ScalarType, MV, OP > *iSolver)
 Check convergence status: Passed, Failed, or Undefined. More...
 
StatusType getStatus () const
 Return the result of the most recent CheckStatus call.
 
Reset methods
void reset ()
 Resets the internal configuration to the initial state.
 
Print methods
void print (std::ostream &os, int indent=0) const
 Output formatted description of stopping test to output stream.
 
void printStatus (std::ostream &os, StatusType type) const
 Print message for each status specific to this stopping test.
 
Methods to access data members.
Teuchos::RCP< MV > getSolution ()
 Returns the current solution estimate that was computed for the most recent residual test.
 
int getQuorum () const
 
bool getShowMaxResNormOnly ()
 Returns whether the only maximum residual norm is displayed when the print() method is called.
 
std::vector< int > convIndices ()
 Returns the vector containing the indices of the residuals that passed the test.
 
MagnitudeType getTolerance () const
 "Original" convergence tolerance $\tau$ as set by user. More...
 
MagnitudeType getCurrTolerance () const
 Current convergence tolerance; may be changed to prevent loss of accuracy. More...
 
const std::vector
< MagnitudeType > * 
getTestValue () const
 Returns the test value, $ \frac{\|r\|}{\sigma} $, computed in most recent call to CheckStatus.
 
const std::vector
< MagnitudeType > * 
getResNormValue () const
 Returns the residual norm value, $ \|r\| $, computed in most recent call to CheckStatus.
 
const std::vector
< MagnitudeType > * 
getScaledNormValue () const
 Returns the scaled norm value, $ \sigma $.
 
bool getLOADetected () const
 Returns a boolean indicating a loss of accuracy has been detected in computing the residual.
 
const std::vector< int > getEnsembleIterations () const
 Returns number of ensemble iterations.
 
Misc.
StatusType firstCallCheckStatusSetup (Iteration< ScalarType, MV, OP > *iSolver)
 Call to setup initial scaling vector. More...
 
Overridden from Teuchos::Describable
std::string description () const
 Method to return description of the maximum iteration status test.
 

Constructor & Destructor Documentation

template<class Storage , class MV , class OP >
Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::StatusTestImpResNorm ( MagnitudeType  Tolerance,
int  quorum = -1,
bool  showMaxResNormOnly = false 
)

Constructor.

Parameters
Tolerance[in] Convergence tolerance $\tau$.
quorum[in] The number of vectors in the problem that must pass the convergence criteria before this StatusTest passes. -1 means that all residuals must pass.
showMaxResNormOnly[in] Whether only the maximum residual norm (of all vectors) is displayed when the print() method is called.

Member Function Documentation

template<class Storage , class MV , class OP >
StatusType Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::checkStatus ( Iteration< ScalarType, MV, OP > *  iSolver)

Check convergence status: Passed, Failed, or Undefined.

This method checks to see if the convergence criteria are met. Depending on how the residual test is constructed this method will return the appropriate status type.

Returns
StatusType: Passed, Failed, or Undefined.
template<class Storage , class MV , class OP >
int Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::defineResForm ( NormType  TypeOfNorm)

Define form of the residual, its norm and optional weighting vector.

This method defines the form of $\|r\|$. We specify:

  • The norm to be used on the residual (this may be different than the norm used in defineScaleForm()).
template<class Storage , class MV , class OP >
int Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::defineScaleForm ( ScaleType  TypeOfScaling,
NormType  TypeOfNorm,
MagnitudeType  ScaleValue = Teuchos::ScalarTraits< MagnitudeType >::one() 
)

Define form of the scaling, its norm, its optional weighting vector, or, alternatively, define an explicit value.

This method defines the form of how the residual is scaled (if at all). It operates in two modes:

  1. User-provided scaling value:

    • Set argument TypeOfScaling to UserProvided.
    • Set ScaleValue to a non-zero value that the residual norm will be divided by.
    • TypeOfNorm argument will be ignored.
    • Sample use: Define ScaleValue = $\|A\|_{\infty}$ where $ A $ is the matrix of the linear problem.

  2. Use a supported Scaling Form:
    • Define TypeOfScaling to be the norm of the right hand side, the initial residual vector, or to none.
    • Define norm to be used on the scaling vector (this may be different than the norm used in DefineResForm()).
template<class Storage , class MV , class OP >
StatusType Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::firstCallCheckStatusSetup ( Iteration< ScalarType, MV, OP > *  iSolver)

Call to setup initial scaling vector.

After this function is called getScaledNormValue() can be called to get the scaling vector.

template<class Storage , class MV , class OP >
MagnitudeType Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::getCurrTolerance ( ) const
inline

Current convergence tolerance; may be changed to prevent loss of accuracy.

The difference between "original" tolerance (the value of getTolerance()) and "current" tolerance (the value of this method) relates to the idea of "loss of accuracy." See this class' main documentation for details. We do not allow users to set the "current" tolerance.

template<class Storage , class MV , class OP >
int Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::getQuorum ( ) const
inline

Returns the number of residuals that must pass the convergence test before Passed is returned.

Note
If quorum=-1 then all residuals must pass the convergence test before Passed is returned.
template<class Storage , class MV , class OP >
MagnitudeType Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::getTolerance ( ) const
inline

"Original" convergence tolerance $\tau$ as set by user.

This value is the convergence tolerance as set by the user in the constructor, or by the setTolerance() method. See this class' main documentation and the documentation of getCurrTolerance() for an explanation of the difference between the "original" and "current" tolerances.

template<class Storage , class MV , class OP >
int Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::setQuorum ( int  quorum)
inline

Sets the number of residuals that must pass the convergence test before Passed is returned.

Note
If quorum=-1 then all residuals must pass the convergence test before Passed is returned.
template<class Storage , class MV , class OP >
int Belos::StatusTestImpResNorm< Sacado::MP::Vector< Storage >, MV, OP >::setTolerance ( MagnitudeType  tolerance)
inline

Set the value of the tolerance.

We allow the tolerance to be reset for cases where, in the process of testing the residual, we find that the initial tolerance was too tight or too lax.


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