42 #ifndef BELOS_OPERATOR_HPP
43 #define BELOS_OPERATOR_HPP
52 #ifdef HAVE_BELOS_EXPERIMENTAL
53 # include "BelosInnerSolver.hpp"
54 #endif // HAVE_BELOS_EXPERIMENTAL
80 template <
class ScalarType>
162 template<
class ScalarType>
173 Op.
Apply (x, y, trans);
184 #ifdef HAVE_BELOS_EXPERIMENTAL
199 template<
class Scalar>
200 class OperatorInnerSolver :
public Operator<Scalar> {
202 typedef Scalar scalar_type;
203 typedef MultiVec<Scalar> multivector_type;
204 typedef Operator<Scalar> operator_type;
205 typedef InnerSolver<scalar_type, multivector_type, operator_type> inner_solver_type;
214 virtual ~OperatorInnerSolver() {}
251 Apply (
const multivector_type& X,
255 using Teuchos::rcpFromRef;
258 "Belos::OperatorInnerSolver only supports applying the"
259 " operator itself, not its transpose or conjugate "
261 solver_->solve (rcpFromRef (Y), rcpFromRef (X));
268 virtual bool HasApplyTranspose()
const {
274 OperatorInnerSolver ();
291 template <
class Scalar>
292 class InnerSolverTraits<Scalar, MultiVec<Scalar>, Operator<Scalar> > {
294 typedef Scalar scalar_type;
295 typedef MultiVec<scalar_type> multivector_type;
296 typedef Operator<scalar_type> operator_type;
297 typedef InnerSolver<scalar_type, multivector_type, operator_type> inner_solver_type;
298 typedef OperatorInnerSolver<scalar_type> wrapper_type;
308 using Teuchos::rcp_implicit_cast;
309 return rcp_implicit_cast<operator_type> (
rcp (
new wrapper_type (solver)));
325 using Teuchos::rcp_dynamic_cast;
326 RCP<wrapper_type> wrapper = rcp_dynamic_cast<wrapper_type> (op,
true);
327 return wrapper->getInnerSolver();
330 #endif // HAVE_BELOS_EXPERIMENTAL
virtual bool HasApplyTranspose() const
Whether this operator implements applying the transpose.
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.
static bool HasApplyTranspose(const Operator< ScalarType > &Op)
Specialization of HasApplyTranspose() for Operator objects.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual ~Operator()
Virtual destructor, for memory safety of derived classes.
Class which defines basic traits for the operator type.
ETrans
Whether to apply the (conjugate) transpose of an operator.
static void Apply(const Operator< ScalarType > &Op, const MultiVec< ScalarType > &x, MultiVec< ScalarType > &y, ETrans trans=NOTRANS)
Specialization of Apply() for Operator and MultiVec objects.
Alternative run-time polymorphic interface for operators.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Operator()
Default constructor (does nothing).
Interface for multivectors used by Belos' linear solvers.
Class which defines basic traits for the operator type.
Belos header file which uses auto-configuration information to include necessary C++ headers...
Interface for multivectors used by Belos' linear solvers.