Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_TpetraCrsMatrix_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Xpetra: A linear algebra interface package
4 //
5 // Copyright 2012 NTESS and the Xpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef XPETRA_TPETRACRSMATRIX_DECL_HPP
11 #define XPETRA_TPETRACRSMATRIX_DECL_HPP
12 
13 /* this file is automatically generated - do not edit (see scripts/tpetra.py) */
14 
15 // FIXME (mfh 03 Sep 2014) The above is probably not true anymore.
16 // Furthermore, I don't think anyone maintains the scripts.
17 // Feel free to correct this comment if I'm wrong.
18 
20 
21 #include "Tpetra_CrsMatrix.hpp"
22 #include "Tpetra_FECrsMatrix.hpp"
23 #include "Tpetra_replaceDiagonalCrsMatrix.hpp"
24 
25 #include "Xpetra_CrsMatrix.hpp"
31 #include "Xpetra_TpetraCrsGraph.hpp"
32 #include "Xpetra_Exceptions.hpp"
33 
34 namespace Xpetra {
35 
36 template <class Scalar,
37  class LocalOrdinal,
38  class GlobalOrdinal,
39  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
41  : public CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> //, public TpetraRowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
42 {
43 #undef XPETRA_TPETRACRSMATRIX_SHORT
45 
46  // The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
51 
52  // The following typedefs are used by the Kokkos interface
53 #ifdef HAVE_XPETRA_TPETRA
55 #endif
56 
57  public:
59 
60 
62  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null);
63 
65  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null);
66 
68  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null);
69 
71  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null);
72 
74  TpetraCrsMatrix(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>> &graph, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null);
75 
77  TpetraCrsMatrix(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>> &graph, typename Xpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::local_matrix_type::values_type &values, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null);
78 
80  TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix> &sourceMatrix,
82  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
83  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
84  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null);
85 
87  TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix> &sourceMatrix,
89  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
90  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
91  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null);
92 
94  TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix> &sourceMatrix,
96  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> DomainImporter,
97  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap,
98  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
99  const Teuchos::RCP<Teuchos::ParameterList> &params);
100 
102  TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix> &sourceMatrix,
104  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> DomainExporter,
105  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap,
106  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
107  const Teuchos::RCP<Teuchos::ParameterList> &params);
108 
109 #ifdef HAVE_XPETRA_TPETRA
110  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap,
131  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
132  const local_matrix_type &lclMatrix,
133  const Teuchos::RCP<Teuchos::ParameterList> &params = null);
134 
137  const local_matrix_type &lclMatrix,
138  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap,
139  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
140  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
141  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
142  const Teuchos::RCP<Teuchos::ParameterList> &params = null);
143 
146  const local_matrix_type &lclMatrix,
147  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap,
148  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
149  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap,
150  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
151  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &importer,
152  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> &exporter,
153  const Teuchos::RCP<Teuchos::ParameterList> &params = null);
154 #endif
155 
157  virtual ~TpetraCrsMatrix();
158 
160 
162 
163 
165  void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &cols, const ArrayView<const Scalar> &vals);
166 
168  void insertLocalValues(LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &cols, const ArrayView<const Scalar> &vals);
169 
171  void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &cols, const ArrayView<const Scalar> &vals);
172 
174  void
175  replaceLocalValues(LocalOrdinal localRow,
176  const ArrayView<const LocalOrdinal> &cols,
177  const ArrayView<const Scalar> &vals);
178 
180  void setAllToScalar(const Scalar &alpha);
181 
183  void scale(const Scalar &alpha);
184 
186  //** \warning This is an expert-only routine and should not be called from user code. */
187  void allocateAllValues(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind, ArrayRCP<Scalar> &values);
188 
190  void setAllValues(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind, const ArrayRCP<Scalar> &values);
191 
193  void getAllValues(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind, ArrayRCP<const Scalar> &values) const;
194 
196  void getAllValues(ArrayRCP<Scalar> &values);
197 
198  bool haveGlobalConstants() const;
199 
201 
203 
204 
206  void resumeFill(const RCP<ParameterList> &params = null);
207 
209  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap, const RCP<ParameterList> &params = null);
210 
212  void fillComplete(const RCP<ParameterList> &params = null);
213 
215  void replaceDomainMapAndImporter(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &newDomainMap, Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &newImporter);
216 
218  void expertStaticFillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap,
219  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
220  const RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &importer = Teuchos::null,
221  const RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> &exporter = Teuchos::null,
222  const RCP<ParameterList> &params = Teuchos::null);
223 
225 
227 
228 
230  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRowMap() const;
231 
233  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getColMap() const;
234 
236  RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>> getCrsGraph() const;
237 
240 
243 
245  size_t getLocalNumRows() const;
246 
248  size_t getLocalNumCols() const;
249 
252 
254  size_t getLocalNumEntries() const;
255 
257  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const;
258 
260  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const;
261 
263  size_t getGlobalMaxNumRowEntries() const;
264 
266  size_t getLocalMaxNumRowEntries() const;
267 
269  bool isLocallyIndexed() const;
270 
272  bool isGloballyIndexed() const;
273 
275  bool isFillComplete() const;
276 
278  bool isFillActive() const;
279 
281  typename ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const;
282 
284  bool supportsRowViews() const;
285 
287  void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView<LocalOrdinal> &Indices, const ArrayView<Scalar> &Values, size_t &NumEntries) const;
288 
290  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &indices, ArrayView<const Scalar> &values) const;
291 
293  void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView<GlobalOrdinal> &indices, const ArrayView<Scalar> &values, size_t &numEntries) const;
294 
296  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices, ArrayView<const Scalar> &values) const;
297 
299 
301 
302 
304  void apply(const MultiVector &X, MultiVector &Y, Teuchos::ETransp mode = Teuchos::NO_TRANS, Scalar alpha = ScalarTraits<Scalar>::one(), Scalar beta = ScalarTraits<Scalar>::zero()) const;
305 
307  void apply(const MultiVector &X, MultiVector &Y, Teuchos::ETransp mode, Scalar alpha, Scalar beta, bool sumInterfaceValues, const RCP<Xpetra::Import<LocalOrdinal, GlobalOrdinal, Node>> &regionInterfaceImporter, const Teuchos::ArrayRCP<LocalOrdinal> &regionInterfaceLIDs) const;
308 
310  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getDomainMap() const;
311 
313  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRangeMap() const;
314 
316 
318 
319 
321  std::string description() const;
322 
324  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const;
325 
327 
329 
330  void setObjectLabel(const std::string &objectLabel);
332 
334  TpetraCrsMatrix(const TpetraCrsMatrix &matrix);
335 
337  void getLocalDiagCopy(Vector &diag) const;
338 
340  void getLocalDiagOffsets(Teuchos::ArrayRCP<size_t> &offsets) const;
341 
343  void getLocalDiagCopy(Vector &diag, const Teuchos::ArrayView<const size_t> &offsets) const;
344 
346  void getLocalDiagCopy(Vector &diag, const Kokkos::View<const size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets) const;
347 
349  void replaceDiag(const Vector &diag);
350 
352  void leftScale(const Vector &x);
353 
355  void rightScale(const Vector &x);
356 
358  //{@
359 
361  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getMap() const;
362 
366 
370 
374 
378 
379  void removeEmptyProcessesInPlace(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &newMap);
380 
381  // @}
383 
384 
386  bool hasMatrix() const;
387 
389  TpetraCrsMatrix(const Teuchos::RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> &mtx);
390 
392  RCP<const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getTpetra_CrsMatrix() const;
393 
395  RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getTpetra_CrsMatrixNonConst() const; // TODO: remove
396 
397 #ifdef HAVE_XPETRA_TPETRA
398  typename local_matrix_type::HostMirror getLocalMatrixHost() const {
400  return getTpetra_CrsMatrixNonConst()->getLocalMatrixHost();
401  }
404  return getTpetra_CrsMatrixNonConst()->getLocalMatrixDevice();
405  }
406 
407  void setAllValues(const typename local_matrix_type::row_map_type &ptr,
408  const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type &ind,
409  const typename local_matrix_type::values_type &val) {
410  getTpetra_CrsMatrixNonConst()->setAllValues(ptr, ind, val);
411  }
412 #endif
413 
415  LocalOrdinal GetStorageBlockSize() const { return 1; }
416 
418  void residual(const MultiVector &X,
419  const MultiVector &B,
420  MultiVector &R) const;
421 
423 
424  private:
425  RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> mtx_;
426 }; // TpetraCrsMatrix class
427 
428 #ifdef HAVE_XPETRA_EPETRA
429 
430 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
431  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
432 
433 // specialization of TpetraCrsMatrix for GO=LO=int
434 template <class Scalar>
435 class TpetraCrsMatrix<Scalar, int, int, EpetraNode>
436  : public CrsMatrix<Scalar, int, int, EpetraNode> //, public TpetraRowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
437 {
438  typedef int LocalOrdinal;
439  typedef int GlobalOrdinal;
440  typedef EpetraNode Node;
441  // The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
446 
447  // The following typedefs are used by the Kokkos interface
448 #ifdef HAVE_XPETRA_TPETRA
450 #endif
451 
452  public:
454 
455 
457  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
459  }
460 
462  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
464  }
465 
467  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
469  }
470 
472  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
474  }
475 
477  TpetraCrsMatrix(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>> &graph, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
479  }
480 
484  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
485  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
486  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
488  }
489 
493  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
494  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
495  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
497  }
498 
502  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> DomainImporter,
503  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap,
504  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
505  const Teuchos::RCP<Teuchos::ParameterList> &params) {
507  }
508 
512  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> DomainExporter,
513  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap,
514  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
515  const Teuchos::RCP<Teuchos::ParameterList> &params) {
517  }
518 
519 #ifdef HAVE_XPETRA_TPETRA
520  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap,
541  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
542  const local_matrix_type &lclMatrix,
543  const Teuchos::RCP<Teuchos::ParameterList> &params = null) {
544  XPETRA_TPETRA_ETI_EXCEPTION(typeid(TpetraCrsMatrix<Scalar, int, int, EpetraNode>).name(), "TpetraCrsMatrix<int,int>", "int", typeid(EpetraNode).name());
545  }
546 
549  const local_matrix_type &lclMatrix,
550  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap,
551  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
552  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
553  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
554  const Teuchos::RCP<Teuchos::ParameterList> &params = null) {
555  XPETRA_TPETRA_ETI_EXCEPTION(typeid(TpetraCrsMatrix<Scalar, int, int, EpetraNode>).name(), "TpetraCrsMatrix<int,int>", "int", typeid(EpetraNode).name());
556  }
557 #endif
558 
560  virtual ~TpetraCrsMatrix() {}
561 
563 
565 
566 
568  void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &cols, const ArrayView<const Scalar> &vals) {}
569 
571  void insertLocalValues(LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &cols, const ArrayView<const Scalar> &vals) {}
572 
574  void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &cols, const ArrayView<const Scalar> &vals) {}
575 
577  void
579  const ArrayView<const LocalOrdinal> &cols,
580  const ArrayView<const Scalar> &vals) {}
581 
583  void setAllToScalar(const Scalar &alpha) {}
584 
586  void scale(const Scalar &alpha) {}
587 
589  //** \warning This is an expert-only routine and should not be called from user code. */
590  void allocateAllValues(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind, ArrayRCP<Scalar> &values) {}
591 
593  void setAllValues(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind, const ArrayRCP<Scalar> &values) {}
594 
596  void getAllValues(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind, ArrayRCP<const Scalar> &values) const {}
597 
599  void getAllValues(ArrayRCP<Scalar> &values) {}
600 
601  bool haveGlobalConstants() const { return false; }
602 
604 
606 
607 
609  void resumeFill(const RCP<ParameterList> &params = null) {}
610 
612  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap, const RCP<ParameterList> &params = null) {}
613 
615  void fillComplete(const RCP<ParameterList> &params = null) {}
616 
618  void replaceDomainMapAndImporter(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &newDomainMap, Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &newImporter) {}
619 
622  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
623  const RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &importer = Teuchos::null,
624  const RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> &exporter = Teuchos::null,
625  const RCP<ParameterList> &params = Teuchos::null) {}
626 
628 
630 
631 
633  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRowMap() const { return Teuchos::null; }
634 
636  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getColMap() const { return Teuchos::null; }
637 
639  RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>> getCrsGraph() const { return Teuchos::null; }
640 
642  global_size_t getGlobalNumRows() const { return 0; }
643 
645  global_size_t getGlobalNumCols() const { return 0; }
646 
648  size_t getLocalNumRows() const { return 0; }
649 
651  size_t getLocalNumCols() const { return 0; }
652 
654  global_size_t getGlobalNumEntries() const { return 0; }
655 
657  size_t getLocalNumEntries() const { return 0; }
658 
660  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
661 
663  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
664 
666  size_t getGlobalMaxNumRowEntries() const { return 0; }
667 
669  size_t getLocalMaxNumRowEntries() const { return 0; }
670 
672  bool isLocallyIndexed() const { return false; }
673 
675  bool isGloballyIndexed() const { return false; }
676 
678  bool isFillComplete() const { return false; }
679 
681  bool isFillActive() const { return false; }
682 
684  typename ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const { return ScalarTraits<Scalar>::magnitude(ScalarTraits<Scalar>::zero()); }
685 
687  bool supportsRowViews() const { return false; }
688 
690  void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView<LocalOrdinal> &Indices, const ArrayView<Scalar> &Values, size_t &NumEntries) const {}
691 
693  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &indices, ArrayView<const Scalar> &values) const {}
694 
696  void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView<GlobalOrdinal> &indices, const ArrayView<Scalar> &values, size_t &numEntries) const {}
697 
699  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices, ArrayView<const Scalar> &values) const {}
700 
702 
704 
705 
707  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 {}
708 
710  void apply(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &X, MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &Y, Teuchos::ETransp mode, Scalar alpha, Scalar beta, bool sumInterfaceValues, const RCP<Xpetra::Import<LocalOrdinal, GlobalOrdinal, Node>> &regionInterfaceImporter, const Teuchos::ArrayRCP<LocalOrdinal> &regionInterfaceLIDs) const {}
711 
713  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getDomainMap() const { return Teuchos::null; }
714 
716  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRangeMap() const { return Teuchos::null; }
717 
719 
721 
722 
724  std::string description() const { return std::string(""); }
725 
727  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
728 
730 
732 
733  void setObjectLabel(const std::string &objectLabel) {}
735 
738 
741 
743  void getLocalDiagOffsets(Teuchos::ArrayRCP<size_t> &offsets) const {}
744 
746  void getLocalDiagCopy(Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &diag, const Teuchos::ArrayView<const size_t> &offsets) const {}
747 
750 
753 
756 
758  //{@
759 
761  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getMap() const { return Teuchos::null; }
762 
766 
770 
774 
778 
779  void removeEmptyProcessesInPlace(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &newMap) {}
780 
781  // @}
783 
784 
786  bool hasMatrix() const { return false; }
787 
789  TpetraCrsMatrix(const Teuchos::RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> &mtx) {
791  }
792 
794  RCP<const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getTpetra_CrsMatrix() const { return Teuchos::null; }
795 
797  RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getTpetra_CrsMatrixNonConst() const { return Teuchos::null; } // TODO: remove
798 
799 #ifdef HAVE_XPETRA_TPETRA
800  local_matrix_type getLocalMatrix() const {
802  TEUCHOS_UNREACHABLE_RETURN(local_matrix_type());
803  }
804 
805  void setAllValues(const typename local_matrix_type::row_map_type &ptr,
806  const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type &ind,
807  const typename local_matrix_type::values_type &val) {}
808 #endif
809 
811  LocalOrdinal GetStorageBlockSize() const { return 1; }
812 
817 
819 }; // TpetraCrsMatrix class (specialization for GO=int, NO=EpetraNode)
820 #endif
821 
822 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
823  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
824 
825 // specialization of TpetraCrsMatrix for GO=long long, NO=EpetraNode
826 template <class Scalar>
827 class TpetraCrsMatrix<Scalar, int, long long, EpetraNode>
828  : public CrsMatrix<Scalar, int, long long, EpetraNode> //, public TpetraRowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
829 {
830  typedef int LocalOrdinal;
831  typedef long long GlobalOrdinal;
832  typedef EpetraNode Node;
833  // The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
838 
839  // The following typedefs are used by the Kokkos interface
840 #ifdef HAVE_XPETRA_TPETRA
842 #endif
843 
844  public:
846 
847 
849  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
851  }
852 
854  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
856  }
857 
859  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
861  }
862 
864  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
866  }
867 
869  TpetraCrsMatrix(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>> &graph, const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
871  }
872 
876  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
877  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
878  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
880  }
881 
885  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
886  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
887  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
889  }
890 
894  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> DomainImporter,
895  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap,
896  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
897  const Teuchos::RCP<Teuchos::ParameterList> &params) {
899  }
900 
904  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> DomainExporter,
905  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap,
906  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
907  const Teuchos::RCP<Teuchos::ParameterList> &params) {
909  }
910 
911 #ifdef HAVE_XPETRA_TPETRA
912  TpetraCrsMatrix(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap,
933  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
934  const local_matrix_type &lclMatrix,
935  const Teuchos::RCP<Teuchos::ParameterList> &params = null) {
937  }
938 
941  const local_matrix_type &lclMatrix,
942  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap,
943  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
944  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
945  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
946  const Teuchos::RCP<Teuchos::ParameterList> &params = null) {
948  }
949 #endif
950 
952  virtual ~TpetraCrsMatrix() {}
953 
955 
957 
958 
960  void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &cols, const ArrayView<const Scalar> &vals) {}
961 
963  void insertLocalValues(LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &cols, const ArrayView<const Scalar> &vals) {}
964 
966  void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &cols, const ArrayView<const Scalar> &vals) {}
967 
969  void
971  const ArrayView<const LocalOrdinal> &cols,
972  const ArrayView<const Scalar> &vals) {}
973 
975  void setAllToScalar(const Scalar &alpha) {}
976 
978  void scale(const Scalar &alpha) {}
979 
981  //** \warning This is an expert-only routine and should not be called from user code. */
982  void allocateAllValues(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind, ArrayRCP<Scalar> &values) {}
983 
985  void setAllValues(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind, const ArrayRCP<Scalar> &values) {}
986 
988  void getAllValues(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind, ArrayRCP<const Scalar> &values) const {}
989 
991  void getAllValues(ArrayRCP<Scalar> &values) {}
992 
993  bool haveGlobalConstants() const { return false; }
994 
996 
998 
999 
1001  void resumeFill(const RCP<ParameterList> &params = null) {}
1002 
1004  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap, const RCP<ParameterList> &params = null) {}
1005 
1007  void fillComplete(const RCP<ParameterList> &params = null) {}
1008 
1010  void replaceDomainMapAndImporter(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &newDomainMap, Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &newImporter) {}
1011 
1014  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
1015  const RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &importer = Teuchos::null,
1016  const RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> &exporter = Teuchos::null,
1017  const RCP<ParameterList> &params = Teuchos::null) {}
1018 
1020 
1022 
1023 
1025  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRowMap() const { return Teuchos::null; }
1026 
1028  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getColMap() const { return Teuchos::null; }
1029 
1031  RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>> getCrsGraph() const { return Teuchos::null; }
1032 
1034  global_size_t getGlobalNumRows() const { return 0; }
1035 
1037  global_size_t getGlobalNumCols() const { return 0; }
1038 
1040  size_t getLocalNumRows() const { return 0; }
1041 
1043  size_t getLocalNumCols() const { return 0; }
1044 
1046  global_size_t getGlobalNumEntries() const { return 0; }
1047 
1049  size_t getLocalNumEntries() const { return 0; }
1050 
1052  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
1053 
1055  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
1056 
1058  size_t getGlobalMaxNumRowEntries() const { return 0; }
1059 
1061  size_t getLocalMaxNumRowEntries() const { return 0; }
1062 
1064  bool isLocallyIndexed() const { return false; }
1065 
1067  bool isGloballyIndexed() const { return false; }
1068 
1070  bool isFillComplete() const { return false; }
1071 
1073  bool isFillActive() const { return false; }
1074 
1076  typename ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const { return ScalarTraits<Scalar>::magnitude(ScalarTraits<Scalar>::zero()); }
1077 
1079  bool supportsRowViews() const { return false; }
1080 
1082  void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView<LocalOrdinal> &Indices, const ArrayView<Scalar> &Values, size_t &NumEntries) const {}
1083 
1085  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &indices, ArrayView<const Scalar> &values) const {}
1086 
1088  void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView<GlobalOrdinal> &indices, const ArrayView<Scalar> &values, size_t &numEntries) const {}
1089 
1091  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices, ArrayView<const Scalar> &values) const {}
1092 
1094 
1096 
1097 
1099  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 {}
1100 
1102  void apply(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &X, MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &Y, Teuchos::ETransp mode, Scalar alpha, Scalar beta, bool sumInterfaceValues, const RCP<Xpetra::Import<LocalOrdinal, GlobalOrdinal, Node>> &regionInterfaceImporter, const Teuchos::ArrayRCP<LocalOrdinal> &regionInterfaceLIDs) const {}
1103 
1105  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getDomainMap() const { return Teuchos::null; }
1106 
1108  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRangeMap() const { return Teuchos::null; }
1109 
1111 
1113 
1114 
1116  std::string description() const { return std::string(""); }
1117 
1119  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
1120 
1122 
1124 
1125  void setObjectLabel(const std::string &objectLabel) {}
1127 
1130 
1133 
1135  void getLocalDiagOffsets(Teuchos::ArrayRCP<size_t> &offsets) const {}
1136 
1138  void getLocalDiagCopy(Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &diag, const Teuchos::ArrayView<const size_t> &offsets) const {}
1139 
1142 
1145 
1148 
1150  //{@
1151 
1153  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getMap() const { return Teuchos::null; }
1154 
1158 
1162 
1166 
1170 
1171  void removeEmptyProcessesInPlace(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &newMap) {}
1172 
1173  // @}
1175 
1176 
1178  bool hasMatrix() const { return false; }
1179 
1181  TpetraCrsMatrix(const Teuchos::RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> &mtx) {
1183  }
1184 
1186  RCP<const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getTpetra_CrsMatrix() const { return Teuchos::null; }
1187 
1189  RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getTpetra_CrsMatrixNonConst() const { return Teuchos::null; } // TODO: remove
1190 
1191 #ifdef HAVE_XPETRA_TPETRA
1192  local_matrix_type getLocalMatrix() const {
1194  TEUCHOS_UNREACHABLE_RETURN(local_matrix_type());
1195  }
1196 
1198  typename local_matrix_type::HostMirror getLocalMatrixHost() const {
1199  TEUCHOS_UNREACHABLE_RETURN(typename local_matrix_type::HostMirror());
1200  }
1203  TEUCHOS_UNREACHABLE_RETURN(local_matrix_type());
1204  }
1205 
1206  void setAllValues(const typename local_matrix_type::row_map_type &ptr,
1207  const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type &ind,
1208  const typename local_matrix_type::values_type &val) {}
1209 #endif
1210 
1212  LocalOrdinal GetStorageBlockSize() const { return 1; }
1213 
1218 
1220 }; // TpetraCrsMatrix class (specialization for GO=long long, NO=EpetraNode)
1221 #endif
1222 
1223 #endif // HAVE_XPETRA_EPETRA
1224 
1225 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
1226 Teuchos::RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
1228  return Teuchos::rcp_dynamic_cast<Xpetra::TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(A, true)->getTpetra_CrsMatrixNonConst();
1229 }
1230 
1231 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
1232 Teuchos::RCP<const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
1234  return Teuchos::rcp_dynamic_cast<const Xpetra::TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(A, true)->getTpetra_CrsMatrix();
1235 }
1236 
1237 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
1238 Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> &
1240  return *dynamic_cast<Xpetra::TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> &>(A).getTpetra_CrsMatrixNonConst();
1241 }
1242 
1243 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
1244 Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> &
1246  return *dynamic_cast<const Xpetra::TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> &>(A).getTpetra_CrsMatrix();
1247 }
1248 
1249 } // namespace Xpetra
1250 
1251 #define XPETRA_TPETRACRSMATRIX_SHORT
1252 #endif // XPETRA_TPETRACRSMATRIX_DECL_HPP
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
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...
LocalOrdinal GetStorageBlockSize() const
Returns the block size of the storage mechanism, which is usually 1, except for Tpetra::BlockCrsMatri...
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
void replaceDiag(const Vector &diag)
Replace the diagonal entries of the matrix.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
RCP< Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsMatrixNonConst() const
Get the underlying Tpetra matrix.
std::string description() const
A simple one-line description of this object.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type local_matrix_type
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
void leftScale(const Vector &x)
Left scale operator with given vector values.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using local IDs.
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &newImporter)
Replaces the current domainMap and importer with the user-specified objects.
LocalOrdinal GetStorageBlockSize() const
Returns the block size of the storage mechanism, which is usually 1, except for Tpetra::BlockCrsMatri...
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y...
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using global IDs.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
TpetraCrsMatrix(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor for a fused export.
RCP< Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > mtx_
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> &exporter=Teuchos::null, const RCP< ParameterList > &params=Teuchos::null)
Expert static fill complete.
TpetraImport< LocalOrdinal, GlobalOrdinal, Node > TpetraImportClass
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the 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.
void getAllValues(ArrayRCP< Scalar > &values)
Gets the 1D pointer arrays of the graph.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the (locally owned) global row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying fixed number of entries for each row.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row idices.
TpetraCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraCrsMatrixClass
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.
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph.
void setAllValues(const typename local_matrix_type::row_map_type &ptr, const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type &ind, const typename local_matrix_type::values_type &val)
size_t getLocalNumRows() const
Returns the number of matrix rows owned on the calling node.
size_t getLocalNumEntries() const
Returns the local number of entries in this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y...
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Right scale operator with given vector values.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using local IDs.
void resumeFill(const RCP< ParameterList > &params=null)
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using local IDs.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
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.
TpetraExport< LocalOrdinal, GlobalOrdinal, Node > TpetraExportClass
void setObjectLabel(const std::string &objectLabel)
local_matrix_type::HostMirror getLocalMatrixHost() const
Access the local Kokkos::CrsMatrix data.
TpetraCrsMatrix(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor for a fused export.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &newMap)
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage...
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
void getAllValues(ArrayRCP< Scalar > &values)
Gets the 1D pointer arrays of the graph.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &newMap)
local_matrix_type::HostMirror getLocalMatrixHost() const
Access the local Kokkos::CrsMatrix data.
local_matrix_type getLocalMatrixDevice() const
Access the local Kokkos::CrsMatrix data.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
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.
void getLocalDiagCopy(Vector &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Left scale operator with given vector values.
std::string description() const
A simple one-line description of this object.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph.
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix. ...
TpetraCrsMatrix(const Teuchos::RCP< Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &mtx)
TpetraCrsMatrix constructor to wrap a Tpetra::CrsMatrix object.
TpetraCrsMatrix(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, 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 > &params=Teuchos::null)
Constructor for a fused export.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
TpetraCrsMatrix(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &graph, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a previously constructed graph.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type local_matrix_type
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
TpetraCrsMatrix(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &graph, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a previously constructed graph.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
std::string description() const
A simple one-line description of this object.
local_matrix_type getLocalMatrixDevice() const
Access the local Kokkos::CrsMatrix data.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying fixed number of entries for each row.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode, Scalar alpha, Scalar beta, bool sumInterfaceValues, const RCP< Xpetra::Import< LocalOrdinal, GlobalOrdinal, Node >> &regionInterfaceImporter, const Teuchos::ArrayRCP< LocalOrdinal > &regionInterfaceLIDs) const
Computes the matrix-multivector multiplication for region layout matrices.
TpetraCrsMatrix(const Teuchos::RCP< Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &mtx)
TpetraCrsMatrix constructor to wrap a Tpetra::CrsMatrix object.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void residual(const MultiVector &X, const MultiVector &B, MultiVector &R) const
Compute a residual R = B - (*this) * X.
size_t getLocalNumRows() const
Returns the number of matrix rows owned on the calling node.
TpetraCrsMatrix(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> DomainImporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor for a fused import.
RCP< const Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsMatrix() const
Get the underlying Tpetra matrix.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying fixed number of entries for each row.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
void setAllValues(const typename local_matrix_type::row_map_type &ptr, const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type &ind, const typename local_matrix_type::values_type &val)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> &exporter=Teuchos::null, const RCP< ParameterList > &params=Teuchos::null)
Expert static fill complete.
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
TpetraCrsMatrix(const local_matrix_type &lclMatrix, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, 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 > &params=null)
Constructor specifying local matrix and 4 maps.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the (locally owned) global row.
TpetraExport< LocalOrdinal, GlobalOrdinal, Node > TpetraExportClass
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with 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.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
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...
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
TpetraCrsMatrix(const local_matrix_type &lclMatrix, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, 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 > &params=null)
Constructor specifying local matrix and 4 maps.
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 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 getLocalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
TpetraCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraCrsMatrixClass
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
size_t getLocalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
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 resumeFill(const RCP< ParameterList > &params=null)
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.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
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.
TpetraCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraCrsMatrixClass
size_t global_size_t
Global size_t object.
TpetraVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraVectorClass
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
TpetraCrsMatrix(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, 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 > &params=Teuchos::null)
Constructor for a fused export.
virtual ~TpetraCrsMatrix()
Destructor.
TpetraVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraVectorClass
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y...
TpetraCrsMatrix(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> DomainImporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor for a fused import.
bool hasMatrix() const
Does this have an underlying matrix.
TpetraCrsMatrix(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, 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 > &params=Teuchos::null)
Constructor for a fused import.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
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...
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
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 setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph.
size_t getLocalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
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.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using global IDs.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &newImporter)
Replaces the current domainMap and importer with the user-specified objects.
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Right scale operator with given vector values.
RCP< const Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsMatrix() const
Get the underlying Tpetra matrix.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph.
bool hasMatrix() const
Does this have an underlying matrix.
void apply(const MultiVector &X, MultiVector &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
Computes the sparse matrix-multivector multiplication.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the (locally owned) global row.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
RCP< Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsMatrixNonConst() const
Get the underlying Tpetra matrix.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode, Scalar alpha, Scalar beta, bool sumInterfaceValues, const RCP< Xpetra::Import< LocalOrdinal, GlobalOrdinal, Node >> &regionInterfaceImporter, const Teuchos::ArrayRCP< LocalOrdinal > &regionInterfaceLIDs) const
Computes the matrix-multivector multiplication for region layout matrices.
size_t getLocalNumRows() const
Returns the number of matrix rows owned on the calling node.
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries of the matrix.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &newImporter)
Replaces the current domainMap and importer with the user-specified objects.
bool hasMatrix() const
Does this have an underlying matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
TpetraImport< LocalOrdinal, GlobalOrdinal, Node > TpetraImportClass
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
CombineMode
Xpetra::Combine Mode enumerable type.
TpetraCrsMatrix(const TpetraCrsMatrix &matrix)
Deep copy constructor.
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.
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix. ...
RCP< const Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsMatrix() const
Get the underlying Tpetra matrix.
size_t getLocalNumEntries() const
Returns the local number of entries in this matrix.
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 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.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using global IDs.
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
KokkosSparse::CrsMatrix< impl_scalar_type, LocalOrdinal, execution_space, void, typename local_graph_type::size_type > local_matrix_type
The specialization of Kokkos::CrsMatrix that represents the part of the sparse matrix on each MPI pro...
void setAllValues(const typename local_matrix_type::row_map_type &ptr, const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type &ind, const typename local_matrix_type::values_type &val)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Left scale operator with given vector values.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
TpetraExport< LocalOrdinal, GlobalOrdinal, Node > TpetraExportClass
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &newMap)
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries of the matrix.
bool isFillActive() const
Returns true if the matrix is in edit mode.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
LocalOrdinal GetStorageBlockSize() const
Returns the block size of the storage mechanism, which is usually 1, except for Tpetra::BlockCrsMatri...
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix. ...
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
bool isFillActive() const
Returns true if the matrix is in edit mode.
TpetraCrsMatrix(const TpetraCrsMatrix &matrix)
Deep copy constructor.
RCP< Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsMatrixNonConst() const
Get the underlying Tpetra matrix.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
TpetraImport< LocalOrdinal, GlobalOrdinal, Node > TpetraImportClass
TpetraCrsMatrix(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, 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 > &params=Teuchos::null)
Constructor for a fused import.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage...
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage...
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
size_t getLocalNumEntries() const
Returns the local number of entries in this matrix.
bool isFillActive() const
Returns true if the matrix is in edit mode.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> &exporter=Teuchos::null, const RCP< ParameterList > &params=Teuchos::null)
Expert static fill complete.
void rightScale(const Vector &x)
Right scale operator with given vector values.
Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type local_matrix_type
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
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.