42 #ifndef TPETRA_ROWMATRIX_DECL_HPP
43 #define TPETRA_ROWMATRIX_DECL_HPP
45 #include "Tpetra_ConfigDefs.hpp"
48 #include "Tpetra_Operator.hpp"
52 #include "Teuchos_Describable.hpp"
53 #include "Kokkos_ArithTraits.hpp"
81 template <
class Scalar,
86 virtual public Operator<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
88 public Packable<char, LocalOrdinal> {
117 using mag_type =
typename Kokkos::ArithTraits<Scalar>::mag_type;
120 Kokkos::View<impl_scalar_type*, typename Node::device_type>::const_type
121 values_device_view_type;
122 typedef typename values_device_view_type::HostMirror::const_type
123 values_host_view_type;
124 typedef typename values_device_view_type::HostMirror
125 nonconst_values_host_view_type;
128 Kokkos::View<LocalOrdinal *, typename Node::device_type>::const_type
129 local_inds_device_view_type;
130 typedef typename local_inds_device_view_type::HostMirror::const_type
131 local_inds_host_view_type;
132 typedef typename local_inds_device_view_type::HostMirror
133 nonconst_local_inds_host_view_type;
136 Kokkos::View<GlobalOrdinal *, typename Node::device_type>::const_type
137 global_inds_device_view_type;
138 typedef typename global_inds_device_view_type::HostMirror::const_type
139 global_inds_host_view_type;
140 typedef typename global_inds_device_view_type::HostMirror
141 nonconst_global_inds_host_view_type;
145 Kokkos::View<const size_t*, typename Node::device_type>::const_type
146 row_ptrs_device_view_type;
147 typedef typename row_ptrs_device_view_type::HostMirror::const_type
148 row_ptrs_host_view_type;
164 virtual Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const = 0;
168 virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
getRowMap()
const = 0;
171 virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
getColMap()
const = 0;
174 virtual Teuchos::RCP<const RowGraph<LocalOrdinal,GlobalOrdinal,Node> >
getGraph()
const = 0;
301 nonconst_global_inds_host_view_type &Indices,
302 nonconst_values_host_view_type &Values,
303 size_t& NumEntries)
const = 0;
304 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
307 const Teuchos::ArrayView<GlobalOrdinal> &Indices,
308 const Teuchos::ArrayView<Scalar> &Values,
309 size_t &NumEntries)
const = 0;
333 nonconst_local_inds_host_view_type &Indices,
334 nonconst_values_host_view_type &Values,
335 size_t& NumEntries)
const = 0;
336 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
339 const Teuchos::ArrayView<LocalOrdinal> &Indices,
340 const Teuchos::ArrayView<Scalar> &Values,
341 size_t &NumEntries)
const = 0;
369 global_inds_host_view_type &indices,
370 values_host_view_type &values)
const = 0;
371 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
374 Teuchos::ArrayView<const GlobalOrdinal> &indices,
375 Teuchos::ArrayView<const Scalar> &values)
const = 0;
404 local_inds_host_view_type & indices,
405 values_host_view_type & values)
const = 0;
406 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
409 Teuchos::ArrayView<const LocalOrdinal>& indices,
410 Teuchos::ArrayView<const Scalar>& values)
const = 0;
439 getLocalRowViewRaw (
const LocalOrdinal lclRow,
440 LocalOrdinal& numEnt,
441 const LocalOrdinal*& lclColInds,
442 const Scalar*& vals)
const;
535 virtual Teuchos::RCP<RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
536 add (
const Scalar& alpha,
541 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
const;
547 packRow (
char*
const numEntOut,
551 const LocalOrdinal lclRow)
const;
556 allocatePackSpace (Teuchos::Array<char>& exports,
557 size_t& totalNumEntries,
558 const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs)
const;
565 packImpl (
const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
566 Teuchos::Array<char>& exports,
567 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
568 size_t& constantNumPackets)
const;
581 pack (
const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
582 Teuchos::Array<char>& exports,
583 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
584 size_t& constantNumPackets)
const;
Declaration of Tpetra::Packable.
Forward declaration of Tpetra::RowGraph.
Forward declaration of Tpetra::RowMatrix.
Abstract base class for sources of an Import or Export.
Forward declaration of Tpetra::Vector.
A parallel distribution of indices over processes.
Abstract interface for operators (e.g., matrices and preconditioners).
Abstract base class for objects that can be the source of an Import or Export operation,...
A read-only, row-oriented interface to a sparse matrix.
virtual void getLocalRowCopy(LocalOrdinal LocalRow, nonconst_local_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const =0
Get a copy of the given local row's entries.
virtual void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const =0
Get a copy of the diagonal entries, distributed by the row Map.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const =0
The Map that describes the distribution of rows over processes.
virtual bool isLocallyIndexed() const =0
Whether matrix indices are locally indexed.
virtual mag_type getFrobeniusNorm() const =0
The Frobenius norm of the matrix.
virtual global_size_t getGlobalNumRows() const =0
The global number of rows of this matrix.
Node node_type
The Kokkos Node type.
typename Kokkos::ArithTraits< Scalar >::val_type impl_scalar_type
The type used internally in place of Scalar.
virtual void getLocalRowView(LocalOrdinal LocalRow, local_inds_host_view_type &indices, values_host_view_type &values) const =0
Get a constant, nonpersisting, locally indexed view of the given row of the matrix.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const =0
The Map that describes the distribution of columns over processes.
virtual Teuchos::RCP< const RowGraph< LocalOrdinal, GlobalOrdinal, Node > > getGraph() const =0
The RowGraph associated with this matrix.
virtual GlobalOrdinal getIndexBase() const =0
The index base for global indices in this matrix.
virtual bool supportsRowViews() const =0
Whether this object implements getLocalRowView() and getGlobalRowView().
virtual global_size_t getGlobalNumCols() const =0
The global number of columns of this matrix.
virtual void getGlobalRowCopy(GlobalOrdinal GlobalRow, nonconst_global_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const =0
Get a copy of the given global row's entries.
Scalar scalar_type
The type of the entries in the sparse matrix.
virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const =0
The current number of entries on the calling process in the specified local row.
virtual void pack(const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< char > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets) const
Pack this object's data for an Import or Export.
virtual ~RowMatrix()
Destructor (virtual for memory safety of derived classes).
virtual global_size_t getGlobalNumEntries() const =0
The global number of stored (structurally nonzero) entries.
virtual void getGlobalRowView(GlobalOrdinal GlobalRow, global_inds_host_view_type &indices, values_host_view_type &values) const =0
Get a constant, nonpersisting, globally indexed view of the given row of the matrix.
virtual size_t getNodeMaxNumRowEntries() const =0
Maximum number of entries in any row of the matrix, on this process.
virtual size_t getNodeNumEntries() const =0
The local number of stored (structurally nonzero) entries.
virtual bool hasColMap() const =0
Whether this matrix has a well-defined column Map.
virtual bool isGloballyIndexed() const =0
Whether matrix indices are globally indexed.
virtual Teuchos::RCP< RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > add(const Scalar &alpha, const RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) const
Return a new RowMatrix which is the result of beta*this + alpha*A.
virtual size_t getNodeNumRows() const =0
The number of rows owned by the calling process.
virtual size_t getGlobalMaxNumRowEntries() const =0
Maximum number of entries in any row of the matrix, over all processes.
virtual bool isFillComplete() const =0
Whether fillComplete() has been called.
virtual void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)=0
Scale the matrix on the left with the given Vector.
virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const =0
The current number of entries on the calling process in the specified global row.
GlobalOrdinal global_ordinal_type
The type of global indices.
virtual void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)=0
Scale the matrix on the right with the given Vector.
virtual size_t getNodeNumCols() const =0
The number of columns needed to apply the forward operator on this node.
LocalOrdinal local_ordinal_type
The type of local indices.
typename Kokkos::ArithTraits< Scalar >::mag_type mag_type
Type of a norm result.
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const =0
The communicator over which this matrix is distributed.
Abstract base class for objects that can be the source of an Import or Export operation.
A distributed dense vector.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
size_t global_size_t
Global size_t object.