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,
92 node_type> row_matrix_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,
100 node_type> crs_matrix_type;
102 typedef Tpetra::Vector<scalar_type,
105 node_type> vector_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);
139 virtual ~Diagonal ();
145 void setParameters (
const Teuchos::ParameterList& params);
151 bool isInitialized ()
const {
152 return isInitialized_;
159 bool isComputed ()
const {
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;
209 Teuchos::RCP<const map_type> getDomainMap ()
const;
212 Teuchos::RCP<const map_type> getRangeMap ()
const;
226 Teuchos::RCP<const row_matrix_type> getMatrix ()
const {
231 double getComputeFlops()
const;
234 double getApplyFlops()
const;
237 int getNumInitialize()
const;
240 int getNumCompute()
const;
243 int getNumApply()
const;
246 double getInitializeTime()
const;
249 double getComputeTime()
const;
252 double getApplyTime()
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> > >
320createDiagonalPreconditioner (
const Teuchos::RCP<const VectorType>& invdiag)
322 typedef Tpetra::RowMatrix<
typename MatrixType::scalar_type,
323 typename MatrixType::local_ordinal_type,
324 typename MatrixType::global_ordinal_type,
325 typename MatrixType::node_type> row_matrix_type;
327 return Teuchos::rcp (
new Ifpack2::Diagonal<row_matrix_type> (invdiag));
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
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:108
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:74