42 #ifndef BELOS_GMRESPOLYOP_HPP 43 #define BELOS_GMRESPOLYOP_HPP 53 #include "Teuchos_RCP.hpp" 54 #include "Teuchos_SerialDenseMatrix.hpp" 55 #include "Teuchos_SerialDenseVector.hpp" 70 template <
class ScalarType,
class MV,
class OP>
82 const Teuchos::RCP<Teuchos::SerialDenseMatrix<int, ScalarType> >& hess,
83 const Teuchos::RCP<Teuchos::SerialDenseMatrix<int, ScalarType> >& comb,
84 const Teuchos::RCP<Teuchos::SerialDenseVector<int, ScalarType> >& scal
86 : problem_(problem_in), LP_(problem_in->getLeftPrec()), RP_(problem_in->getRightPrec()), H_(hess), y_(comb), r0_(scal)
108 typedef Teuchos::ScalarTraits<ScalarType> SCT ;
111 Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > problem_;
112 Teuchos::RCP<const OP> LP_, RP_;
113 Teuchos::RCP<MV> V_, wL_, wR_;
114 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > H_, y_;
115 Teuchos::RCP<Teuchos::SerialDenseVector<int,ScalarType> > r0_;
118 template <
class ScalarType,
class MV,
class OP>
122 if (V_ == Teuchos::null) {
124 if (LP_ != Teuchos::null) {
127 if (RP_ != Teuchos::null) {
135 std::vector<int> idxi(1), idxi2, idxj(1);
138 for (
int j=0; j<n; ++j) {
144 if (LP_ != Teuchos::null) {
146 problem_->applyLeftPrec( *x_view, *v_curr );
151 for (
int i=0; i<dim_-1; ++i) {
155 for (
int ii=0; ii<i+1; ++ii) { idxi2[ii] = ii; }
167 if (RP_ != Teuchos::null) {
168 problem_->applyRightPrec( *v_curr, *wR_ );
173 if (LP_ == Teuchos::null) {
177 problem_->applyOp( *wR_, *wL_ );
179 if (LP_ != Teuchos::null) {
180 problem_->applyLeftPrec( *wL_, *v_next );
184 Teuchos::SerialDenseMatrix<int,ScalarType> h(Teuchos::View,*H_,i+1,1,0,i);
192 if (RP_ != Teuchos::null) {
194 problem_->applyRightPrec( *wR_, *y_view );
211 template <
class ScalarType,
class MV,
class OP>
220 { Op.
Apply( x, y, trans ); }
static void Apply(const GmresPolyOp< ScalarType, MV, OP > &Op, const MV &x, MV &y, ETrans trans=NOTRANS)
static Teuchos::RCP< const MV > CloneView(const MV &mv, const std::vector< int > &index)
Creates a new const MV that shares the selected contents of mv (shallow copy).
Declaration of basic traits for the multivector type.
Class which defines basic traits for the operator type.
static int GetNumberVecs(const MV &mv)
Obtain the number of vectors in mv.
ETrans
Whether to apply the (conjugate) transpose of an operator.
Traits class which defines basic operations on multivectors.
GmresPolyOp()
Default constructor.
static void SetBlock(const MV &A, const std::vector< int > &index, MV &mv)
Copy the vectors in A to a set of vectors in mv indicated by the indices given in index...
static Teuchos::RCP< MV > CloneViewNonConst(MV &mv, const std::vector< int > &index)
Creates a new MV that shares the selected contents of mv (shallow copy).
static Teuchos::RCP< MV > Clone(const MV &mv, const int numvecs)
Creates a new empty MV containing numvecs columns.
void Apply(const MV &x, MV &y, ETrans trans=NOTRANS)
This routine takes the MV x and applies the polynomial operator phi(OP) to it resulting in the MV y...
GmresPolyOp(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem_in, const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > &hess, const Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > &comb, const Teuchos::RCP< Teuchos::SerialDenseVector< int, ScalarType > > &scal)
Basic contstructor.
A linear system to solve, and its associated information.
Class which describes the linear problem to be solved by the iterative solver.
static void MvTimesMatAddMv(const ScalarType alpha, const MV &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, const ScalarType beta, MV &mv)
Update mv with .
Belos's class for applying the GMRES polynomial operator that is used by the hybrid-GMRES linear solv...
virtual ~GmresPolyOp()
Destructor.
Class which defines basic traits for the operator type.
static void MvScale(MV &mv, const ScalarType alpha)
Scale each element of the vectors in mv with alpha.
Belos header file which uses auto-configuration information to include necessary C++ headers...