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 <Kokkos_DefaultNode.hpp>
53 
54 #include "Xpetra_ConfigDefs.hpp"
55 #include "Xpetra_Exceptions.hpp"
56 
57 #include "Xpetra_MultiVector.hpp"
58 #include "Xpetra_CrsGraph.hpp"
59 #include "Xpetra_CrsMatrix.hpp"
61 #include "Xpetra_MatrixView.hpp"
62 #include "Xpetra_Operator.hpp"
63 #include "Xpetra_StridedMap.hpp"
65 
67 #include <Teuchos_Hashtable.hpp>
68 
73 namespace Xpetra {
74 
91  typedef std::string viewLabel_t;
92 
93  template <class Scalar = Operator<>::scalar_type,
94  class LocalOrdinal = Operator<>::local_ordinal_type,
95  class GlobalOrdinal = typename Operator<LocalOrdinal>::global_ordinal_type,
97  class Matrix : public Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > {
103 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
104  typedef typename CrsMatrix::local_matrix_type local_matrix_type;
105 #endif
106 
107  public:
108  typedef Scalar scalar_type;
109  typedef LocalOrdinal local_ordinal_type;
110  typedef GlobalOrdinal global_ordinal_type;
111  typedef Node node_type;
112 
114 
115 
116  Matrix() { }
117 
119  virtual ~Matrix() { }
120 
122 
124 
125  void CreateView(viewLabel_t viewLabel, const RCP<const Map> & rowMap, const RCP<const Map> & colMap) {
126  TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == true, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.CreateView(): a view labeled '" + viewLabel + "' already exist.");
127  RCP<MatrixView> view = rcp(new MatrixView(rowMap, colMap));
128  operatorViewTable_.put(viewLabel, view);
129  }
130 
131  // JG TODO: why this is a member function??
132  void CreateView(const viewLabel_t viewLabel, const RCP<const Matrix>& A, bool transposeA = false, const RCP<const Matrix>& B = Teuchos::null, bool transposeB = false) {
133  RCP<const Map> domainMap = Teuchos::null;
134  RCP<const Map> rangeMap = Teuchos::null;
135 
137 
138  const size_t blkSize = 1;
139  std::vector<size_t> stridingInfo(1, blkSize);
140  LocalOrdinal stridedBlockId = -1;
141 
142 
143  if (A->IsView(viewLabel)) {
144  rangeMap = transposeA ? A->getColMap(viewLabel) : A->getRowMap(viewLabel);
145  domainMap = transposeA ? A->getRowMap(viewLabel) : A->getColMap(viewLabel); // will be overwritten if B != Teuchos::null
146 
147  } else {
148  rangeMap = transposeA ? A->getDomainMap() : A->getRangeMap();
149  domainMap = transposeA ? A->getRangeMap() : A->getDomainMap();
150 
151  if (viewLabel == "stridedMaps") {
152  rangeMap = StridedMapFactory::Build(rangeMap, stridingInfo, stridedBlockId);
153  domainMap = StridedMapFactory::Build(domainMap, stridingInfo, stridedBlockId);
154  }
155  }
156 
157  if (B != Teuchos::null ) {
158  // B has strided Maps
159 
160  if (B->IsView(viewLabel)) {
161  domainMap = transposeB ? B->getRowMap(viewLabel) : B->getColMap(viewLabel);
162 
163  } else {
164  domainMap = transposeB ? B->getRangeMap() : B->getDomainMap();
165 
166  if (viewLabel == "stridedMaps")
167  domainMap = StridedMapFactory::Build(domainMap, stridingInfo, stridedBlockId);
168  }
169  }
170 
171 
172  if (IsView(viewLabel))
173  RemoveView(viewLabel);
174 
175  CreateView(viewLabel, rangeMap, domainMap);
176  }
177 
180  int last = out.getOutputToRootOnly();
181  Teuchos::OSTab tab(out);
182  out.setOutputToRootOnly(0);
183  Teuchos::Array<viewLabel_t> viewLabels;
185  operatorViewTable_.arrayify(viewLabels,viewList);
186  out << "views associated with this operator" << std::endl;
187  for (int i=0; i<viewLabels.size(); ++i)
188  out << viewLabels[i] << std::endl;
189  out.setOutputToRootOnly(last);
190  }
191 
192 
193  void RemoveView(const viewLabel_t viewLabel) {
194  TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.RemoveView(): view '" + viewLabel + "' does not exist.");
195  TEUCHOS_TEST_FOR_EXCEPTION(viewLabel == GetDefaultViewLabel(), Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.RemoveView(): view '" + viewLabel + "' is the default view and cannot be removed.");
196  operatorViewTable_.remove(viewLabel);
197  }
198 
199  const viewLabel_t SwitchToView(const viewLabel_t viewLabel) {
200  TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.SwitchToView(): view '" + viewLabel + "' does not exist.");
201  viewLabel_t oldViewLabel = GetCurrentViewLabel();
202  currentViewLabel_ = viewLabel;
203  return oldViewLabel;
204  }
205 
206  bool IsView(const viewLabel_t viewLabel) const {
207  return operatorViewTable_.containsKey(viewLabel);
208  }
209 
210  const viewLabel_t SwitchToDefaultView() { return SwitchToView(GetDefaultViewLabel()); }
211 
212  const viewLabel_t & GetDefaultViewLabel() const { return defaultViewLabel_; }
213 
214  const viewLabel_t & GetCurrentViewLabel() const { return currentViewLabel_; }
215 
217 
219 
220 
222 
233  virtual void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &cols, const ArrayView<const Scalar> &vals) = 0;
234 
236 
243  virtual void insertLocalValues(LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &cols, const ArrayView<const Scalar> &vals) = 0;
244 
246 
251  virtual void replaceGlobalValues(GlobalOrdinal globalRow,
252  const ArrayView<const GlobalOrdinal> &cols,
253  const ArrayView<const Scalar> &vals) = 0;
254 
256 
259  virtual void replaceLocalValues(LocalOrdinal localRow,
260  const ArrayView<const LocalOrdinal> &cols,
261  const ArrayView<const Scalar> &vals) = 0;
262 
264  virtual void setAllToScalar(const Scalar &alpha)= 0;
265 
267  virtual void scale(const Scalar &alpha)= 0;
268 
270 
272 
273 
282  virtual void resumeFill(const RCP< ParameterList > &params=null) = 0;
283 
295  virtual void fillComplete(const RCP<const Map> &domainMap, const RCP<const Map> &rangeMap, const RCP<ParameterList> &params = null) =0;
296 
310  //TODO : Get ride of "Tpetra"::OptimizeOption
311  virtual void fillComplete(const RCP<ParameterList> &params=null) =0;
312 
314 
316 
317 
319  virtual const RCP<const Map> & getRowMap() const { return getRowMap(GetCurrentViewLabel()); }
320 
322  virtual const RCP<const Map> & getRowMap(viewLabel_t viewLabel) const {
323  TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.GetRowMap(): view '" + viewLabel + "' does not exist.");
324  return operatorViewTable_.get(viewLabel)->GetRowMap();
325  }
326 
329  virtual const RCP<const Map> & getColMap() const { return getColMap(GetCurrentViewLabel()); }
330 
332  virtual const RCP<const Map> & getColMap(viewLabel_t viewLabel) const {
333  TEUCHOS_TEST_FOR_EXCEPTION(operatorViewTable_.containsKey(viewLabel) == false, Xpetra::Exceptions::RuntimeError, "Xpetra::Matrix.GetColMap(): view '" + viewLabel + "' does not exist.");
334  return operatorViewTable_.get(viewLabel)->GetColMap();
335  }
336 
338 
340  virtual global_size_t getGlobalNumRows() const =0;
341 
343 
345  virtual global_size_t getGlobalNumCols() const =0;
346 
348  virtual size_t getNodeNumRows() const =0;
349 
351  virtual global_size_t getGlobalNumEntries() const =0;
352 
354  virtual size_t getNodeNumEntries() const =0;
355 
357 
358  virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const =0;
359 
361 
363  virtual global_size_t getGlobalNumDiags() const =0;
364 
366 
368  virtual size_t getNodeNumDiags() const =0;
369 
371 
373  virtual size_t getGlobalMaxNumRowEntries() const =0;
374 
376 
378  virtual size_t getNodeMaxNumRowEntries() const =0;
379 
381  virtual bool isLocallyIndexed() const =0;
382 
384  virtual bool isGloballyIndexed() const =0;
385 
387  virtual bool isFillComplete() const =0;
388 
390 
402  virtual void getLocalRowCopy(LocalOrdinal LocalRow,
403  const ArrayView<LocalOrdinal> &Indices,
404  const ArrayView<Scalar> &Values,
405  size_t &NumEntries
406  ) const =0;
407 
409 
418  virtual void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &indices, ArrayView<const Scalar> &values) const =0;
419 
421 
430  virtual void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices, ArrayView<const Scalar> &values) const =0;
431 
433 
436 
438  virtual typename ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const = 0;
439 
441 
443 
444 
446 
455  //TODO virtual=0 // TODO: Add default parameters ?
456 // virtual void multiply(const MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> & X, MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y, Teuchos::ETransp trans, Scalar alpha, Scalar beta) const=0;
457 
459 
461  //{@
462 
465 
466  // TODO: first argument of doImport/doExport should be a Xpetra::DistObject
467 
469  virtual void doImport(const Matrix &source,
471 
473  virtual void doExport(const Matrix &dest,
475 
477  virtual void doImport(const Matrix &source,
479 
481  virtual void doExport(const Matrix &dest,
483 
484  // @}
485 
487 
488 
489  // TODO: describe of views can be done here
490 
491  // /** \brief Return a simple one-line description of this object. */
492  // virtual std::string description() const =0;
493 
494  // /** \brief Print the object with some verbosity level to an FancyOStream object. */
495  // virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const =0;
496 
498 
499 
501 
502 
504  virtual std::string description() const =0;
505 
509 
510  // JG: Added:
511 
513  virtual RCP<const CrsGraph> getCrsGraph() const =0;
514 
515  // ----------------------------------------------------------------------------------
516  // "TEMPORARY" VIEW MECHANISM
523  void SetFixedBlockSize(LocalOrdinal blksize, GlobalOrdinal offset=0) {
524 
525  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
526 
527  std::vector<size_t> stridingInfo;
528  stridingInfo.push_back(Teuchos::as<size_t>(blksize));
529  LocalOrdinal stridedBlockId = -1;
530 
532  this->getRangeMap(),
533  stridingInfo,
534  stridedBlockId,
535  offset
536  );
538  this->getDomainMap(),
539  stridingInfo,
540  stridedBlockId,
541  offset
542  );
543 
544  if(IsView("stridedMaps") == true) RemoveView("stridedMaps");
545  CreateView("stridedMaps", stridedRangeMap, stridedDomainMap);
546  }
547 
548  //==========================================================================
549 
550  LocalOrdinal GetFixedBlockSize() const {
551  if(IsView("stridedMaps")==true) {
554  TEUCHOS_TEST_FOR_EXCEPTION(rangeMap == Teuchos::null, Exceptions::BadCast, "Xpetra::Matrix::GetFixedBlockSize(): rangeMap is not of type StridedMap");
555  TEUCHOS_TEST_FOR_EXCEPTION(domainMap == Teuchos::null, Exceptions::BadCast, "Xpetra::Matrix::GetFixedBlockSize(): domainMap is not of type StridedMap");
556  TEUCHOS_TEST_FOR_EXCEPTION(domainMap->getFixedBlockSize() != rangeMap->getFixedBlockSize(), Exceptions::RuntimeError, "Xpetra::Matrix::GetFixedBlockSize(): block size of rangeMap and domainMap are different.");
557  return Teuchos::as<LocalOrdinal>(domainMap->getFixedBlockSize()); // TODO: why LocalOrdinal?
558  } else
559  //TEUCHOS_TEST_FOR_EXCEPTION(false, Exceptions::RuntimeError, "Xpetra::Matrix::GetFixedBlockSize(): no strided maps available."); // TODO remove this
560  return 1;
561  }; //TODO: why LocalOrdinal?
562 
563  // ----------------------------------------------------------------------------------
564 
565  virtual void SetMaxEigenvalueEstimate(Scalar const &sigma) {
566  operatorViewTable_.get(GetCurrentViewLabel())->SetMaxEigenvalueEstimate(sigma);
567  }
568 
569  // ----------------------------------------------------------------------------------
570 
571  virtual Scalar GetMaxEigenvalueEstimate() const {
572  return operatorViewTable_.get(GetCurrentViewLabel())->GetMaxEigenvalueEstimate();
573  }
574 
575  // ----------------------------------------------------------------------------------
576 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
577  virtual local_matrix_type getLocalMatrix () const = 0;
579 #endif
580  // ----------------------------------------------------------------------------------
581 
582  protected:
583  Teuchos::Hashtable<viewLabel_t, RCP<MatrixView> > operatorViewTable_; // hashtable storing the operator views (keys = view names, values = views).
584 
585  viewLabel_t defaultViewLabel_; // label of the view associated with inital Matrix construction
586  viewLabel_t currentViewLabel_; // label of the current view
587 
588  }; //class Matrix
589 
590 } //namespace Xpetra
591 
592 #define XPETRA_MATRIX_SHORT
593 #endif //XPETRA_MATRIX_DECL_HPP
virtual void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)=0
Insert matrix entries, using local IDs.
virtual size_t getNodeMaxNumRowEntries() const =0
Returns the maximum number of entries across all rows/columns on this node.
virtual size_t getNodeNumRows() const =0
Returns the number of matrix rows owned on the calling node.
virtual size_t getNodeNumEntries() const =0
Returns the local number of entries in this matrix.
virtual global_size_t getGlobalNumRows() const =0
Returns the number of global rows 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.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Xpetra namespace
void RemoveView(const viewLabel_t viewLabel)
virtual global_size_t getGlobalNumCols() const =0
Returns the number of global columns in the matrix.
LocalOrdinal local_ordinal_type
virtual ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const =0
Get Frobenius norm of the matrix.
virtual void resumeFill(const RCP< ParameterList > &params=null)=0
Exception throws to report errors in the internal logical of the program.
virtual size_t getGlobalMaxNumRowEntries() const =0
Returns the maximum number of entries across all rows/columns on all nodes.
Teuchos::Hashtable< viewLabel_t, RCP< MatrixView > > operatorViewTable_
virtual bool isGloballyIndexed() const =0
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
virtual void doExport(const Matrix &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)=0
Export.
Node node_type
The Kokkos Node type.
virtual const RCP< const Map > & getColMap() const
Returns the Map that describes the column distribution in this matrix. This might be null until fillC...
Exception indicating invalid cast attempted.
GlobalOrdinal global_ordinal_type
The global index type.
virtual const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const =0
Multiplies this matrix by a MultiVector.
virtual void SetMaxEigenvalueEstimate(Scalar const &sigma)
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.
Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > CrsMatrix
virtual ~Matrix()
Destructor.
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 idices.
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.
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...
viewLabel_t defaultViewLabel_
virtual void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)=0
Insert matrix entries, using global IDs.
void SetFixedBlockSize(LocalOrdinal blksize, GlobalOrdinal offset=0)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual global_size_t getGlobalNumDiags() const =0
Returns the number of global diagonal entries, based on global row/column index comparisons.
LocalOrdinal local_ordinal_type
The local index type.
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.
bool IsView(const viewLabel_t viewLabel) const
const viewLabel_t & GetCurrentViewLabel() const
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. ...
static RCP< StridedMap > 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, const Teuchos::RCP< Node > &node=defaultArgNode())
Map constructor with Xpetra-defined contiguous uniform distribution.
void CreateView(viewLabel_t viewLabel, const RCP< const Map > &rowMap, const RCP< const Map > &colMap)
virtual void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)=0
Replace matrix entries, using local IDs.
virtual const RCP< const Map > & getColMap(viewLabel_t viewLabel) const
Returns the Map that describes the column distribution in this matrix.
viewLabel_t currentViewLabel_
const viewLabel_t SwitchToDefaultView()
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
int getOutputToRootOnly() const
void PrintViews(Teuchos::FancyOStream &out) const
Print all of the views associated with the Matrix.
LocalOrdinal GetFixedBlockSize() const
virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const =0
Returns the current number of entries on this node in the specified local row.
std::string viewLabel_t
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > CrsGraph
size_t global_size_t
Global size_t object.
virtual void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)=0
Replace matrix entries, using global IDs.
static const EVerbosityLevel verbLevel_default
virtual void doImport(const Matrix &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)=0
Import.
virtual RCP< const CrsGraph > getCrsGraph() const =0
Returns the CrsGraph associated with this matrix.
virtual size_t getNodeNumDiags() const =0
Returns the number of local diagonal entries, based on global row/column index comparisons.
virtual std::string description() const =0
Return a simple one-line description of this object.
virtual bool isLocallyIndexed() const =0
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
virtual Scalar GetMaxEigenvalueEstimate() const
size_type size() const
virtual global_size_t getGlobalNumEntries() const =0
Returns the global number of entries in this matrix.
virtual Teuchos::RCP< const Map > getRangeMap() const =0
The Map associated with the range of this operator, which must be compatible with Y...
CombineMode
Xpetra::Combine Mode enumerable type.
virtual const RCP< const Map > & getRowMap() const
Returns the Map that describes the row 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)
virtual void scale(const Scalar &alpha)=0
Scale the current values of a matrix, this = alpha*this.
const viewLabel_t & GetDefaultViewLabel() const
Xpetra::MatrixView< Scalar, LocalOrdinal, GlobalOrdinal, Node > MatrixView
virtual const RCP< const Map > & getRowMap(viewLabel_t viewLabel) const
Returns the Map that describes the row distribution in this matrix.
virtual void setAllToScalar(const Scalar &alpha)=0
Set all matrix entries equal to scalar.
virtual Teuchos::RCP< const Map > getDomainMap() const =0
The Map associated with the domain of this operator, which must be compatible with X...
Xpetra::CrsMatrixFactory< Scalar, LocalOrdinal, GlobalOrdinal, Node > CrsMatrixFactory
Xpetra-specific matrix class.
Class that stores a strided map.
const viewLabel_t SwitchToView(const viewLabel_t viewLabel)
GlobalOrdinal global_ordinal_type