10 #ifndef MUELU_CGSOLVER_DEF_HPP
11 #define MUELU_CGSOLVER_DEF_HPP
14 #include <Xpetra_MatrixFactory2.hpp>
17 #include "MueLu_Utilities.hpp"
18 #include "MueLu_Constraint.hpp"
25 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
29 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
36 finalP = MatrixFactory2::BuildCopy(rcpFromRef(P0));
50 #ifndef TWO_ARG_MATRIX_ADD
54 SC oldRZ, newRZ, alpha, beta, app;
58 T_->fillComplete(P0.getDomainMap(), P0.getRangeMap());
62 X = rcp_const_cast<Matrix>(rcpFromRef(P0));
64 tmpAP = MatrixMatrix::Multiply(*A,
false, *X,
false, mmfancy,
true ,
true );
81 for (
size_t i = 0; i < nIts_; i++) {
83 if (i == 0 || useTpetra) {
88 tmpAP = MatrixMatrix::Multiply(*A,
false, *P,
false, mmfancy,
true ,
true );
91 tmpAP = MatrixMatrix::Multiply(*A,
false, *P,
false, tmpAP, mmfancy,
true ,
true );
102 X = MatrixFactory2::BuildCopy(rcpFromRef(P0));
108 this->GetOStream(
Runtime1, 1) <<
"alpha = " << alpha << std::endl;
111 #ifndef TWO_ARG_MATRIX_ADD
112 newX = Teuchos::null;
113 MatrixMatrix::TwoMatrixAdd(*P,
false, alpha, *X,
false, one, newX, mmfancy);
114 newX->fillComplete(P0.getDomainMap(), P0.getRangeMap());
117 MatrixMatrix::TwoMatrixAdd(*P,
false, alpha, *X, one);
124 #ifndef TWO_ARG_MATRIX_ADD
125 newR = Teuchos::null;
126 MatrixMatrix::TwoMatrixAdd(*AP,
false, -alpha, *R,
false, one, newR, mmfancy);
127 newR->fillComplete(P0.getDomainMap(), P0.getRangeMap());
130 MatrixMatrix::TwoMatrixAdd(*AP,
false, -alpha, *R, one);
134 Z = MatrixFactory2::BuildCopy(R);
139 beta = newRZ / oldRZ;
142 #ifndef TWO_ARG_MATRIX_ADD
143 newP = Teuchos::null;
144 MatrixMatrix::TwoMatrixAdd(*P,
false, beta, *Z,
false, one, newP, mmfancy);
145 newP->fillComplete(P0.getDomainMap(), P0.getRangeMap());
148 MatrixMatrix::TwoMatrixAdd(*Z,
false, one, *P, beta);
159 #endif // ifndef MUELU_CGSOLVER_DECL_HPP
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)
Constraint space information for the potential prolongator.
void swap(RCP< T > &r_ptr)
RCP< const CrsGraph > GetPattern() const
Print even more statistics.
void Iterate(const Matrix &A, const Constraint &C, const Matrix &P0, RCP< Matrix > &P) const
Iterate.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
static Teuchos::ArrayRCP< Scalar > GetMatrixDiagonal_arcp(const Matrix &A)
Extract Matrix Diagonal.
static RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > BuildCopy(const RCP< const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > A)
void Apply(const Matrix &P, Matrix &Projected) const
Apply constraint.
static Scalar Frobenius(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B)
Frobenius inner product of two matrices.
Description of what is happening (more verbose)