00001 /* @HEADER@ */ 00002 // 00003 /* @HEADER@ */ 00004 00005 #ifndef PLAYA_SIMPLE_SCALED_OP_DECL_HPP 00006 #define PLAYA_SIMPLE_SCALED_OP_DECL_HPP 00007 00008 00009 00010 #include "PlayaDefs.hpp" 00011 #include "PlayaLinearOpWithSpacesDecl.hpp" 00012 #include "PlayaLinearOperatorDecl.hpp" 00013 00014 00015 namespace Playa 00016 { 00017 using namespace Teuchos; 00018 00019 00020 00021 00022 /** 00023 * Represent a scaled operator 00024 */ 00025 template <class Scalar> 00026 class SimpleScaledOp : public LinearOpWithSpaces<Scalar>, 00027 public Printable 00028 { 00029 public: 00030 /** */ 00031 SimpleScaledOp(const Scalar& alpha, const LinearOperator<Scalar>& A); 00032 00033 /** */ 00034 void apply(Teuchos::ETransp transApplyType, 00035 const Vector<Scalar>& in, 00036 Vector<Scalar> out) const; 00037 00038 00039 /** */ 00040 std::string description() const ; 00041 00042 /** */ 00043 const Scalar& alpha() const {return alpha_;} 00044 00045 /** */ 00046 LinearOperator<Scalar> op() const {return A_;} 00047 00048 /** */ 00049 void print(std::ostream& os) const ; 00050 00051 private: 00052 Scalar alpha_; 00053 LinearOperator<Scalar> A_; 00054 }; 00055 00056 00057 /** \relates SimpleScaledOp */ 00058 template <class Scalar> 00059 LinearOperator<Scalar> scaledOperator( 00060 const Scalar& scale, 00061 const LinearOperator<Scalar>& op); 00062 00063 00064 template <class Scalar> 00065 LinearOperator<Scalar> operator*(const Scalar& a, const LinearOperator<Scalar>& A); 00066 00067 } 00068 00069 #endif