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 
481  Scalar alpha = ScalarTraits<Scalar>::one(),
482  Scalar beta = ScalarTraits<Scalar>::zero()) const {
483 
484  matrixData_->apply(X,Y,mode,alpha,beta);
485  }
486 
490  return matrixData_->getDomainMap();
491  }
492 
496  return matrixData_->getRangeMap();
497  }
498 
502 
504  const RCP<const Map> & getColMap(viewLabel_t viewLabel) const {
505  TEUCHOS_TEST_FOR_EXCEPTION(Matrix::operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.GetColMap(): view '" + viewLabel + "' does not exist.");
506  updateDefaultView(); // If CrsMatrix::fillComplete() have been used instead of CrsMatrixWrap::fillComplete(), the default view is updated.
507  return Matrix::operatorViewTable_.get(viewLabel)->GetColMap();
508  }
509 
511  matrixData_->removeEmptyProcessesInPlace(newMap);
512  this->operatorViewTable_.get(this->GetCurrentViewLabel())->SetRowMap(matrixData_->getRowMap());
513  this->operatorViewTable_.get(this->GetCurrentViewLabel())->SetColMap(matrixData_->getColMap());
514  }
515 
517 
519  //{@
520 
523  return matrixData_->getMap();
524  }
525 
527  void doImport(const Matrix &source,
529  const CrsMatrixWrap & sourceWrp = dynamic_cast<const CrsMatrixWrap &>(source);
530  matrixData_->doImport(*sourceWrp.getCrsMatrix(), importer, CM);
531  }
532 
534  void doExport(const Matrix &dest,
536  const CrsMatrixWrap & destWrp = dynamic_cast<const CrsMatrixWrap &>(dest);
537  matrixData_->doExport(*destWrp.getCrsMatrix(), importer, CM);
538  }
539 
541  void doImport(const Matrix &source,
543  const CrsMatrixWrap & sourceWrp = dynamic_cast<const CrsMatrixWrap &>(source);
544  matrixData_->doImport(*sourceWrp.getCrsMatrix(), exporter, CM);
545  }
546 
548  void doExport(const Matrix &dest,
550  const CrsMatrixWrap & destWrp = dynamic_cast<const CrsMatrixWrap &>(dest);
551  matrixData_->doExport(*destWrp.getCrsMatrix(), exporter, CM);
552  }
553 
554  // @}
555 
557 
558 
560  std::string description() const {
561  return "Xpetra::CrsMatrixWrap";
562  }
563 
566  // Teuchos::EVerbosityLevel vl = verbLevel;
567  // if (vl == VERB_DEFAULT) vl = VERB_LOW;
568  // RCP<const Comm<int> > comm = this->getComm();
569  // const int myImageID = comm->getRank(),
570  // numImages = comm->getSize();
571 
572  // if (myImageID == 0) out << this->description() << std::endl;
573 
574  matrixData_->describe(out,verbLevel);
575 
576  // Teuchos::OSTab tab(out);
577  }
578 
579 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
580  local_matrix_type getLocalMatrix () const {
582  return matrixData_->getLocalMatrix();
583  }
584 #endif
585 
586  // JG: Added:
587 
589  RCP<const CrsGraph> getCrsGraph() const { return matrixData_->getCrsGraph(); }
590 
592 
594 
595  template<class Node2>
597 #ifdef HAVE_XPETRA_TPETRA
600  if (tMatrix == Teuchos::null)
601  throw Xpetra::Exceptions::RuntimeError("clone() functionality is only available for Tpetra");
602 
604  // TODO: inherit strided maps/views ?
605 #else
606  return Teuchos::null;
607 #endif
608  }
609 
610 private:
611 
612  // Default view is created after fillComplete()
613  // Because ColMap might not be available before fillComplete().
615 
616  // Create default view
617  this->defaultViewLabel_ = "point";
618  this->CreateView(this->GetDefaultViewLabel(), matrixData_->getRowMap(), matrixData_->getColMap());
619 
620  // Set current view
621  this->currentViewLabel_ = this->GetDefaultViewLabel();
622  }
623 
624 private:
625 
626  // 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.
627  // If CrsMatrix::fillComplete() have been used instead of CrsMatrixWrap::fillComplete(), the default view is updated when getColMap() is called.
628  void updateDefaultView() const {
629  if ((finalDefaultView_ == false) && matrixData_->isFillComplete() ) {
630  // Update default view with the colMap
632  finalDefaultView_ = true;
633  }
634  }
635  // The boolean finalDefaultView_ keep track of the status of the default view (= already updated or not)
636  // See also CrsMatrixWrap::updateDefaultView()
637  mutable bool finalDefaultView_;
638 
639 
641 
642 }; //class Matrix
643 
644 } //namespace Xpetra
645 
646 #define XPETRA_CRSMATRIXWRAP_SHORT
647 #endif //XPETRA_CRSMATRIXWRAP_DECL_HPP
648 
649 //NOTE: if CrsMatrix and VbrMatrix share a common interface for fillComplete() etc, I can move some stuff in Xpetra_Matrix.hpp
650 //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.
void doExport(const Matrix &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
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.
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)
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.
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...
void doImport(const Matrix &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
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.
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(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...
void CreateView(viewLabel_t viewLabel, const RCP< const Map > &rowMap, const RCP< const Map > &colMap)
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row idices.
void doExport(const Matrix &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
viewLabel_t currentViewLabel_
void doImport(const Matrix &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
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 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 apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, 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 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