10#ifndef BELOS_OPERATOR_HPP
11#define BELOS_OPERATOR_HPP
20#ifdef HAVE_BELOS_EXPERIMENTAL
47 template <
class ScalarType>
129 template<
class ScalarType>
140 Op.
Apply (x, y, trans);
151#ifdef HAVE_BELOS_EXPERIMENTAL
166 template<
class Scalar>
167 class OperatorInnerSolver :
public Operator<Scalar> {
169 typedef Scalar scalar_type;
170 typedef MultiVec<Scalar> multivector_type;
171 typedef Operator<Scalar> operator_type;
172 typedef InnerSolver<scalar_type, multivector_type, operator_type> inner_solver_type;
177 OperatorInnerSolver (
const Teuchos::RCP<inner_solver_type>& solver) :
181 virtual ~OperatorInnerSolver() {}
204 Teuchos::RCP<inner_solver_type> getInnerSolver()
const {
218 Apply (
const multivector_type& X,
220 ETrans mode = NOTRANS)
const
222 using Teuchos::rcpFromRef;
224 TEUCHOS_TEST_FOR_EXCEPTION(mode != NOTRANS, std::invalid_argument,
225 "Belos::OperatorInnerSolver only supports applying the"
226 " operator itself, not its transpose or conjugate "
228 solver_->solve (rcpFromRef (Y), rcpFromRef (X));
235 virtual bool HasApplyTranspose()
const {
241 OperatorInnerSolver ();
244 Teuchos::RCP<inner_solver_type> solver_;
258 template <
class Scalar>
264 typedef InnerSolver<scalar_type, multivector_type, operator_type>
inner_solver_type;
271 static Teuchos::RCP<operator_type>
275 using Teuchos::rcp_implicit_cast;
276 return rcp_implicit_cast<operator_type> (rcp (
new wrapper_type (solver)));
288 static Teuchos::RCP<inner_solver_type>
292 using Teuchos::rcp_dynamic_cast;
293 RCP<wrapper_type> wrapper = rcp_dynamic_cast<wrapper_type> (op,
true);
294 return wrapper->getInnerSolver();
Belos header file which uses auto-configuration information to include necessary C++ headers.
Interface for multivectors used by Belos' linear solvers.
Class which defines basic traits for the operator type.
Wrap an InnerSolver in an OP (operator).
InnerSolver< scalar_type, multivector_type, operator_type > inner_solver_type
static Teuchos::RCP< inner_solver_type > getInnerSolver(const Teuchos::RCP< operator_type > &op)
Return the given wrapper's inner solver object.
UndefinedWrapperType< Scalar, MV, OP > wrapper_type
static Teuchos::RCP< OP > makeInnerSolverOperator(const Teuchos::RCP< InnerSolver< Scalar, MV, OP > > &solver)
Wrap the given inner solver in a wrapper_type.
Interface for multivectors used by Belos' linear solvers.
static bool HasApplyTranspose(const Operator< ScalarType > &Op)
Specialization of HasApplyTranspose() for Operator objects.
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.
Class which defines basic traits for the operator type.
Alternative run-time polymorphic interface for operators.
Operator()
Default constructor (does nothing).
virtual bool HasApplyTranspose() const
Whether this operator implements applying the transpose.
virtual ~Operator()
Virtual destructor, for memory safety of derived classes.
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.
ETrans
Whether to apply the (conjugate) transpose of an operator.