Belos Version of the Day
Public Types | Public Member Functions
Belos::StandardGmres< Scalar, MV, OP > Class Template Reference

Implementation of (Standard) GMRES. More...

#include <BelosStandardGmres.hpp>

Inheritance diagram for Belos::StandardGmres< Scalar, MV, OP >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef Scalar scalar_type
typedef Teuchos::ScalarTraits
< Scalar >::magnitudeType 
magnitude_type
typedef MV multivector_type
typedef OP operator_type

Public Member Functions

 StandardGmres (const Teuchos::RCP< LinearProblem< Scalar, MV, OP > > &lp, const Teuchos::RCP< const OrthoManager< Scalar, MV > > &ortho, const Teuchos::RCP< OutputManager< Scalar > > &outMan, const int maxIterCount, const bool flexible)
 Constructor.
virtual ~StandardGmres ()
 Destructor -- need to have it because class is polymorphic.
virtual bool canExtendBasis () const
 Whether it's legal to call extendBasis()
virtual void extendBasis (Teuchos::RCP< MV > &V_cur, Teuchos::RCP< MV > &Z_cur)
 Extend the basis by 1 (or more) vector(s)
virtual void orthogonalize (const Teuchos::RCP< MV > &V_cur, const Teuchos::RCP< const MV > &V_prv, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &C_V, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &B_V, const Teuchos::RCP< MV > &Z_cur, const Teuchos::RCP< const MV > &Z_prv, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &C_Z, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &B_Z)
 Orthogonalize the candidate basis/es.
virtual bool acceptedCandidateBasis () const
 Whether the subclass "accepted" the candidate basis.
virtual void updateUpperHessenbergMatrix (const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &C_V, const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &B_V, const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &C_Z, const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &B_Z)
 Update the upper Hessenberg matrix (H_)

Detailed Description

template<class Scalar, class MV, class OP>
class Belos::StandardGmres< Scalar, MV, OP >

Implementation of (Standard) GMRES.

Author:
Mark Hoemmen
Warning:
This is EXPERIMENTAL CODE. DO NOT RELY ON THIS CODE. The interface or implementation may change at any time.
Note:
If you are a new Belos user and just want an interface to standard GMRES, use PseudoBlockGmresSolMgr. If you want Flexible GMRES, use BlockGmresSolMgr with the appropriate option set.

Implementation of the Generalized Minimal Residual (GMRES) method of Saad and Schultz (1986) for solving nonsymmetric linear systems.

References:

Definition at line 74 of file BelosStandardGmres.hpp.


Member Typedef Documentation

template<class Scalar , class MV , class OP >
typedef Scalar Belos::StandardGmres< Scalar, MV, OP >::scalar_type

Reimplemented from Belos::GmresBase< Scalar, MV, OP >.

Definition at line 76 of file BelosStandardGmres.hpp.

template<class Scalar , class MV , class OP >
typedef Teuchos::ScalarTraits<Scalar>::magnitudeType Belos::StandardGmres< Scalar, MV, OP >::magnitude_type

Reimplemented from Belos::GmresBase< Scalar, MV, OP >.

Definition at line 77 of file BelosStandardGmres.hpp.

template<class Scalar , class MV , class OP >
typedef MV Belos::StandardGmres< Scalar, MV, OP >::multivector_type

Reimplemented from Belos::GmresBase< Scalar, MV, OP >.

Definition at line 78 of file BelosStandardGmres.hpp.

template<class Scalar , class MV , class OP >
typedef OP Belos::StandardGmres< Scalar, MV, OP >::operator_type

Reimplemented from Belos::GmresBase< Scalar, MV, OP >.

Definition at line 79 of file BelosStandardGmres.hpp.


Constructor & Destructor Documentation

template<class Scalar , class MV , class OP >
Belos::StandardGmres< Scalar, MV, OP >::StandardGmres ( const Teuchos::RCP< LinearProblem< Scalar, MV, OP > > &  lp,
const Teuchos::RCP< const OrthoManager< Scalar, MV > > &  ortho,
const Teuchos::RCP< OutputManager< Scalar > > &  outMan,
const int  maxIterCount,
const bool  flexible 
) [inline]

Constructor.

Parameters:
problem[in/out] Linear problem. On input, we use the starting guess (x0) and the initial residual (r0) to initialize the iteration. The iteration may call updateSolution(). On output, if the solution has been updated, the vector returned by getLHS() will be modified.
ortho[in] Orthogonalization manager
outMan[in/out] Output manager
maxIterCount[in] Maximum number of iterations before restart. The number of vectors' worth of storage this constructor allocates is proportional to this, so choose carefully.
flexible[in] Whether or not to run the Flexible variant of GMRES (FGMRES). This requires twice as much vector storage, but lets the preconditioner change in every iteration. This only works with right preconditioning, not left or split preconditioning.

Definition at line 108 of file BelosStandardGmres.hpp.

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

Destructor -- need to have it because class is polymorphic.

Definition at line 116 of file BelosStandardGmres.hpp.


Member Function Documentation

template<class Scalar , class MV , class OP >
virtual bool Belos::StandardGmres< Scalar, MV, OP >::canExtendBasis ( ) const [inline, virtual]

Whether it's legal to call extendBasis()

Whether the basis (bases, if Flexible GMRES) can be extended by computing candidate basis vectors, i.e., whether it's legal to call extendBasis(). Subclasses' implementations of extendBasis() must throw GmresCantExtendBasis if no more candidate basis vectors can be computed.

Implements Belos::GmresBase< Scalar, MV, OP >.

Definition at line 118 of file BelosStandardGmres.hpp.

