Belos Version of the Day
Alternative run-time polymorphic interface for operators. More...
|Default constructor (does nothing). |
|Virtual destructor, for memory safety of derived classes. |
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. |
|virtual bool||HasApplyTranspose () const|
|Whether this operator implements applying the transpose. |
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, and any left or right scaling operators. 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.
|virtual void Belos::Operator< ScalarType >::Apply||(||const MultiVec< ScalarType > &||x,|
|MultiVec< ScalarType > &||y,|
Apply the operator to x, putting the result in 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.
|virtual bool Belos::Operator< ScalarType >::HasApplyTranspose||(||)|| const
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.