42 #ifndef BELOS_OPERATOR_HPP 43 #define BELOS_OPERATOR_HPP 52 #ifdef HAVE_BELOS_EXPERIMENTAL 53 # include "BelosInnerSolver.hpp" 54 #endif // HAVE_BELOS_EXPERIMENTAL 79 template <
class ScalarType>
161 template<
class ScalarType>
172 Op.
Apply (x, y, trans);
183 #ifdef HAVE_BELOS_EXPERIMENTAL 198 template<
class Scalar>
199 class OperatorInnerSolver :
public Operator<Scalar> {
201 typedef Scalar scalar_type;
204 typedef InnerSolver<scalar_type, multivector_type, operator_type> inner_solver_type;
209 OperatorInnerSolver (
const Teuchos::RCP<inner_solver_type>& solver) :
213 virtual ~OperatorInnerSolver() {}
236 Teuchos::RCP<inner_solver_type> getInnerSolver()
const {
250 Apply (
const multivector_type& X,
254 using Teuchos::rcpFromRef;
256 TEUCHOS_TEST_FOR_EXCEPTION(mode !=
NOTRANS, std::invalid_argument,
257 "Belos::OperatorInnerSolver only supports applying the" 258 " operator itself, not its transpose or conjugate " 260 solver_->solve (rcpFromRef (Y), rcpFromRef (X));
273 OperatorInnerSolver ();
276 Teuchos::RCP<inner_solver_type> solver_;
290 template <
class Scalar>
291 class InnerSolverTraits<Scalar, MultiVec<Scalar>, Operator<Scalar> > {
293 typedef Scalar scalar_type;
296 typedef InnerSolver<scalar_type, multivector_type, operator_type> inner_solver_type;
297 typedef OperatorInnerSolver<scalar_type> wrapper_type;
303 static Teuchos::RCP<operator_type>
304 makeInnerSolverOperator (
const Teuchos::RCP<inner_solver_type>& solver)
307 using Teuchos::rcp_implicit_cast;
308 return rcp_implicit_cast<operator_type> (rcp (
new wrapper_type (solver)));
320 static Teuchos::RCP<inner_solver_type>
321 getInnerSolver (
const Teuchos::RCP<operator_type>& op)
324 using Teuchos::rcp_dynamic_cast;
325 RCP<wrapper_type> wrapper = rcp_dynamic_cast<wrapper_type> (op,
true);
326 return wrapper->getInnerSolver();
329 #endif // HAVE_BELOS_EXPERIMENTAL 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.
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.
Operator()
Default constructor (does nothing).
virtual bool HasApplyTranspose() const
Whether this operator implements applying the transpose.
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.