template<class Scalar , class MV , class OP >
virtual void Belos::StandardGmres< Scalar, MV, OP >::extendBasis ( Teuchos::RCP< MV > &  V_cur,
Teuchos::RCP< MV > &  Z_cur 
) [inline, virtual]

Extend the basis by 1 (or more) vector(s)

Extend the basis (bases, if Flexible GMRES) by 1 (or more) vector(s), without orthogonalizing it/them. Standard GMRES only adds one basis vector at a time; CA-GMRES may add more than one at a time.

Parameters:
V_cur[out] New basis vector(s). The number of column(s) gives the number of basis vector(s) added. This may be a view of member data, rather than freshly allocated storage.
Z_cur[out] If running Flexible GMRES, the preconditioned basis vector(s); else, Teuchos::null. The number of column(s) gives the number of basis vector(s) added. This may be a view of member data, rather than freshly allocated storage.
Warning:
Don't call this if canExtendBasis() returns false.
Note:
This method is non-const so that implementations may use previously allocated space for the basis vectors. (They are not _required_ to use previously allocated space, so this method may, if it wishes, allocate a new multivector to return.)

Implements Belos::GmresBase< Scalar, MV, OP >.

Definition at line 123 of file BelosStandardGmres.hpp.

template<class Scalar , class MV , class OP >
virtual void Belos::StandardGmres< Scalar, MV, OP >::orthogonalize ( const Teuchos::RCP< MV > &  V_cur,
const Teuchos::RCP< const MV > &  V_prv,
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &  C_V,
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &  B_V,
const Teuchos::RCP< MV > &  Z_cur,
const Teuchos::RCP< const MV > &  Z_prv,
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &  C_Z,
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &  B_Z 
) [inline, virtual]

Orthogonalize the candidate basis/es.

Flexible CA-GMRES must orthogonalize the Z basis along with the V basis, and it must keep both sets of orthogonalization coefficients. Flexible standard GMRES, in contrast, only needs to orthogonalize the new V basis vector; it doesn't need to orthogonalize the Z basis vector. This is why we let the subclass implement this functionality, rather than calling the OrthoManager's projectAndNormalize() method directly; the subclass has to decide whether it needs to orthogonalize Z_cur as well as V_cur.

Subclasses may want to save the rank (if applicable) from ortho_->projectAndNormalize() somewhere. In the case of Flexible CA-GMRES, there are _two_ ranks -- one for the V basis, and the other for the Z basis. This is why this method doesn't return the rank, as ortho_->projectAndNormalize() does.

C_V and B_V are the "C" (projection) resp. "B" (normalization) block coefficients from ortho_->projectAndNormalize() on the new V basis vectors. If the new Z basis vectors need to be orthogonalized as well, then C_Z and B_Z are the "C" resp. "B" block coefficients from ortho_->projectAndNormalize() on the new Z basis vectors. Subclasses' implementations of orthogonalize() are responsible for allocating space for C_V and B_V, and C_Z and B_Z if necessary (otherwise they are set to Teuchos::null, as the RCPs are passed by reference).

Parameters:
V_cur[in/out] Candidate basis vector(s) for V basis
V_prv[in] Previously orthogonalized V basis vectors
C_V[out] Projection coefficients (V_prv^* V_cur) of candidate V basis vector(s)
B_V[out] Normalization coefficients (after projection) of candidate V basis vector(s)
Z_cur[in/out] Candidate basis vector(s) for Z basis, or null if there is no Z basis
Z_prv[in] Previously orthogonalized Z basis vectors, or null if there is no Z basis
C_Z[out] Projection coefficients (Z_prv^* Z_cur) of candidate Z basis vector(s), or null if there is no Z basis
B_Z[out] Normalization coefficients (after projection) of candidate Z basis vector(s), or null if there is no Z basis

Implements Belos::GmresBase< Scalar, MV, OP >.

Definition at line 175 of file BelosStandardGmres.hpp.

template<class Scalar , class MV , class OP >
virtual bool Belos::StandardGmres< Scalar, MV, OP >::acceptedCandidateBasis ( ) const [inline, virtual]

Whether the subclass "accepted" the candidate basis.

Implements Belos::GmresBase< Scalar, MV, OP >.

Definition at line 227 of file BelosStandardGmres.hpp.

template<class Scalar , class MV , class OP >
virtual void Belos::StandardGmres< Scalar, MV, OP >::updateUpperHessenbergMatrix ( const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &  C_V,
const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &  B_V,
const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &  C_Z,
const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > &  B_Z 
) [inline, virtual]

Update the upper Hessenberg matrix (H_)

Parameters:
C_V[in] Projection coefficients (V_prv^* V_cur) of candidate V basis vector(s)
B_V[in] Normalization coefficients (after projection) of candidate V basis vector(s)
C_Z[in] Projection coefficients (Z_prv^* Z_cur) of candidate Z basis vector(s), or null if there is no Z basis
B_Z[in] Normalization coefficients (after projection) of candidate Z basis vector(s), or null if there is no Z basis
Note:
For Flexible GMRES, it may be desirable to compute or update a rank-revealing decomposition of the upper square submatrix of H_. This is because FGMRES only promises convergence in exact arithmetic if this submatrix is full rank and the computed residual norm is zero. Any decomposition of H_ should not be done in place; this is because updateProjectedLeastSquaresProblem() depends on H_ being intact. That method does not itself modify H_, so implementations of updateUpperHessenbergMatrix() can also rely on H_ being intact.
For an algorithm for updating a rank-revealing decomposition, see e.g., G. W. Stewart, "Updating a rank-revealing ULV decomposition", SIAM J. Matrix Anal. & Appl., Volume 14, Issue 2, pp. 494-499 (April 1993).

Implements Belos::GmresBase< Scalar, MV, OP >.

Definition at line 243 of file BelosStandardGmres.hpp.


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