Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_Matrix.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_MATRIX_HPP
50#define XPETRA_MATRIX_HPP
51
52#include <KokkosCompat_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#include "Xpetra_MatrixView.hpp"
62#include "Xpetra_Operator.hpp"
63#include "Xpetra_StridedMap.hpp"
64#include "Xpetra_StridedMapFactory.hpp"
65
67#include <Teuchos_Hashtable.hpp>
68
73namespace Xpetra {
74
91 typedef std::string viewLabel_t;
92
93 template <class Scalar,
94 class LocalOrdinal,
95 class GlobalOrdinal,
97 class Matrix : public Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > {
103
104 public:
105 typedef Scalar scalar_type;
106 typedef LocalOrdinal local_ordinal_type;
107 typedef GlobalOrdinal global_ordinal_type;
108 typedef Node node_type;
109
110#ifdef HAVE_XPETRA_TPETRA
112#endif
113
115
116
117 Matrix() { }
118
120 virtual ~Matrix() { }
121
123
125
126 void CreateView(viewLabel_t viewLabel, const RCP<const Map> & rowMap, const RCP<const Map> & colMap) {
127 TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == true, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.CreateView(): a view labeled '" + viewLabel + "' already exist.");
128 RCP<MatrixView> view = rcp(new MatrixView(rowMap, colMap));
129 operatorViewTable_.put(viewLabel, view);
130 }
131
132 // JG TODO: why this is a member function??
133 void CreateView(const viewLabel_t viewLabel, const RCP<const Matrix>& A, bool transposeA = false, const RCP<const Matrix>& B = Teuchos::null, bool transposeB = false) {
134 RCP<const Map> domainMap = Teuchos::null;
135 RCP<const Map> rangeMap = Teuchos::null;
136
137 const size_t blkSize = 1;
138 std::vector<size_t> stridingInfo(1, blkSize);
139 LocalOrdinal stridedBlockId = -1;
140
141
142 if (A->IsView(viewLabel)) {
143 rangeMap = transposeA ? A->getColMap(viewLabel) : A->getRowMap(viewLabel);
144 domainMap = transposeA ? A->getRowMap(viewLabel) : A->getColMap(viewLabel); // will be overwritten if B != Teuchos::null
145
146 } else {
147 rangeMap = transposeA ? A->getDomainMap() : A->getRangeMap();
148 domainMap = transposeA ? A->getRangeMap() : A->getDomainMap();
149
150 if (viewLabel == "stridedMaps") {
151 rangeMap = Xpetra::StridedMapFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(rangeMap, stridingInfo, stridedBlockId);
152 domainMap = Xpetra::StridedMapFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(domainMap, stridingInfo, stridedBlockId);
153 }
154 }
155
156 if (B != Teuchos::null ) {
157 // B has strided Maps
158
159 if (B->IsView(viewLabel)) {
160 domainMap = transposeB ? B->getRowMap(viewLabel) : B->getColMap(viewLabel);
161
162 } else {
163 domainMap = transposeB ? B->getRangeMap() : B->getDomainMap();
164
165 if (viewLabel == "stridedMaps")
166 domainMap = Xpetra::StridedMapFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(domainMap, stridingInfo, stridedBlockId);
167 }
168 }
169
170
171 if (IsView(viewLabel))
172 RemoveView(viewLabel);
173
174 CreateView(viewLabel, rangeMap, domainMap);
175 }
176
179 int last = out.getOutputToRootOnly();
180 Teuchos::OSTab tab(out);
181 out.setOutputToRootOnly(0);
184 operatorViewTable_.arrayify(viewLabels,viewList);
185 out << "views associated with this operator" << std::endl;
186 for (int i=0; i<viewLabels.size(); ++i)
187 out << viewLabels[i] << std::endl;
188 out.setOutputToRootOnly(last);
189 }
190
191
192 void RemoveView(const viewLabel_t viewLabel) {
193 TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.RemoveView(): view '" + viewLabel + "' does not exist.");
194 TEUCHOS_TEST_FOR_EXCEPTION(viewLabel == GetDefaultViewLabel(), Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.RemoveView(): view '" + viewLabel + "' is the default view and cannot be removed.");
195 operatorViewTable_.remove(viewLabel);
196 }
197
198 const viewLabel_t SwitchToView(const viewLabel_t viewLabel) {
199 TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.SwitchToView(): view '" + viewLabel + "' does not exist.");
200 viewLabel_t oldViewLabel = GetCurrentViewLabel();
201 currentViewLabel_ = viewLabel;
202 return oldViewLabel;
203 }
204
205 bool IsView(const viewLabel_t viewLabel) const {
206 return operatorViewTable_.containsKey(viewLabel);
207 }
208
210
212
214
216
218
219
221
232 virtual void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &cols, const ArrayView<const Scalar> &vals) = 0;
233
235
242 virtual void insertLocalValues(LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &cols, const ArrayView<const Scalar> &vals) = 0;
243
245
250 virtual void replaceGlobalValues(GlobalOrdinal globalRow,
252 const ArrayView<const Scalar> &vals) = 0;
253
255
258 virtual void replaceLocalValues(LocalOrdinal localRow,
260 const ArrayView<const Scalar> &vals) = 0;
261
263 virtual void setAllToScalar(const Scalar &alpha)= 0;
264
266 virtual void scale(const Scalar &alpha)= 0;
267
269
271
272
281 virtual void resumeFill(const RCP< ParameterList > &params=null) = 0;
282
294 virtual void fillComplete(const RCP<const Map> &domainMap, const RCP<const Map> &rangeMap, const RCP<ParameterList> &params = null) =0;
295
309 //TODO : Get ride of "Tpetra"::OptimizeOption
310 virtual void fillComplete(const RCP<ParameterList> &params=null) =0;
311
313
315
316
318 virtual const RCP<const Map> & getRowMap() const { return getRowMap(GetCurrentViewLabel()); }
319
321 virtual const RCP<const Map> & getRowMap(viewLabel_t viewLabel) const {
322 TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.GetRowMap(): view '" + viewLabel + "' does not exist.");
323 return operatorViewTable_.get(viewLabel)->GetRowMap();
324 }
325
328 virtual const RCP<const Map> & getColMap() const { return getColMap(GetCurrentViewLabel()); }
329
331 virtual const RCP<const Map> & getColMap(viewLabel_t viewLabel) const {
332 TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.GetColMap(): view '" + viewLabel + "' does not exist.");
333 return operatorViewTable_.get(viewLabel)->GetColMap();
334 }
335
337
339 virtual global_size_t getGlobalNumRows() const =0;
340
342
344 virtual global_size_t getGlobalNumCols() const =0;
345
347 virtual size_t getLocalNumRows() const =0;
348
351
353 virtual size_t getLocalNumEntries() const =0;
354
356
357 virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const =0;
358
360
361 virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const =0;
362
364
366 virtual size_t getGlobalMaxNumRowEntries() const =0;
367
369
371 virtual size_t getLocalMaxNumRowEntries() const =0;
372
373
375 virtual bool isLocallyIndexed() const =0;
376
378 virtual bool isGloballyIndexed() const =0;
379
381 virtual bool isFillComplete() const =0;
382
384
396 virtual void getLocalRowCopy(LocalOrdinal LocalRow,
397 const ArrayView<LocalOrdinal> &Indices,
398 const ArrayView<Scalar> &Values,
399 size_t &NumEntries
400 ) const =0;
401
403
412 virtual void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &indices, ArrayView<const Scalar> &values) const =0;
413
415
424 virtual void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices, ArrayView<const Scalar> &values) const =0;
425
427
430
433
436
439
440
442 virtual bool haveGlobalConstants() const = 0;
443
444
446
448 //{@
449
452
453 // TODO: first argument of doImport/doExport should be a Xpetra::DistObject
454
456 virtual void doImport(const Matrix &source,
458
460 virtual void doExport(const Matrix &dest,
462
464 virtual void doImport(const Matrix &source,
466
468 virtual void doExport(const Matrix &dest,
470
471 // @}
472
474
475
477
478
480 virtual std::string description() const =0;
481
485
487
488 virtual void setObjectLabel( const std::string &objectLabel ) =0;
490
491 // JG: Added:
492
494 virtual bool hasCrsGraph() const =0;
495
498
499 // To keep the normal virtual matrix-multivector definition of apply before overloading with the region variant
500 using Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >::apply;
501
505 Teuchos::ETransp mode,
506 Scalar alpha,
507 Scalar beta,
508 bool sumInterfaceValues,
509 const RCP<Import<LocalOrdinal, GlobalOrdinal, Node> >& regionInterfaceImporter,
510 const Teuchos::ArrayRCP<LocalOrdinal>& regionInterfaceLIDs ) const =0;
511
512 // ----------------------------------------------------------------------------------
513 // "TEMPORARY" VIEW MECHANISM
520 void SetFixedBlockSize(LocalOrdinal blksize, GlobalOrdinal offset=0) {
521
522 TEUCHOS_TEST_FOR_EXCEPTION(isFillComplete() == false, Exceptions::RuntimeError, "Xpetra::Matrix::SetFixedBlockSize(): operator is not filled and completed."); // TODO: do we need this? we just wanna "copy" the domain and range map
523
524 std::vector<size_t> stridingInfo;
525 stridingInfo.push_back(Teuchos::as<size_t>(blksize));
526 LocalOrdinal stridedBlockId = -1;
527
529 this->getRangeMap(),
530 stridingInfo,
531 stridedBlockId,
532 offset
533 );
535 this->getDomainMap(),
536 stridingInfo,
537 stridedBlockId,
538 offset
539 );
540
541 if(IsFixedBlockSizeSet()) RemoveView("stridedMaps");
542 CreateView("stridedMaps", stridedRangeMap, stridedDomainMap);
543 }
544
545 //==========================================================================
546
547 LocalOrdinal GetFixedBlockSize() const {
548 if(IsFixedBlockSizeSet()) {
549 Teuchos::RCP<const StridedMap<LocalOrdinal, GlobalOrdinal, Node> > rangeMap = Teuchos::rcp_dynamic_cast<const StridedMap<LocalOrdinal, GlobalOrdinal, Node> >(getRowMap("stridedMaps"));
550 Teuchos::RCP<const StridedMap<LocalOrdinal, GlobalOrdinal, Node> > domainMap = Teuchos::rcp_dynamic_cast<const StridedMap<LocalOrdinal, GlobalOrdinal, Node> >(getColMap("stridedMaps"));
551 TEUCHOS_TEST_FOR_EXCEPTION(rangeMap == Teuchos::null, Exceptions::BadCast, "Xpetra::Matrix::GetFixedBlockSize(): rangeMap is not of type StridedMap");
552 TEUCHOS_TEST_FOR_EXCEPTION(domainMap == Teuchos::null, Exceptions::BadCast, "Xpetra::Matrix::GetFixedBlockSize(): domainMap is not of type StridedMap");
553 TEUCHOS_TEST_FOR_EXCEPTION(domainMap->getFixedBlockSize() != rangeMap->getFixedBlockSize(), Exceptions::RuntimeError, "Xpetra::Matrix::GetFixedBlockSize(): block size of rangeMap and domainMap are different.");
554 return Teuchos::as<LocalOrdinal>(domainMap->getFixedBlockSize()); // TODO: why LocalOrdinal?
555 } else
556 //TEUCHOS_TEST_FOR_EXCEPTION(false, Exceptions::RuntimeError, "Xpetra::Matrix::GetFixedBlockSize(): no strided maps available."); // TODO remove this
557 return 1;
558 }; //TODO: why LocalOrdinal?
559
560
562 bool IsFixedBlockSizeSet() const {
563 return IsView("stridedMaps");
564 };
565
566
568 virtual LocalOrdinal GetStorageBlockSize() const = 0;
569
570
571 // ----------------------------------------------------------------------------------
572
573 virtual void SetMaxEigenvalueEstimate(Scalar const &sigma) {
574 operatorViewTable_.get(GetCurrentViewLabel())->SetMaxEigenvalueEstimate(sigma);
575 }
576
577 // ----------------------------------------------------------------------------------
578
579 virtual Scalar GetMaxEigenvalueEstimate() const {
580 return operatorViewTable_.get(GetCurrentViewLabel())->GetMaxEigenvalueEstimate();
581 }
582
583 // ----------------------------------------------------------------------------------
584#ifdef HAVE_XPETRA_TPETRA
586 virtual typename local_matrix_type::HostMirror getLocalMatrixHost () const = 0;
587#else
588#ifdef __GNUC__
589#warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
590#endif
591#endif
592 // ----------------------------------------------------------------------------------
593
598
599 protected:
600 Teuchos::Hashtable<viewLabel_t, RCP<MatrixView> > operatorViewTable_; // hashtable storing the operator views (keys = view names, values = views).
601
602 viewLabel_t defaultViewLabel_; // label of the view associated with inital Matrix construction
603 viewLabel_t currentViewLabel_; // label of the current view
604
605 }; //class Matrix
606
607} //namespace Xpetra
608
609#define XPETRA_MATRIX_SHORT
610#endif //XPETRA_MATRIX_DECL_HPP
size_type size() const
static const EVerbosityLevel verbLevel_default
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
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...
Exception indicating invalid cast attempted.
Exception throws to report errors in the internal logical of the program.
Xpetra-specific matrix class.
virtual global_size_t getGlobalNumEntries() const =0
Returns the global number of entries in this matrix.
virtual bool haveGlobalConstants() const =0
Returns true if globalConstants have been computed; false otherwise.
Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > CrsMatrix
void CreateView(viewLabel_t viewLabel, const RCP< const Map > &rowMap, const RCP< const Map > &colMap)
virtual size_t getGlobalMaxNumRowEntries() const =0
Returns the maximum number of entries across all rows/columns on all nodes.
virtual global_size_t getGlobalNumRows() const =0
Returns the number of global rows in this matrix.
virtual bool hasCrsGraph() const =0
Supports the getCrsGraph() call.
viewLabel_t currentViewLabel_
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > CrsGraph
Xpetra::CrsMatrixFactory< Scalar, LocalOrdinal, GlobalOrdinal, Node > CrsMatrixFactory
virtual const RCP< const Map > & getColMap(viewLabel_t viewLabel) const
Returns the Map that describes the column distribution in this matrix.
void CreateView(const viewLabel_t viewLabel, const RCP< const Matrix > &A, bool transposeA=false, const RCP< const Matrix > &B=Teuchos::null, bool transposeB=false)
LocalOrdinal local_ordinal_type
const viewLabel_t & GetCurrentViewLabel() const
void SetFixedBlockSize(LocalOrdinal blksize, GlobalOrdinal offset=0)
virtual void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)=0
Replace matrix entries, using local IDs.
virtual void resumeFill(const RCP< ParameterList > &params=null)=0
virtual void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const =0
Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calli...
virtual bool isLocallyIndexed() const =0
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
virtual bool isGloballyIndexed() const =0
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
virtual Scalar GetMaxEigenvalueEstimate() const
virtual void doImport(const Matrix &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)=0
Import (using an Exporter).
virtual void SetMaxEigenvalueEstimate(Scalar const &sigma)
Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > Map
virtual bool isFillComplete() const =0
Returns true if fillComplete() has been called and the matrix is in compute mode.
virtual const RCP< const Map > & getColMap() const
Returns the Map that describes the column distribution in this matrix. This might be null until fillC...
virtual void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const =0
Compute a residual R = B - (*this) * X.
virtual void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const =0
Get a copy of the diagonal entries owned by this node, with local row indices.
virtual void setAllToScalar(const Scalar &alpha)=0
Set all matrix entries equal to scalar.
virtual void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)=0
Insert matrix entries, using local IDs.
virtual std::string description() const =0
Return a simple one-line description of this object.
virtual size_t getLocalNumRows() const =0
Returns the number of matrix rows owned on the calling node.
virtual void fillComplete(const RCP< const Map > &domainMap, const RCP< const Map > &rangeMap, const RCP< ParameterList > &params=null)=0
Signal that data entry is complete, specifying domain and range maps.
virtual void doExport(const Matrix &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)=0
Export (using an Importer).
viewLabel_t defaultViewLabel_
virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const =0
Returns the current number of entries on this node in the specified local row.
virtual local_matrix_type::HostMirror getLocalMatrixHost() const =0
bool IsView(const viewLabel_t viewLabel) const
virtual void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const =0
Extract a const, non-persisting view of local indices in a specified row of the matrix.
GlobalOrdinal global_ordinal_type
virtual void fillComplete(const RCP< ParameterList > &params=null)=0
Signal that data entry is complete.
bool IsFixedBlockSizeSet() const
Returns true, if SetFixedBlockSize has been called before.
virtual void setObjectLabel(const std::string &objectLabel)=0
void RemoveView(const viewLabel_t viewLabel)
virtual ~Matrix()
Destructor.
virtual size_t getLocalNumEntries() const =0
Returns the local number of entries in this matrix.
virtual void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const =0
Extract a const, non-persisting view of global indices in a specified row of the matrix.
virtual void doImport(const Matrix &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)=0
Import.
virtual void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)=0
Left scale matrix using the given vector entries.
CrsMatrix::local_matrix_type local_matrix_type
virtual 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< Import< LocalOrdinal, GlobalOrdinal, Node > > &regionInterfaceImporter, const Teuchos::ArrayRCP< LocalOrdinal > &regionInterfaceLIDs) const =0
Computes the matrix-multivector multiplication for region layout matrices.
virtual void doExport(const Matrix &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)=0
Export.
Xpetra::MatrixView< Scalar, LocalOrdinal, GlobalOrdinal, Node > MatrixView
virtual const RCP< const Map > & getRowMap() const
Returns the Map that describes the row distribution in this matrix.
virtual local_matrix_type getLocalMatrixDevice() const =0
virtual void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)=0
Replace matrix entries, using global IDs.
void PrintViews(Teuchos::FancyOStream &out) const
Print all of the views associated with the Matrix.
const viewLabel_t & GetDefaultViewLabel() const
const viewLabel_t SwitchToView(const viewLabel_t viewLabel)
virtual size_t getLocalMaxNumRowEntries() const =0
Returns the maximum number of entries across all rows/columns on this node.
Teuchos::Hashtable< viewLabel_t, RCP< MatrixView > > operatorViewTable_
virtual LocalOrdinal GetStorageBlockSize() const =0
Returns the block size of the storage mechanism, which is usually 1, except for Tpetra::BlockCrsMatri...
virtual RCP< const CrsGraph > getCrsGraph() const =0
Returns the CrsGraph associated with this matrix.
virtual ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const =0
Get Frobenius norm of the matrix.
LocalOrdinal GetFixedBlockSize() const
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const =0
Print the object with some verbosity level to an FancyOStream object.
virtual void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)=0
Right scale matrix using the given vector entries.
virtual const RCP< const Map > & getRowMap(viewLabel_t viewLabel) const
Returns the Map that describes the row distribution in this matrix.
const viewLabel_t SwitchToDefaultView()
virtual global_size_t getGlobalNumCols() const =0
Returns the number of global columns in the matrix.
virtual void scale(const Scalar &alpha)=0
Scale the current values of a matrix, this = alpha*this.
virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const =0
Returns the current number of entries in the specified global row.
virtual const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const =0
Implements DistObject interface.
virtual void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)=0
Insert matrix entries, using global IDs.
virtual Teuchos::RCP< const Map > getRangeMap() const =0
The Map associated with the range of this operator, which must be compatible with Y....
virtual Teuchos::RCP< const Map > getDomainMap() const =0
The Map associated with the domain of this operator, which must be compatible with X....
static RCP< Xpetra::StridedMap< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, std::vector< size_t > &stridingInfo, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalOrdinal stridedBlockId=-1, GlobalOrdinal offset=0, LocalGlobal lg=Xpetra::GloballyDistributed)
Map constructor with Xpetra-defined contiguous uniform distribution.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Xpetra namespace
std::string viewLabel_t
size_t global_size_t
Global size_t object.
CombineMode
Xpetra::Combine Mode enumerable type.