|
Belos Version of the Day
|
Implementation of (Standard) GMRES. More...
#include <BelosStandardGmres.hpp>

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 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_) | |
Implementation of (Standard) GMRES.
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.
| typedef Scalar Belos::StandardGmres< Scalar, MV, OP >::scalar_type |
Reimplemented from Belos::GmresBase< Scalar, MV, OP >.
Definition at line 76 of file BelosStandardGmres.hpp.
| 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.
| typedef MV Belos::StandardGmres< Scalar, MV, OP >::multivector_type |
Reimplemented from Belos::GmresBase< Scalar, MV, OP >.
Definition at line 78 of file BelosStandardGmres.hpp.
| typedef OP Belos::StandardGmres< Scalar, MV, OP >::operator_type |
Reimplemented from Belos::GmresBase< Scalar, MV, OP >.
Definition at line 79 of file BelosStandardGmres.hpp.
| 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.
| 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.
| 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 115 of file BelosStandardGmres.hpp.
| 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.
| 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. |
Implements Belos::GmresBase< Scalar, MV, OP >.
Definition at line 120 of file BelosStandardGmres.hpp.
| 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).
| 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 172 of file BelosStandardGmres.hpp.
| 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 224 of file BelosStandardGmres.hpp.
| 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_)
| 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 |
updateProjectedLeastSquaresProblem() depends on H_ being intact. That method does not itself modify H_, so implementations of updateUpperHessenbergMatrix() can also rely on H_ being intact.Implements Belos::GmresBase< Scalar, MV, OP >.
Definition at line 240 of file BelosStandardGmres.hpp.
1.7.4