10 #ifndef MUELU_NULLSPACEPRESMOOTHFACTORY_DEF_HPP
11 #define MUELU_NULLSPACEPRESMOOTHFACTORY_DEF_HPP
15 #include <Xpetra_MultiVectorFactory.hpp>
18 #include "MueLu_Utilities.hpp"
24 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
29 validParamList->
set<
RCP<const FactoryBase> >(
"Nullspace", Teuchos::null,
"Generating factory for the nonsmoothed nullspace");
31 return validParamList;
34 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
36 Input(currentLevel,
"Nullspace");
39 Input(currentLevel,
"A");
42 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
44 FactoryMonitor m(*
this,
"Nullspace presmooth factory", currentLevel);
48 RCP<Matrix> A = Get<RCP<Matrix> >(currentLevel,
"A");
50 newB = MultiVectorFactory::Build(B->getMap(), B->getNumVectors());
59 size_t numVec = newB->getNumVectors();
60 LO numElements = newB->getLocalLength();
61 for (
size_t j = 0; j < numVec; j++) {
65 for (
LO i = 0; i < numElements; i++)
66 newBj[i] = Bj[i] - damping * newBj[i] / D[i];
69 newB = Get<RCP<MultiVector> >(currentLevel,
"Nullspace");
73 Set(currentLevel,
"Nullspace", newB);
79 #endif // MUELU_NULLSPACEPRESMOOTHFACTORY_DEF_HPP
void Build(Level ¤tLevel) const
Build an object with this factory.
static Scalar PowerMethod(const Matrix &A, bool scaleByDiag=true, LocalOrdinal niters=10, Magnitude tolerance=1e-2, bool verbose=false, unsigned int seed=123)
Power method.
Timer to be used in factories. Similar to Monitor but with additional timers.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
static Teuchos::ArrayRCP< Scalar > GetMatrixDiagonal_arcp(const Matrix &A)
Extract Matrix Diagonal.
void DeclareInput(Level ¤tLevel) const
Specifies the data that this class needs, and the factories that generate that data.
int GetLevelID() const
Return level number.