Belos Package Browser (Single Doxygen Collection) Development
Public Types | Private Member Functions | Private Attributes
Belos::MinresIter< ScalarType, MV, OP > Class Template Reference

MINRES implementation. More...

#include <BelosMinresIter.hpp>

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

List of all members.

Public Types

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

Private Member Functions

void setStateSize ()
 Method for initalizing the state storage needed by MINRES.

Private Attributes

const Teuchos::RCP
< LinearProblem< ScalarType,
MV, OP > > 
lp_
const Teuchos::RCP
< OutputManager< ScalarType > > 
om_
const Teuchos::RCP< StatusTest
< ScalarType, MV, OP > > 
stest_
bool initialized_
 Whether the solver has been initialized.
bool stateStorageInitialized_
 Whether the state storage has been initialized.
int iter_
 Current number of iterations performed.
MagnitudeType phibar_
Teuchos::RCP< MV > Y_
 Preconditioned residual.
Teuchos::RCP< MV > R1_
 Previous residual.
Teuchos::RCP< MV > R2_
 Previous residual.
Teuchos::RCP< MV > W_
 Direction vector.
Teuchos::RCP< MV > W1_
 Previous direction vector.
Teuchos::RCP< MV > W2_
 Previous direction vector.
Teuchos::SerialDenseMatrix
< int, ScalarType > 
beta1_
 Coefficient in the MINRES iteration.

Constructors/Destructor

 MinresIter (const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &tester, const Teuchos::ParameterList &params)
 Constructor.
virtual ~MinresIter ()
 Destructor.

Solver methods

void iterate ()
 Perform MINRES iterations until convergence or error.
void initializeMinres (MinresIterationState< ScalarType, MV > newstate)
 Initialize the solver to an iterate, providing a complete state.
void initialize ()
 Initialize the solver.
MinresIterationState
< ScalarType, MV > 
getState () const
 Get the current state of the linear solver.

Status methods

int getNumIters () const
 Get the current iteration count.
void resetNumIters (int iter=0)
 Reset the iteration count.
Teuchos::RCP< const MV > getNativeResiduals (std::vector< MagnitudeType > *norms) const
 Get the norms of the residuals native to the solver.
Teuchos::RCP< MV > getCurrentUpdate () const
 Get the current update to the linear system.
void symOrtho (ScalarType a, ScalarType b, ScalarType *c, ScalarType *s, ScalarType *r)

Accessor methods

const LinearProblem
< ScalarType, MV, OP > & 
getProblem () const
 Get a constant reference to the linear problem.
int getBlockSize () const
 Get the blocksize to be used by the iterative solver in solving this linear problem.
void setBlockSize (int blockSize)
 Set the blocksize to be used by the iterative solver in solving this linear problem.
bool isInitialized () const
 States whether the solver has been initialized or not.
bool isInitialized ()
 States whether the solver has been initialized or not.

Detailed Description

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

MINRES implementation.

Author:
Nico Schl"omer

Implementation of the preconditioned Minimal Residual Method (MINRES) iteration. This a bilinear form implementation, that uses inner products of the form <x,My> to solve the preconditioned linear system M^{-1}*A x = b. Thus, it is necessary that the left preconditioner M is positive definite.

Definition at line 95 of file BelosMinresIter.hpp.


Member Typedef Documentation

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

Definition at line 102 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
typedef MultiVecTraitsExt< ScalarType, MV > Belos::MinresIter< ScalarType, MV, OP >::MVText

Definition at line 103 of file BelosMinresIter.hpp.

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

Definition at line 104 of file BelosMinresIter.hpp.

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

Definition at line 105 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
typedef SCT::magnitudeType Belos::MinresIter< ScalarType, MV, OP >::MagnitudeType

Definition at line 106 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
typedef Teuchos::ScalarTraits< MagnitudeType > Belos::MinresIter< ScalarType, MV, OP >::SMT

Definition at line 107 of file BelosMinresIter.hpp.


Constructor & Destructor Documentation

template<class ScalarType , class MV , class OP >
Belos::MinresIter< ScalarType, MV, OP >::MinresIter ( const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &  problem,
const Teuchos::RCP< OutputManager< ScalarType > > &  printer,
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &  tester,
const Teuchos::ParameterList params 
)

Constructor.

problem The linear problem to solve printer Output manager, for intermediate solver output tester Status test for determining when the current approximate solution has converged params Parameter list of solver options

Definition at line 327 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
virtual Belos::MinresIter< ScalarType, MV, OP >::~MinresIter ( ) [inline, virtual]

Destructor.

Definition at line 126 of file BelosMinresIter.hpp.


Member Function Documentation

template<class ScalarType , class MV , class OP >
void Belos::MinresIter< ScalarType, MV, OP >::iterate ( ) [virtual]

Perform MINRES iterations until convergence or error.

Perform MINRES iterations until the status test indicates the need to stop, or until an error occurs. In the latter case, a (subclass of) std::exception is thrown.

iterate() will first determine whether the solver is initialized; if not, it will call initialize() using default arguments. After initialization, the solver performs MINRES iterations until the status test evaluates as Passed, at which point the method returns to the caller.

The status test is queried at the beginning of the iteration.

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

Definition at line 453 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::MinresIter< ScalarType, MV, OP >::initializeMinres ( MinresIterationState< ScalarType, MV >  newstate) [virtual]

Initialize the solver to an iterate, providing a complete state.

The MinresIter contains a certain amount of state, consisting of the current residual, preconditioned residual, and decent direction.

initialize() gives the user the opportunity to manually set these, although only the current unpreconditioned residual is required.

