46 #ifndef MUELU_CGSOLVER_DEF_HPP
47 #define MUELU_CGSOLVER_DEF_HPP
52 #include "MueLu_Utilities.hpp"
53 #include "MueLu_Constraint.hpp"
60 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
64 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 finalP = MatrixFactory2::BuildCopy(rcpFromRef(P0));
85 #ifndef TWO_ARG_MATRIX_ADD
89 SC oldRZ, newRZ, alpha, beta, app;
93 T_->fillComplete(P0.getDomainMap(), P0.getRangeMap());
97 X = rcp_const_cast<Matrix>(rcpFromRef(P0));
99 tmpAP = MatrixMatrix::Multiply(*A,
false, *X,
false, mmfancy,
true ,
true );
116 for (
size_t i = 0; i < nIts_; i++) {
118 if (i == 0 || useTpetra) {
123 tmpAP = MatrixMatrix::Multiply(*A,
false, *P,
false, mmfancy,
true ,
true );
126 tmpAP = MatrixMatrix::Multiply(*A,
false, *P,
false, tmpAP, mmfancy,
true ,
true );
137 X = MatrixFactory2::BuildCopy(rcpFromRef(P0));
143 this->GetOStream(
Runtime1, 1) <<
"alpha = " << alpha << std::endl;
146 #ifndef TWO_ARG_MATRIX_ADD
147 newX = Teuchos::null;
148 MatrixMatrix::TwoMatrixAdd(*P,
false, alpha, *X,
false, one, newX, mmfancy);
149 newX->fillComplete(P0.getDomainMap(), P0.getRangeMap());
152 MatrixMatrix::TwoMatrixAdd(*P,
false, alpha, *X, one);
159 #ifndef TWO_ARG_MATRIX_ADD
160 newR = Teuchos::null;
161 MatrixMatrix::TwoMatrixAdd(*AP,
false, -alpha, *R,
false, one, newR, mmfancy);
162 newR->fillComplete(P0.getDomainMap(), P0.getRangeMap());
165 MatrixMatrix::TwoMatrixAdd(*AP,
false, -alpha, *R, one);
169 Z = MatrixFactory2::BuildCopy(R);
174 beta = newRZ / oldRZ;
177 #ifndef TWO_ARG_MATRIX_ADD
178 newP = Teuchos::null;
179 MatrixMatrix::TwoMatrixAdd(*P,
false, beta, *Z,
false, one, newP, mmfancy);
180 newP->fillComplete(P0.getDomainMap(), P0.getRangeMap());
183 MatrixMatrix::TwoMatrixAdd(*Z,
false, one, *P, beta);
194 #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)