Belos Package Browser (Single Doxygen Collection)  Development
Private Types | Private Attributes | List of all members
Belos::MinresSolMgr< ScalarType, MV, OP > Class Template Reference

MINRES linear solver solution manager. More...

#include <BelosMinresSolMgr.hpp>

Inheritance diagram for Belos::MinresSolMgr< ScalarType, MV, OP >:
Inheritance graph
[legend]

Private Types

typedef MultiVecTraits< ScalarType, MV > MVT
 
typedef OperatorTraits< ScalarType, MV, OP > OPT
 
typedef Teuchos::ScalarTraits< ScalarType > SCT
 
typedef Teuchos::ScalarTraits< ScalarType >::magnitudeType MagnitudeType
 
typedef Teuchos::ScalarTraits< MagnitudeTypeMT
 

Private Attributes

Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > problem_
 Linear problem to solve. More...
 
Teuchos::RCP< OutputManager< ScalarType > > printer_
 Output manager. More...
 
Teuchos::RCP< std::ostream > outputStream_
 
Teuchos::RCP< StatusTest< ScalarType, MV, OP > > sTest_
 The full status test. More...
 
Teuchos::RCP< StatusTestMaxIters< ScalarType, MV, OP > > maxIterTest_
 The status test for maximum iteration count. More...
 
Teuchos::RCP< StatusTest< ScalarType, MV, OP > > convTest_
 The combined status test for convergence. More...
 