Postcondition:
isInitialized() == true (see post-conditions of isInitialize())
Note:
For any pointer in newstate which directly points to the multivectors in the solver, the data is not copied.

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

Definition at line 382 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::MinresIter< ScalarType, MV, OP >::initialize ( ) [inline, virtual]

Initialize the solver.

Initialize the solver. If a starting guess is provided in the linear problem, use that. Otherwise, choose a random starting guess.

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

Definition at line 170 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
MinresIterationState<ScalarType,MV> Belos::MinresIter< ScalarType, MV, OP >::getState ( ) const [inline, virtual]

Get the current state of the linear solver.

The returned current state is only valid if isInitialized() == true.

Returns:
A MinresIterationState object containing const pointers to the current solver state.

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

Definition at line 182 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::MinresIter< ScalarType, MV, OP >::getNumIters ( ) const [inline, virtual]

Get the current iteration count.

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

Definition at line 203 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::MinresIter< ScalarType, MV, OP >::resetNumIters ( int  iter = 0) [inline, virtual]

Reset the iteration count.

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

Definition at line 206 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<const MV> Belos::MinresIter< ScalarType, MV, OP >::getNativeResiduals ( std::vector< MagnitudeType > *  norms) const [inline]

Get the norms of the residuals native to the solver.

Returns:
A std::vector of length blockSize containing the native residuals.

Definition at line 211 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<MV> Belos::MinresIter< ScalarType, MV, OP >::getCurrentUpdate ( ) const [inline, virtual]

Get the current update to the linear system.

Note:
This method returns a null pointer because the linear problem is current.

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

Definition at line 226 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::MinresIter< ScalarType, MV, OP >::symOrtho ( ScalarType  a,
ScalarType  b,
ScalarType *  c,
ScalarType *  s,
ScalarType *  r 
)

Definition at line 608 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
const LinearProblem<ScalarType,MV,OP>& Belos::MinresIter< ScalarType, MV, OP >::getProblem ( ) const [inline, virtual]

Get a constant reference to the linear problem.

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

Definition at line 237 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::MinresIter< ScalarType, MV, OP >::getBlockSize ( ) const [inline, virtual]

Get the blocksize to be used by the iterative solver in solving this linear problem.

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

Definition at line 240 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::MinresIter< ScalarType, MV, OP >::setBlockSize ( int  blockSize) [inline, virtual]

Set the blocksize to be used by the iterative solver in solving this linear problem.

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

Definition at line 243 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::MinresIter< ScalarType, MV, OP >::isInitialized ( ) const [inline]

States whether the solver has been initialized or not.

Definition at line 249 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::MinresIter< ScalarType, MV, OP >::isInitialized ( ) [inline, virtual]

States whether the solver has been initialized or not.

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

Definition at line 250 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::MinresIter< ScalarType, MV, OP >::setStateSize ( ) [private]

Method for initalizing the state storage needed by MINRES.

Definition at line 344 of file BelosMinresIter.hpp.


Member Data Documentation

template<class ScalarType , class MV , class OP >
const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > Belos::MinresIter< ScalarType, MV, OP >::lp_ [private]

Definition at line 265 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
const Teuchos::RCP< OutputManager< ScalarType > > Belos::MinresIter< ScalarType, MV, OP >::om_ [private]

Definition at line 266 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > Belos::MinresIter< ScalarType, MV, OP >::stest_ [private]

Definition at line 267 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::MinresIter< ScalarType, MV, OP >::initialized_ [private]

Whether the solver has been initialized.

If initialized_ == true, then the basis vectors have been initialized and the iterate() routine is capable of running. _initialize is set by the initialize() member method. For the implications of the state of initialized_, please see documentation for initialize().

Definition at line 277 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::MinresIter< ScalarType, MV, OP >::stateStorageInitialized_ [private]

Whether the state storage has been initialized.

If stateStorageInitialized_ == true, then the state storage has been initialized. This initialization may be postponed if the linear problem was generated without the right-hand side or solution vectors.

Definition at line 285 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::MinresIter< ScalarType, MV, OP >::iter_ [private]

Current number of iterations performed.

Definition at line 288 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
MagnitudeType Belos::MinresIter< ScalarType, MV, OP >::phibar_ [private]

Definition at line 294 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP< MV > Belos::MinresIter< ScalarType, MV, OP >::Y_ [private]

Preconditioned residual.

Definition at line 301 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP< MV > Belos::MinresIter< ScalarType, MV, OP >::R1_ [private]

Previous residual.

Definition at line 303 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP< MV > Belos::MinresIter< ScalarType, MV, OP >::R2_ [private]

Previous residual.

Definition at line 305 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP< MV > Belos::MinresIter< ScalarType, MV, OP >::W_ [private]

Direction vector.

Definition at line 307 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP< MV > Belos::MinresIter< ScalarType, MV, OP >::W1_ [private]

Previous direction vector.

Definition at line 309 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP< MV > Belos::MinresIter< ScalarType, MV, OP >::W2_ [private]

Previous direction vector.

Definition at line 311 of file BelosMinresIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::SerialDenseMatrix<int,ScalarType> Belos::MinresIter< ScalarType, MV, OP >::beta1_ [private]

Coefficient in the MINRES iteration.

Note:
If we could be sure that the preconditioner is Hermitian in complex arithmetic (which must be true anyway, in order for MINRES to work), we could make beta1_ a MagnitudeType. This would certainly be cleaner, considering it will be copied into beta (which is of MagnitudeType).

Definition at line 320 of file BelosMinresIter.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines