Belos Version of the Day
Loading...
Searching...
No Matches
Public Types | List of all members
Belos::GCRODRIter< ScalarType, MV, OP, DM > Class Template Reference

This class implements the GCRODR iteration, where a single-vector Krylov subspace is constructed. The QR decomposition of block, upper Hessenberg matrix is performed each iteration to update the least squares system and give the current linear system residuals. More...

#include <BelosGCRODRIter.hpp>

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

Public Types

typedef MultiVecTraits< ScalarType, MV, DM > MVT
 
typedef OperatorTraits< ScalarType, MV, OPOPT
 
typedef DenseMatTraits< ScalarType, DM > DMT
 
typedef Teuchos::ScalarTraits< ScalarTypeSCT
 
typedef SCT::magnitudeType MagnitudeType
 

Public Member Functions

Constructors/Destructor
 GCRODRIter (const Teuchos::RCP< LinearProblem< ScalarType, MV, OP, DM > > &problem, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP, DM > > &tester, const Teuchos::RCP< MatOrthoManager< ScalarType, MV, OP, DM > > &ortho, Teuchos::ParameterList &params)
 GCRODRIter constructor with linear problem, solver utilities, and parameter list of solver options.
 
virtual ~GCRODRIter ()
 Destructor.
 
Solver methods
void iterate ()
 This method performs block Gmres iterations until the status test indicates the need to stop or an error occurs (in which case, an std::exception is thrown).
 
void initialize (GCRODRIterState< ScalarType, MV, DM > &newstate)
 Initialize the solver to an iterate, providing a complete state.
 
void initialize ()
 Initialize the solver with empty data. Calling this method will result in error, as GCRODRIter must be initialized with a valid state.
 
GCRODRIterState< ScalarType, MV, DM > 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 updateLSQR (int dim=-1)
 Method for updating QR factorization of upper Hessenberg matrix.
 
int getCurSubspaceDim () const
 Get the dimension of the search subspace used to generate the current solution to the linear problem.
 
int getMaxSubspaceDim () const
 Get the maximum dimension allocated for the search subspace.
 
- Public Member Functions inherited from Belos::GCRODRIteration< ScalarType, MV, OP, DM >
virtual ~GCRODRIteration ()
 
- Public Member Functions inherited from Belos::Iteration< ScalarType, MV, OP, DM >
 Iteration ()
 Default Constructor.
 
virtual ~Iteration ()
 Destructor.
 
virtual Teuchos::RCP< const MV > getNativeResiduals (std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > *norms) const=0
 Get the residuals native to the solver.
 

Accessor methods

const LinearProblem< ScalarType, MV, OP, DM > & getProblem () const
 Get a constant reference to the linear problem.
 
int getNumBlocks () const
 Get the maximum number of blocks used by the iterative solver in solving this linear problem.
 
void setNumBlocks (int numBlocks)
 Set the maximum number of blocks used by the iterative solver.
 
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.
 
void setSize (int recycledBlocks, int numBlocks)
 Set the maximum number of blocks used by the iterative solver and the number of recycled vectors.
 
bool isInitialized ()
 States whether the solver has been initialized or not.
 

Detailed Description

template<class ScalarType, class MV, class OP, class DM>
class Belos::GCRODRIter< ScalarType, MV, OP, DM >

This class implements the GCRODR iteration, where a single-vector Krylov subspace is constructed. The QR decomposition of block, upper Hessenberg matrix is performed each iteration to update the least squares system and give the current linear system residuals.

Author
Michael Parks and Heidi Thornquist

Definition at line 130 of file BelosGCRODRIter.hpp.

Member Typedef Documentation

◆ MVT

Definition at line 137 of file BelosGCRODRIter.hpp.

◆ OPT

Definition at line 138 of file BelosGCRODRIter.hpp.

◆ DMT

Definition at line 139 of file BelosGCRODRIter.hpp.

◆ SCT

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

Definition at line 140 of file BelosGCRODRIter.hpp.

◆ MagnitudeType

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

Definition at line 141 of file BelosGCRODRIter.hpp.

Constructor & Destructor Documentation

◆ GCRODRIter()

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

GCRODRIter constructor with linear problem, solver utilities, and parameter list of solver options.

