Belos
Version of the Day
|
Alternative run-time polymorphic interface for operators. More...
#include <BelosOperator.hpp>
Public Member Functions | |
Constructor/Destructor | |
Operator () | |
Default constructor (does nothing). More... | |
virtual | ~Operator () |
Virtual destructor, for memory safety of derived classes. More... | |
Methods relating to applying the operator | |
virtual void | Apply (const MultiVec< ScalarType > &x, MultiVec< ScalarType > &y, ETrans trans=NOTRANS) const =0 |
Apply the operator to x, putting the result in y. More... | |
virtual bool | HasApplyTranspose () const |
Whether this operator implements applying the transpose. More... | |
Alternative run-time polymorphic interface for operators.
Belos' linear solvers are templated on the scalar (Scalar), multivector (MV), and operator (OP) types. The term "operator" includes the matrix A in the linear system , any left or right preconditioners. If you have enabled the corresponding Trilinos packages, you can use Belos' solvers directly with OP = Epetra_Operator, Tpetra::Operator, or Thyra::LinearOpBase. Alternately, you may wish to use some other object as an operator. If so, you can make that object inherit from Belos::Operator<Scalar>, and make its corresponding multivector objects inherit from Belos::MultiVec<Scalar>. Belos' solvers may also be instantiated with MV = Belos::MultiVec<Scalar> and OP = Belos::Operator<Scalar>.
A concrete implementation of this class is necessary. Users may create their own implementation if the supplied implementations are not suitable for their needs.
Definition at line 48 of file BelosOperator.hpp.
|
inline |
Default constructor (does nothing).
Definition at line 54 of file BelosOperator.hpp.
|
inlinevirtual |
Virtual destructor, for memory safety of derived classes.
Definition at line 57 of file BelosOperator.hpp.
|
pure virtual |
Apply the operator to x, putting the result in y.
Take the Belos::MultiVec x
and apply the operator (or its transpose or Hermitian transpose) to it, writing the result into the Belos::MultiVec y
.
x | [in] The input multivector. |
y | [out] The output multivector. x and y may not alias (i.e., be views of) one another. |
trans | [in] Whether to apply the operator (NOTRANS), its transpose (TRANS), or its Hermitian transpose (CONJTRANS). The default is NOTRANS. |
Your Operator subclass' implementation of Apply() is not required to support applying the transpose (or Hermitian transpose, if applicable). If the caller passes in a value of trans
which your Apply() implementation does not support, it should throw a subclass of std::exception. In general, subclasses' implementations should signal any problems applying the operator by throwing a subclass of std::exception.
Implemented in Belos::GmresPolyOp< ScalarType, MV, OP >.
|
inlinevirtual |
Whether this operator implements applying the transpose.
Your Operator subclass' implementation of Apply() is not required to support applying the transpose (or Hermitian transpose, if applicable). If it does support applying the transpose, this method should return true. Otherwise, it should return false.
We assume that if an operator can apply its transpose, it can also apply its Hermitian transpose, if the operator is complex (otherwise the transpose and Hermitian transpose are the same operation).
We provide a default implementation of this method that conservatively returns false. If you want your Operator subclass to advertise that it implements applying the transpose, override the default implementation in your subclass.
Definition at line 109 of file BelosOperator.hpp.