49 #ifndef XPETRA_CRSMATRIXWRAP_DECL_HPP
50 #define XPETRA_CRSMATRIXWRAP_DECL_HPP
64 #include <Teuchos_SerialDenseMatrix.hpp>
65 #include <Teuchos_Hashtable.hpp>
79 template <
class Scalar,
84 public Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
90 #ifdef HAVE_XPETRA_TPETRA
95 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
96 #ifdef HAVE_XPETRA_TPETRA
97 typedef typename CrsMatrix::local_matrix_type local_matrix_type;
110 size_t maxNumEntriesPerRow);
114 const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc);
117 CrsMatrixWrap(
const RCP<const Map> &rowMap,
const RCP<const Map>& colMap,
size_t maxNumEntriesPerRow);
120 CrsMatrixWrap(
const RCP<const Map> &rowMap,
const RCP<const Map>& colMap,
const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc);
122 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
123 #ifdef HAVE_XPETRA_TPETRA
124 CrsMatrixWrap(
const RCP<const Map> &rowMap,
const RCP<const Map>& colMap,
const local_matrix_type& lclMatrix,
const Teuchos::RCP<Teuchos::ParameterList>& params = null);
128 CrsMatrixWrap(
const local_matrix_type& lclMatrix,
const RCP<const Map> &rowMap,
const RCP<const Map>& colMap,
129 const RCP<const Map>& domainMap = Teuchos::null,
const RCP<const Map>& rangeMap = Teuchos::null,
130 const Teuchos::RCP<Teuchos::ParameterList>& params = null);
133 #warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
140 CrsMatrixWrap(
const RCP<const CrsGraph>& graph,
const RCP<ParameterList>& paramList = Teuchos::null);
163 void insertGlobalValues(GlobalOrdinal globalRow,
const ArrayView<const GlobalOrdinal> &cols,
const ArrayView<const Scalar> &vals);
173 void insertLocalValues(LocalOrdinal localRow,
const ArrayView<const LocalOrdinal> &cols,
const ArrayView<const Scalar> &vals);
182 const ArrayView<const GlobalOrdinal> &cols,
183 const ArrayView<const Scalar> &vals);
190 const ArrayView<const LocalOrdinal> &cols,
191 const ArrayView<const Scalar> &vals);
197 void scale(
const Scalar &alpha);
212 void resumeFill(
const RCP< ParameterList > ¶ms=null);
225 void fillComplete(
const RCP<const Map> &domainMap,
const RCP<const Map> &rangeMap,
const RCP<Teuchos::ParameterList> ¶ms = null);
241 void fillComplete(
const RCP<ParameterList> ¶ms = null);
305 const ArrayView<LocalOrdinal> &Indices,
306 const ArrayView<Scalar> &Values,
320 void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &indices, ArrayView<const Scalar> &values)
const;
332 void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices, ArrayView<const Scalar> &values)
const;
388 Teuchos::ETransp mode = Teuchos::NO_TRANS,
389 Scalar alpha = ScalarTraits<Scalar>::one(),
390 Scalar beta = ScalarTraits<Scalar>::zero())
const;
394 RCP<const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
getDomainMap()
const;
398 RCP<const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
getRangeMap()
const;
402 const RCP<const Map> &
getColMap()
const;
415 const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > >
getMap()
const;
442 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
452 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
453 #ifdef HAVE_XPETRA_TPETRA
454 local_matrix_type getLocalMatrix ()
const;
458 #warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
502 #define XPETRA_CRSMATRIXWRAP_SHORT
503 #endif //XPETRA_CRSMATRIXWRAP_DECL_HPP
void setObjectLabel(const std::string &objectLabel)
RCP< CrsMatrix > getCrsMatrix() const
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Right scale matrix using the given vector entries.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
Xpetra::TpetraCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraCrsMatrix
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using global IDs.
global_size_t getGlobalNumRows() const
Returns the number of global rows in this matrix.
const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
bool hasCrsGraph() const
Supports the getCrsGraph() call.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map > &newMap)
Xpetra::MatrixView< Scalar, LocalOrdinal, GlobalOrdinal, Node > MatrixView
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
void doExport(const Matrix &dest, const Xpetra::Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void updateDefaultView() const
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Get Frobenius norm of the matrix.
void doImport(const Matrix &source, const Xpetra::Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
std::string description() const
Return a simple one-line description of this object.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > CrsGraph
void getLocalDiagCopy(Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row idices.
CrsMatrixWrap(const RCP< const Map > &rowMap)
Constructor for a dynamic profile matrix (Epetra only)
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
Compute a residual R = B - (*this) * X.
RCP< const CrsGraph > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
size_t global_size_t
Global size_t object.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
void fillComplete(const RCP< const Map > &domainMap, const RCP< const Map > &rangeMap, const RCP< Teuchos::ParameterList > ¶ms=null)
Signal that data entry is complete, specifying domain and range maps.
RCP< CrsMatrix > matrixData_
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
virtual ~CrsMatrixWrap()
Destructor.
const RCP< const Map > & getColMap() const
Returns the Map that describes the column distribution in this matrix. This might be null until fillC...
void resumeFill(const RCP< ParameterList > ¶ms=null)
bool isFillComplete() const
Returns true if fillComplete() has been called and the matrix is in compute mode. ...
RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
virtual void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalar.
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the matrix.
Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > Map
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
CombineMode
Xpetra::Combine Mode enumerable type.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Left scale matrix using the given vector entries.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > CrsMatrix
virtual void apply(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
Computes the sparse matrix-multivector multiplication.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the specified global row.
Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > Matrix
RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
Xpetra::CrsMatrixFactory< Scalar, LocalOrdinal, GlobalOrdinal, Node > CrsMatrixFactory
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using local IDs.
Xpetra-specific matrix class.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calli...