This constructor takes pointers required by the linear solver, in addition to a parameter list of options for the linear solver. These options include the following:

  • "Num Blocks" - an int specifying the maximum number of blocks allocated for the solver basis. Default: 25
  • "Restart Timers" = a bool specifying whether the timers should be restarted each time iterate() is called. Default: false
  • "Keep Hessenberg" = a bool specifying whether the upper Hessenberg should be stored separately from the least squares system. Default: false

Definition at line 393 of file BelosGCRODRIter.hpp.

◆ ~GCRODRIter()

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

Destructor.

Definition at line 161 of file BelosGCRODRIter.hpp.

Member Function Documentation

◆ iterate()

template<class ScalarType , class MV , class OP , class DM >
void Belos::GCRODRIter< ScalarType, MV, OP, DM >::iterate ( )
virtual

This method performs block Gmres iterations until the status test indicates the need to stop or an error occurs (in which case, an std::exception is thrown).

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

The block Gmres iteration proceeds as follows:

  1. The operator problem->applyOp() is applied to the newest blockSize vectors in the Krylov basis.
  2. The resulting vectors are orthogonalized against the previous basis vectors, and made orthonormal.
  3. The Hessenberg matrix is updated.
  4. The least squares system is updated.

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

Possible exceptions thrown include the GCRODRIterOrthoFailure.

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

Definition at line 546 of file BelosGCRODRIter.hpp.

◆ initialize() [1/2]

template<class ScalarType , class MV , class OP , class DM >
void Belos::GCRODRIter< ScalarType, MV, OP, DM >::initialize ( GCRODRIterState< ScalarType, MV, DM > &  newstate)
virtual

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

The GCRODRIter contains a certain amount of state, consisting of the current Krylov basis and the associated Hessenberg matrix.

initialize() gives the user the opportunity to manually set these, although this must be done with caution, abiding by the rules given below. All notions of orthogonality and orthonormality are derived from the inner product specified by the orthogonalization manager.

Postcondition
isInitialized() == true (see post-conditions of isInitialize())

The user has the option of specifying any component of the state using initialize(). However, these arguments are assumed to match the post-conditions specified under isInitialized(). Any necessary component of the state not given to initialize() will be generated.

Note
For any pointer in newstate which directly points to the multivectors in the solver, the data is not copied.

Implements Belos::GCRODRIteration< ScalarType, MV, OP, DM >.

Definition at line 512 of file BelosGCRODRIter.hpp.

◆ initialize() [2/2]

template<class ScalarType , class MV , class OP , class DM >
void Belos::GCRODRIter< ScalarType, MV, OP, DM >::initialize ( )
inlinevirtual

Initialize the solver with empty data. Calling this method will result in error, as GCRODRIter must be initialized with a valid state.

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

Definition at line 217 of file BelosGCRODRIter.hpp.

◆ getState()

template<class ScalarType , class MV , class OP , class DM >
GCRODRIterState< ScalarType, MV, DM > Belos::GCRODRIter< ScalarType, MV, OP, DM >::getState ( ) const
inlinevirtual

Get the current state of the linear solver.

The data is only valid if isInitialized() == true.

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

Implements Belos::GCRODRIteration< ScalarType, MV, OP, DM >.

Definition at line 229 of file BelosGCRODRIter.hpp.

◆ getNumIters()

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

Get the current iteration count.

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

Definition at line 250 of file BelosGCRODRIter.hpp.

◆ resetNumIters()

template<class ScalarType , class MV , class OP , class DM >
void Belos::GCRODRIter< ScalarType, MV, OP, DM >::resetNumIters ( int  iter = 0)
inlinevirtual

Reset the iteration count.

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

Definition at line 253 of file BelosGCRODRIter.hpp.

◆ getNativeResiduals()

template<class ScalarType , class MV , class OP , class DM >
Teuchos::RCP< const MV > Belos::GCRODRIter< ScalarType, MV, OP, DM >::getNativeResiduals ( std::vector< MagnitudeType > *  norms) const

Get the norms of the residuals native to the solver.

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

Definition at line 492 of file BelosGCRODRIter.hpp.

◆ getCurrentUpdate()

