10#ifndef MUELU_CONSTRAINT_DECL_HPP
11#define MUELU_CONSTRAINT_DECL_HPP
13#include "Teuchos_ScalarTraits.hpp"
15#include <Xpetra_MultiVector_fwd.hpp>
16#include <Xpetra_MultiVectorFactory.hpp>
17#include <Xpetra_Matrix.hpp>
18#include <Xpetra_CrsGraph_fwd.hpp>
19#include <Xpetra_MatrixFactory_fwd.hpp>
25#ifdef HAVE_MUELU_BELOS
26#include <BelosLinearProblem.hpp>
27#include <BelosSolverFactory.hpp>
28#include <BelosXpetraAdapter.hpp>
79 :
public Xpetra::Operator<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
81#undef MUELU_CONSTRAINT_SHORT
89 using MagnitudeType =
typename Teuchos::ScalarTraits<Scalar>::magnitudeType;
105 virtual void apply(
const MultiVector& P,
106 MultiVector& Projected,
107 Teuchos::ETransp mode = Teuchos::NO_TRANS,
108 Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
109 Scalar beta = Teuchos::ScalarTraits<Scalar>::zero())
const;
113 const MultiVector& B,
114 MultiVector& R)
const;
120 void SetPattern(RCP<const CrsGraph>& Ppattern);
126 virtual typename CrsGraph::local_graph_type
FindBlocks(RCP<const CrsGraph>& XXt);
148#ifdef HAVE_MUELU_BELOS
149 using MV = Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
150 using OP = Belos::OperatorT<MV>;
151 RCP<Belos::LinearProblem<Scalar, MV, OP>>
problem_;
152 RCP<Belos::SolverManager<Scalar, MV, OP>>
solver_;
176#define MUELU_CONSTRAINT_SHORT
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Base class for MueLu classes.
Constraint space information for the potential prolongator.
void LeastSquaresSolveDirect(const MultiVector &B, MultiVector &C) const
Direct solve of least-squares problem.
RCP< Matrix > GetConstraintMatrix()
virtual const RCP< const Map > getDomainMap() const
The Map associated with the domain of this operator, which must be compatible with X....
void PrepareLeastSquaresSolveDirect(bool detect_singular_blocks)
Prepare direct solution of least-squares problem.
Belos::OperatorT< MV > OP
RCP< Belos::SolverManager< Scalar, MV, OP > > solver_
RCP< const CrsGraph > Ppattern_
Nonzero sparsity pattern.
virtual void apply(const MultiVector &P, MultiVector &Projected, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Apply constraint.
RCP< Matrix > X_
The constraints matrix.
void PrepareLeastSquaresSolveBelos(bool detect_singular_blocks)
Prepare least-squares solve using Belos.
virtual CrsGraph::local_graph_type FindBlocks(RCP< const CrsGraph > &XXt)
void PrepareLeastSquaresSolve(const std::string &solverType, bool detect_singular_blocks=false)
typename Teuchos::ScalarTraits< Scalar >::magnitudeType MagnitudeType
RCP< Belos::LinearProblem< Scalar, MV, OP > > problem_
void residual(const MultiVector &X, const MultiVector &B, MultiVector &R) const
Compute a residual R = B - (*this) * X.
RCP< Matrix > invXXt_
Inverse of X*X^T.
virtual MagnitudeType ResidualNorm(const RCP< const Matrix > P) const =0
RCP< MultiVector > temp2_
void LeastSquaresSolve(const MultiVector &B, MultiVector &C) const
void SetConstraintsMatrix(RCP< Matrix > &X)
void LeastSquaresSolveBelos(const MultiVector &B, MultiVector &C) const
Perform least-squares solve using Belos.
RCP< Matrix > GetMatrixWithEntriesFromVector(MultiVector &vecP) const
RCP< const CrsGraph > GetPattern() const
RCP< MultiVector > temp3_
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > MV
RCP< MultiVector > temp1_
void SetPattern(RCP< const CrsGraph > &Ppattern)
virtual const RCP< const Map > getRangeMap() const
The Map associated with the range of this operator, which must be compatible with Y....
void AssignMatrixEntriesToVector(const Matrix &P, const RCP< const CrsGraph > &pattern, MultiVector &vecP) const
Namespace for MueLu classes and methods.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar