Tpetra parallel linear algebra  Version of the Day
Tpetra_Experimental_BlockCrsMatrix_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Tpetra: Templated Linear Algebra Services Package
5 // Copyright (2008) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #ifndef TPETRA_EXPERIMENTAL_BLOCKCRSMATRIX_DECL_HPP
43 #define TPETRA_EXPERIMENTAL_BLOCKCRSMATRIX_DECL_HPP
44 
47 
48 #include "Tpetra_CrsGraph.hpp"
49 #include "Tpetra_RowMatrix.hpp"
50 #include "Tpetra_Experimental_BlockMultiVector.hpp"
52 
53 namespace Tpetra {
54 namespace Experimental {
55 
133 template<class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
135  class GO = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
138  virtual public Tpetra::RowMatrix<Scalar, LO, GO, Node>,
139  virtual public Tpetra::DistObject<char, LO, GO, Node>
140 {
141 private:
144  typedef Teuchos::ScalarTraits<Scalar> STS;
145 
146 protected:
148  typedef char packet_type;
149 
150 public:
152 
153 
155  typedef Scalar scalar_type;
156 
164 
166  typedef LO local_ordinal_type;
173  typedef Node node_type;
174 
176  typedef typename Node::device_type device_type;
178  typedef typename device_type::execution_space execution_space;
180  typedef typename device_type::memory_space memory_space;
181 
183  typedef ::Tpetra::Map<LO, GO, node_type> map_type;
188 
190  typedef Kokkos::View<impl_scalar_type**,
191  Kokkos::LayoutRight,
192  device_type,
193  Kokkos::MemoryTraits<Kokkos::Unmanaged> >
196  typedef Kokkos::View<const impl_scalar_type**,
197  Kokkos::LayoutRight,
198  device_type,
199  Kokkos::MemoryTraits<Kokkos::Unmanaged> >
202  typedef Kokkos::View<impl_scalar_type*,
203  Kokkos::LayoutRight,
204  device_type,
205  Kokkos::MemoryTraits<Kokkos::Unmanaged> >
208  typedef Kokkos::View<const impl_scalar_type*,
209  Kokkos::LayoutRight,
210  device_type,
211  Kokkos::MemoryTraits<Kokkos::Unmanaged> >
213 
215 
217 
219  BlockCrsMatrix ();
220 
230  BlockCrsMatrix (const crs_graph_type& graph, const LO blockSize);
231 
239  BlockCrsMatrix (const crs_graph_type& graph,
240  const map_type& domainPointMap,
241  const map_type& rangePointMap,
242  const LO blockSize);
243 
245  virtual ~BlockCrsMatrix () {}
246 
248 
250 
252  Teuchos::RCP<const map_type> getDomainMap () const;
253 
255  Teuchos::RCP<const map_type> getRangeMap () const;
256 
258  Teuchos::RCP<const map_type> getRowMap () const;
259 
261  Teuchos::RCP<const map_type> getColMap () const;
262 
265 
267  size_t getNodeNumRows() const;
268 
269  size_t getNodeMaxNumRowEntries() const;
270 
280  void
281  apply (const mv_type& X,
282  mv_type& Y,
283  Teuchos::ETransp mode = Teuchos::NO_TRANS,
284  Scalar alpha = Teuchos::ScalarTraits<Scalar>::one (),
285  Scalar beta = Teuchos::ScalarTraits<Scalar>::zero ()) const;
286 
289  bool hasTransposeApply () const {
290  // FIXME (mfh 04 May 2014) Transpose and conjugate transpose modes
291  // are not implemented yet. Fill in applyBlockTrans() to fix this.
292  return false;
293  }
294 
296  void setAllToScalar (const Scalar& alpha);
297 
299 
301 
303  std::string description () const;
304 
328  void
329  describe (Teuchos::FancyOStream& out,
330  const Teuchos::EVerbosityLevel verbLevel) const;
331 
333 
335 
337  LO getBlockSize () const { return blockSize_; }
338 
340  virtual Teuchos::RCP<const Tpetra::RowGraph<LO,GO,Node> > getGraph () const;
341 
342  const crs_graph_type & getCrsGraph () const { return graph_; }
343 
348  void
349  applyBlock (const BlockMultiVector<Scalar, LO, GO, Node>& X,
350  BlockMultiVector<Scalar, LO, GO, Node>& Y,
351  Teuchos::ETransp mode = Teuchos::NO_TRANS,
352  const Scalar alpha = Teuchos::ScalarTraits<Scalar>::one (),
353  const Scalar beta = Teuchos::ScalarTraits<Scalar>::zero ());
354 
358  void
362  const Scalar& dampingFactor,
363  const ESweepDirection direction,
364  const int numSweeps,
365  const bool zeroInitialGuess) const;
366 
370  void
374  const Teuchos::ArrayView<LO>& rowIndices,
375  const Scalar& dampingFactor,
376  const ESweepDirection direction,
377  const int numSweeps,
378  const bool zeroInitialGuess) const;
379 
399  void
400  localGaussSeidel (const BlockMultiVector<Scalar, LO, GO, Node>& Residual,
401  BlockMultiVector<Scalar, LO, GO, Node>& Solution,
402  const Kokkos::View<impl_scalar_type***, device_type,
403  Kokkos::MemoryUnmanaged>& D_inv,
404  const Scalar& omega,
405  const ESweepDirection direction) const;
406 
433  LO
434  replaceLocalValues (const LO localRowInd,
435  const LO colInds[],
436  const Scalar vals[],
437  const LO numColInds) const;
438 
465  LO
466  sumIntoLocalValues (const LO localRowInd,
467  const LO colInds[],
468  const Scalar vals[],
469  const LO numColInds) const;
470 
500  LO
501  getLocalRowView (const LO localRowInd,
502  const LO*& colInds,
503  Scalar*& vals,
504  LO& numInds) const;
505 
507  void
508  getLocalRowView (LO LocalRow,
509  Teuchos::ArrayView<const LO> &indices,
510  Teuchos::ArrayView<const Scalar> &values) const;
511 
513  void
514  getLocalRowCopy (LO LocalRow,
515  const Teuchos::ArrayView<LO> &Indices,
516  const Teuchos::ArrayView<Scalar> &Values,
517  size_t &NumEntries) const;
518 
520  getLocalBlock (const LO localRowInd, const LO localColInd) const;
521 
545  LO
546  getLocalRowOffsets (const LO localRowInd,
547  ptrdiff_t offsets[],
548  const LO colInds[],
549  const LO numColInds) const;
550 
556  LO
557  replaceLocalValuesByOffsets (const LO localRowInd,
558  const ptrdiff_t offsets[],
559  const Scalar vals[],
560  const LO numOffsets) const;
561 
567  LO
568  sumIntoLocalValuesByOffsets (const LO localRowInd,
569  const ptrdiff_t offsets[],
570  const Scalar vals[],
571  const LO numOffsets) const;
572 
579  size_t getNumEntriesInLocalRow (const LO localRowInd) const;
580 
597  bool localError () const {
598  return *localError_;
599  }
600 
615  std::string errorMessages () const {
616  return (*errs_).is_null () ? std::string ("") : (*errs_)->str ();
617  }
618 
650  void
651  getLocalDiagOffsets (const Kokkos::View<size_t*, device_type,
652  Kokkos::MemoryUnmanaged>& offsets) const;
653 
659  void TPETRA_DEPRECATED
660  getLocalDiagOffsets (Teuchos::ArrayRCP<size_t>& offsets) const;
661 
675  void
676  getLocalDiagCopy (const Kokkos::View<impl_scalar_type***, device_type,
677  Kokkos::MemoryUnmanaged>& diag,
678  const Kokkos::View<const size_t*, device_type,
679  Kokkos::MemoryUnmanaged>& offsets) const;
680 
694  void
695  getLocalDiagCopy (const Kokkos::View<impl_scalar_type***, device_type,
696  Kokkos::MemoryUnmanaged>& diag,
697  const Teuchos::ArrayView<const size_t>& offsets) const;
698 
712  void TPETRA_DEPRECATED
714  const Teuchos::ArrayView<const size_t>& offsets) const;
715 
716 protected:
718  LO
719  absMaxLocalValues (const LO localRowInd,
720  const LO colInds[],
721  const Scalar vals[],
722  const LO numColInds) const;
723 
725  LO
726  absMaxLocalValuesByOffsets (const LO localRowInd,
727  const ptrdiff_t offsets[],
728  const Scalar vals[],
729  const LO numOffsets) const;
730 
736 
737 
738  virtual bool checkSizes (const Tpetra::SrcDistObject& source);
739 
740  virtual void
741  copyAndPermute (const Tpetra::SrcDistObject& source,
742  size_t numSameIDs,
743  const Teuchos::ArrayView<const LO>& permuteToLIDs,
744  const Teuchos::ArrayView<const LO>& permuteFromLIDs);
745 
746  virtual void
747  packAndPrepare (const Tpetra::SrcDistObject& source,
748  const Teuchos::ArrayView<const LO>& exportLIDs,
749  Teuchos::Array<packet_type>& exports,
750  const Teuchos::ArrayView<size_t>& numPacketsPerLID,
751  size_t& constantNumPackets,
752  Tpetra::Distributor& distor);
753 
754  virtual void
755  unpackAndCombine (const Teuchos::ArrayView<const LO> &importLIDs,
756  const Teuchos::ArrayView<const packet_type> &imports,
757  const Teuchos::ArrayView<size_t> &numPacketsPerLID,
758  size_t constantNumPackets,
759  Tpetra::Distributor& distor,
762 
763 private:
765  crs_graph_type graph_;
766  Teuchos::RCP<crs_graph_type> graphRCP_;
775  map_type rowMeshMap_;
782  map_type domainPointMap_;
789  map_type rangePointMap_;
791  LO blockSize_;
792 
806  typename crs_graph_type::local_graph_type::row_map_type::HostMirror ptrHost_;
807 
813  typename crs_graph_type::local_graph_type::entries_type::HostMirror indHost_;
814 
820  typename Kokkos::DualView<impl_scalar_type*, device_type> val_;
821 
843  Teuchos::RCP<Teuchos::RCP<BMV> > X_colMap_;
847  Teuchos::RCP<Teuchos::RCP<BMV> > Y_rowMap_;
848 
856  Teuchos::RCP<Teuchos::RCP<typename crs_graph_type::import_type> > pointImporter_;
857 
859  LO offsetPerBlock_;
860 
872  Teuchos::RCP<bool> localError_;
873 
881  Teuchos::RCP<Teuchos::RCP<std::ostringstream> > errs_;
882 
884  std::ostream& markLocalErrorAndGetStream ();
885 
886  // //! Clear the local error state and stream.
887  // void clearLocalErrorStateAndStream ();
888 
889 public:
891 
892 
894  template<class MemorySpace>
895  void modify ()
896  {
897  // It's legit to use a memory space, execution space, or
898  // Kokkos::Device specialization as the template parameter of
899  // Kokkos::DualView::modify. That method just extracts the
900  // memory_space typedef of its template parameter anyway.
901  // However, insisting on a memory space avoids unnecessary
902  // instantiations.
903  val_.template modify<typename MemorySpace::memory_space> ();
904  }
905 
907  template<class MemorySpace>
908  bool need_sync () const
909  {
910  // It's legit to use a memory space, execution space, or
911  // Kokkos::Device specialization as the template parameter of
912  // Kokkos::DualView::need_sync. That method just extracts the
913  // memory_space typedef of its template parameter anyway.
914  // However, insisting on a memory space avoids unnecessary
915  // instantiations.
916  return val_.template need_sync<typename MemorySpace::memory_space> ();
917  }
918 
920  template<class MemorySpace>
921  void sync ()
922  {
923  // It's legit to use a memory space, execution space, or
924  // Kokkos::Device specialization as the template parameter of
925  // Kokkos::DualView::sync. That method just extracts the
926  // memory_space typedef of its template parameter anyway.
927  // However, insisting on a memory space avoids unnecessary
928  // instantiations.
929  val_.template sync<typename MemorySpace::memory_space> ();
930  }
931 
946  template<class MemorySpace>
947  auto getValues () -> decltype (val_.template view<typename MemorySpace::memory_space> ())
948  {
949  return val_.template view<typename MemorySpace::memory_space> ();
950  }
951 
953 
954 private:
955 
965  void
966  applyBlockTrans (const BlockMultiVector<Scalar, LO, GO, Node>& X,
968  const Teuchos::ETransp mode,
969  const Scalar alpha,
970  const Scalar beta);
971 
979  void
980  applyBlockNoTrans (const BlockMultiVector<Scalar, LO, GO, Node>& X,
982  const Scalar alpha,
983  const Scalar beta);
984 
992  void
993  localApplyBlockNoTrans (const BlockMultiVector<Scalar, LO, GO, Node>& X,
995  const Scalar alpha,
996  const Scalar beta);
997 
1037  LO
1038  findRelOffsetOfColumnIndex (const LO localRowIndex,
1039  const LO colIndexToFind,
1040  const LO hint = 0) const;
1041 
1044  LO offsetPerBlock () const;
1045 
1047  getConstLocalBlockFromInput (const impl_scalar_type* val, const size_t pointOffset) const;
1048 
1050  getNonConstLocalBlockFromInput (impl_scalar_type* val, const size_t pointOffset) const;
1051 
1053  getConstLocalBlockFromAbsOffset (const size_t absBlockOffset) const;
1054 
1056  getNonConstLocalBlockFromAbsOffset (const size_t absBlockOffset) const;
1057 
1062  getConstLocalBlockFromRelOffset (const LO lclMeshRow,
1063  const size_t relMeshOffset) const;
1064 
1065 public:
1067  virtual Teuchos::RCP<const Teuchos::Comm<int> > getComm() const;
1068 
1070  virtual Teuchos::RCP<Node> getNode() const;
1071 
1073  virtual global_size_t getGlobalNumCols() const;
1074 
1075  virtual size_t getNodeNumCols() const;
1076 
1077  virtual GO getIndexBase() const;
1078 
1080  virtual global_size_t getGlobalNumEntries() const;
1081 
1083  virtual size_t getNodeNumEntries() const;
1084 
1094  virtual size_t getNumEntriesInGlobalRow (GO globalRow) const;
1095 
1097  virtual global_size_t getGlobalNumDiags() const;
1098 
1100  virtual size_t getNodeNumDiags() const;
1101 
1103  virtual size_t getGlobalMaxNumRowEntries() const;
1104 
1106  virtual bool hasColMap() const;
1107 
1109  virtual bool isLowerTriangular() const;
1110 
1112  virtual bool isUpperTriangular() const;
1113 
1123  virtual bool isLocallyIndexed() const;
1124 
1134  virtual bool isGloballyIndexed() const;
1135 
1137  virtual bool isFillComplete() const;
1138 
1140  virtual bool supportsRowViews() const;
1141 
1143 
1145 
1166  virtual void
1167  getGlobalRowCopy (GO GlobalRow,
1168  const Teuchos::ArrayView<GO> &Indices,
1169  const Teuchos::ArrayView<Scalar> &Values,
1170  size_t& NumEntries) const;
1171 
1196  virtual void
1197  getGlobalRowView (GO GlobalRow,
1198  Teuchos::ArrayView<const GO>& indices,
1199  Teuchos::ArrayView<const Scalar>& values) const;
1200 
1212  virtual void getLocalDiagCopy (Vector<Scalar,LO,GO,Node>& diag) const;
1213 
1215 
1217 
1223  virtual void leftScale (const Vector<Scalar, LO, GO, Node>& x);
1224 
1230  virtual void rightScale (const Vector<Scalar, LO, GO, Node>& x);
1231 
1241  getFrobeniusNorm () const;
1243 };
1244 
1245 } // namespace Experimental
1246 } // namespace Tpetra
1247 
1248 #endif // TPETRA_EXPERIMENTAL_BLOCKCRSMATRIX_DECL_HPP
virtual Tpetra::RowMatrix< Scalar, LO, GO, Node >::mag_type getFrobeniusNorm() const
The Frobenius norm of the matrix.
LO absMaxLocalValues(const LO localRowInd, const LO colInds[], const Scalar vals[], const LO numColInds) const
Like sumIntoLocalValues, but for the ABSMAX combine mode.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
LO replaceLocalValuesByOffsets(const LO localRowInd, const ptrdiff_t offsets[], const Scalar vals[], const LO numOffsets) const
Like replaceLocalValues, but avoids computing row offsets.
virtual void copyAndPermute(const Tpetra::SrcDistObject &source, size_t numSameIDs, const Teuchos::ArrayView< const LO > &permuteToLIDs, const Teuchos::ArrayView< const LO > &permuteFromLIDs)
Perform copies and permutations that are local to this process.
void apply(const mv_type &X, mv_type &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
For this matrix A, compute Y := beta * Y + alpha * Op(A) * X.
bool hasTransposeApply() const
Whether it is valid to apply the transpose or conjugate transpose of this matrix.
virtual size_t getNodeNumEntries() const
The local number of stored (structurally nonzero) entries.
Kokkos::View< impl_scalar_type *, Kokkos::LayoutRight, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > little_vec_type
The type used to access nonconst vector blocks.
LO sumIntoLocalValues(const LO localRowInd, const LO colInds[], const Scalar vals[], const LO numColInds) const
Sum into values at the given (mesh, i.e., block) column indices, in the given (mesh,...
Scalar scalar_type
The type of entries in the matrix (that is, of each entry in each block).
virtual size_t getNumEntriesInGlobalRow(GO globalRow) const
The current number of entries on the calling process in the specified global row.
global_size_t getGlobalNumRows() const
get the global number of block rows
KokkosClassic::DefaultNode::DefaultNodeType node_type
Default value of Node template parameter.
Kokkos::View< impl_scalar_type **, Kokkos::LayoutRight, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > little_block_type
The type used to access nonconst matrix blocks.
std::string errorMessages() const
The current stream of error messages.
void applyBlock(const BlockMultiVector< Scalar, LO, GO, Node > &X, BlockMultiVector< Scalar, LO, GO, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, const Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), const Scalar beta=Teuchos::ScalarTraits< Scalar >::zero())
Version of apply() that takes BlockMultiVector input and output.
One or more distributed dense vectors.
Node::device_type device_type
The Kokkos::Device specialization that this class uses.
MultiVector for multiple degrees of freedom per mesh point.
Declaration of the Tpetra::CrsMatrix class.
size_t getNumEntriesInLocalRow(const LO localRowInd) const
Return the number of entries in the given row on the calling process.
virtual Teuchos::RCP< const Tpetra::RowGraph< LO, GO, Node > > getGraph() const
Get the (mesh) graph.
virtual void getGlobalRowCopy(GO GlobalRow, const Teuchos::ArrayView< GO > &Indices, const Teuchos::ArrayView< Scalar > &Values, size_t &NumEntries) const
Get a copy of the given global row's entries.
virtual global_size_t getGlobalNumCols() const
The global number of columns of this matrix.
std::string description() const
One-line description of this object.
LO sumIntoLocalValuesByOffsets(const LO localRowInd, const ptrdiff_t offsets[], const Scalar vals[], const LO numOffsets) const
Like sumIntoLocalValues, but avoids computing row offsets.
virtual size_t getNodeNumDiags() const
The number of local diagonal entries, based on global row/column index comparisons.
LO getLocalRowView(const LO localRowInd, const LO *&colInds, Scalar *&vals, LO &numInds) const
Get a view of the (mesh, i.e., block) row, using local (mesh, i.e., block) indices.
virtual bool isGloballyIndexed() const
Whether matrix indices are globally indexed.
int local_ordinal_type
Default value of LocalOrdinal template parameter.
virtual bool isLowerTriangular() const
Whether this matrix is lower triangular.
Tpetra::MultiVector< Scalar, LO, GO, node_type > mv_type
The implementation of MultiVector that this class uses.
virtual global_size_t getGlobalNumDiags() const
The number of global diagonal entries, based on global row/column index comparisons.
mv_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the matrix.
virtual bool checkSizes(const Tpetra::SrcDistObject &source)
Compare the source and target (this) objects for compatibility.
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to alpha.
::Tpetra::Map< LO, GO, node_type > map_type
The implementation of Map that this class uses.
virtual size_t getNodeNumCols() const
The number of columns needed to apply the forward operator on this node.
size_t global_size_t
Global size_t object.
device_type::execution_space execution_space
The Kokkos execution space that this class uses.
BlockCrsMatrix()
Default constructor: Makes an empty block matrix.
LO getLocalRowOffsets(const LO localRowInd, ptrdiff_t offsets[], const LO colInds[], const LO numColInds) const
Get relative offsets corresponding to the given rows, given by local row index.
void reorderedGaussSeidelCopy(MultiVector< Scalar, LO, GO, Node > &X, const MultiVector< Scalar, LO, GO, Node > &B, const MultiVector< Scalar, LO, GO, Node > &D, const Teuchos::ArrayView< LO > &rowIndices, const Scalar &dampingFactor, const ESweepDirection direction, const int numSweeps, const bool zeroInitialGuess) const
Version of reorderedGaussSeidel(), with fewer requirements on X.
ESweepDirection
Sweep direction for Gauss-Seidel or Successive Over-Relaxation (SOR).
LO absMaxLocalValuesByOffsets(const LO localRowInd, const ptrdiff_t offsets[], const Scalar vals[], const LO numOffsets) const
Like sumIntoLocalValuesByOffsets, but for the ABSMAX combine mode.
LO replaceLocalValues(const LO localRowInd, const LO colInds[], const Scalar vals[], const LO numColInds) const
Replace values at the given (mesh, i.e., block) column indices, in the given (mesh,...
bool need_sync() const
Whether the matrix's values need sync'ing to the given memory space.
virtual Teuchos::RCP< Node > getNode() const
The Kokkos Node instance.
Sets up and executes a communication plan for a Tpetra DistObject.
void gaussSeidelCopy(MultiVector< Scalar, LO, GO, Node > &X, const MultiVector< Scalar, LO, GO, Node > &B, const MultiVector< Scalar, LO, GO, Node > &D, const Scalar &dampingFactor, const ESweepDirection direction, const int numSweeps, const bool zeroInitialGuess) const
Version of gaussSeidel(), with fewer requirements on X.
CombineMode
Rule for combining data in an Import or Export.
size_t getNodeMaxNumRowEntries() const
The maximum number of entries across all rows/columns on this node.
Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::mag_type mag_type
Type of a norm result.
virtual void leftScale(const Vector< Scalar, LO, GO, Node > &x)
Scale the RowMatrix on the left with the given Vector x.
auto getValues() -> decltype(val_.template view< typename MemorySpace::memory_space >())
Get the host or device View of the matrix's values (val_).
Abstract base class for objects that can be the source of an Import or Export operation.
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries across all rows/columns on all nodes.
double scalar_type
Default value of Scalar template parameter.
virtual bool supportsRowViews() const
Whether this object implements getLocalRowView() and getGlobalRowView().
void getLocalRowCopy(LO LocalRow, const Teuchos::ArrayView< LO > &Indices, const Teuchos::ArrayView< Scalar > &Values, size_t &NumEntries) const
Not implemented.
Teuchos::RCP< const map_type > getRowMap() const
get the (mesh) map for the rows of this block matrix.
Kokkos::View< const impl_scalar_type **, Kokkos::LayoutRight, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > const_little_block_type
The type used to access const matrix blocks.
bool localError() const
Whether this object had an error on the calling process.
virtual bool hasColMap() const
Whether this matrix has a well-defined column map.
void modify()
Mark the matrix's values as modified in the given memory space.
virtual bool isUpperTriangular() const
Whether this matrix is upper triangular.
void getLocalDiagOffsets(const Kokkos::View< size_t *, device_type, Kokkos::MemoryUnmanaged > &offsets) const
Get offsets of the diagonal entries in the matrix.
virtual global_size_t getGlobalNumEntries() const
The global number of stored (structurally nonzero) entries.
virtual void rightScale(const Vector< Scalar, LO, GO, Node > &x)
Scale the RowMatrix on the right with the given Vector x.
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which this matrix is distributed.
virtual void getGlobalRowView(GO GlobalRow, Teuchos::ArrayView< const GO > &indices, Teuchos::ArrayView< const Scalar > &values) const
Get a constant, nonpersisting, globally indexed view of the given row of the matrix.
virtual GO getIndexBase() const
The index base for global indices in this matrix.
void localGaussSeidel(const BlockMultiVector< Scalar, LO, GO, Node > &Residual, BlockMultiVector< Scalar, LO, GO, Node > &Solution, const Kokkos::View< impl_scalar_type ***, device_type, Kokkos::MemoryUnmanaged > &D_inv, const Scalar &omega, const ESweepDirection direction) const
Local Gauss-Seidel solve, given a factorized diagonal.
A read-only, row-oriented interface to a sparse matrix.
void getLocalDiagCopy(const Kokkos::View< impl_scalar_type ***, device_type, Kokkos::MemoryUnmanaged > &diag, const Kokkos::View< const size_t *, device_type, Kokkos::MemoryUnmanaged > &offsets) const
Variant of getLocalDiagCopy() that uses precomputed offsets and puts diagonal blocks in a 3-D Kokkos:...
A distributed dense vector.
Sparse matrix whose entries are small dense square blocks, all of the same dimensions.
device_type::memory_space memory_space
The Kokkos memory space that this class uses.
Teuchos::RCP< const map_type > getDomainMap() const
Get the (point) domain Map of this matrix.
virtual bool isFillComplete() const
Whether fillComplete() has been called.
Kokkos::View< const impl_scalar_type *, Kokkos::LayoutRight, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > const_little_vec_type
The type used to access const vector blocks.
BlockMultiVector< Scalar, LO, GO, Node >::impl_scalar_type impl_scalar_type
The implementation type of entries in the matrix.
LO getBlockSize() const
The number of degrees of freedom per mesh point.
virtual ~BlockCrsMatrix()
Destructor (declared virtual for memory safety).
Teuchos::RCP< const map_type > getColMap() const
get the (mesh) map for the columns of this block matrix.
void sync()
Sync the matrix's values to the given memory space.
Base class for distributed Tpetra objects that support data redistribution.
Teuchos::RCP< const map_type > getRangeMap() const
Get the (point) range Map of this matrix.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Print a description of this object to the given output stream.
size_t getNodeNumRows() const
get the local number of block rows
virtual bool isLocallyIndexed() const
Whether matrix indices are locally indexed.
Tpetra::CrsGraph< LO, GO, node_type > crs_graph_type
The implementation of CrsGraph that this class uses.