template<class ScalarType , class MV , class OP , class DM >
Teuchos::RCP< MV > Belos::GCRODRIter< ScalarType, MV, OP, DM >::getCurrentUpdate ( ) const
virtual

Get the current update to the linear system.

Note
Some solvers, like GMRES, do not compute updates to the solution every iteration. This method forces its computation. Other solvers, like CG, update the solution each iteration, so this method will return a zero vector indicating that the linear problem contains the current solution.

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

Definition at line 434 of file BelosGCRODRIter.hpp.

◆ updateLSQR()

template<class ScalarType , class MV , class OP , class DM >
void Belos::GCRODRIter< ScalarType, MV, OP, DM >::updateLSQR ( int  dim = -1)
virtual

Method for updating QR factorization of upper Hessenberg matrix.

Note
If dim >= getCurSubspaceDim() and dim < getMaxSubspaceDim(), then the dim-th equations of the least squares problem will be updated.

Implements Belos::GCRODRIteration< ScalarType, MV, OP, DM >.

Definition at line 692 of file BelosGCRODRIter.hpp.

◆ getCurSubspaceDim()

template<class ScalarType , class MV , class OP , class DM >
int Belos::GCRODRIter< ScalarType, MV, OP, DM >::getCurSubspaceDim ( ) const
inlinevirtual

Get the dimension of the search subspace used to generate the current solution to the linear problem.

Implements Belos::GCRODRIteration< ScalarType, MV, OP, DM >.

Definition at line 274 of file BelosGCRODRIter.hpp.

◆ getMaxSubspaceDim()

template<class ScalarType , class MV , class OP , class DM >
int Belos::GCRODRIter< ScalarType, MV, OP, DM >::getMaxSubspaceDim ( ) const
inlinevirtual

Get the maximum dimension allocated for the search subspace.

Implements Belos::GCRODRIteration< ScalarType, MV, OP, DM >.

Definition at line 280 of file BelosGCRODRIter.hpp.

◆ getProblem()

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

Get a constant reference to the linear problem.

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

Definition at line 289 of file BelosGCRODRIter.hpp.

◆ getNumBlocks()

template<class ScalarType , class MV , class OP , class DM >
int Belos::GCRODRIter< ScalarType, MV, OP, DM >::getNumBlocks ( ) const
inline

Get the maximum number of blocks used by the iterative solver in solving this linear problem.

Definition at line 292 of file BelosGCRODRIter.hpp.

◆ setNumBlocks()

template<class ScalarType , class MV , class OP , class DM >
void Belos::GCRODRIter< ScalarType, MV, OP, DM >::setNumBlocks ( int  numBlocks)
inline

Set the maximum number of blocks used by the iterative solver.

Definition at line 295 of file BelosGCRODRIter.hpp.

◆ getBlockSize()

template<class ScalarType , class MV , class OP , class DM >
int Belos::GCRODRIter< ScalarType, MV, OP, DM >::getBlockSize ( ) const
inlinevirtual

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

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

Definition at line 298 of file BelosGCRODRIter.hpp.

◆ setBlockSize()

template<class ScalarType , class MV , class OP , class DM >
void Belos::GCRODRIter< ScalarType, MV, OP, DM >::setBlockSize ( int  blockSize)
inlinevirtual

Set the blocksize.

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

Definition at line 301 of file BelosGCRODRIter.hpp.

◆ setSize()

template<class ScalarType , class MV , class OP , class DM >
void Belos::GCRODRIter< ScalarType, MV, OP, DM >::setSize ( int  recycledBlocks,
int  numBlocks 
)
inlinevirtual

Set the maximum number of blocks used by the iterative solver and the number of recycled vectors.

Implements Belos::GCRODRIteration< ScalarType, MV, OP, DM >.

Definition at line 306 of file BelosGCRODRIter.hpp.

◆ isInitialized()

template<class ScalarType , class MV , class OP , class DM >
bool Belos::GCRODRIter< ScalarType, MV, OP, DM >::isInitialized ( )
inlinevirtual

States whether the solver has been initialized or not.

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

Definition at line 320 of file BelosGCRODRIter.hpp.


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

Generated for Belos by doxygen 1.9.8