Tpetra Matrix/Vector Services Version of the Day
Protected Member Functions | Protected Attributes | Friends | Related Functions
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps > Class Template Reference

Sparse matrix that presents a compressed sparse row interface. More...

#include <Tpetra_CrsMatrix_decl.hpp>

Inheritance diagram for Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >:
Inheritance graph
[legend]

List of all members.

Public Types

Typedefs
typedef Scalar scalar_type
 This class' first template parameter; the type of entries in the matrix.
typedef LocalOrdinal local_ordinal_type
 This class' second template parameter; the type of local indices.
typedef GlobalOrdinal global_ordinal_type
 This class' third template parameter; the type of global indices.
typedef Node node_type
 This class' fourth template parameter; the Kokkos Node type.
typedef LocalMatOps mat_vec_type
 This class' fifth template parameter; the implementation of local sparse kernels.
typedef LocalMatOps mat_solve_type
 This class' fifth template parameter; the implementation of local sparse kernels.
typedef Map< LocalOrdinal,
GlobalOrdinal, node_type
map_type
 The Map specialization suitable for this CrsMatrix specialization.
typedef CrsGraph< LocalOrdinal,
GlobalOrdinal, node_type,
LocalMatOps > 
crs_graph_type
 The CrsGraph specialization suitable for this CrsMatrix specialization.
Typedefs
typedef char packet_type
 The type of each datum being sent or received in an Import or Export.

Public Member Functions

