Xpetra_CrsMatrixWrap.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 
47 // WARNING: This code is experimental. Backwards compatibility should not be expected.
48 
49 #ifndef XPETRA_CRSMATRIXWRAP_HPP
50 #define XPETRA_CRSMATRIXWRAP_HPP
51 
52 #include <Kokkos_DefaultNode.hpp>
53 
54 #include "Xpetra_ConfigDefs.hpp"
55 #include "Xpetra_Exceptions.hpp"
56 
57 #include "Xpetra_MultiVector.hpp"
58 #include "Xpetra_CrsGraph.hpp"
59 #include "Xpetra_CrsMatrix.hpp"
61 
62 #include "Xpetra_Matrix.hpp"
63 
65 #include <Teuchos_Hashtable.hpp>
66 
71 namespace Xpetra {
72 
73  typedef std::string viewLabel_t;
74 
79 template <class Scalar = Matrix<>::scalar_type,
80  class LocalOrdinal = typename Matrix<Scalar>::local_ordinal_type,
81  class GlobalOrdinal =
83  class Node =
85 class CrsMatrixWrap :
86  public Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
87 {
92 #ifdef HAVE_XPETRA_TPETRA
94 #endif
97 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
98  typedef typename CrsMatrix::local_matrix_type local_matrix_type;
99 #endif
100 
101 public:
103 
104 
107  size_t maxNumEntriesPerRow,
109  : finalDefaultView_ (false)
110  {
111  matrixData_ = CrsMatrixFactory::Build (rowMap, maxNumEntriesPerRow, pftype);
113  }
114 
117  const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc,
119  : finalDefaultView_ (false)
120  {
121  matrixData_ = CrsMatrixFactory::Build(rowMap, NumEntriesPerRowToAlloc, pftype);
123  }
124 
126  CrsMatrixWrap(const RCP<const Map> &rowMap, const RCP<const Map>& colMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype = Xpetra::DynamicProfile)
127  : finalDefaultView_(false)
128  {
129  // Set matrix data
130  matrixData_ = CrsMatrixFactory::Build(rowMap, colMap, maxNumEntriesPerRow, pftype);
131 
132  // Default view
134  }
135 
137  CrsMatrixWrap(const RCP<const Map> &rowMap, const RCP<const Map>& colMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, Xpetra::ProfileType pftype = Xpetra::DynamicProfile)
138  : finalDefaultView_(false)
139  {
140  // Set matrix data
141  matrixData_ = CrsMatrixFactory::Build(rowMap, colMap, NumEntriesPerRowToAlloc, pftype);
142 
143  // Default view
145  }
146 
147 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
148  CrsMatrixWrap(const RCP<const Map> &rowMap, const RCP<const Map>& colMap, const local_matrix_type& lclMatrix, const Teuchos::RCP<Teuchos::ParameterList>& params = null)
150  : finalDefaultView_(false)
151  {
152  // Set matrix data
153  matrixData_ = CrsMatrixFactory::Build(rowMap, colMap, lclMatrix, params);
154 
155  // Default view
157  }
158 #endif
159 
161  : finalDefaultView_(matrix->isFillComplete())
162  {
163  // Set matrix data
164  matrixData_ = matrix;
165 
166  // Default view
168  }
169 
170  CrsMatrixWrap(const RCP<const CrsGraph>& graph, const RCP<ParameterList>& paramList = Teuchos::null)
171  : finalDefaultView_(false)
172  {
173  // Set matrix data
174  matrixData_ = CrsMatrixFactory::Build(graph, paramList);
175 
176  // Default view
178  }
179 
181  virtual ~CrsMatrixWrap() {}
182 
184 
185 
187 
188 
190 
201  void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &cols, const ArrayView<const Scalar> &vals) {
202  matrixData_->insertGlobalValues(globalRow, cols, vals);
203  }
204 
206 
213  void insertLocalValues(LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &cols, const ArrayView<const Scalar> &vals) {
214  matrixData_->insertLocalValues(localRow, cols, vals);
215  }
216 
218 
223  void replaceGlobalValues(GlobalOrdinal globalRow,
224  const ArrayView<const GlobalOrdinal> &cols,
225  const ArrayView<const Scalar> &vals) { matrixData_->replaceGlobalValues(globalRow, cols, vals); }
226 
228 
231  void replaceLocalValues(LocalOrdinal localRow,
232  const ArrayView<const LocalOrdinal> &cols,
233  const ArrayView<const Scalar> &vals) { matrixData_->replaceLocalValues(localRow, cols, vals); }
234 
236  virtual void setAllToScalar(const Scalar &alpha) { matrixData_->setAllToScalar(alpha); }
237 
239  void scale(const Scalar &alpha) {
240  matrixData_->scale(alpha);
241  }
242 
244 
246 
247 
256  void resumeFill(const RCP< ParameterList > &params=null) {
257  matrixData_->resumeFill(params);
258  }
259 
271  void fillComplete(const RCP<const Map> &domainMap, const RCP<const Map> &rangeMap, const RCP<Teuchos::ParameterList> &params = null) {
272  matrixData_->fillComplete(domainMap, rangeMap, params);
273 
274  // Update default view with the colMap because colMap can be <tt>null</tt> until fillComplete() is called.
276  }
277 
291  //TODO : Get ride of "Tpetra"::OptimizeOption
292  void fillComplete(const RCP<ParameterList> &params = null) {
293  matrixData_->fillComplete(params);
294 
295  // Update default view with the colMap because colMap can be <tt>null</tt> until fillComplete() is called.
297  }
298 
300 
302 
305  return matrixData_->getGlobalNumRows();
306  }
307 
309 
312  return matrixData_->getGlobalNumCols();
313  }
314 
316  size_t getNodeNumRows() const {
317  return matrixData_->getNodeNumRows();
318  }
319 
322  return matrixData_->getGlobalNumEntries();
323  }
324 
326  size_t getNodeNumEntries() const {
327  return matrixData_->getNodeNumEntries();
328  }
329 
331 
332  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const {
333  return matrixData_->getNumEntriesInLocalRow(localRow);
334  }
335 
337 
340  return matrixData_->getGlobalNumDiags();
341  }
342 
344 
346  size_t getNodeNumDiags() const {
347  return matrixData_->getNodeNumDiags();
348  }
349 
351 
353  size_t getGlobalMaxNumRowEntries() const {
354  return matrixData_->getGlobalMaxNumRowEntries();
355  }
356 
358 
360  size_t getNodeMaxNumRowEntries() const {
361  return matrixData_->getNodeMaxNumRowEntries();
362  }
363 
365  bool isLocallyIndexed() const {
366  return matrixData_->isLocallyIndexed();
367  }
368 
370  bool isGloballyIndexed() const {
371  return matrixData_->isGloballyIndexed();
372  }
373 
375  bool isFillComplete() const {
376  return matrixData_->isFillComplete();
377  }
378 
380 
392  void getLocalRowCopy(LocalOrdinal LocalRow,
393  const ArrayView<LocalOrdinal> &Indices,
394  const ArrayView<Scalar> &Values,
395  size_t &NumEntries
396  ) const {
397  matrixData_->getLocalRowCopy(LocalRow, Indices, Values, NumEntries);
398  }
399 
401 
410  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &indices, ArrayView<const Scalar> &values) const {
411  matrixData_->getGlobalRowView(GlobalRow, indices, values);
412  }
413 
415 
424  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices, ArrayView<const Scalar> &values) const {
425  matrixData_->getLocalRowView(LocalRow, indices, values);
426  }
427 
429 
432  matrixData_->getLocalDiagCopy(diag);
433  }
434 
437  matrixData_->getLocalDiagOffsets(offsets);
438  }
439 
442  matrixData_->getLocalDiagCopy(diag,offsets);
443  }
444 
447  return matrixData_->getFrobeniusNorm();
448  }
449 
451 
453 
454 
456 
465  //TODO virtual=0 // TODO: Add default parameters ?
466 // void multiply(const MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> & X, MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y, Teuchos::ETransp trans, Scalar alpha, Scalar beta) const {
467 // matrixData_->multiply(X, Y, trans, alpha, beta);
468 // }
469 
471 
473 
474 
476 
482  Scalar alpha = ScalarTraits<Scalar>::one(),
483  Scalar beta = ScalarTraits<Scalar>::zero()) const {
484 
485  matrixData_->apply(X,Y,mode,alpha,beta);
486  }
487 
491  return matrixData_->getDomainMap();
492  }
493 
497  return matrixData_->getRangeMap();
498  }
499 
503 
505  const RCP<const Map> & getColMap(viewLabel_t viewLabel) const {
506  TEUCHOS_TEST_FOR_EXCEPTION(Matrix::operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.GetColMap(): view '" + viewLabel + "' does not exist.");
507  updateDefaultView(); // If CrsMatrix::fillComplete() have been used instead of CrsMatrixWrap::fillComplete(), the default view is updated.
508  return Matrix::operatorViewTable_.get(viewLabel)->GetColMap();
509  }
510 
512  matrixData_->removeEmptyProcessesInPlace(newMap);
513  this->operatorViewTable_.get(this->GetCurrentViewLabel())->SetRowMap(matrixData_->getRowMap());
514  this->operatorViewTable_.get(this->GetCurrentViewLabel())->SetColMap(matrixData_->getColMap());
515  }
516 
518 
520  //{@
521 
524  return matrixData_->getMap();
525  }
526 
528  void doImport(const Matrix &source,
530  const CrsMatrixWrap & sourceWrp = dynamic_cast<const CrsMatrixWrap &>(source);
531  matrixData_->doImport(*sourceWrp.getCrsMatrix(), importer, CM);
532  }
533 
535  void doExport(const Matrix &dest,
537  const CrsMatrixWrap & destWrp = dynamic_cast<const CrsMatrixWrap &>(dest);
538  matrixData_->doExport(*destWrp.getCrsMatrix(), importer, CM);
539  }
540 
542  void doImport(const Matrix &source,
544  const CrsMatrixWrap & sourceWrp = dynamic_cast<const CrsMatrixWrap &>(source);
545  matrixData_->doImport(*sourceWrp.getCrsMatrix(), exporter, CM);
546  }
547 
549  void doExport(const Matrix &dest,
551  const CrsMatrixWrap & destWrp = dynamic_cast<const CrsMatrixWrap &>(dest);
552  matrixData_->doExport(*destWrp.getCrsMatrix(), exporter, CM);
553  }
554 
555  // @}
556 
558 
559 
561  std::string description() const {
562  return "Xpetra::CrsMatrixWrap";
563  }
564 
567  // Teuchos::EVerbosityLevel vl = verbLevel;
568  // if (vl == VERB_DEFAULT) vl = VERB_LOW;
569  // RCP<const Comm<int> > comm = this->getComm();
570  // const int myImageID = comm->getRank(),
571  // numImages = comm->getSize();
572 
573  // if (myImageID == 0) out << this->description() << std::endl;
574 
575  matrixData_->describe(out,verbLevel);
576 
577  // Teuchos::OSTab tab(out);
578  }
579 
580 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
581  local_matrix_type getLocalMatrix () const {
583  return matrixData_->getLocalMatrix();
584  }
585 #endif
586 
587  // JG: Added:
588 
590  RCP<const CrsGraph> getCrsGraph() const { return matrixData_->getCrsGraph(); }
591 
593 
595 
596  template<class Node2>
598 #ifdef HAVE_XPETRA_TPETRA
601  if (tMatrix == Teuchos::null)
602  throw Xpetra::Exceptions::RuntimeError("clone() functionality is only available for Tpetra");
603 
605  // TODO: inherit strided maps/views ?
606 #else
607  return Teuchos::null;
608 #endif
609  }
610 
611 private:
612 
613  // Default view is created after fillComplete()
614  // Because ColMap might not be available before fillComplete().
616 
617  // Create default view
618  this->defaultViewLabel_ = "point";
619  this->CreateView(this->GetDefaultViewLabel(), matrixData_->getRowMap(), matrixData_->getColMap());
620 
621  // Set current view
622  this->currentViewLabel_ = this->GetDefaultViewLabel();
623  }
624 
625 private:
626 
627  // The colMap can be <tt>null</tt> until fillComplete() is called. The default view of the Matrix have to be updated when fillComplete() is called.
628  // If CrsMatrix::fillComplete() have been used instead of CrsMatrixWrap::fillComplete(), the default view is updated when getColMap() is called.
629  void updateDefaultView() const {
630  if ((finalDefaultView_ == false) && matrixData_->isFillComplete() ) {
631  // Update default view with the colMap
633  finalDefaultView_ = true;
634  }
635  }
636  // The boolean finalDefaultView_ keep track of the status of the default view (= already updated or not)
637  // See also CrsMatrixWrap::updateDefaultView()
638  mutable bool finalDefaultView_;
639 
640 
642 
643 }; //class Matrix
644 
645 } //namespace Xpetra
646 
647 #define XPETRA_CRSMATRIXWRAP_SHORT
648 #endif //XPETRA_CRSMATRIXWRAP_DECL_HPP
649 
650 //NOTE: if CrsMatrix and VbrMatrix share a common interface for fillComplete() etc, I can move some stuff in Xpetra_Matrix.hpp
651 //TODO: getUnderlyingMatrix() method
virtual void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalar.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
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
virtual ~CrsMatrixWrap()
Destructor.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
CrsMatrixWrap(const RCP< const Map > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=Xpetra::DynamicProfile)
Constructor specifying (possibly different) number of entries in each row.
RCP< CrsMatrix > getCrsMatrix() const
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using global IDs.
void doExport(const Matrix &dest, const Xpetra::Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
global_size_t getGlobalNumRows() const
Returns the number of global rows in this matrix.
size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype=Xpetra::DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying fixed number of entries for each row.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
Xpetra namespace
LocalOrdinal local_ordinal_type
CrsMatrixWrap(RCP< CrsMatrix > matrix)
void getLocalDiagCopy(Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
Get a copy of the diagonal entries owned by this node, with local row indices, using row offsets...
Exception throws to report errors in the internal logical of the program.
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map > &newMap)
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Get Frobenius norm of the matrix.
RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
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.
CrsMatrixWrap(const RCP< const Map > &rowMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype=Xpetra::DynamicProfile)
Constructor specifying fixed number of entries for each row.
RCP< const CrsGraph > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
void doExport(const Matrix &dest, const Xpetra::Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
Teuchos::Hashtable< viewLabel_t, RCP< MatrixView > > operatorViewTable_
const RCP< const Map > & getColMap() const
Returns the Map that describes the column distribution in this matrix. This might be null until fillC...
Xpetra::MatrixView< LocalOrdinal, GlobalOrdinal, Node > MatrixView
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...
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void doImport(const Matrix &source, const Xpetra::Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void doImport(const Matrix &source, const Xpetra::Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
CrsMatrixWrap(const RCP< const Map > &rowMap, const RCP< const Map > &colMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype=Xpetra::DynamicProfile)
Constructor specifying fixed number of entries for each row and column map.
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.
viewLabel_t defaultViewLabel_
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > CrsGraph
const viewLabel_t & GetCurrentViewLabel() const
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.
void CreateView(viewLabel_t viewLabel, const RCP< const Map > &rowMap, const RCP< const Map > &colMap)
viewLabel_t currentViewLabel_
size_t getNodeNumEntries() const
Returns the local number of entries in 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.
std::string viewLabel_t
size_t global_size_t
Global size_t object.
static const EVerbosityLevel verbLevel_default
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
CrsMatrixWrap(const RCP< const Map > &rowMap, const RCP< const Map > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, Xpetra::ProfileType pftype=Xpetra::DynamicProfile)
Constructor specifying fixed number of entries for each row and column map.
void fillComplete(const RCP< const Map > &domainMap, const RCP< const Map > &rangeMap, const RCP< Teuchos::ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
void resumeFill(const RCP< ParameterList > &params=null)
bool isFillComplete() const
Returns true if fillComplete() has been called and the matrix is in compute mode. ...
RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node2 > > clone(const RCP< Node2 > &node2) const
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
CrsMatrixWrap(const RCP< const CrsGraph > &graph, const RCP< ParameterList > &paramList=Teuchos::null)
Concrete implementation of Xpetra::Matrix.
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.
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
const viewLabel_t & GetDefaultViewLabel() const
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.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > Matrix
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...
const RCP< const Map > & getColMap(viewLabel_t viewLabel) const
Returns the Map that describes the column distribution in this matrix.
GlobalOrdinal global_ordinal_type