43#ifndef IFPACK2_DIAGONAL_DECL_HPP
44#define IFPACK2_DIAGONAL_DECL_HPP
48#include "Tpetra_CrsMatrix_decl.hpp"
70template<
class MatrixType>
73 typename MatrixType::local_ordinal_type,
74 typename MatrixType::global_ordinal_type,
75 typename MatrixType::node_type>,
77 typename MatrixType::local_ordinal_type,
78 typename MatrixType::global_ordinal_type,
79 typename MatrixType::node_type> >
82 typedef typename MatrixType::scalar_type scalar_type;
83 typedef typename MatrixType::local_ordinal_type local_ordinal_type;
84 typedef typename MatrixType::global_ordinal_type global_ordinal_type;
85 typedef typename MatrixType::node_type node_type;
86 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
89 typedef Tpetra::RowMatrix<scalar_type,
94 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
"Ifpack2::Diagonal: The template parameter MatrixType must be a Tpetra::RowMatrix specialization. Please don't use Tpetra::CrsMatrix (a subclass of Tpetra::RowMatrix) here anymore. The constructor can take either a RowMatrix or a CrsMatrix just fine.");
97 typedef Tpetra::CrsMatrix<scalar_type,
102 typedef Tpetra::Vector<scalar_type,
107 typedef Tpetra::Map<local_ordinal_type,
114 Diagonal (
const Teuchos::RCP<const row_matrix_type>& A);
123 Diagonal (
const Teuchos::RCP<const crs_matrix_type>& A_in);
136 Diagonal (
const Teuchos::RCP<const vector_type>& diag);
152 return isInitialized_;
190 setMatrix (
const Teuchos::RCP<const row_matrix_type>& A);
202 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
203 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
204 Teuchos::ETransp mode = Teuchos::NO_TRANS,
205 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
206 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const;
226 Teuchos::RCP<const row_matrix_type>
getMatrix ()
const {
231 double getComputeFlops()
const;
234 double getApplyFlops()
const;
259 std::string description()
const;
263 describe (Teuchos::FancyOStream& out,
264 const Teuchos::EVerbosityLevel verbLevel =
265 Teuchos::Describable::verbLevel_default)
const;
273 Teuchos::RCP<const row_matrix_type> matrix_;
279 Teuchos::RCP<const vector_type> userInverseDiag_;
282 Teuchos::RCP<const vector_type> inverseDiag_;
284 typedef Kokkos::View<size_t*, typename node_type::device_type> offsets_type;
285 offsets_type offsets_;
287 double initializeTime_;
289 mutable double applyTime_;
293 mutable int numApply_;
315template<
class MatrixType,
class VectorType>
316Teuchos::RCP<Ifpack2::Diagonal<Tpetra::RowMatrix<
typename MatrixType::scalar_type,
317 typename MatrixType::local_ordinal_type,
318 typename MatrixType::global_ordinal_type,
319 typename MatrixType::node_type> > >
322 typedef Tpetra::RowMatrix<
typename MatrixType::scalar_type,
323 typename MatrixType::local_ordinal_type,
324 typename MatrixType::global_ordinal_type,
Declaration of interface for preconditioners that can change their matrix after construction.
Mix-in interface for preconditioners that can change their matrix after construction.
Definition Ifpack2_Details_CanChangeMatrix.hpp:93
Diagonal preconditioner.
Definition Ifpack2_Diagonal_decl.hpp:80
virtual ~Diagonal()
Destructor.
Definition Ifpack2_Diagonal_def.hpp:92
Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > vector_type
Tpetra::Vector specialization used by this class.
Definition Ifpack2_Diagonal_decl.hpp:105
bool isComputed() const
Return true if compute() has been called.
Definition Ifpack2_Diagonal_decl.hpp:159
Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > map_type
Tpetra::Map specialization used by this class.
Definition Ifpack2_Diagonal_decl.hpp:109
virtual void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Change the matrix to be preconditioned.
Definition Ifpack2_Diagonal_def.hpp:149
Tpetra::CrsMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > crs_matrix_type
Tpetra::CrsMatrix specialization used by this class.
Definition Ifpack2_Diagonal_decl.hpp:100
void setParameters(const Teuchos::ParameterList ¶ms)
Sets parameters on this object.
Definition Ifpack2_Diagonal_def.hpp:135
Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > row_matrix_type
Tpetra::RowMatrix specialization used by this class.
Definition Ifpack2_Diagonal_decl.hpp:92
Diagonal(const Teuchos::RCP< const row_matrix_type > &A)
Constructor that takes a Tpetra::RowMatrix.
Definition Ifpack2_Diagonal_def.hpp:52
void initialize()
Initialize.
Definition Ifpack2_Diagonal_def.hpp:158
void compute()
Compute the preconditioner.
Definition Ifpack2_Diagonal_def.hpp:200
bool isInitialized() const
Returns true if the preconditioner has been successfully initialized.
Definition Ifpack2_Diagonal_decl.hpp:151
Interface for all Ifpack2 preconditioners.
Definition Ifpack2_Preconditioner.hpp:108
virtual double getComputeTime() const=0
virtual int getNumCompute() const=0
virtual Teuchos::RCP< const Tpetra::RowMatrix< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > getMatrix() const=0
virtual int getNumApply() const=0
virtual double getApplyTime() const=0
virtual void apply(const Tpetra::MultiVector< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > &X, Tpetra::MultiVector< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, MatrixType::scalar_type alpha=Teuchos::ScalarTraits< MatrixType::scalar_type >::one(), MatrixType::scalar_type beta=Teuchos::ScalarTraits< MatrixType::scalar_type >::zero()) const=0
virtual Teuchos::RCP< const Tpetra::Map< MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > getRangeMap() const=0
virtual Teuchos::RCP< const Tpetra::Map< MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > getDomainMap() const=0
virtual double getInitializeTime() const=0
virtual int getNumInitialize() const=0
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:74
Teuchos::RCP< Ifpack2::Diagonal< Tpetra::RowMatrix< typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > > createDiagonalPreconditioner(const Teuchos::RCP< const VectorType > &invdiag)
Definition Ifpack2_Diagonal_decl.hpp:320