Methods for inserting, modifying, or removing entries
void insertGlobalValues (const GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
 Insert one or more entries into the matrix, using global indices.
void insertLocalValues (const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
 Insert one or more entries into the matrix, using local indices.
void replaceGlobalValues (GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
void replaceLocalValues (LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
void sumIntoGlobalValues (const GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
 Sum into one or more sparse matrix entries, using global indices.
void sumIntoLocalValues (const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
 Sum into one or more sparse matrix entries, using local indices.
void setAllToScalar (const Scalar &alpha)
 Set all matrix entries equal to alpha.
void scale (const Scalar &alpha)
 Scale the matrix's values: this := alpha*this.
void setAllValues (const ArrayRCP< size_t > &rowPointers, const ArrayRCP< LocalOrdinal > &columnIndices, const ArrayRCP< Scalar > &values)
 Sets the 1D pointer arrays of the graph.
void getAllValues (ArrayRCP< const size_t > &rowPointers, ArrayRCP< const LocalOrdinal > &columnIndices, ArrayRCP< const Scalar > &values) const
 Gets the 1D pointer arrays of the graph.
Transformational methods
void globalAssemble ()
 Communicate nonlocal contributions to other processes.
void resumeFill (const RCP< ParameterList > &params=null)
 Resume operations that may change the values or structure of the matrix.
void fillComplete (const RCP< const map_type > &domainMap, const RCP< const map_type > &rangeMap, const RCP< ParameterList > &params=null)
 Signal that data entry is complete, specifying domain and range maps.
void fillComplete (const RCP< ParameterList > &params=null)
 Signal that data entry is complete.
void expertStaticFillComplete (const RCP< const map_type > &domainMap, const RCP< const map_type > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, node_type > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, node_type > > &exporter=Teuchos::null, const RCP< ParameterList > &params=Teuchos::null)
 Perform a fillComplete on a matrix that already has data.
void replaceColMap (const Teuchos::RCP< const map_type > &newColMap)
 Replace the matrix's column Map with the given Map.
void replaceDomainMapAndImporter (const Teuchos::RCP< const map_type > &newDomainMap, Teuchos::RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, node_type > > &newImporter)
 Replace the current domain Map and Import with the given objects.
virtual void removeEmptyProcessesInPlace (const Teuchos::RCP< const map_type > &newMap)
 Remove processes owning zero rows from the Maps and their communicator.
Methods implementing RowMatrix
RCP< const Comm< int > > getComm () const
 The communicator over which the matrix is distributed.
RCP< node_typegetNode () const
 The Kokkos Node instance.
RCP< const map_typegetRowMap () const
 The Map that describes the row distribution in this matrix.
RCP< const map_typegetColMap () const
 The Map that describes the column distribution in this matrix.
RCP< const RowGraph
< LocalOrdinal, GlobalOrdinal,
node_type > > 
getGraph () const
 This matrix's graph, as a RowGraph.
RCP< const crs_graph_typegetCrsGraph () const
 This matrix's graph, as a CrsGraph.
global_size_t getGlobalNumRows () const
 Number of global elements in the row map of this matrix.
global_size_t getGlobalNumCols () const
 The number of global columns in the matrix.
size_t getNodeNumRows () const
 The number of matrix rows owned by the calling process.
size_t getNodeNumCols () const
 The number of columns connected to the locally owned rows of this matrix.
GlobalOrdinal getIndexBase () const
 The index base for global indices for this matrix.
global_size_t getGlobalNumEntries () const
 The global number of entries in this matrix.
size_t getNodeNumEntries () const
 The local number of entries in this matrix.
size_t getNumEntriesInGlobalRow (GlobalOrdinal globalRow) const
 Returns the current number of entries on this node in the specified global row.
size_t getNumEntriesInLocalRow (LocalOrdinal localRow) const
 Returns the current number of entries on this node in the specified local row.
global_size_t getGlobalNumDiags () const
 Returns the number of global diagonal entries, based on global row/column index comparisons.
size_t getNodeNumDiags () const
 Returns the number of local diagonal entries, based on global row/column index comparisons.
size_t getGlobalMaxNumRowEntries () const
 Returns the maximum number of entries across all rows/columns on all nodes.
size_t getNodeMaxNumRowEntries () const
 Returns the maximum number of entries across all rows/columns on this node.
bool hasColMap () const
 Indicates whether the matrix has a well-defined column map.
bool isLowerTriangular () const
 Indicates whether the matrix is lower triangular.
bool isUpperTriangular () const
 Indicates whether the matrix is upper triangular.
bool isLocallyIndexed () const
 Whether the matrix is locally indexed on the calling process.
bool isGloballyIndexed () const
 Whether the matrix is globally indexed on the calling process.
bool isFillComplete () const
 Whether the matrix is fill complete.
bool isFillActive () const
 Whether the matrix is not fill complete.
bool isStorageOptimized () const
 Returns true if storage has been optimized.
ProfileType getProfileType () const
 Returns true if the matrix was allocated with static data structures.
bool isStaticGraph () const
 Indicates that the graph is static, so that new entries cannot be added to this matrix.
ScalarTraits< Scalar >
::magnitudeType 
getFrobeniusNorm () const
 Returns the Frobenius norm of the matrix.
virtual bool supportsRowViews () const
 Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
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 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 calling routine.
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 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 getLocalDiagCopy (Vector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &diag) const
 Get a copy of the diagonal entries owned by this node, with local row indices.
void getLocalDiagOffsets (Teuchos::ArrayRCP< size_t > &offsets) const
 Get offsets of the diagonal entries in the matrix.
void getLocalDiagCopy (Vector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
 Variant of getLocalDiagCopy() that uses precomputed offsets.
void leftScale (const Vector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &x)
 
void rightScale (const Vector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &x)
 
Advanced templated methods
template<class DomainScalar , class RangeScalar >
void localMultiply (const MultiVector< DomainScalar, LocalOrdinal, GlobalOrdinal, node_type > &X, MultiVector< RangeScalar, LocalOrdinal, GlobalOrdinal, node_type > &Y, Teuchos::ETransp trans, RangeScalar alpha, RangeScalar beta) const
 Compute a sparse matrix-MultiVector product local to each process.
template<class DomainScalar , class RangeScalar >
void localGaussSeidel (const MultiVector< DomainScalar, LocalOrdinal, GlobalOrdinal, node_type > &B, MultiVector< RangeScalar, LocalOrdinal, GlobalOrdinal, node_type > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &D, const RangeScalar &dampingFactor, const KokkosClassic::ESweepDirection direction) const
 Gauss-Seidel or SOR on $B = A X$.
template<class DomainScalar , class RangeScalar >
void reorderedLocalGaussSeidel (const MultiVector< DomainScalar, LocalOrdinal, GlobalOrdinal, node_type > &B, MultiVector< RangeScalar, LocalOrdinal, GlobalOrdinal, node_type > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &D, const ArrayView< LocalOrdinal > &rowIndices, const RangeScalar &dampingFactor, const KokkosClassic::ESweepDirection direction) const
 Reordered Gauss-Seidel or SOR on $B = A X$.
template<class DomainScalar , class RangeScalar >
void localSolve (const MultiVector< RangeScalar, LocalOrdinal, GlobalOrdinal, node_type > &Y, MultiVector< DomainScalar, LocalOrdinal, GlobalOrdinal, node_type > &X, Teuchos::ETransp trans) const
 Solves a linear system when the underlying matrix is triangular.
template<class T >
RCP< CrsMatrix< T,
LocalOrdinal, GlobalOrdinal,
node_type > > 
convert () const
 Returns another CrsMatrix with the same entries, but represented as a different scalar type.
Methods implementing Operator
void apply (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
 Compute a sparse matrix-MultiVector multiply.
bool hasTransposeApply () const
 Whether apply() allows applying the transpose or conjugate transpose.
RCP< const map_typegetDomainMap () const
 The domain Map of this operator.
RCP< const map_typegetRangeMap () const
 The range Map of this operator.
Other "apply"-like methods
void gaussSeidel (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &D, const Scalar &dampingFactor, const ESweepDirection direction, const int numSweeps) const
 "Hybrid" Jacobi + (Gauss-Seidel or SOR) on $B = A X$.
void reorderedGaussSeidel (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &D, const ArrayView< LocalOrdinal > &rowIndices, const Scalar &dampingFactor, const ESweepDirection direction, const int numSweeps) const
 Reordered "Hybrid" Jacobi + (Gauss-Seidel or SOR) on $B = A X$.
void gaussSeidelCopy (MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &B, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &D, const Scalar &dampingFactor, const ESweepDirection direction, const int numSweeps, const bool zeroInitialGuess) const
 Version of gaussSeidel(), with fewer requirements on X.
void reorderedGaussSeidelCopy (MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &B, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &D, const ArrayView< LocalOrdinal > &rowIndices, const Scalar &dampingFactor, const ESweepDirection direction, const int numSweeps, const bool zeroInitialGuess) const
 Version of reorderedGaussSeidel(), with fewer requirements on X.
virtual Teuchos::RCP
< RowMatrix< Scalar,
LocalOrdinal, GlobalOrdinal,
node_type > > 
add (const Scalar &alpha, const RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &A, const Scalar &beta, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, node_type > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, node_type > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params) const
 Implementation of RowMatrix::add: return alpha*A + beta*this.
Implementation of Teuchos::Describable interface
std::string description () const
 A simple one-line description of this object.
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.
Implementation of DistObject interface
virtual bool checkSizes (const SrcDistObject &source)
 Compare the source and target (this) objects for compatibility.
virtual void copyAndPermute (const SrcDistObject &source, size_t numSameIDs, const ArrayView< const LocalOrdinal > &permuteToLIDs, const ArrayView< const LocalOrdinal > &permuteFromLIDs)
 Perform copies and permutations that are local to this process.
virtual void packAndPrepare (const SrcDistObject &source, const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< char > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor)
 Perform any packing or preparation required for communication.
void unpackAndCombine (const Teuchos::ArrayView< const LocalOrdinal > &importLIDs, const Teuchos::ArrayView< const char > &imports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t constantNumPackets, Distributor &distor, CombineMode combineMode)
 Unpack the imported column indices and values, and combine into matrix.
Implementation of Packable interface
virtual void pack (const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< char > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor) const
 Pack this object's data for an Import or Export.
Public methods for redistributing data
void doImport (const SrcDistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
 Import data into this object using an Import object ("forward mode").
void doImport (const SrcDistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
 Import data into this object using an Export object ("reverse mode").
void doExport (const SrcDistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
 Export data into this object using an Export object ("forward mode").
void doExport (const SrcDistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
 Export data into this object using an Import object ("reverse mode").
Attribute accessor methods
bool isDistributed () const
 Whether this is a globally distributed object.
virtual Teuchos::RCP< const
Map< LocalOrdinal,
GlobalOrdinal, Node > > 
getMap () const
 The Map describing the parallel distribution of this object.
I/O methods
void print (std::ostream &os) const
 Print this object to the given output stream.

Protected Member Functions

void allocateValues (ELocalGlobal lg, GraphAllocationStatus gas)
 Allocate values (and optionally indices) using the Node.
void sortEntries ()
 Sort the entries of each row by their column indices.
void mergeRedundantEntries ()
 Merge entries in each row with the same column indices.
void clearGlobalConstants ()
 Clear matrix properties that require collectives.
void computeGlobalConstants ()
 Compute matrix properties that require collectives.
Teuchos::RCP< MVgetColumnMapMultiVector (const MV &X_domainMap, const bool force=false) const
 Create a (or fetch a cached) column Map MultiVector.
Teuchos::RCP< MVgetRowMapMultiVector (const MV &Y_rangeMap, const bool force=false) const
 Create a (or fetch a cached) row Map MultiVector.
void applyNonTranspose (const MV &X_in, MV &Y_in, Scalar alpha, Scalar beta) const
 Special case of apply() for mode == Teuchos::NO_TRANS.
void applyTranspose (const MV &X_in, MV &Y_in, const Teuchos::ETransp mode, Scalar alpha, Scalar beta) const
 Special case of apply() for mode != Teuchos::NO_TRANS.
void fillLocalMatrix (const RCP< ParameterList > &params)
 Fill data into the local matrix.
void fillLocalGraphAndMatrix (const RCP< ParameterList > &params)
 Fill data into the local graph and matrix.
virtual size_t constantNumberOfPackets () const
 Whether the implementation's instance promises always to have a constant number of packets per LID, and if so, how many packets per LID there are.
virtual void doTransfer (const SrcDistObject &src, CombineMode CM, size_t numSameIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteToLIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteFromLIDs, const Teuchos::ArrayView< const LocalOrdinal > &remoteLIDs, const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Distributor &distor, ReverseOption revOp)
 Redistribute data across memory images.
virtual void createViews () const
 Hook for creating a const view.
virtual void createViewsNonConst (KokkosClassic::ReadWriteOption rwo)
 Hook for creating a nonconst view.
virtual void releaseViews () const
 Hook for releasing views.

Protected Attributes

Teuchos::RCP< MVimportMV_
 Column Map MultiVector used in apply() and gaussSeidel().
Teuchos::RCP< MVexportMV_
 Row Map MultiVector used in apply().
RCP< sparse_ops_type > lclMatOps_
RCP< local_matrix_type > lclMatrix_
bool fillComplete_
 Whether the matrix is fill complete.
std::map< GlobalOrdinal,
std::pair< Teuchos::Array
< GlobalOrdinal >
, Teuchos::Array< Scalar > > > 
nonlocals_
 Nonlocal data added using insertGlobalValues().
Magnitude frobNorm_
 Cached Frobenius norm of the (global) matrix.
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal,
Node > > 
map_
 The Map over which this object is distributed.
Teuchos::Array< char > imports_
 Buffer into which packed data are imported (received from other processes).
Teuchos::Array< size_t > numImportPacketsPerLID_
 Number of packets to receive for each receive operation.
Teuchos::Array< char > exports_
 Buffer from which packed data are exported (sent to other processes).
Teuchos::Array< size_t > numExportPacketsPerLID_
 Number of packets to send for each send operation.
(Global) graph pointers

We keep two graph pointers in order to maintain const correctness. myGraph_ is a graph which we create internally. Operations that change the sparsity structure also modify myGraph_. If myGraph_ != null, then staticGraph_ == myGraph_ pointerwise (we set the pointers equal to each other when we create myGraph_). myGraph_ is only null if this CrsMatrix was created using the constructor with a const CrsGraph input argument. In this case, staticGraph_ is set to the input CrsGraph.

RCP< const GraphstaticGraph_
RCP< GraphmyGraph_
Sparse matrix values.

values1D_ represents the values assuming "1-D" compressed sparse row storage. values2D_ represents the values as an array of arrays, one (inner) array per row of the sparse matrix.

Before allocation, both arrays are null. After allocation, one is null. If static allocation, then values2D_ is null. If dynamic allocation, then values1D_ is null. The allocation always matches that of graph_, as the graph does the allocation for the matrix.

ArrayRCP< Scalar > values1D_
ArrayRCP< Array< Scalar > > values2D_

Friends

template<class CrsMatrixType >
Teuchos::RCP< CrsMatrixType > importAndFillCompleteCrsMatrix (const Teuchos::RCP< const CrsMatrixType > &sourceMatrix, const Import< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > &importer, const Teuchos::RCP< const Map< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > > &domainMap, const Teuchos::RCP< const Map< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
 Nonmember CrsMatrix constructor that fuses Import and fillComplete().
template<class CrsMatrixType >
Teuchos::RCP< CrsMatrixType > exportAndFillCompleteCrsMatrix (const Teuchos::RCP< const CrsMatrixType > &sourceMatrix, const Export< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > &exporter, const Teuchos::RCP< const Map< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > > &domainMap, const Teuchos::RCP< const Map< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
 Nonmember CrsMatrix constructor that fuses Export and fillComplete().

Related Functions

(Note that these are not member functions.)

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< CrsMatrix
< Scalar, LocalOrdinal,
GlobalOrdinal, Node > > 
createCrsMatrix (const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t maxNumEntriesPerRow=0, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
 Non-member function to create an empty CrsMatrix given a row map and a non-zero profile.
template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void extractBlockDiagonals (const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &matrix, const Teuchos::ArrayView< const LocalOrdinal > &first_points, Teuchos::ArrayRCP< Scalar > &out_diags, Teuchos::ArrayRCP< LocalOrdinal > &out_offsets)
 Extracts the block diagonals from a RowMatrix into contiguous, host storage.
template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void extractBlockDiagonals (const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &matrix, const Tpetra::BlockMap< LocalOrdinal, GlobalOrdinal, Node > &block_map, Teuchos::ArrayRCP< Scalar > &out_diags, Teuchos::ArrayRCP< LocalOrdinal > &out_offsets)
 Extracts the block diagonals from a RowMatrix into contiguous, host storage using a BlockMap.
template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void extractBlockRow (LocalOrdinal localBlockRow, const RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &matrix, const BlockMap< LocalOrdinal, GlobalOrdinal, Node > &block_row_map, const BlockMap< LocalOrdinal, GlobalOrdinal, Node > &block_col_map, ArrayRCP< ArrayRCP< Scalar > > &out_block_entries, ArrayRCP< LocalOrdinal > &out_block_indices)
 Extracts block elements from a RowMatrix into contiguous, host storage.

Constructors and destructor

class CrsMatrix
 CrsMatrix (const Teuchos::RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
 Constructor specifying fixed number of entries for each row.
 CrsMatrix (const Teuchos::RCP< const map_type > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
 Constructor specifying (possibly different) number of entries in each row.
 CrsMatrix (const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
 Constructor specifying column Map and fixed number of entries for each row.
 CrsMatrix (const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
 Constructor specifying column Map and number of entries in each row.
 CrsMatrix (const Teuchos::RCP< const crs_graph_type > &graph, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
 Constructor specifying a previously constructed graph.
 CrsMatrix (const RCP< const map_type > &rowMap, const RCP< const map_type > &colMap, const ArrayRCP< size_t > &rowPointers, const ArrayRCP< LocalOrdinal > &columnIndices, const ArrayRCP< Scalar > &values, const RCP< ParameterList > &params=null)
 Constructor specifying column Map and arrays containing the matrix in sorted, local ids.
template<class Node2 >
RCP< CrsMatrix< Scalar,
LocalOrdinal, GlobalOrdinal,
Node2, typename
KokkosClassic::DefaultKernels
< void, LocalOrdinal, Node2 >
::SparseOps > > 
clone (const RCP< Node2 > &node2, const RCP< ParameterList > &params=null) const
 Create a deep copy of this CrsMatrix, where the copy may have a different Node type.
virtual ~CrsMatrix ()
 Destructor.

Methods for use only by experts

void removeEmptyProcessesInPlace (Teuchos::RCP< Tpetra::DistObject< PT, LO, GO, NT > > &input, const Teuchos::RCP< const Map< LO, GO, NT > > &newMap)
void removeEmptyProcessesInPlace (Teuchos::RCP< Tpetra::DistObject< PT, LO, GO, NT > > &input)
virtual void removeEmptyProcessesInPlace (const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
 Remove processes which contain no elements in this object's Map.

Detailed Description

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
class Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >

Sparse matrix that presents a compressed sparse row interface.

Template Parameters:
ScalarThe type of the numerical entries of the matrix. (You can use real-valued or complex-valued types here, unlike in Epetra, where the scalar type is always double.)
LocalOrdinalThe type of local indices. Same as the LocalOrdinal template parameter of Map objects used by this matrix. (In Epetra, this is just int.) The default type is int, which should suffice for most users. This type must be big enough to store the local (per process) number of rows or columns.
GlobalOrdinalThe type of global indices. Same as the GlobalOrdinal template parameter of Map objects used by this matrix. (In Epetra, this is just int. One advantage of Tpetra over Epetra is that you can use a 64-bit integer type here if you want to solve big problems.) The default type is LocalOrdinal. This type must be big enough to store the global (over all processes in the communicator) number of rows or columns.
NodeA class implementing on-node shared-memory parallel operations. It must implement the Kokkos Node API. The default Node type should suffice for most users. The actual default type depends on your Trilinos build options.
LocalMatOpsType implementing local sparse matrix-(multi)vector multiply and local sparse triangular solve. It must implement the Kokkos CRS Ops API. The default LocalMatOps type should suffice for most users. The actual default type depends on your Trilinos build options.
Note:
If you use the default GlobalOrdinal type, which is int, then the global number of rows or columns in the matrix may be no more than INT_MAX, which for typical 32-bit int is $2^{31} - 1$ (about two billion). If you want to solve larger problems, you must use a 64-bit integer type here.

This class implements a distributed-memory parallel sparse matrix, and provides sparse matrix-vector multiply (including transpose) and sparse triangular solve operations. It provides access by rows to the elements of the matrix, as if the local data were stored in compressed sparse row format. (Implementations are not required to store the data in this way internally.) This class has an interface like that of Epetra_CrsMatrix, but also allows insertion of data into nonowned rows, much like Epetra_FECrsMatrix.

Prerequisites

Before reading the rest of this documentation, it helps to know something about the Teuchos memory management classes, in particular Teuchos::RCP, Teuchos::ArrayRCP, and Teuchos::ArrayView. You should also know a little bit about MPI (the Message Passing Interface for distributed-memory programming). You won't have to use MPI directly to use CrsMatrix, but it helps to be familiar with the general idea of distributed storage of data over a communicator. Finally, you should read the documentation of Map and MultiVector.

Local and global indices

The distinction between local and global indices might confuse new Tpetra users. Please refer to the documentation of Map for a detailed explanation. This is important because many of CrsMatrix's methods for adding, modifying, or accessing entries come in versions that take either local or global indices. The matrix itself may store indices either as local or global, and the same matrix may use global indices or local indices at different points in its life. You should only use the method version corresponding to the current state of the matrix. For example, getGlobalRowView() returns a view to the indices represented as global; it is incorrect to call this method if the matrix is storing indices as local. Call isGloballyIndexed() or isLocallyIndexed() to find out whether the matrix currently stores indices as local or global.

Insertion into nonowned rows

All methods (except for insertGlobalValues() and sumIntoGlobalValues(); see below) that work with global indices only allow operations on indices owned by the calling process. For example, methods that take a global row index expect that row to be owned by the calling process. Access to nonowned rows, that is, rows not owned by the calling process, requires performing an explicit communication via the Import / Export capabilities of the CrsMatrix object. See the documentation of DistObject for more details.

The methods insertGlobalValues() and sumIntoGlobalValues() are exceptions to this rule. They both allows you to add data to nonowned rows. These data are stored locally and communicated to the appropriate process on the next call to globalAssemble() or fillComplete(). This means that CrsMatrix provides the same nonowned insertion functionality that Epetra provides via Epetra_FECrsMatrix.

Note for developers on DistObject

DistObject only takes a single Map as input to its constructor. MultiVector is an example of a subclass for which a single Map suffices to describe its data distribution. In that case, DistObject's getMap() method obviously must return that Map. CrsMatrix is an example of a subclass that requires two Map objects: a row Map and a column Map. For CrsMatrix, getMap() returns the row Map. This means that doTransfer() (which CrsMatrix does not override) uses the row Map objects of the source and target CrsMatrix objects. CrsMatrix in turn uses its column Map (if it has one) to "filter" incoming sparse matrix entries whose column indices are not in that process' column Map. This means that CrsMatrix may perform extra communication, though the Import and Export operations are still correct.

This is necessary if the CrsMatrix does not yet have a column Map. Other processes might have added new entries to the matrix; the calling process has to see them in order to accept them. However, the CrsMatrix may already have a column Map, for example, if it was created with the constructor that takes both a row and a column Map, or if it is fill complete (which creates the column Map if the matrix does not yet have one). In this case, it could be possible to "filter" on the sender (instead of on the receiver, as CrsMatrix currently does) and avoid sending data corresponding to columns that the receiver does not own. Doing this would require revising the Import or Export object (instead of the incoming data) using the column Map, to remove global indices and their target process ranks from the send lists if the target process does not own those columns, and to remove global indices and their source process ranks from the receive lists if the calling process does not own those columns. (Abstractly, this is a kind of set difference between an Import or Export object for the row Maps, and the Import resp. Export object for the column Maps.) This could be done separate from DistObject, by creating a new "filtered" Import or Export object, that keeps the same source and target Map objects but has a different communication plan. We have not yet implemented this optimization.

Examples:

lesson03_power_method.cpp, lesson05_redistribution.cpp, LocalMatOpExample.cpp, and Tpetra_Power_Method_From_File.cpp.

Definition at line 204 of file Tpetra_CrsMatrix_decl.hpp.


Member Typedef Documentation

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
typedef Scalar Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::scalar_type

This class' first template parameter; the type of entries in the matrix.

Reimplemented from Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 211 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
typedef LocalOrdinal Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::local_ordinal_type

This class' second template parameter; the type of local indices.

Reimplemented from Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 213 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
typedef GlobalOrdinal Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::global_ordinal_type

This class' third template parameter; the type of global indices.

Reimplemented from Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 215 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
typedef Node Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::node_type

This class' fourth template parameter; the Kokkos Node type.

Reimplemented from Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 217 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
typedef LocalMatOps Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::mat_vec_type

This class' fifth template parameter; the implementation of local sparse kernels.

We define both this typedef and mat_solve_type for backwards compatibility.

Definition at line 222 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
typedef LocalMatOps Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::mat_solve_type

This class' fifth template parameter; the implementation of local sparse kernels.

We define both this typedef and mat_vec_type for backwards compatibility.

Definition at line 226 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
typedef Map<LocalOrdinal, GlobalOrdinal, node_type> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::map_type

The Map specialization suitable for this CrsMatrix specialization.

Definition at line 229 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
typedef CrsGraph<LocalOrdinal, GlobalOrdinal, node_type, LocalMatOps> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::crs_graph_type

The CrsGraph specialization suitable for this CrsMatrix specialization.

Definition at line 232 of file Tpetra_CrsMatrix_decl.hpp.

typedef char Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::packet_type [inherited]

The type of each datum being sent or received in an Import or Export.

Note that this type does not always correspond to the Scalar template parameter of subclasses.

Definition at line 183 of file Tpetra_DistObject_decl.hpp.


Constructor & Destructor Documentation

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::CrsMatrix ( const Teuchos::RCP< const map_type > &  rowMap,
size_t  maxNumEntriesPerRow,
ProfileType  pftype = DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > &  params = Teuchos::null 
)

Constructor specifying fixed number of entries for each row.

Parameters:
rowMap[in] Distribution of rows of the matrix.
maxNumEntriesPerRow[in] Maximum number of matrix entries per row. If pftype==DynamicProfile, this is only a hint, and you can set this to zero without affecting correctness. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed this number of entries in any row.
pftype[in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile).
params[in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::CrsMatrix ( const Teuchos::RCP< const map_type > &  rowMap,
const ArrayRCP< const size_t > &  NumEntriesPerRowToAlloc,
ProfileType  pftype = DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > &  params = Teuchos::null 
)

Constructor specifying (possibly different) number of entries in each row.

Parameters:
rowMap[in] Distribution of rows of the matrix.
NumEntriesPerRowToAlloc[in] Maximum number of matrix entries to allocate for each row. If pftype==DynamicProfile, this is only a hint. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed the allocated number of entries for any row.
pftype[in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile).
params[in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::CrsMatrix ( const Teuchos::RCP< const map_type > &  rowMap,
const Teuchos::RCP< const map_type > &  colMap,
size_t  maxNumEntriesPerRow,
ProfileType  pftype = DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > &  params = Teuchos::null 
)

Constructor specifying column Map and fixed number of entries for each row.

The column Map will be used to filter any matrix entries inserted using insertLocalValues() or insertGlobalValues().

Parameters:
rowMap[in] Distribution of rows of the matrix.
colMap[in] Distribution of columns of the matrix.
maxNumEntriesPerRow[in] Maximum number of matrix entries per row. If pftype==DynamicProfile, this is only a hint, and you can set this to zero without affecting correctness. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed this number of entries in any row.
pftype[in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile).
params[in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::CrsMatrix ( const Teuchos::RCP< const map_type > &  rowMap,
const Teuchos::RCP< const map_type > &  colMap,
const ArrayRCP< const size_t > &  NumEntriesPerRowToAlloc,
ProfileType  pftype = DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > &  params = Teuchos::null 
)

Constructor specifying column Map and number of entries in each row.

The column Map will be used to filter any matrix indices inserted using insertLocalValues() or insertGlobalValues().

Parameters:
rowMap[in] Distribution of rows of the matrix.
colMap[in] Distribution of columns of the matrix.
NumEntriesPerRowToAlloc[in] Maximum number of matrix entries to allocate for each row. If pftype==DynamicProfile, this is only a hint. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed the allocated number of entries for any row.
pftype[in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile).
params[in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::CrsMatrix ( const Teuchos::RCP< const crs_graph_type > &  graph,
const Teuchos::RCP< Teuchos::ParameterList > &  params = Teuchos::null 
) [explicit]

Constructor specifying a previously constructed graph.

Calling this constructor fixes the graph structure of the sparse matrix. We say in this case that the matrix has a "static graph." If you create a CrsMatrix with this constructor, you are not allowed to insert new entries into the matrix, but you are allowed to change values in the matrix.

The given graph must be fill complete. Note that calling resumeFill() on the graph makes it not fill complete, even if you had previously called fillComplete() on the graph. In that case, you must call fillComplete() on the graph again before invoking this CrsMatrix constructor.

This constructor is marked explicit so that you can't create a CrsMatrix by accident when passing a CrsGraph into a function that takes a CrsMatrix.

Parameters:
graph[in] The graph structure of the sparse matrix. The graph must be fill complete.
params[in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::CrsMatrix ( const RCP< const map_type > &  rowMap,
const RCP< const map_type > &  colMap,
const ArrayRCP< size_t > &  rowPointers,
const ArrayRCP< LocalOrdinal > &  columnIndices,
const ArrayRCP< Scalar > &  values,
const RCP< ParameterList > &  params = null 
)

Constructor specifying column Map and arrays containing the matrix in sorted, local ids.

Parameters:
rowMap[in] Distribution of rows of the matrix.
colMap[in] Distribution of columns of the matrix.
rowPointers[in] The beginning of each row in the matrix, as in a CSR "rowptr" array. The length of this vector should be equal to the number of rows in the graph, plus one. This last entry should store the nunber of nonzeros in the matrix.
columnIndices[in] The local indices of the columns, as in a CSR "colind" array. The length of this vector should be equal to the number of unknowns in the matrix.
values[in] The local entries in the matrix, as in a CSR "vals" array. The length of this vector should be equal to the number of unknowns in the matrix.
params[in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
virtual Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::~CrsMatrix ( ) [virtual]

Destructor.


Member Function Documentation

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
template<class Node2 >
RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node2, typename KokkosClassic::DefaultKernels<void,LocalOrdinal,Node2>::SparseOps> > Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::clone ( const RCP< Node2 > &  node2,
const RCP< ParameterList > &  params = null 
) const [inline]

Create a deep copy of this CrsMatrix, where the copy may have a different Node type.

Parameters:
node2[in] Kokkos Node instance for the returned copy.
params[in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values.

Parameters to params:

  • "Static profile clone" [boolean, default: true] If true, create the copy with a static allocation profile. If false, use a dynamic allocation profile.
  • "Locally indexed clone" [boolean] If true, fill clone using this matrix's column Map and local indices. This matrix must have a column Map in order for this to work. If false, fill clone using global indices. By default, this will use local indices only if this matrix is using local indices.
  • "fillComplete clone" [boolean, default: true] If true, call fillComplete() on the cloned CrsMatrix object, with parameters from the input parameters' "CrsMatrix" sublist The domain Map and range Map passed to fillComplete() are those of the map being cloned, if they exist. Otherwise, the row Map is used.

Definition at line 424 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::insertGlobalValues ( const GlobalOrdinal  globalRow,
const ArrayView< const GlobalOrdinal > &  cols,
const ArrayView< const Scalar > &  vals 
)

Insert one or more entries into the matrix, using global indices.

Parameters:
globalRow[in] Global index of the row into which to insert the entries.
cols[in] Global indices of the columns into which to insert the entries.
values[in] Values to insert into the above columns.

For all k in 0, ..., col.size()-1, insert the value values[k] into entry (globalRow, cols[k]) of the matrix. If that entry already exists, add the new value to the old value.

This is a local operation. It does not communicate (using MPI). If row globalRow is owned by the calling process, the entries will be inserted immediately. Otherwise, if that row is not owned by the calling process, then the entries will be stored locally for now, and only communicated to the process that owns the row when either fillComplete() or globalAssemble() is called. If that process already has an entry, the incoming value will be added to the old value, just as if it were inserted on the owning process. If the matrix has a column Map (hasColMap() == true), and if globalRow is owned by process p, then it is forbidden to insert column indices that are not in the column Map on process p. Tpetra will test the input column indices to ensure this is the case, but if globalRow is not owned by the calling process, the test will be deferred until the next call to globalAssemble() or fillComplete().

Warning:
The behavior described in the above paragraph differs from that of Epetra. If the matrix has a column Map, Epetra_CrsMatrix "filters" column indices not in the column Map. Many users found this confusing, so we changed it so that nonowned column indices are forbidden.

It is legal to call this method whether the matrix's column indices are globally or locally indexed. If the matrix's column indices are locally indexed (isLocallyIndexed() == true), then this method will convert the input global column indices to local column indices.

For better performance when filling entries into a sparse matrix, consider the following tips:

  1. Use local indices (e.g., insertLocalValues()) if you know the column Map in advance. Converting global indices to local indices is expensive. Of course, if you don't know the column Map in advance, you must use global indices.
  2. When invoking the CrsMatrix constructor, give the best possible upper bounds on the number of entries in each row of the matrix. This will avoid expensive reallocation if your bound was not large enough.
  3. If your upper bound on the number of entries in each row will always be correct, create the matrix with StaticProfile. This uses a faster and more compact data structure to store the matrix.
  4. If you plan to reuse a matrix's graph structure, but change its values, in repeated fillComplete() / resumeFill() cycles, you can get the best performance by creating the matrix with a const CrsGraph. Do this by using the CrsMatrix constructor that accepts an RCP of a const CrsGraph. If you do this, you must use the "replace" or "sumInto" methods to change the values of the matrix; you may not use insertGlobalValues() or insertLocalValues().
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::insertLocalValues ( const LocalOrdinal  localRow,
const ArrayView< const LocalOrdinal > &  cols,
const ArrayView< const Scalar > &  vals 
)

Insert one or more entries into the matrix, using local indices.

Parameters:
LocalRow[in] Local index of the row into which to insert the entries. It must be owned by the row Map on the calling process.
cols[in] Local indices of the columns into which to insert the entries. All of the column indices must be owned by the column Map on the calling process.
values[in] Values to insert into the above columns.

For all k in 0, ..., cols.size()-1, insert the value values[k] into entry (globalRow, cols[k]) of the matrix. If that entry already exists, add the new value to the old value.

In order to call this method, the matrix must be locally indexed, and it must have a column Map.

For better performance when filling entries into a sparse matrix, consider the following tips:

  1. When invoking the CrsMatrix constructor, give the best possible upper bounds on the number of entries in each row of the matrix. This will avoid expensive reallocation if your bound was not large enough.
  2. If your upper bound on the number of entries in each row will always be correct, create the matrix with StaticProfile. This uses a faster and more compact data structure to store the matrix.
  3. If you plan to reuse a matrix's graph structure, but change its values, in repeated fillComplete() / resumeFill() cycles, you can get the best performance by creating the matrix with a const CrsGraph. Do this by using the CrsMatrix constructor that accepts an RCP of a const CrsGraph. If you do this, you must use the "replace" or "sumInto" methods to change the values of the matrix; you may not use insertGlobalValues() or insertLocalValues().
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::replaceGlobalValues ( GlobalOrdinal  globalRow,
const ArrayView< const GlobalOrdinal > &  cols,
const ArrayView< const Scalar > &  vals 
)

Replace one or more entries' values, using global indices.

Parameters:
globalRow[in] Global index of the row in which to replace the entries. This row must be owned by the calling process.
cols[in] Global indices of the columns in which to replace the entries.
vals[in] Values to use for replacing the entries.

For all k in 0, ..., cols.size()-1, replace the value at entry (globalRow, cols[k]) of the matrix with vals[k]. That entry must exist in the matrix already.

If (globalRow, cols[k]) corresponds to an entry that is duplicated in this matrix row (likely because it was inserted more than once and fillComplete() has not been called in the interim), the behavior of this method is not defined.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::replaceLocalValues ( LocalOrdinal  localRow,
const ArrayView< const LocalOrdinal > &  cols,
const ArrayView< const Scalar > &  vals 
)

Replace one or more entries' values, using global indices.

Parameters:
localRow[in] local index of the row in which to replace the entries. This row must be owned by the calling process.
cols[in] Local indices of the columns in which to replace the entries.
vals[in] Values to use for replacing the entries.

For all k in 0, ..., cols.size()-1, replace the value at entry (localRow, cols[k]) of the matrix with vals[k]. That entry must exist in the matrix already.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::sumIntoGlobalValues ( const GlobalOrdinal  globalRow,
const ArrayView< const GlobalOrdinal > &  cols,
const ArrayView< const Scalar > &  vals 
)

Sum into one or more sparse matrix entries, using global indices.

This is a local operation; it does not involve communication. However, if you sum into rows not owned by the calling process, it may result in future communication in globalAssemble() (which is called by fillComplete()).

If globalRow is owned by the calling process, then this method performs the sum-into operation right away. Otherwise, if the row is not owned by the calling process, this method defers the sum-into operation until globalAssemble(). That method communicates data for nonowned rows to the processes that own those rows. Then, globalAssemble() does one of the following:

  • It calls insertGlobalValues() for that data if the matrix has a dynamic graph.
  • It calls sumIntoGlobalValues() for that data if the matrix has a static graph. The matrix silently ignores (row,column) pairs that do not exist in the graph.
Parameters:
globalRow[in] The global index of the row in which to sum into the matrix entries.
cols[in] One or more column indices.
vals[in] One or more values corresponding to those column indices. vals[k] corresponds to cols[k].
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::sumIntoLocalValues ( const LocalOrdinal  localRow,
const ArrayView< const LocalOrdinal > &  cols,
const ArrayView< const Scalar > &  vals 
)

Sum into one or more sparse matrix entries, using local indices.

Parameters:
localRow[in] Local index of a row. This row must be owned by the calling process.
cols[in] Local indices of the columns whose entries we want to modify.
vals[in] Values corresponding to the above column indices. vals[k] corresponds to cols[k].
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::setAllToScalar ( const Scalar &  alpha)

Set all matrix entries equal to alpha.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::scale ( const Scalar &  alpha)

Scale the matrix's values: this := alpha*this.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::setAllValues ( const ArrayRCP< size_t > &  rowPointers,
const ArrayRCP< LocalOrdinal > &  columnIndices,
const ArrayRCP< Scalar > &  values 
)

Sets the 1D pointer arrays of the graph.

Precondition:
hasColMap() == true
getGraph() != Teuchos::null
No insert/sum routines have been called
Warning:
This method is intended for expert developer use only, and should never be called by user code.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getAllValues ( ArrayRCP< const size_t > &  rowPointers,
ArrayRCP< const LocalOrdinal > &  columnIndices,
ArrayRCP< const Scalar > &  values 
) const

Gets the 1D pointer arrays of the graph.

Precondition:
hasColMap() == true
getGraph() != Teuchos::null
fillComplete() has been called
Warning:
This method is intended for expert developer use only, and should never be called by user code.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::globalAssemble ( )

Communicate nonlocal contributions to other processes.

Users do not normally need to call this method. fillComplete always calls this method, unless you specifically tell fillComplete to do otherwise by setting its "No Nonlocal Changes" parameter to true. Thus, it suffices to call fillComplete.

Methods like insertGlobalValues and sumIntoGlobalValues let you add or modify entries in rows that are not owned by the calling process. These entries are called "nonlocal contributions." The methods that allow nonlocal contributions store the entries on the calling process, until globalAssemble is called. globalAssemble sends these nonlocal contributions to the process(es) that own them, where they then become part of the matrix.

This method only does global assembly if there are nonlocal entries on at least one process. It does an all-reduce to find that out. If not, it returns early, without doing any more communication or work.

If you previously inserted into a row which is not owned by any process in the row Map, the behavior of this method is undefined. It may detect the invalid row indices and throw an exception, or it may silently drop the entries inserted into invalid rows. Behavior may vary, depending on whether Tpetra was built with debug checking enabled.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::resumeFill ( const RCP< ParameterList > &  params = null)

Resume operations that may change the values or structure of the matrix.

This method must be called as a collective operation.

Calling fillComplete "freezes" both the values and the structure of the matrix. If you want to modify the matrix again, you must first call resumeFill. You then may not call resumeFill again on that matrix until you first call fillComplete. You may make sequences of fillComplete, resumeFill calls as many times as you wish.

Postcondition:
isFillActive() && ! isFillComplete()
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::fillComplete ( const RCP< const map_type > &  domainMap,
const RCP< const map_type > &  rangeMap,
const RCP< ParameterList > &  params = null 
)

Signal that data entry is complete, specifying domain and range maps.

Off-node indices are distributed (via globalAssemble()), indices are sorted, redundant indices are eliminated, and global indices are transformed to local indices.

Precondition:
isFillActive() == true
isFillComplete()() == false
Postcondition:
isFillActive() == false
isFillComplete() == true

Parameters:

  • "No Nonlocal Changes" (bool): Default is false. If true, the caller promises that no modifications to nonowned rows have happened on any process since the last call to fillComplete. This saves a global all-reduce to check whether any process did a nonlocal insert. Nonlocal changes include any sumIntoGlobalValues or insertGlobalValues call with a row index that is not in the row Map of the calling process.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::fillComplete ( const RCP< ParameterList > &  params = null)

Signal that data entry is complete.

Off-node entries are distributed (via globalAssemble()), repeated entries are summed, and global indices are transformed to local indices.

Note:
This method calls fillComplete( getRowMap(), getRowMap(), os ).
Precondition:
isFillActive() == true
isFillComplete()() == false
Postcondition:
isFillActive() == false
isFillComplete() == true
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::expertStaticFillComplete ( const RCP< const map_type > &  domainMap,
const RCP< const map_type > &  rangeMap,
const RCP< const Import< LocalOrdinal, GlobalOrdinal, node_type > > &  importer = Teuchos::null,
const RCP< const Export< LocalOrdinal, GlobalOrdinal, node_type > > &  exporter = Teuchos::null,
const RCP< ParameterList > &  params = Teuchos::null 
)

Perform a fillComplete on a matrix that already has data.

The matrix must already have filled local 1-D storage (lclInds1D_ and rowPtrs_ for the graph, and values1D_ in the matrix). If the matrix has been constructed in any other way, this method will throw an exception. This routine is needed to support other Trilinos packages and should not be called by ordinary users.

Warning:
This method is intended for expert developer use only, and should never be called by user code.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::replaceColMap ( const Teuchos::RCP< const map_type > &  newColMap)

Replace the matrix's column Map with the given Map.

Parameters:
newColMap[in] New column Map. Must be nonnull.
Precondition:
The matrix must have no entries inserted yet, on any process in the row Map's communicator.
The matrix must not have been created with a constant (a.k.a. "static") CrsGraph.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::replaceDomainMapAndImporter ( const Teuchos::RCP< const map_type > &  newDomainMap,
Teuchos::RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, node_type > > &  newImporter 
)

Replace the current domain Map and Import with the given objects.

Parameters:
newDomainMap[in] New domain Map. Must be nonnull.
newImporter[in] Optional Import object. If null, we will compute it.
Precondition:
The matrix must be fill complete: isFillComplete() == true.
If the Import is provided, its target Map must be the same as the column Map of the matrix.
If the Import is provided, its source Map must be the same as the provided new domain Map.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
virtual void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::removeEmptyProcessesInPlace ( const Teuchos::RCP< const map_type > &  newMap) [virtual]

Remove processes owning zero rows from the Maps and their communicator.

Warning:
This method is ONLY for use by experts. We highly recommend using the nonmember function of the same name defined in Tpetra_DistObject_decl.hpp.
We make NO promises of backwards compatibility. This method may change or disappear at any time.
Parameters:
newMap[in] This must be the result of calling the removeEmptyProcesses() method on the row Map. If it is not, this method's behavior is undefined. This pointer will be null on excluded processes.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<const Comm<int> > Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getComm ( ) const [virtual]

The communicator over which the matrix is distributed.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<node_type> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getNode ( ) const [virtual]
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<const map_type> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getRowMap ( ) const [virtual]

The Map that describes the row distribution in this matrix.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<const map_type> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getColMap ( ) const [virtual]

The Map that describes the column distribution in this matrix.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<const RowGraph<LocalOrdinal,GlobalOrdinal,node_type> > Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getGraph ( ) const [virtual]
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<const crs_graph_type> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getCrsGraph ( ) const

This matrix's graph, as a CrsGraph.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
global_size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getGlobalNumRows ( ) const [virtual]

Number of global elements in the row map of this matrix.

This is <it>not</it> the number of rows in the matrix as a mathematical object. This method returns the global sum of the number of local elements in the row map on each processor, which is the row map's getGlobalNumElements(). Since the row map is not one-to-one in general, that global sum could be different than the number of rows in the matrix. If you want the number of rows in the matrix, ask the range map for its global number of elements, using the following code: global_size_t globalNumRows = getRangeMap()->getGlobalNumElements(); This method retains the behavior of Epetra, which also asks the row map for the global number of rows, rather than asking the range map.

Warning:
Undefined if isFillActive().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
global_size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getGlobalNumCols ( ) const [virtual]

The number of global columns in the matrix.

This equals the number of entries in the matrix's domain Map.

Warning:
Undefined if isFillActive().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getNodeNumRows ( ) const [virtual]

The number of matrix rows owned by the calling process.

Note that the sum of all the return values over all processes in the row Map's communicator does not necessarily equal the global number of rows in the matrix, if the row Map is overlapping.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getNodeNumCols ( ) const [virtual]

The number of columns connected to the locally owned rows of this matrix.

Throws std::runtime_error if ! hasColMap ().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
GlobalOrdinal Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getIndexBase ( ) const [virtual]

The index base for global indices for this matrix.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
global_size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getGlobalNumEntries ( ) const [virtual]

The global number of entries in this matrix.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getNodeNumEntries ( ) const [virtual]

The local number of entries in this matrix.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getNumEntriesInGlobalRow ( GlobalOrdinal  globalRow) const [virtual]

Returns the current number of entries on this node in the specified global row.

Returns OrdinalTraits<size_t>::invalid() if the specified global row does not belong to this matrix.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getNumEntriesInLocalRow ( LocalOrdinal  localRow) const [virtual]

Returns the current number of entries on this node in the specified local row.

Returns OrdinalTraits<size_t>::invalid() if the specified local row is not valid for this matrix.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
global_size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getGlobalNumDiags ( ) const [virtual]

Returns the number of global diagonal entries, based on global row/column index comparisons.

Undefined if isFillActive().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getNodeNumDiags ( ) const [virtual]

Returns the number of local diagonal entries, based on global row/column index comparisons.

Undefined if isFillActive().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getGlobalMaxNumRowEntries ( ) const [virtual]

Returns the maximum number of entries across all rows/columns on all nodes.

Undefined if isFillActive().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
size_t Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getNodeMaxNumRowEntries ( ) const [virtual]

Returns the maximum number of entries across all rows/columns on this node.

Undefined if isFillActive().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::hasColMap ( ) const [virtual]

Indicates whether the matrix has a well-defined column map.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::isLowerTriangular ( ) const [virtual]

Indicates whether the matrix is lower triangular.

Undefined if isFillActive().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::isUpperTriangular ( ) const [virtual]

Indicates whether the matrix is upper triangular.

Undefined if isFillActive().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::isLocallyIndexed ( ) const [virtual]

Whether the matrix is locally indexed on the calling process.

The matrix is locally indexed on the calling process if and only if all of the following hold:

  1. The matrix is not empty on the calling process
  2. The matrix has a column Map

The following is always true:

 (! locallyIndexed() && ! globallyIndexed()) || (locallyIndexed() || globallyIndexed());

That is, a matrix may be neither locally nor globally indexed, but it can never be both. Furthermore a matrix that is not fill complete, might have some processes that are neither locally nor globally indexed, and some processes that are globally indexed. The processes that are neither do not have any entries.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::isGloballyIndexed ( ) const [virtual]

Whether the matrix is globally indexed on the calling process.

The matrix is globally indexed on the calling process if and only if all of the following hold:

  1. The matrix is not empty on the calling process
  2. The matrix does not yet have a column Map

The following is always true:

 (! locallyIndexed() && ! globallyIndexed()) || (locallyIndexed() || globallyIndexed());

That is, a matrix may be neither locally nor globally indexed, but it can never be both. Furthermore a matrix that is not fill complete, might have some processes that are neither locally nor globally indexed, and some processes that are globally indexed. The processes that are neither do not have any entries.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::isFillComplete ( ) const [virtual]

Whether the matrix is fill complete.

A matrix is fill complete (or "in compute mode") when fillComplete() has been called without an intervening call to resumeFill(). A matrix must be fill complete in order to call computational kernels like sparse matrix-vector multiply and sparse triangular solve. A matrix must be not fill complete ("in edit mode") in order to call methods that insert, modify, or remove entries.

The following are always true:

A matrix starts out (after its constructor returns) as not fill complete. It becomes fill complete after fillComplete() returns, and becomes not fill complete again if resumeFill() is called. Some methods like clone() and some of the "nonmember constructors" (like importAndFillComplete() and exportAndFillComplete()) may return a fill-complete matrix.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::isFillActive ( ) const

Whether the matrix is not fill complete.

A matrix is fill complete (or "in compute mode") when fillComplete() has been called without an intervening call to resumeFill(). A matrix must be fill complete in order to call computational kernels like sparse matrix-vector multiply and sparse triangular solve. A matrix must be not fill complete ("in edit mode") in order to call methods that insert, modify, or remove entries.

The following are always true:

A matrix starts out (after its constructor returns) as not fill complete. It becomes fill complete after fillComplete() returns, and becomes not fill complete again if resumeFill() is called. Some methods like clone() and some of the "nonmember constructors" (like importAndFillComplete() and exportAndFillComplete()) may return a fill-complete matrix.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::isStorageOptimized ( ) const

Returns true if storage has been optimized.

Optimized storage means that the allocation of each row is equal to the number of entries. The effect is that a pass through the matrix, i.e., during a mat-vec, requires minimal memory traffic. One limitation of optimized storage is that no new indices can be added to the matrix.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
ProfileType Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getProfileType ( ) const

Returns true if the matrix was allocated with static data structures.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::isStaticGraph ( ) const

Indicates that the graph is static, so that new entries cannot be added to this matrix.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
ScalarTraits<Scalar>::magnitudeType Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getFrobeniusNorm ( ) const [virtual]

Returns the Frobenius norm of the matrix.

Computes and returns the Frobenius norm of the matrix, defined as: $ \|A\|_F = \sqrt{\sum_{i,j} \|\a_{ij}\|^2} $

If the matrix is fill-complete, then the computed value is cached; the cache is cleared whenever resumeFill() is called. Otherwise, the value is computed every time the method is called.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
virtual bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::supportsRowViews ( ) const [virtual]
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getGlobalRowCopy ( GlobalOrdinal  GlobalRow,
const ArrayView< GlobalOrdinal > &  Indices,
const ArrayView< Scalar > &  Values,
size_t &  NumEntries 
) const [virtual]

Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage.

Parameters:
LocalRow- (In) Global row number for which indices are desired.
Indices- (Out) Global column indices corresponding to values.
Values- (Out) Matrix values.
NumEntries- (Out) Number of indices.

Note: A std::runtime_error exception is thrown if either Indices or Values is not large enough to hold the data associated with row GlobalRow. If GlobalRow does not belong to this node, then Indices and Values are unchanged and NumIndices is returned as OrdinalTraits<size_t>::invalid().

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getLocalRowCopy ( LocalOrdinal  LocalRow,
const ArrayView< LocalOrdinal > &  Indices,
const ArrayView< Scalar > &  Values,
size_t &  NumEntries 
) const [virtual]

Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calling routine.

Parameters:
LocalRow- (In) Local row number for which indices are desired.
Indices- (Out) Local column indices corresponding to values.
Values- (Out) Matrix values.
NumIndices- (Out) Number of indices.

Note: A std::runtime_error exception is thrown if either Indices or Values is not large enough to hold the data associated with row LocalRow. If LocalRow is not valid for this node, then Indices and Values are unchanged and NumIndices is returned as OrdinalTraits<size_t>::invalid().

Precondition:
isLocallyIndexed()==true or hasColMap() == true

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getGlobalRowView ( GlobalOrdinal  GlobalRow,
ArrayView< const GlobalOrdinal > &  indices,
ArrayView< const Scalar > &  values 
) const [virtual]

Extract a const, non-persisting view of global indices in a specified row of the matrix.

Parameters:
GlobalRow- (In) Global row number for which indices are desired.
Indices- (Out) Global column indices corresponding to values.
Values- (Out) Row values
Precondition:
isLocallyIndexed() == false
Postcondition:
indices.size() == getNumEntriesInGlobalRow(GlobalRow)

Note: If GlobalRow does not belong to this node, then indices is set to null.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getLocalRowView ( LocalOrdinal  LocalRow,
ArrayView< const LocalOrdinal > &  indices,
ArrayView< const Scalar > &  values 
) const [virtual]

Extract a const, non-persisting view of local indices in a specified row of the matrix.

Parameters:
LocalRow- (In) Local row number for which indices are desired.
Indices- (Out) Global column indices corresponding to values.
Values- (Out) Row values
Precondition:
isGloballyIndexed() == false
Postcondition:
indices.size() == getNumEntriesInLocalRow(LocalRow)

Note: If LocalRow does not belong to this node, then indices is set to null.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getLocalDiagCopy ( Vector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  diag) const [virtual]

Get a copy of the diagonal entries owned by this node, with local row indices.

Returns a distributed Vector object partitioned according to this matrix's row map, containing the the zero and non-zero diagonals owned by this node.

Implements Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getLocalDiagOffsets ( Teuchos::ArrayRCP< size_t > &  offsets) const

Get offsets of the diagonal entries in the matrix.

Warning:
This method is only for expert users.
We make no promises about backwards compatibility for this method. It may disappear or change at any time.
This method must be called collectively. We reserve the right to do extra checking in a debug build that will require collectives.
Precondition:
The matrix must be locally indexed (which means that it has a column Map).
All diagonal entries of the matrix's graph must be populated on this process. Results are undefined otherwise.
Postcondition:
offsets.size() == getNodeNumRows()

This method creates an array of offsets of the local diagonal entries in the matrix. This array is suitable for use in the two-argument version of getLocalDiagCopy(). However, its contents are not defined in any other context. For example, you should not rely on offsets[i] being the index of the diagonal entry in the views returned by getLocalRowView(). This may be the case, but it need not be. (For example, we may choose to optimize the lookups down to the optimized storage level, in which case the offsets will be computed with respect to the underlying storage format, rather than with respect to the views.)

Calling any of the following invalidates the output array:

If the matrix has a const ("static") graph, and if that graph is fill complete, then the offsets array remains valid through calls to fillComplete() and resumeFill(). "Invalidates" means that you must call this method again to recompute the offsets.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getLocalDiagCopy ( Vector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  diag,
const Teuchos::ArrayView< const size_t > &  offsets 
) const

Variant of getLocalDiagCopy() that uses precomputed offsets.

Warning:
This method is only for expert users.
We make no promises about backwards compatibility for this method. It may disappear or change at any time.

This method uses the offsets of the diagonal entries, as precomputed by getLocalDiagOffsets(), to speed up copying the diagonal of the matrix. The offsets must be recomputed if any of the following methods are called:

If the matrix has a const ("static") graph, and if that graph is fill complete, then the offsets array remains valid through calls to fillComplete() and resumeFill().

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::leftScale ( const Vector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  x) [virtual]
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::rightScale ( const Vector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  x) [virtual]
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
template<class DomainScalar , class RangeScalar >
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::localMultiply ( const MultiVector< DomainScalar, LocalOrdinal, GlobalOrdinal, node_type > &  X,
MultiVector< RangeScalar, LocalOrdinal, GlobalOrdinal, node_type > &  Y,
Teuchos::ETransp  trans,
RangeScalar  alpha,
RangeScalar  beta 
) const

Compute a sparse matrix-MultiVector product local to each process.

This method computes the local part of Y := beta*Y + alpha*Op(A)*X, where Op(A) is either $A$, $A^T$ (the transpose), or $A^H$ (the conjugate transpose). "The local part" means that this method does no communication between processes, even if this is necessary for correctness of the matrix-vector multiply. Use the apply() method if you want to compute the mathematical sparse matrix-vector multiply.

This method is mainly of use to Tpetra developers, though some users may find it helpful if they plan to reuse the result of doing an Import on the input MultiVector for several sparse matrix-vector multiplies with matrices that have the same column Map.

When Op(A) is $A$ (trans == Teuchos::NO_TRANS), then X's Map must be the same as the column Map of this matrix, and Y's Map must be the same as the row Map of this matrix. We say in this case that X is "post-Imported," and Y is "pre-Exported." When Op(A) is $A^T$ or $A^H$ (trans is Teuchos::TRANS or Teuchos::CONJ_TRANS, then X's Map must be the same as the row Map of this matrix, and Y's Map must be the same as the column Map of this matrix.

Both X and Y must have constant stride, and they may not alias one another (that is, occupy overlapping space in memory). We may not necessarily check for aliasing, and if we do, we will only do this in a debug build. Aliasing X and Y may cause nondeterministically incorrect results.

This method is templated on the type of entries in both the input MultiVector (DomainScalar) and the output MultiVector (RangeScalar). Thus, this method works for MultiVector objects of arbitrary type. However, this method only performs computation local to each MPI process. Use CrsMatrixMultiplyOp to handle global communication (the Import and Export operations for the input resp. output MultiVector), if you have a matrix with entries of a different type than the input and output MultiVector objects.

If beta == 0, this operation will enjoy overwrite semantics: Y will be overwritten with the result of the multiplication, even if it contains NaN (not-a-number) floating-point entries. Otherwise, the multiply result will be accumulated into Y.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
template<class DomainScalar , class RangeScalar >
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::localGaussSeidel ( const MultiVector< DomainScalar, LocalOrdinal, GlobalOrdinal, node_type > &  B,
MultiVector< RangeScalar, LocalOrdinal, GlobalOrdinal, node_type > &  X,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  D,
const RangeScalar &  dampingFactor,
const KokkosClassic::ESweepDirection  direction 
) const

Gauss-Seidel or SOR on $B = A X$.

Apply a forward or backward sweep of Gauss-Seidel or Successive Over-Relaxation (SOR) to the linear system(s) $B = A X$. For Gauss-Seidel, set the damping factor omega to 1.

Template Parameters:
DomainScalarThe type of entries in the input multivector X. This may differ from the type of entries in A or in B.
RangeScalarThe type of entries in the output multivector B. This may differ from the type of entries in A or in X.
Parameters:
B[in] Right-hand side(s).
X[in/out] On input: initial guess(es). On output: result multivector(s).
D[in] Inverse of diagonal entries of the matrix A.
omega[in] SOR damping factor. omega = 1 results in Gauss-Seidel.
direction[in] Sweep direction: KokkosClassic::Forward or KokkosClassic::Backward. ("Symmetric" requires interprocess communication (before each sweep), which is not part of the local kernel.)
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
template<class DomainScalar , class RangeScalar >
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::reorderedLocalGaussSeidel ( const MultiVector< DomainScalar, LocalOrdinal, GlobalOrdinal, node_type > &  B,
MultiVector< RangeScalar, LocalOrdinal, GlobalOrdinal, node_type > &  X,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  D,
const ArrayView< LocalOrdinal > &  rowIndices,
const RangeScalar &  dampingFactor,
const KokkosClassic::ESweepDirection  direction 
) const

Reordered Gauss-Seidel or SOR on $B = A X$.

Apply a forward or backward sweep of reordered Gauss-Seidel or Successive Over-Relaxation (SOR) to the linear system(s) $B = A X$. For Gauss-Seidel, set the damping factor omega to 1. The ordering can be a partial one, in which case the Gauss-Seidel is only executed on a local subset of unknowns.

Template Parameters:
DomainScalarThe type of entries in the input multivector X. This may differ from the type of entries in A or in B.
RangeScalarThe type of entries in the output multivector B. This may differ from the type of entries in A or in X.
Parameters:
B[in] Right-hand side(s).
X[in/out] On input: initial guess(es). On output: result multivector(s).
D[in] Inverse of diagonal entries of the matrix A.
rowIndices[in] Ordered list of indices on which to execute GS.
omega[in] SOR damping factor. omega = 1 results in Gauss-Seidel.
direction[in] Sweep direction: KokkosClassic::Forward or KokkosClassic::Backward. ("Symmetric" requires interprocess communication (before each sweep), which is not part of the local kernel.)
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
template<class DomainScalar , class RangeScalar >
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::localSolve ( const MultiVector< RangeScalar, LocalOrdinal, GlobalOrdinal, node_type > &  Y,
MultiVector< DomainScalar, LocalOrdinal, GlobalOrdinal, node_type > &  X,
Teuchos::ETransp  trans 
) const

Solves a linear system when the underlying matrix is triangular.

X is required to be post-imported, i.e., described by the column map of the matrix. Y is required to be pre-exported, i.e., described by the row map of the matrix.

This method is templated on the scalar type of MultiVector objects, allowing this method to be applied to MultiVector objects of arbitrary type. However, it is recommended that solve() not be called directly; instead, use the CrsMatrixSolveOp, as it will handle the Import/Export operations required to apply a matrix with non-trivial communication needs.

Both X and Y are required to have constant stride. However, unlike multiply(), it is permissible for &X == &Y. No run-time checking will be performed in a non-debug build.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
template<class T >
RCP<CrsMatrix<T,LocalOrdinal,GlobalOrdinal,node_type> > Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::convert ( ) const

Returns another CrsMatrix with the same entries, but represented as a different scalar type.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::apply ( const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  X,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  Y,
Teuchos::ETransp  mode = Teuchos::NO_TRANS,
Scalar  alpha = ScalarTraits< Scalar >::one(),
Scalar  beta = ScalarTraits< Scalar >::zero() 
) const [virtual]

Compute a sparse matrix-MultiVector multiply.

This method computes Y := beta*Y + alpha*Op(A)*X, where Op(A) is either $A$, $A^T$ (the transpose), or $A^H$ (the conjugate transpose).

If beta == 0, this operation will enjoy overwrite semantics: Y's entries will be ignored, and Y will be overwritten with the result of the multiplication, even if it contains NaN (not-a-number) floating-point entries.

Implements Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::hasTransposeApply ( ) const [virtual]

Whether apply() allows applying the transpose or conjugate transpose.

Reimplemented from Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<const map_type> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getDomainMap ( ) const [virtual]

The domain Map of this operator.

This is null until fillComplete() has been called.

Implements Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<const map_type> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getRangeMap ( ) const [virtual]

The range Map of this operator.

This is null until fillComplete() has been called.

Implements Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::gaussSeidel ( const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  B,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  X,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  D,
const Scalar &  dampingFactor,
const ESweepDirection  direction,
const int  numSweeps 
) const

"Hybrid" Jacobi + (Gauss-Seidel or SOR) on $B = A X$.

"Hybrid" means Successive Over-Relaxation (SOR) or Gauss-Seidel within an (MPI) process, but Jacobi between processes. Gauss-Seidel is a special case of SOR, where the damping factor is one.

The Forward or Backward sweep directions have their usual SOR meaning within the process. Interprocess communication occurs once before the sweep, as it normally would in Jacobi.

The Symmetric sweep option means two sweeps: first Forward, then Backward. Interprocess communication occurs before each sweep, as in Jacobi. Thus, Symmetric results in two interprocess communication steps.

Parameters:
B[in] Right-hand side(s).
X[in/out] On input: initial guess(es). On output: result multivector(s).
D[in] Inverse of diagonal entries of the matrix A.
dampingFactor[in] SOR damping factor. A damping factor of one results in Gauss-Seidel.
direction[in] Sweep direction: Forward, Backward, or Symmetric.
numSweeps[in] Number of sweeps. We count each Symmetric sweep (including both its Forward and its Backward sweep) as one.

Requirements

This method has the following requirements:

1. X is in the domain Map of the matrix. 2. The domain and row Maps of the matrix are the same. 3. The column Map contains the domain Map, and both start at the same place. 4. The row Map is uniquely owned. 5. D is in the row Map of the matrix. 6. X is actually a view of a column Map multivector. 7. Neither B nor D alias X.

#1 is just the usual requirement for operators: the input multivector must always be in the domain Map. The Gauss-Seidel kernel imposes additional requirements, since it

  • overwrites the input multivector with the output (which implies #2), and
  • uses the same local indices for the input and output multivector (which implies #2 and #3).

#3 is reasonable if the matrix constructed the column Map, because the method that does this (CrsGraph::makeColMap) puts the local GIDs (those in the domain Map) in front and the remote GIDs (not in the domain Map) at the end of the column Map. However, if you constructed the column Map yourself, you are responsible for maintaining this invariant. #6 lets us do the Import from the domain Map to the column Map in place.

The Gauss-Seidel kernel also assumes that each process has the entire value (not a partial value to sum) of all the diagonal elements in the rows in its row Map. (We guarantee this anyway though the separate D vector.) This is because each element of the output multivector depends nonlinearly on the diagonal elements. Shared ownership of off-diagonal elements would produce different results.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::reorderedGaussSeidel ( const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  B,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  X,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  D,
const ArrayView< LocalOrdinal > &  rowIndices,
const Scalar &  dampingFactor,
const ESweepDirection  direction,
const int  numSweeps 
) const

Reordered "Hybrid" Jacobi + (Gauss-Seidel or SOR) on $B = A X$.

"Hybrid" means Successive Over-Relaxation (SOR) or Gauss-Seidel within an (MPI) process, but Jacobi between processes. Gauss-Seidel is a special case of SOR, where the damping factor is one. The ordering can be a partial one, in which case the Gauss-Seidel is only executed on a local subset of unknowns.

The Forward or Backward sweep directions have their usual SOR meaning within the process. Interprocess communication occurs once before the sweep, as it normally would in Jacobi.

The Symmetric sweep option means two sweeps: first Forward, then Backward. Interprocess communication occurs before each sweep, as in Jacobi. Thus, Symmetric results in two interprocess communication steps.

Parameters:
B[in] Right-hand side(s).
X[in/out] On input: initial guess(es). On output: result multivector(s).
D[in] Inverse of diagonal entries of the matrix A.
rowIndices[in] Ordered list of indices on which to execute GS.
dampingFactor[in] SOR damping factor. A damping factor of one results in Gauss-Seidel.
direction[in] Sweep direction: Forward, Backward, or Symmetric.
numSweeps[in] Number of sweeps. We count each Symmetric sweep (including both its Forward and its Backward sweep) as one.

Requirements

This method has the following requirements:

1. X is in the domain Map of the matrix. 2. The domain and row Maps of the matrix are the same. 3. The column Map contains the domain Map, and both start at the same place. 4. The row Map is uniquely owned. 5. D is in the row Map of the matrix. 6. X is actually a view of a column Map multivector. 7. Neither B nor D alias X.

#1 is just the usual requirement for operators: the input multivector must always be in the domain Map. The Gauss-Seidel kernel imposes additional requirements, since it

  • overwrites the input multivector with the output (which implies #2), and
  • uses the same local indices for the input and output multivector (which implies #2 and #3).

#3 is reasonable if the matrix constructed the column Map, because the method that does this (CrsGraph::makeColMap) puts the local GIDs (those in the domain Map) in front and the remote GIDs (not in the domain Map) at the end of the column Map. However, if you constructed the column Map yourself, you are responsible for maintaining this invariant. #6 lets us do the Import from the domain Map to the column Map in place.

The Gauss-Seidel kernel also assumes that each process has the entire value (not a partial value to sum) of all the diagonal elements in the rows in its row Map. (We guarantee this anyway though the separate D vector.) This is because each element of the output multivector depends nonlinearly on the diagonal elements. Shared ownership of off-diagonal elements would produce different results.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::gaussSeidelCopy ( MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  X,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  B,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  D,
const Scalar &  dampingFactor,
const ESweepDirection  direction,
const int  numSweeps,
const bool  zeroInitialGuess 
) const

Version of gaussSeidel(), with fewer requirements on X.

This method is just like gaussSeidel(), except that X need only be in the domain Map. This method does not require that X be a domain Map view of a column Map multivector. As a result, this method must copy X into a domain Map multivector before operating on it.

Parameters:
X[in/out] On input: initial guess(es). On output: result multivector(s).
B[in] Right-hand side(s), in the range Map.
D[in] Inverse of diagonal entries of the matrix, in the row Map.
dampingFactor[in] SOR damping factor. A damping factor of one results in Gauss-Seidel.
direction[in] Sweep direction: Forward, Backward, or Symmetric.
numSweeps[in] Number of sweeps. We count each Symmetric sweep (including both its Forward and its Backward sweep) as one.
zeroInitialGuess[in] If true, this method will fill X with zeros initially. If false, this method will assume that X contains a possibly nonzero initial guess on input. Note that a nonzero initial guess may impose an additional nontrivial communication cost (an additional Import).
Precondition:
Domain, range, and row Maps of the sparse matrix are all the same.
No other argument aliases X.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::reorderedGaussSeidelCopy ( MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  X,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  B,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  D,
const ArrayView< LocalOrdinal > &  rowIndices,
const Scalar &  dampingFactor,
const ESweepDirection  direction,
const int  numSweeps,
const bool  zeroInitialGuess 
) const

Version of reorderedGaussSeidel(), with fewer requirements on X.

This method is just like reorderedGaussSeidel(), except that X need only be in the domain Map. This method does not require that X be a domain Map view of a column Map multivector. As a result, this method must copy X into a domain Map multivector before operating on it.

Parameters:
X[in/out] On input: initial guess(es). On output: result multivector(s).
B[in] Right-hand side(s), in the range Map.
D[in] Inverse of diagonal entries of the matrix, in the row Map.
rowIndices[in] Ordered list of indices on which to execute GS.
dampingFactor[in] SOR damping factor. A damping factor of one results in Gauss-Seidel.
direction[in] Sweep direction: Forward, Backward, or Symmetric.
numSweeps[in] Number of sweeps. We count each Symmetric sweep (including both its Forward and its Backward sweep) as one.
zeroInitialGuess[in] If true, this method will fill X with zeros initially. If false, this method will assume that X contains a possibly nonzero initial guess on input. Note that a nonzero initial guess may impose an additional nontrivial communication cost (an additional Import).
Precondition:
Domain, range, and row Maps of the sparse matrix are all the same.
No other argument aliases X.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
virtual Teuchos::RCP<RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, node_type> > Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::add ( const Scalar &  alpha,
const RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, node_type > &  A,
const Scalar &  beta,
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, node_type > > &  domainMap,
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, node_type > > &  rangeMap,
const Teuchos::RCP< Teuchos::ParameterList > &  params 
) const [virtual]

Implementation of RowMatrix::add: return alpha*A + beta*this.

This override of the default implementation ensures that, when called on a CrsMatrix, this method always returns a CrsMatrix of exactly the same type as *this. "Exactly the same type" means that all the template parameters match, including the fifth template parameter. The input matrix A need not necessarily be a CrsMatrix or a CrsMatrix of the same type as *this, though this method may be able to optimize further in that case.

Reimplemented from Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
std::string Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::description ( ) const [virtual]

A simple one-line description of this object.

Reimplemented from Tpetra::DistObject< char, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::describe ( Teuchos::FancyOStream out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const [virtual]

Print the object with some verbosity level to an FancyOStream object.

Reimplemented from Tpetra::DistObject< char, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
virtual bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::checkSizes ( const SrcDistObject source) [virtual]

Compare the source and target (this) objects for compatibility.

Returns:
True if they are compatible, else false.

Implements Tpetra::DistObject< char, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
virtual void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::copyAndPermute ( const SrcDistObject source,
size_t  numSameIDs,
const ArrayView< const LocalOrdinal > &  permuteToLIDs,
const ArrayView< const LocalOrdinal > &  permuteFromLIDs 
) [virtual]

Perform copies and permutations that are local to this process.

Parameters:
source[in] On entry, the source object, from which we are distributing. We distribute to the destination object, which is *this object.
numSameIDs[in] The umber of elements that are the same on the source and destination (this) objects. These elements are owned by the same process in both the source and destination objects. No permutation occurs.
numPermuteIDs[in] The number of elements that are locally permuted between the source and destination objects.
permuteToLIDs[in] List of the elements that are permuted. They are listed by their LID in the destination object.
permuteFromLIDs[in] List of the elements that are permuted. They are listed by their LID in the source object.

Implements Tpetra::DistObject< char, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
virtual void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::packAndPrepare ( const SrcDistObject source,
const Teuchos::ArrayView< const LocalOrdinal > &  exportLIDs,
Teuchos::Array< char > &  exports,
const Teuchos::ArrayView< size_t > &  numPacketsPerLID,
size_t &  constantNumPackets,
Distributor distor 
) [virtual]

Perform any packing or preparation required for communication.

Parameters:
source[in] Source object for the redistribution.
exportLIDs[in] List of the entries (as local IDs in the source object) we will be sending to other images.
exports[out] On exit, the buffer for data to send.
numPacketsPerLID[out] On exit, the implementation of this method must do one of two things: set numPacketsPerLID[i] to contain the number of packets to be exported for exportLIDs[i] and set constantNumPackets to zero, or set constantNumPackets to a nonzero value. If the latter, the implementation need not fill numPacketsPerLID.
constantNumPackets[out] On exit, 0 if numPacketsPerLID has variable contents (different size for each LID). If nonzero, then it is expected that the number of packets per LID is constant, and that constantNumPackets is that value.
distor[in] The Distributor object we are using.

Implements Tpetra::DistObject< char, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::unpackAndCombine ( const Teuchos::ArrayView< const LocalOrdinal > &  importLIDs,
const Teuchos::ArrayView< const char > &  imports,
const Teuchos::ArrayView< size_t > &  numPacketsPerLID,
size_t  constantNumPackets,
Distributor distor,
CombineMode  combineMode 
) [virtual]

Unpack the imported column indices and values, and combine into matrix.

Warning:
The allowed combineMode depends on whether the matrix's graph is static or dynamic. ADD, REPLACE, and ABSMAX are valid for a static graph, but INSERT is not. ADD and INSERT are valid for a dynamic graph; ABSMAX and REPLACE have not yet been implemented (and would require serious changes to matrix assembly in order to implement sensibly).

Implements Tpetra::DistObject< char, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
virtual void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::pack ( const Teuchos::ArrayView< const LocalOrdinal > &  exportLIDs,
Teuchos::Array< char > &  exports,
const Teuchos::ArrayView< size_t > &  numPacketsPerLID,
size_t &  constantNumPackets,
Distributor distor 
) const [virtual]

Pack this object's data for an Import or Export.

Warning:
To be called only by the packAndPrepare method of appropriate classes of DistObject.

Subclasses may override this method to speed up or otherwise improve the implementation by exploiting more specific details of the subclass.

Reimplemented from Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::allocateValues ( ELocalGlobal  lg,
GraphAllocationStatus  gas 
) [protected]

Allocate values (and optionally indices) using the Node.

Parameters:
gas[in] If GraphNotYetAllocated, allocate the indices of myGraph_ via allocateIndices(lg) before allocating values.
lg[in] Argument passed into myGraph_->allocateIndices(), if applicable.
Precondition:
If the graph (that is, staticGraph_) indices are already allocated, then gas must be GraphAlreadyAllocated. Otherwise, gas must be GraphNotYetAllocated. We only check for this precondition in debug mode.
If the graph indices are not already allocated, then the graph must be owned by the matrix.
template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::sortEntries ( ) [protected]

Sort the entries of each row by their column indices.

This only does anything if the graph isn't already sorted (i.e., ! myGraph_->isSorted ()). This method is called in fillComplete().

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::mergeRedundantEntries ( ) [protected]

Merge entries in each row with the same column indices.

This only does anything if the graph isn't already merged (i.e., ! myGraph_->isMerged ()). This method is called in fillComplete().

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::clearGlobalConstants ( ) [protected]

Clear matrix properties that require collectives.

This clears whatever computeGlobalConstants() (which see) computed, in preparation for changes to the matrix. The current implementation of this method does nothing.

This method is called in resumeFill().

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::computeGlobalConstants ( ) [protected]

Compute matrix properties that require collectives.

The corresponding Epetra_CrsGraph method computes things like the global number of nonzero entries, that require collectives over the matrix's communicator. The current Tpetra implementation of this method does nothing.

This method is called in fillComplete().

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Teuchos::RCP<MV> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getColumnMapMultiVector ( const MV X_domainMap,
const bool  force = false 
) const [protected]

Create a (or fetch a cached) column Map MultiVector.

Parameters:
X_domainMap[in] A domain Map Multivector. The returned MultiVector, if nonnull, will have the same number of columns as Y_domainMap.
force[in] Force creating the MultiVector if it hasn't been created already.

The force parameter is helpful when the domain Map and the column Map are the same (so that normally we wouldn't need the column Map MultiVector), but the following (for example) holds:

1. The kernel needs a constant stride input MultiVector, but the given input MultiVector is not constant stride.

We don't test for the above in this method, because it depends on the specific kernel.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Teuchos::RCP<MV> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::getRowMapMultiVector ( const MV Y_rangeMap,
const bool  force = false 
) const [protected]

Create a (or fetch a cached) row Map MultiVector.

Parameters:
Y_rangeMap[in] A range Map Multivector. The returned MultiVector, if nonnull, will have the same number of columns as Y_rangeMap.
force[in] Force creating the MultiVector if it hasn't been created already.

The force parameter is helpful when the range Map and the row Map are the same (so that normally we wouldn't need the row Map MultiVector), but one of the following holds:

1. The kernel needs a constant stride output MultiVector, but the given output MultiVector is not constant stride.

2. The kernel does not permit aliasing of its input and output MultiVector arguments, but they do alias each other.

We don't test for the above in this method, because it depends on the specific kernel.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::applyNonTranspose ( const MV X_in,
MV Y_in,
Scalar  alpha,
Scalar  beta 
) const [protected]

Special case of apply() for mode == Teuchos::NO_TRANS.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::applyTranspose ( const MV X_in,
MV Y_in,
const Teuchos::ETransp  mode,
Scalar  alpha,
Scalar  beta 
) const [protected]

Special case of apply() for mode != Teuchos::NO_TRANS.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::fillLocalMatrix ( const RCP< ParameterList > &  params) [protected]

Fill data into the local matrix.

This method is only called in fillComplete(), and it is only called if the graph's structure is already fixed (that is, if the matrix does not own the graph).

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
void Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::fillLocalGraphAndMatrix ( const RCP< ParameterList > &  params) [protected]

Fill data into the local graph and matrix.

This method is only called in fillComplete(), and it is only called if the graph's structure is not already fixed (that is, if the matrix does own the graph).

void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::doImport ( const SrcDistObject< char, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Import< LocalOrdinal, GlobalOrdinal, Node > &  importer,
CombineMode  CM 
) [inherited]

Import data into this object using an Import object ("forward mode").

The input DistObject is always the source of the data redistribution operation, and the *this object is always the target.

If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use this method with your precomputed Import object if you want to do an Import, else use doExport() with a precomputed Export object.

Parameters:
source[in] The "source" object for redistribution.
importer[in] Precomputed data redistribution plan. Its source Map must be the same as the input DistObject's Map, and its target Map must be the same as this->getMap().
CM[in] How to combine incoming data with the same global index.
void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::doImport ( const SrcDistObject< char, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Export< LocalOrdinal, GlobalOrdinal, Node > &  exporter,
CombineMode  CM 
) [inherited]

Import data into this object using an Export object ("reverse mode").

The input DistObject is always the source of the data redistribution operation, and the *this object is always the target.

If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use the version of doImport() that takes a precomputed Import object in that case.

Parameters:
source[in] The "source" object for redistribution.
exporter[in] Precomputed data redistribution plan. Its target Map must be the same as the input DistObject's Map, and its source Map must be the same as this->getMap(). (Note the difference from forward mode.)
CM[in] How to combine incoming data with the same global index.
void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::doExport ( const SrcDistObject< char, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Export< LocalOrdinal, GlobalOrdinal, Node > &  exporter,
CombineMode  CM 
) [inherited]

Export data into this object using an Export object ("forward mode").

The input DistObject is always the source of the data redistribution operation, and the *this object is always the target.

If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use this method with your precomputed Export object if you want to do an Export, else use doImport() with a precomputed Import object.

Parameters:
source[in] The "source" object for redistribution.
exporter[in] Precomputed data redistribution plan. Its source Map must be the same as the input DistObject's Map, and its target Map must be the same as this->getMap().
CM[in] How to combine incoming data with the same global index.
void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::doExport ( const SrcDistObject< char, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Import< LocalOrdinal, GlobalOrdinal, Node > &  importer,
CombineMode  CM 
) [inherited]

Export data into this object using an Import object ("reverse mode").

The input DistObject is always the source of the data redistribution operation, and the *this object is always the target.

If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use the version of doExport() that takes a precomputed Export object in that case.

Parameters:
source[in] The "source" object for redistribution.
importer[in] Precomputed data redistribution plan. Its target Map must be the same as the input DistObject's Map, and its source Map must be the same as this->getMap(). (Note the difference from forward mode.)
CM[in] How to combine incoming data with the same global index.
bool Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::isDistributed ( ) const [inherited]

Whether this is a globally distributed object.

For a definition of "globally distributed" (and its opposite, "locally replicated"), see the documentation of Map's isDistributed() method.

virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::getMap ( ) const [inline, virtual, inherited]

The Map describing the parallel distribution of this object.

Note that some Tpetra objects might be distributed using multiple Map objects. For example, CrsMatrix has both a row Map and a column Map. It is up to the subclass to decide which Map to use when invoking the DistObject constructor.

Definition at line 316 of file Tpetra_DistObject_decl.hpp.

void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::print ( std::ostream &  os) const [inherited]

Print this object to the given output stream.

We generally assume that all MPI processes can print to the given stream.

virtual void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::removeEmptyProcessesInPlace ( const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &  newMap) [virtual, inherited]

Remove processes which contain no elements in this object's Map.

Warning:
This method is ONLY for use by experts. We highly recommend using the nonmember function of the same name defined in this file.
We make NO promises of backwards compatibility. This method may change or disappear at any time.

On input, this object is distributed over the Map returned by getMap() (the "original Map," with its communicator, the "original communicator"). The input newMap of this method must be the same as the result of calling getMap()->removeEmptyProcesses(). On processes in the original communicator which contain zero elements ("excluded processes," as opposed to "included processes"), the input newMap must be Teuchos::null (which is what getMap()->removeEmptyProcesses() returns anyway).

On included processes, reassign this object's Map (that would be returned by getMap()) to the input newMap, and do any work that needs to be done to restore correct semantics. On excluded processes, free any data that needs freeing, and do any other work that needs to be done to restore correct semantics.

This method has collective semantics over the original communicator. On exit, the only method of this object which is safe to call on excluded processes is the destructor. This implies that subclasses' destructors must not contain communication operations.

Returns:
The object's new Map. Its communicator is a new communicator, distinct from the old Map's communicator, which contains a subset of the processes in the old communicator.
Note:
The name differs from Map's method removeEmptyProcesses(), in order to emphasize that the operation on DistObject happens in place, modifying the input, whereas the operation removeEmptyProcess() on Map does not modify the input.
To implementers of DistObject subclasses: The default implementation of this class throws std::logic_error.
virtual size_t Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::constantNumberOfPackets ( ) const [protected, virtual, inherited]

Whether the implementation's instance promises always to have a constant number of packets per LID, and if so, how many packets per LID there are.

If this method returns zero, the instance says that it might possibly have a different number of packets for each LID to send or receive. If it returns nonzero, the instance promises that the number of packets is the same for all LIDs, and that the return value is this number of packets per LID.

The default implementation of this method returns zero. This does not affect the behavior of doTransfer() in any way. If a nondefault implementation returns nonzero, doTransfer() will use this information to avoid unnecessary allocation and / or resizing of arrays.

virtual void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::doTransfer ( const SrcDistObject< char, LocalOrdinal, GlobalOrdinal, Node > &  src,
CombineMode  CM,
size_t  numSameIDs,
const Teuchos::ArrayView< const LocalOrdinal > &  permuteToLIDs,
const Teuchos::ArrayView< const LocalOrdinal > &  permuteFromLIDs,
const Teuchos::ArrayView< const LocalOrdinal > &  remoteLIDs,
const Teuchos::ArrayView< const LocalOrdinal > &  exportLIDs,
Distributor distor,
ReverseOption  revOp 
) [protected, virtual, inherited]

Redistribute data across memory images.

Parameters:
src[in] The source object, to redistribute into the target object, which is *this object.
CM[in] The combine mode that describes how to combine values that map to the same global ID on the same process.
permuteToLIDs[in] See copyAndPermute().
permuteFromLIDs[in] See copyAndPermute().
remoteLIDs[in] List of entries (as local IDs) in the destination object to receive from other processes.
exportLIDs[in] See packAndPrepare().
distor[in/out] The Distributor object that knows how to redistribute data.
revOp[in] Whether to do a forward or reverse mode redistribution.
virtual void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::createViews ( ) const [protected, virtual, inherited]

Hook for creating a const view.

doTransfer() calls this on the source object. By default, it does nothing, but the source object can use this as a hint to fetch data from a compute buffer on an off-CPU device (such as a GPU) into host memory.

virtual void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::createViewsNonConst ( KokkosClassic::ReadWriteOption  rwo) [protected, virtual, inherited]

Hook for creating a nonconst view.

doTransfer() calls this on the destination (*this) object. By default, it does nothing, but the destination object can use this as a hint to fetch data from a compute buffer on an off-CPU device (such as a GPU) into host memory.

Parameters:
rwo[in] Whether to create a write-only or a read-and-write view. For Kokkos Node types where compute buffers live in a separate memory space (e.g., in the device memory of a discrete accelerator like a GPU), a write-only view only requires copying from host memory to the compute buffer, whereas a read-and-write view requires copying both ways (once to read, from the compute buffer to host memory, and once to write, back to the compute buffer).
virtual void Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::releaseViews ( ) const [protected, virtual, inherited]

Hook for releasing views.

doTransfer() calls this on both the source and destination objects, once it no longer needs to access that object's data. By default, this method does nothing. Implementations may use this as a hint to free host memory which is a view of a compute buffer, once the host memory view is no longer needed. Some implementations may prefer to mirror compute buffers in host memory; for these implementations, releaseViews() may do nothing.


Friends And Related Function Documentation

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
template<class CrsMatrixType >
Teuchos::RCP<CrsMatrixType> importAndFillCompleteCrsMatrix ( const Teuchos::RCP< const CrsMatrixType > &  sourceMatrix,
const Import< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > &  importer,
const Teuchos::RCP< const Map< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > > &  domainMap = Teuchos::null,
const Teuchos::RCP< const Map< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > > &  rangeMap = Teuchos::null,
const Teuchos::RCP< Teuchos::ParameterList > &  params = Teuchos::null 
) [friend]

Nonmember CrsMatrix constructor that fuses Import and fillComplete().

Template Parameters:
CrsMatrixTypeA specialization of CrsMatrix.

A common use case is to create an empty destination CrsMatrix, redistribute from a source CrsMatrix (by an Import or Export operation), then call fillComplete() on the destination CrsMatrix. This constructor fuses these three cases, for an Import redistribution.

Fusing redistribution and fillComplete() exposes potential optimizations. For example, it may make constructing the column Map faster, and it may avoid intermediate unoptimized storage in the destination CrsMatrix. These optimizations may improve performance for specialized kernels like sparse matrix-matrix multiply, as well as for redistributing data after doing load balancing.

The resulting matrix is fill complete (in the sense of isFillComplete()) and has optimized storage (in the sense of isStorageOptimized()). By default, its domain Map is the domain Map of the source matrix, and its range Map is the range Map of the source matrix.

Warning:
If the target Map of the Import is a subset of the source Map of the Import, then you cannot use the default range Map. You should instead construct a nonoverlapping version of the target Map and supply that as the nondefault value of the range Map.
Parameters:
sourceMatrix[in] The source matrix from which to import. The source of an Import must have a nonoverlapping distribution.
importer[in] The Import instance containing a precomputed redistribution plan. The source Map of the Import must be the same as the rowMap of sourceMatrix unless the "Reverse Mode" option on the params list, in which case the targetMap of Import must match the rowMap of the sourceMatrix
domainMap[in] Domain Map of the returned matrix. If null, we use the default, which is the domain Map of the source matrix.
rangeMap[in] Range Map of the returned matrix. If null, we use the default, which is the range Map of the source matrix.
params[in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values.

Definition at line 2539 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
template<class CrsMatrixType >
Teuchos::RCP<CrsMatrixType> exportAndFillCompleteCrsMatrix ( const Teuchos::RCP< const CrsMatrixType > &  sourceMatrix,
const Export< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > &  exporter,
const Teuchos::RCP< const Map< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > > &  domainMap = Teuchos::null,
const Teuchos::RCP< const Map< typename CrsMatrixType::local_ordinal_type, typename CrsMatrixType::global_ordinal_type, typename CrsMatrixType::node_type > > &  rangeMap = Teuchos::null,
const Teuchos::RCP< Teuchos::ParameterList > &  params = Teuchos::null 
) [friend]

Nonmember CrsMatrix constructor that fuses Export and fillComplete().

Template Parameters:
CrsMatrixTypeA specialization of CrsMatrix.

For justification, see the documentation of importAndFillCompleteCrsMatrix() (which is the Import analog of this function).

The resulting matrix is fill complete (in the sense of isFillComplete()) and has optimized storage (in the sense of isStorageOptimized()). By default, its domain Map is the domain Map of the source matrix, and its range Map is the range Map of the source matrix.

Parameters:
sourceMatrix[in] The source matrix from which to export. Its row Map may be overlapping, since the source of an Export may be overlapping.
exporter[in] The Export instance containing a precomputed redistribution plan. The source Map of the Export must be the same as the row Map of sourceMatrix.
domainMap[in] Domain Map of the returned matrix. If null, we use the default, which is the domain Map of the source matrix.
rangeMap[in] Range Map of the returned matrix. If null, we use the default, which is the range Map of the source matrix.
params[in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values.

Definition at line 2589 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > createCrsMatrix ( const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &  map,
size_t  maxNumEntriesPerRow = 0,
const Teuchos::RCP< Teuchos::ParameterList > &  params = Teuchos::null 
) [related]

Non-member function to create an empty CrsMatrix given a row map and a non-zero profile.

Returns:
A dynamically allocated (DynamicProfile) matrix with specified number of nonzeros per row (defaults to zero).

Definition at line 2477 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void extractBlockDiagonals ( const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  matrix,
const Teuchos::ArrayView< const LocalOrdinal > &  first_points,
Teuchos::ArrayRCP< Scalar > &  out_diags,
Teuchos::ArrayRCP< LocalOrdinal > &  out_offsets 
) [related]

Extracts the block diagonals from a RowMatrix into contiguous, host storage.

This method does not initiate any communication, and therefore can be called safely on a single node.

Parameters:
inmatrix - The sparse matrix source for the diagonals.
infirst_points - A list of ordinals, where first_points[b] indicates the first local element in the b-th block.
outout_diags - A reference-counted array, containing the block diagonals in contiguous storage.
outout_offsets - A reference-counted array, indicating the offset to reach each block in out_diags.
Precondition:
- first_points[0] == 0
- elements in first_points are non-decreasing
- matrix.isFillComplete() == true
Postcondition:
- out_offsets.size() == block_sizes.size()
- the non-trivial b-th block is stored contiguously (column-major) in out_diags( out_offsets[b], block_size_b ), where $block\_size\_b = ( first\_points\[b+1\] - first\_points\[b\] )^2 $.
template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void extractBlockDiagonals ( const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  matrix,
const Tpetra::BlockMap< LocalOrdinal, GlobalOrdinal, Node > &  block_map,
Teuchos::ArrayRCP< Scalar > &  out_diags,
Teuchos::ArrayRCP< LocalOrdinal > &  out_offsets 
) [related]

Extracts the block diagonals from a RowMatrix into contiguous, host storage using a BlockMap.

This method does not initiate any communication, and therefore can be called safely on a single node.

Parameters:
inmatrix - The sparse matrix source for the diagonals.
inblock_map - A BlockMap describing the blocks
outout_diags - A reference-counted array, containing the block diagonals in contiguous storage.
outout_offsets - A reference-counted array, indicating the offset to reach each block in out_diags.
Precondition:
- block_map.getPointMap().isCompatible( matrix.getRowMap() )
- matrix.isFillComplete() == true
Postcondition:
- out_offsets.size() == block_sizes.size()
- the non-trivial b-th block is stored contiguously (column-major) in out_diags( out_offsets[b], block_map.getLocalBlockSize(b) )

Calls extractBlockDiagonals().

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void extractBlockRow ( LocalOrdinal  localBlockRow,
const RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  matrix,
const BlockMap< LocalOrdinal, GlobalOrdinal, Node > &  block_row_map,
const BlockMap< LocalOrdinal, GlobalOrdinal, Node > &  block_col_map,
ArrayRCP< ArrayRCP< Scalar > > &  out_block_entries,
ArrayRCP< LocalOrdinal > &  out_block_indices 
) [related]

Extracts block elements from a RowMatrix into contiguous, host storage.

This method does not initiate any communication, and therefore can be called safely on a single node.

Parameters:
inblock_row - The block row to be extracted
inblock_row_map - A BlockMap describing the row blocks
inblock_col_map - A BlockMap describing the column blocks
inmatrix - The sparse matrix source for the diagonals.
outblock_entries - The block entries
outblock_indices - The indices for the block entries
Precondition:
- block_row_map.getPointMap().isCompatible( matrix.getRowMap() )
- block_row_map.getPointMap().isCompatible( matrix.getRowMap() )
- block_col_map.getPointMap().isCompatible( matrix.getColMap() )
- block_col_map.getPointMap().isCompatible( matrix.getColMap() )
- matrix.isFillComplete() == true

Member Data Documentation

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Teuchos::RCP<MV> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::importMV_ [mutable, protected]

Column Map MultiVector used in apply() and gaussSeidel().

This is a column Map MultiVector. It is used as the target of the forward mode Import operation (if necessary) in apply() and gaussSeidel(), and the source of the reverse mode Export operation (if necessary) in these methods. Both of these methods create this MultiVector on demand if needed, and reuse it (if possible) for subsequent calls.

This is declared mutable because the methods in question are const, yet want to cache the MultiVector for later use.

Definition at line 2282 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Teuchos::RCP<MV> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::exportMV_ [mutable, protected]

Row Map MultiVector used in apply().

This is a row Map MultiVector. It is uses as the source of the forward mode Export operation (if necessary) in apply() and gaussSeidel(), and the target of the reverse mode Import operation (if necessary) in these methods. Both of these methods create this MultiVector on demand if needed, and reuse it (if possible) for subsequent calls.

This is declared mutable because the methods in question are const, yet want to cache the MultiVector for later use.

Definition at line 2296 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<sparse_ops_type> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::lclMatOps_ [protected]

The local sparse matrix kernels, after kernel optimizations.

resumeFill() sets this to null. fillComplete() initializes this object using the local graph and matrix.

Definition at line 2401 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
RCP<local_matrix_type> Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::lclMatrix_ [protected]

The local sparse matrix, before kernel optimizations.

resumeFill() sets this to null. fillLocalGraphAndMatrix() and fillLocalMatrix() initialize this. Once fillComplete() has initialized the sparse kernels object (lclMatOps_ above), this object is set to null again.

Definition at line 2408 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
bool Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::fillComplete_ [protected]

Whether the matrix is fill complete.

Definition at line 2428 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
std::map<GlobalOrdinal, std::pair<Teuchos::Array<GlobalOrdinal>, Teuchos::Array<Scalar> > > Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::nonlocals_ [protected]

Nonlocal data added using insertGlobalValues().

These data are cleared by globalAssemble(), once it finishes redistributing them to their owning processes.

For a given nonowned global row gRow which was given to insertGlobalValues() or sumIntoGlobalValues(), nonlocals_[gRow].first[k] is the column index of an inserted entry, and nonlocals_[gRow].second[k] is its value. Duplicate column indices for the same row index are allowed and will be summed during globalAssemble().

This used to be a map from GlobalOrdinal to (GlobalOrdinal, Scalar) pairs. This makes gcc issue a "note" about the ABI of structs containing std::complex members changing. CDash reports this as a warning, even though it's a "note," not a warning. However, I don't want it to show up, so I rearranged the map's value type to a pair of arrays, rather than an array of pairs.

Note:
For Epetra developers: Tpetra::CrsMatrix corresponds more to Epetra_FECrsMatrix than to Epetra_CrsMatrix. The insertGlobalValues() method in Tpetra::CrsMatrix, unlike its corresponding method in Epetra_CrsMatrix, allows insertion into rows which are not owned by the calling process. The globalAssemble() method redistributes these to their owning processes.

Definition at line 2458 of file Tpetra_CrsMatrix_decl.hpp.

template<class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType, class LocalMatOps = typename KokkosClassic::DefaultKernels<Scalar,LocalOrdinal,Node>::SparseOps>
Magnitude Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps >::frobNorm_ [mutable, protected]

Cached Frobenius norm of the (global) matrix.

The value -1 (in general, -Teuchos::ScalarTraits<Magnitude>::one()) means that the norm has not yet been computed, or that the values in the matrix may have changed and the norm must be recomputed.

Definition at line 2466 of file Tpetra_CrsMatrix_decl.hpp.

Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::map_ [protected, inherited]

The Map over which this object is distributed.

Definition at line 611 of file Tpetra_DistObject_decl.hpp.

Teuchos::Array<char > Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::imports_ [protected, inherited]

Buffer into which packed data are imported (received from other processes).

Definition at line 615 of file Tpetra_DistObject_decl.hpp.

Teuchos::Array<size_t> Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::numImportPacketsPerLID_ [protected, inherited]

Number of packets to receive for each receive operation.

This array is used in Distributor::doPosts() (and doReversePosts()) when starting the ireceive operation.

This may be ignored in doTransfer() if constantNumPackets is nonzero, indicating a constant number of packets per LID. (For example, MultiVector sets the constantNumPackets output argument of packAndPrepare() to the number of columns in the multivector.)

Definition at line 627 of file Tpetra_DistObject_decl.hpp.

Teuchos::Array<char > Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::exports_ [protected, inherited]

Buffer from which packed data are exported (sent to other processes).

Definition at line 630 of file Tpetra_DistObject_decl.hpp.

Teuchos::Array<size_t> Tpetra::DistObject< char , LocalOrdinal, GlobalOrdinal, Node >::numExportPacketsPerLID_ [protected, inherited]

Number of packets to send for each send operation.

This array is used in Distributor::doPosts() (and doReversePosts()) for preparing for the send operation.

This may be ignored in doTransfer() if constantNumPackets is nonzero, indicating a constant number of packets per LID. (For example, MultiVector sets the constantNumPackets output argument of packAndPrepare() to the number of columns in the multivector.)

Definition at line 642 of file Tpetra_DistObject_decl.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines