46 #ifndef MUELU_STEEPESTDESCENTSOLVER_DEF_HPP
47 #define MUELU_STEEPESTDESCENTSOLVER_DEF_HPP
49 #include <Xpetra_CrsMatrixFactory.hpp>
50 #include <Xpetra_CrsMatrixWrap.hpp>
51 #include <Xpetra_MatrixMatrix.hpp>
53 #include "MueLu_Constraint.hpp"
55 #include "MueLu_Utilities.hpp"
61 using Teuchos::rcp_const_cast;
63 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
65 : nIts_(Its), stepLength_(StepLength)
68 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
80 Ptmp_->fillComplete(P0.getDomainMap(), P0.getRangeMap());
84 P = rcp_const_cast<Matrix>(rcpFromRef(P0));
86 for (
size_t k = 0; k < nIts_; k++) {
87 AP = Xpetra::MatrixMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Multiply(*A,
false, *P,
false, mmfancy,
true,
true);
90 SC stepLength = 2*stepLength_;
91 G = Xpetra::MatrixMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Multiply(*A,
true, *AP,
false,
true,
true);
95 SC stepLength = stepLength_;
101 Xpetra::MatrixMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::TwoMatrixAdd(*Ptmp,
false, -stepLength, *P,
false,
Teuchos::ScalarTraits<Scalar>::one(), newP, mmfancy);
102 newP->fillComplete(P->getDomainMap(), P->getRangeMap() );
108 #endif //ifndef MUELU_STEEPESTDESCENTSOLVER_DECL_HPP
static Teuchos::ArrayRCP< Scalar > GetMatrixDiagonal(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
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.
RCP< const CrsGraph > GetPattern() const
Print even more statistics.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void Apply(const Matrix &P, Matrix &Projected) const
Apply constraint.
void Iterate(const Matrix &A, const Constraint &C, const Matrix &P0, RCP< Matrix > &P) const
Iterate.
SteepestDescentSolver(size_t Its, SC StepLength=Teuchos::ScalarTraits< Scalar >::one())