Belos Version of the Day
|
An implementation of StatusTestResNorm using a family of residual norms. More...
#include <BelosStatusTestGenResNorm.hpp>
Public Types | |
typedef Teuchos::ScalarTraits< ScalarType > | SCT |
typedef SCT::magnitudeType | MagnitudeType |
typedef MultiVecTraits< ScalarType, MV > | MVT |
Enums. | |
enum | ResType { Implicit , Explicit } |
Select how the residual std::vector is produced. More... | |
![]() | |
typedef Teuchos::ScalarTraits< ScalarType > | SCT |
typedef SCT::magnitudeType | MagnitudeType |
typedef MultiVecTraits< ScalarType, MV > | MVT |
Public Member Functions | |
Constructors/destructors. | |
StatusTestGenResNorm (MagnitudeType Tolerance, int quorum=-1, bool showMaxResNormOnly=false) | |
Constructor. | |
virtual | ~StatusTestGenResNorm () |
Destructor. | |
Form and parameter definition methods. | |
int | defineResForm (ResType TypeOfResidual, NormType TypeOfNorm) |
Define form of the residual, its norm and optional weighting std::vector. | |
int | defineScaleForm (ScaleType TypeOfScaling, NormType TypeOfNorm, MagnitudeType ScaleValue=Teuchos::ScalarTraits< MagnitudeType >::one()) |
Define form of the scaling, its norm, its optional weighting std::vector, or, alternatively, define an explicit value. | |
NormType | getResNormType () |
int | setTolerance (MagnitudeType tolerance) |
Set the value of the tolerance. | |
int | setQuorum (int quorum) |
Sets the number of residuals that must pass the convergence test before Passed is returned. | |
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. | |
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 |
Returns the number of residuals that must pass the convergence test before Passed is returned. | |
bool | getShowMaxResNormOnly () |
Returns whether the only maximum residual norm is displayed when the print() method is called. | |
std::vector< int > | convIndices () |
Returns the std::vector containing the indices of the residuals that passed the test. | |
MagnitudeType | getTolerance () const |
Returns the value of the tolerance, ![]() | |
const std::vector< MagnitudeType > * | getTestValue () const |
Returns the test value, ![]() | |
const std::vector< MagnitudeType > * | getResNormValue () const |
Returns the residual norm value, ![]() | |
const std::vector< MagnitudeType > * | getScaledNormValue () const |
Returns the scaled norm value, ![]() | |
bool | getLOADetected () const |
Returns a boolean indicating a loss of accuracy has been detected in computing the residual. | |
Misc. | |
StatusType | firstCallCheckStatusSetup (Iteration< ScalarType, MV, OP > *iSolver) |
Call to setup initial scaling std::vector. | |
Overridden from Teuchos::Describable | |
std::string | description () const |
Method to return description of the maximum iteration status test | |
Form and parameter definition methods. | |
Methods to access data members. | |
![]() | |
StatusTest () | |
Constructor. | |
virtual | ~StatusTest () |
Destructor. | |
An implementation of StatusTestResNorm using a family of residual norms.
StatusTestGenResNorm is an implementation of StatusTestResNorm that allows a user to construct one of a family of residual tests for use as a status/convergence test for Belos. The form of the test is
where
Definition at line 79 of file BelosStatusTestGenResNorm.hpp.
typedef Teuchos::ScalarTraits<ScalarType> Belos::StatusTestGenResNorm< ScalarType, MV, OP >::SCT |
Definition at line 84 of file BelosStatusTestGenResNorm.hpp.
typedef SCT::magnitudeType Belos::StatusTestGenResNorm< ScalarType, MV, OP >::MagnitudeType |
Definition at line 85 of file BelosStatusTestGenResNorm.hpp.
typedef MultiVecTraits<ScalarType,MV> Belos::StatusTestGenResNorm< ScalarType, MV, OP >::MVT |
Definition at line 86 of file BelosStatusTestGenResNorm.hpp.
enum Belos::StatusTestGenResNorm::ResType |
Select how the residual std::vector is produced.
Enumerator | |
---|---|
Implicit | Use the residual std::vector produced by the iterative solver. |
Explicit | Explicitly compute the residual std::vector r = b - A*x using the linear problem. |
Definition at line 94 of file BelosStatusTestGenResNorm.hpp.
Belos::StatusTestGenResNorm< ScalarType, MV, OP >::StatusTestGenResNorm | ( | MagnitudeType | Tolerance, |
int | quorum = -1, | ||
bool | showMaxResNormOnly = false ) |
Constructor.
The constructor takes a single argument specifying the tolerance (
You can also state the number of vectors that must pass the convergence criteria before the status test passes by using the quorum
argument.
Definition at line 386 of file BelosStatusTestGenResNorm.hpp.
|
virtual |
Destructor.
Definition at line 410 of file BelosStatusTestGenResNorm.hpp.
int Belos::StatusTestGenResNorm< ScalarType, MV, OP >::defineResForm | ( | ResType | TypeOfResidual, |
NormType | TypeOfNorm ) |
Define form of the residual, its norm and optional weighting std::vector.
This method defines the form of
Definition at line 427 of file BelosStatusTestGenResNorm.hpp.
|
virtual |
Define form of the scaling, its norm, its optional weighting std::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:
User-provided scaling value:
Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 440 of file BelosStatusTestGenResNorm.hpp.
|
inline |
Definition at line 159 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
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.
Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 165 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Sets the number of residuals that must pass the convergence test before Passed is returned.
quorum=-1
then all residuals must pass the convergence test before Passed is returned. Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 169 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Set whether the only maximum residual norm is displayed when the print() method is called.
Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 172 of file BelosStatusTestGenResNorm.hpp.
|
virtual |
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.
Implements Belos::StatusTest< ScalarType, MV, OP >.
Definition at line 455 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Return the result of the most recent CheckStatus call.
Implements Belos::StatusTest< ScalarType, MV, OP >.
Definition at line 188 of file BelosStatusTestGenResNorm.hpp.
|
virtual |
Resets the internal configuration to the initial state.
Implements Belos::StatusTest< ScalarType, MV, OP >.
Definition at line 414 of file BelosStatusTestGenResNorm.hpp.
|
virtual |
Output formatted description of stopping test to output stream.
Implements Belos::StatusTest< ScalarType, MV, OP >.
Definition at line 587 of file BelosStatusTestGenResNorm.hpp.
|
virtual |
Print message for each status specific to this stopping test.
Reimplemented from Belos::StatusTest< ScalarType, MV, OP >.
Definition at line 619 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Returns the current solution estimate that was computed for the most recent residual test.
Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 215 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Returns the number of residuals that must pass the convergence test before Passed is returned.
quorum=-1
then all residuals must pass the convergence test before Passed is returned. Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 219 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Returns whether the only maximum residual norm is displayed when the print() method is called.
Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 222 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Returns the std::vector containing the indices of the residuals that passed the test.
Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 225 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Returns the value of the tolerance,
Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 228 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Returns the test value,
Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 231 of file BelosStatusTestGenResNorm.hpp.
|
inline |
Returns the residual norm value,
Definition at line 234 of file BelosStatusTestGenResNorm.hpp.
|
inline |
Returns the scaled norm value,
Definition at line 237 of file BelosStatusTestGenResNorm.hpp.
|
inlinevirtual |
Returns a boolean indicating a loss of accuracy has been detected in computing the residual.
Implements Belos::StatusTestResNorm< ScalarType, MV, OP >.
Definition at line 241 of file BelosStatusTestGenResNorm.hpp.
StatusType Belos::StatusTestGenResNorm< ScalarType, MV, OP >::firstCallCheckStatusSetup | ( | Iteration< ScalarType, MV, OP > * | iSolver | ) |
Call to setup initial scaling std::vector.
After this function is called getScaledNormValue()
can be called to get the scaling std::vector.
Definition at line 639 of file BelosStatusTestGenResNorm.hpp.
|
inline |
Method to return description of the maximum iteration status test
Definition at line 261 of file BelosStatusTestGenResNorm.hpp.