Teuchos::RCP< StatusTestGenResNorm< ScalarType, MV, OP > > impConvTest_
 The implicit (a.k.a. More...
 
Teuchos::RCP< StatusTestGenResNorm< ScalarType, MV, OP > > expConvTest_
 The explicit residual norm test. More...
 
Teuchos::RCP< StatusTestOutput< ScalarType, MV, OP > > outputTest_
 The "status test" that handles output. More...
 
Teuchos::RCP< const Teuchos::ParameterList > defaultParams_
 List of default parameters. More...
 
Teuchos::RCP< Teuchos::ParameterList > params_
 List of current parameters. More...
 
MagnitudeType convtol_
 Current relative residual 2-norm convergence tolerance. More...
 
MagnitudeType achievedTol_
 Tolerance achieved by the last solve() invocation. More...
 
int maxIters_
 Maximum number of iterations before stopping. More...
 
int numIters_
 Current number of iterations. More...
 
int blockSize_
 Current block size (i.e., number of right-hand sides): always 1 (one). More...
 
int verbosity_
 Current output verbosity. More...
 
int outputStyle_
 Current output style. More...
 
int outputFreq_
 Current frequency of output. More...
 
std::string label_
 Timer label. More...
 
Teuchos::RCP< Teuchos::Time > timerSolve_
 Total time to solution. More...
 
bool parametersSet_
 Whether the solver manager's parameters have been set. More...
 

MinresSolMgr Exceptions

static Teuchos::RCP< const Teuchos::ParameterList > defaultParameters ()
 List of valid MINRES parameters and their default values. More...
 
static void validateProblem (const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)
 Validate the given linear problem. More...
 

Constructors/Destructor

 MinresSolMgr ()
 Default constructor. More...
 
 MinresSolMgr (const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< Teuchos::ParameterList > &params)
 Basic constructor for MinresSolMgr. More...
 
virtual ~MinresSolMgr ()
 Destructor. More...
 

Accessor methods

const LinearProblem< ScalarType, MV, OP > & getProblem () const
 Return the linear problem to be solved. More...
 
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters () const
 Return the list of default parameters for this object. More...
 
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters () const
 Return the list of current parameters for this object. More...
 
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers () const
 Return all timers for this object. More...
 
MagnitudeType achievedTol () const
 Tolerance achieved by the last solve() invocation. More...
 
int getNumIters () const
 Get the iteration count for the most recent call to solve(). More...
 
bool isLOADetected () const
 Whether a loss of accuracy was detected in the solver. More...
 

Set methods (overridden from \c SolverManager)

void setProblem (const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)
 Set the linear problem that needs to be solved. More...
 
void setParameters (const Teuchos::RCP< Teuchos::ParameterList > &params)
 Set the parameters to use when solving the linear problem. More...
 

Reset methods (overridden from \c SolverManager)

void reset (const ResetType type)
 Reset the solver manager. More...
 

Solver application methods (overridden from \c SolverManager)

ReturnType solve ()
 Iterate until the status test tells us to stop. More...
 

Overridden from Teuchos::Describable

std::string description () const
 

Additional Inherited Members

- Public Member Functions inherited from Belos::SolverManager< ScalarType, MV, OP >
 SolverManager ()
 Empty constructor. More...
 
virtual ~SolverManager ()
 Destructor. More...
 
virtual void setUserConvStatusTest (const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &userConvStatusTest, const typename StatusTestCombo< ScalarType, MV, OP >::ComboType &comboType=StatusTestCombo< ScalarType, MV, OP >::SEQ)
 Set user-defined convergence status test. More...
 
virtual void setDebugStatusTest (const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &debugStatusTest)
 Set user-defined debug status test. More...
 

Detailed Description

template<class ScalarType, class MV, class OP>
class Belos::MinresSolMgr< ScalarType, MV, OP >

MINRES linear solver solution manager.

Author
Nico Schl"omer

The Minimal Residual Method (MINRES) is a Krylov subspace method for solving symmetric (in real arithmetic, or Hermitian in complex arithmetic), nonsingular, but possibly indefinite linear systems

Definition at line 115 of file BelosMinresSolMgr.hpp.

Member Typedef Documentation

◆ MVT

template<class ScalarType, class MV, class OP>
typedef MultiVecTraits<ScalarType,MV> Belos::MinresSolMgr< ScalarType, MV, OP >::MVT
private

Definition at line 118 of file BelosMinresSolMgr.hpp.

◆ OPT

template<class ScalarType, class MV, class OP>
typedef OperatorTraits<ScalarType,MV,OP> Belos::MinresSolMgr< ScalarType, MV, OP >::OPT
private

Definition at line 119 of file BelosMinresSolMgr.hpp.

◆ SCT

template<class ScalarType, class MV, class OP>
typedef Teuchos::ScalarTraits<ScalarType> Belos::MinresSolMgr< ScalarType, MV, OP >::SCT
private

Definition at line 120 of file BelosMinresSolMgr.hpp.

◆ MagnitudeType

template<class ScalarType, class MV, class OP>
typedef Teuchos::ScalarTraits<ScalarType>::magnitudeType Belos::MinresSolMgr< ScalarType, MV, OP >::MagnitudeType
private

Definition at line 121 of file BelosMinresSolMgr.hpp.

◆ MT

template<class ScalarType, class MV, class OP>
typedef Teuchos::ScalarTraits< MagnitudeType > Belos::MinresSolMgr< ScalarType, MV, OP >::MT
private

Definition at line 122 of file BelosMinresSolMgr.hpp.

Constructor & Destructor Documentation

◆ MinresSolMgr() [1/2]

template<class ScalarType , class MV , class OP >
Belos::MinresSolMgr< ScalarType, MV, OP >::MinresSolMgr ( )

Default constructor.

This constructor takes no arguments and sets the default values for the solver. The linear problem must be passed in using setProblem() before solve() is called on this object, otherwise an exception is thrown. The solver's parameters (which this constructor sets to their default values) may be changed using setParameters().

Definition at line 452 of file BelosMinresSolMgr.hpp.

◆ MinresSolMgr() [2/2]

template<class ScalarType , class MV , class OP >
Belos::MinresSolMgr< ScalarType, MV, OP >::MinresSolMgr ( const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &  problem,
const Teuchos::RCP< Teuchos::ParameterList > &  params 
)

Basic constructor for MinresSolMgr.

Parameters
problem[in/out] The LinearProblem to be solved
params[in/out] Parameter list of options for the solver manager. Parameters not provided will be filled in with default values. These are the options accepted by the solver manager:
  • "Block Size" - an int specifying the block size to be used by the underlying MINRES solver. Default: 1 (which is the only valid value!)
  • "Convergence Tolerance" - a MagnitudeType specifying the level that residual norms must reach to decide convergence. Default value: 1e-8.
  • "Maximum Iterations" - an int specifying the maximum number of iterations the underlying solver is allowed to perform. Default: 1000
  • "Verbosity" - a sum of MsgType (stored as an int) specifying the verbosity. Default value: Belos::Errors
  • "Output Style" - a OutputType specifying the style of output. Default value: Belos::General
  • "Output Stream" - a reference-counted pointer to the output stream where all solver output is sent. Default value: Teuchos::rcp(&std::cout,false)
  • "Output Frequency" - an int specifying how often (in terms of number of iterations) intermediate convergence information should be written to the output stream. Default value: -1 (which means no intermediate convergence information is ever written to the output stream)
  • "Timer Label" - an std::string to use as a prefix for the timer labels. Default value: "Belos"

We accept the "Num Blocks" parameter for compatibility with other Belos solvers, but ignore it, since it is not relevant to MINRES. ("Num Blocks" specifies the restart length, but our MINRES implementation does not restart.)

Definition at line 469 of file BelosMinresSolMgr.hpp.

◆ ~MinresSolMgr()

template<class ScalarType, class MV, class OP>
virtual Belos::MinresSolMgr< ScalarType, MV, OP >::~MinresSolMgr ( )
inlinevirtual

Destructor.

Definition at line 187 of file BelosMinresSolMgr.hpp.

Member Function Documentation

◆ defaultParameters()

template<class ScalarType , class MV , class OP >
Teuchos::RCP< const Teuchos::ParameterList > Belos::MinresSolMgr< ScalarType, MV, OP >::defaultParameters ( )
static

List of valid MINRES parameters and their default values.

One way to set up this solver manager with nondefault parameters, is to make a deep non-const copy of the default parameters, and change the parameters you want to change.

Note
This is a class ("static") method, so that it can be called before you have constructed a MinresSolMgr object (useful for you, so you can have valid parameters before constructing one), or within the MinresSolMgr constructor (useful for me, so I can set default parameters).

Definition at line 399 of file BelosMinresSolMgr.hpp.

◆ getProblem()

template<class ScalarType, class MV, class OP>
const LinearProblem<ScalarType,MV,OP>& Belos::MinresSolMgr< ScalarType, MV, OP >::getProblem ( ) const
inlinevirtual

Return the linear problem to be solved.

Implements Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 194 of file BelosMinresSolMgr.hpp.

◆ getValidParameters()

template<class ScalarType, class MV, class OP>
Teuchos::RCP<const Teuchos::ParameterList> Belos::MinresSolMgr< ScalarType, MV, OP >::getValidParameters ( ) const
inlinevirtual

Return the list of default parameters for this object.

Implements Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 199 of file BelosMinresSolMgr.hpp.

◆ getCurrentParameters()

template<class ScalarType, class MV, class OP>
Teuchos::RCP<const Teuchos::ParameterList> Belos::MinresSolMgr< ScalarType, MV, OP >::getCurrentParameters ( ) const
inlinevirtual

Return the list of current parameters for this object.

Implements Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 207 of file BelosMinresSolMgr.hpp.

◆ getTimers()

template<class ScalarType, class MV, class OP>
Teuchos::Array<Teuchos::RCP<Teuchos::Time> > Belos::MinresSolMgr< ScalarType, MV, OP >::getTimers ( ) const
inline

Return all timers for this object.

Currently only one timer is being used, which is the total time spent in the solve() routine. Thus, the returned Array currently has only one element.

Warning
If setParameters() has not yet been called, or if you change the timer label, that invalidates the pointer timer(s).

Definition at line 220 of file BelosMinresSolMgr.hpp.

◆ achievedTol()

template<class ScalarType, class MV, class OP>
MagnitudeType Belos::MinresSolMgr< ScalarType, MV, OP >::achievedTol ( ) const
inlinevirtual

Tolerance achieved by the last solve() invocation.

This is the maximum over all right-hand sides' achieved convergence tolerances, and is set whether or not the solve actually managed to achieve the desired convergence tolerance.

Reimplemented from Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 229 of file BelosMinresSolMgr.hpp.

◆ getNumIters()

template<class ScalarType, class MV, class OP>
int Belos::MinresSolMgr< ScalarType, MV, OP >::getNumIters ( ) const
inlinevirtual

Get the iteration count for the most recent call to solve().

Implements Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 234 of file BelosMinresSolMgr.hpp.

◆ isLOADetected()

template<class ScalarType, class MV, class OP>
bool Belos::MinresSolMgr< ScalarType, MV, OP >::isLOADetected ( ) const
inlinevirtual

Whether a loss of accuracy was detected in the solver.

Warning
This implementation of MINRES does not currently attempt to detect a loss of accuracy in the solver; thus we always return false (for now).

Implements Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 243 of file BelosMinresSolMgr.hpp.

◆ setProblem()

template<class ScalarType, class MV, class OP>
void Belos::MinresSolMgr< ScalarType, MV, OP >::setProblem ( const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &  problem)
inlinevirtual

Set the linear problem that needs to be solved.

Implements Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 251 of file BelosMinresSolMgr.hpp.

◆ setParameters()

template<class ScalarType , class MV , class OP >
void Belos::MinresSolMgr< ScalarType, MV, OP >::setParameters ( const Teuchos::RCP< Teuchos::ParameterList > &  params)
virtual

Set the parameters to use when solving the linear problem.

Parameters
params[in/out] List of parameters to use when solving the linear problem. This list will be modified as necessary to include default parameters that need not be provided. If params is null, then this method uses default parameters.
Note
The ParameterList returned by getValidParameters() has all the parameters that the solver understands, possibly including human-readable documentation and validators.

Implements Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 507 of file BelosMinresSolMgr.hpp.

◆ reset()

template<class ScalarType, class MV, class OP>
void Belos::MinresSolMgr< ScalarType, MV, OP >::reset ( const ResetType  type)
inlinevirtual

Reset the solver manager.

Reset the solver manager in a way specified by the ResetType parameter. This informs the solver manager that the solver should prepare for the next call to solve by resetting certain elements of the iterative solver strategy.

Implements Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 265 of file BelosMinresSolMgr.hpp.

◆ solve()

template<class ScalarType , class MV , class OP >
ReturnType Belos::MinresSolMgr< ScalarType, MV, OP >::solve ( )
virtual

Iterate until the status test tells us to stop.

This method implements SolverManager::solve() (which see).

MINRES' implementation of this method invokes MinresIter::iterate(), which will return either because a specially constructed status test that evaluates to Passed, or an std::exception is thrown.

A return from MinresIter::iterate() signifies one of the following scenarios:

  • the maximum number of iterations has been exceeded. In this scenario, the current solutions to the linear system will be placed in the linear problem and return Unconverged.
  • global convergence has been met. In this case, the current solutions to the linear system will be placed in the linear problem and the solver manager will return Converged.

Implements Belos::SolverManager< ScalarType, MV, OP >.

Definition at line 670 of file BelosMinresSolMgr.hpp.

◆ description()

template<class ScalarType , class MV , class OP >
std::string Belos::MinresSolMgr< ScalarType, MV, OP >::description ( ) const

Definition at line 834 of file BelosMinresSolMgr.hpp.

◆ validateProblem()

template<class ScalarType , class MV , class OP >
void Belos::MinresSolMgr< ScalarType, MV, OP >::validateProblem ( const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &  problem)
staticprivate

Validate the given linear problem.

We do this by raising std::invalid_argument (with an informative message) if the problem is null or its essential components are null.

Definition at line 485 of file BelosMinresSolMgr.hpp.

Member Data Documentation

◆ problem_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > Belos::MinresSolMgr< ScalarType, MV, OP >::problem_
private

Linear problem to solve.

Definition at line 306 of file BelosMinresSolMgr.hpp.

◆ printer_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<OutputManager<ScalarType> > Belos::MinresSolMgr< ScalarType, MV, OP >::printer_
private

Output manager.

Definition at line 309 of file BelosMinresSolMgr.hpp.

◆ outputStream_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<std::ostream> Belos::MinresSolMgr< ScalarType, MV, OP >::outputStream_
private

Definition at line 310 of file BelosMinresSolMgr.hpp.

◆ sTest_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<StatusTest<ScalarType,MV,OP> > Belos::MinresSolMgr< ScalarType, MV, OP >::sTest_
private

The full status test.

sTest_ is an OR combination of maxIterTest_ and convTest_. If you reallocate either of these, you have to give them to sTest_ again. If you reallocate sTest_, you have to tell outputTest_.

Definition at line 318 of file BelosMinresSolMgr.hpp.

◆ maxIterTest_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<StatusTestMaxIters<ScalarType,MV,OP> > Belos::MinresSolMgr< ScalarType, MV, OP >::maxIterTest_
private

The status test for maximum iteration count.

If you reallocate this, sTest_ needs the new RCP.

Definition at line 323 of file BelosMinresSolMgr.hpp.

◆ convTest_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<StatusTest<ScalarType,MV,OP> > Belos::MinresSolMgr< ScalarType, MV, OP >::convTest_
private

The combined status test for convergence.

If you reallocate this, sTest_ needs the new RCP.

Definition at line 328 of file BelosMinresSolMgr.hpp.

◆ impConvTest_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<StatusTestGenResNorm<ScalarType,MV,OP> > Belos::MinresSolMgr< ScalarType, MV, OP >::impConvTest_
private

The implicit (a.k.a.

"recursive") residual norm test.

If you reallocate this, convTest_ needs the new RCP.

Definition at line 333 of file BelosMinresSolMgr.hpp.

◆ expConvTest_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<StatusTestGenResNorm<ScalarType,MV,OP> > Belos::MinresSolMgr< ScalarType, MV, OP >::expConvTest_
private

The explicit residual norm test.

If you reallocate this, convTest_ needs the new RCP.

Definition at line 338 of file BelosMinresSolMgr.hpp.

◆ outputTest_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP> > Belos::MinresSolMgr< ScalarType, MV, OP >::outputTest_
private

The "status test" that handles output.

This object keeps a pointer to printer_ and sTest_. If you reallocate either of them, outputTest_ needs to know.

Definition at line 344 of file BelosMinresSolMgr.hpp.

◆ defaultParams_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<const Teuchos::ParameterList> Belos::MinresSolMgr< ScalarType, MV, OP >::defaultParams_
mutableprivate

List of default parameters.

This is declared "mutable" because it is computed on demand.

Definition at line 349 of file BelosMinresSolMgr.hpp.

◆ params_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<Teuchos::ParameterList> Belos::MinresSolMgr< ScalarType, MV, OP >::params_
private

List of current parameters.

Definition at line 352 of file BelosMinresSolMgr.hpp.

◆ convtol_

template<class ScalarType, class MV, class OP>
MagnitudeType Belos::MinresSolMgr< ScalarType, MV, OP >::convtol_
private

Current relative residual 2-norm convergence tolerance.

Definition at line 355 of file BelosMinresSolMgr.hpp.

◆ achievedTol_

template<class ScalarType, class MV, class OP>
MagnitudeType Belos::MinresSolMgr< ScalarType, MV, OP >::achievedTol_
private

Tolerance achieved by the last solve() invocation.

Definition at line 358 of file BelosMinresSolMgr.hpp.

◆ maxIters_

template<class ScalarType, class MV, class OP>
int Belos::MinresSolMgr< ScalarType, MV, OP >::maxIters_
private

Maximum number of iterations before stopping.

Definition at line 361 of file BelosMinresSolMgr.hpp.

◆ numIters_

template<class ScalarType, class MV, class OP>
int Belos::MinresSolMgr< ScalarType, MV, OP >::numIters_
private

Current number of iterations.

Definition at line 364 of file BelosMinresSolMgr.hpp.

◆ blockSize_

template<class ScalarType, class MV, class OP>
int Belos::MinresSolMgr< ScalarType, MV, OP >::blockSize_
private

Current block size (i.e., number of right-hand sides): always 1 (one).

Definition at line 367 of file BelosMinresSolMgr.hpp.

◆ verbosity_

template<class ScalarType, class MV, class OP>
int Belos::MinresSolMgr< ScalarType, MV, OP >::verbosity_
private

Current output verbosity.

Definition at line 370 of file BelosMinresSolMgr.hpp.

◆ outputStyle_

template<class ScalarType, class MV, class OP>
int Belos::MinresSolMgr< ScalarType, MV, OP >::outputStyle_
private

Current output style.

Definition at line 373 of file BelosMinresSolMgr.hpp.

◆ outputFreq_

template<class ScalarType, class MV, class OP>
int Belos::MinresSolMgr< ScalarType, MV, OP >::outputFreq_
private

Current frequency of output.

Definition at line 376 of file BelosMinresSolMgr.hpp.

◆ label_

template<class ScalarType, class MV, class OP>
std::string Belos::MinresSolMgr< ScalarType, MV, OP >::label_
private

Timer label.

Definition at line 379 of file BelosMinresSolMgr.hpp.

◆ timerSolve_

template<class ScalarType, class MV, class OP>
Teuchos::RCP<Teuchos::Time> Belos::MinresSolMgr< ScalarType, MV, OP >::timerSolve_
private

Total time to solution.

Definition at line 382 of file BelosMinresSolMgr.hpp.

◆ parametersSet_

template<class ScalarType, class MV, class OP>
bool Belos::MinresSolMgr< ScalarType, MV, OP >::parametersSet_
private

Whether the solver manager's parameters have been set.

Definition at line 385 of file BelosMinresSolMgr.hpp.


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