46 #ifndef MUELU_GMRESSOLVER_DEF_HPP 
   47 #define MUELU_GMRESSOLVER_DEF_HPP 
   55 #include "MueLu_GMRESSolver.hpp" 
   57 #include "MueLu_Constraint.hpp" 
   59 #include "MueLu_Utilities.hpp" 
   64   template <
class Scalar, 
class LocalOrdinal, 
class GlobalOrdinal, 
class Node>
 
   69   template <
class Scalar, 
class LocalOrdinal, 
class GlobalOrdinal, 
class Node>
 
   71     for (
int i = 0; i < k; i++) {
 
   72       SC w1 = c[i]*v[i] - s[i]*v[i+1];
 
   73       SC w2 = s[i]*v[i] + c[i]*v[i+1];
 
   79   template <
class Scalar, 
class LocalOrdinal, 
class GlobalOrdinal, 
class Node>
 
   83     finalP = MatrixFactory2::BuildCopy(rcpFromRef(P0));
 
   88         "For now, solving Hessenberg system works only for a single iteration");
 
  105     RCP<Matrix>               X = rcp_const_cast<Matrix>(rcpFromRef(P0)), tmpAP, newV;
 
  106     std::vector<RCP<Matrix> > V(nIts_+1);
 
  110     T_->fillComplete(P0.getDomainMap(), P0.getRangeMap());
 
  117       tmpAP = MatrixMatrix::Multiply(*A, 
false, *X, 
false, mmfancy, 
true, 
true);
 
  120       V[0] = MatrixFactory2::BuildCopy(T);
 
  126       V[0]->scale(-one/rho);
 
  127       V[0]->fillComplete(V[0]->getDomainMap(), V[0]->getRangeMap());
 
  130     std::vector<SC> h((nIts_+1) * (nIts_+1));
 
  131     std::vector<SC> c(nIts_+1, 0.0);
 
  132     std::vector<SC> s(nIts_+1, 0.0);
 
  133     std::vector<SC> g(nIts_+1, 0.0);
 
  136 #define I(i,j) ((i) + (j)*(nIts_+1)) // column ordering 
  137     for (
size_t i = 0; i < nIts_; i++) {
 
  139       tmpAP = MatrixMatrix::Multiply(*A, 
false, *V[i], 
false, mmfancy, 
true, 
true);
 
  142       V[i+1] = MatrixFactory2::BuildCopy(T);
 
  146       for (
size_t j = 0; j <= i; j++) {
 
  150 #ifndef TWO_ARG_MATRIX_ADD 
  151         newV = Teuchos::null;
 
  152         MatrixMatrix::TwoMatrixAdd(*V[j], 
false, -h[
I(j,i)], *V[i+1], 
false, one, newV, mmfancy);
 
  153         newV->fillComplete(V[i+1]->getDomainMap(), V[i+1]->getRangeMap());
 
  164         MatrixMatrix::TwoMatrixAdd(*V[j], 
false, -h[
I(j,i)], *V[i+1], one);
 
  183       if (h[
I(i+1,i)] != zero) {
 
  185         V[i+1]->resumeFill();
 
  186         V[i+1]->scale(one/h[
I(i+1,i)]);
 
  187         V[i+1]->fillComplete(V[i+1]->getDomainMap(), V[i+1]->getRangeMap());
 
  191         givapp(&c[0], &s[0], &h[
I(0,i)], i); 
 
  193       SC nu = sqrt(h[
I(i,i)]*h[
I(i,i)] + h[
I(i+1,i)]*h[
I(i+1,i)]);
 
  195         c[i]        =  h[
I(i,  i)] / nu;
 
  196         s[i]        = -h[
I(i+1,i)] / nu;
 
  197         h[
I(i,i)]   =  c[i] * h[
I(i,i)] - s[i] * h[
I(i+1,i)];
 
  200         givapp(&c[i], &s[i], &g[i], 1);
 
  206     std::vector<SC> y(nIts_);
 
  208       y[0] = g[0] / h[
I(0,0)];
 
  213     for (
size_t i = 0; i < nIts_; i++) {
 
  214 #ifndef TWO_ARG_MATRIX_ADD 
  215       newV = Teuchos::null;
 
  216       MatrixMatrix::TwoMatrixAdd(*V[i], 
false, y[i], *finalP, 
false, one, newV, mmfancy);
 
  217       newV->fillComplete(finalP->getDomainMap(), finalP->getRangeMap());
 
  220       MatrixMatrix::TwoMatrixAdd(*V[i], 
false, y[i], *finalP, one);
 
  227 #endif //ifndef MUELU_GMRESSOLVER_DECL_HPP 
static Teuchos::ArrayRCP< Scalar > GetMatrixDiagonal(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
void givapp(SC *c, SC *s, SC *v, int k) const 
static void MyOldScaleMatrix(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, const Teuchos::ArrayRCP< const Scalar > &scalingVector, bool doInverse=true, bool doFillComplete=true, bool doOptimizeStorage=true)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Constraint space information for the potential prolongator. 
void swap(RCP< T > &r_ptr)
RCP< const CrsGraph > GetPattern() const 
Print even more statistics. 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void Iterate(const Matrix &A, const Constraint &C, const Matrix &P0, RCP< Matrix > &P) const 
Iterate. 
void Apply(const Matrix &P, Matrix &Projected) const 
Apply constraint. 
Exception throws to report errors in the internal logical of the program. 
static Scalar Frobenius(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B)