42 #ifndef BELOS_GMRESPOLYOP_HPP
43 #define BELOS_GMRESPOLYOP_HPP
70 template <
class ScalarType,
class MV,
class OP>
86 :
problem_(problem_in),
LP_(problem_in->getLeftPrec()),
RP_(problem_in->getRightPrec()),
H_(hess),
y_(comb),
r0_(scal)
118 template <
class ScalarType,
class MV,
class OP>
122 if (V_ == Teuchos::null) {
123 V_ = MVT::Clone( x, dim_ );
124 if (LP_ != Teuchos::null) {
125 wL_ = MVT::Clone( y, 1 );
127 if (RP_ != Teuchos::null) {
128 wR_ = MVT::Clone( y, 1 );
134 int n = MVT::GetNumberVecs( x );
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 );
148 MVT::SetBlock( *x_view, idxi, *V_ );
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 );
185 MVT::MvTimesMatAddMv( -SCT::one(), *v_prev, h, SCT::one(), *v_next );
188 MVT::MvScale( *v_next, SCT::one()/(*H_)(i+1,i) );
192 if (RP_ != Teuchos::null) {
193 MVT::MvTimesMatAddMv( SCT::one()/(*r0_)(0), *V_, *y_, SCT::zero(), *wR_ );
194 problem_->applyRightPrec( *wR_, *y_view );
197 MVT::MvTimesMatAddMv( SCT::one()/(*r0_)(0), *V_, *y_, SCT::zero(), *y_view );
211 template <
class ScalarType,
class MV,
class OP>
220 { Op.
Apply( x, y, trans ); }