Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | List of all members
Tpetra::Details::Impl::CooMatrixImpl< SC, GO > Class Template Reference

Implementation detail of Tpetra::Details::CooMatrix (which see below). More...

#include <Tpetra_Details_CooMatrix.hpp>

Public Types

typedef char packet_type
 Type for packing and unpacking data. More...
 

Public Member Functions

 CooMatrixImpl ()=default
 Default constructor. More...
 
void sumIntoGlobalValue (const GO gblRowInd, const GO gblColInd, const SC &val)
 Insert one entry locally into the sparse matrix, if it does not exist there yet. If it does exist, sum the values. More...
 
void sumIntoGlobalValues (const GO gblRowInds[], const GO gblColInds[], const SC vals[], const std::size_t numEnt)
 Insert multiple entries locally into the sparse matrix. More...
 
std::size_t getLclNumEntries () const
 Number of entries in the sparse matrix on the calling process. More...
 
void forAllEntries (std::function< void(const GO, const GO, const SC &)> f) const
 Execute the given function for all entries of the sparse matrix, sequentially (no thread parallelism). Do not modify entries. More...
 
void mergeIntoRow (const GO tgtGblRow, const CooMatrixImpl< SC, GO > &src, const GO srcGblRow)
 Into global row tgtGblRow of *this, merge global row srcGblRow of src. More...
 
int countPackRow (int &numPackets, const GO gblRow, const ::Teuchos::Comm< int > &comm, std::ostream *errStrm=NULL) const
 Count the number of packets (bytes, in this case) needed to pack the given row of the matrix. More...
 
void packRow (packet_type outBuf[], const int outBufSize, int &outBufCurPos, const ::Teuchos::Comm< int > &comm, std::vector< GO > &gblRowInds, std::vector< GO > &gblColInds, std::vector< SC > &vals, const GO gblRow) const
 Pack the given row of the matrix. More...
 
GO getMyGlobalRowIndices (std::vector< GO > &rowInds) const
 Get the global row indices on this process, sorted and made unique, and return the minimum global row index on this process. More...
 
template<class OffsetType , class LO >
void buildLocallyIndexedCrs (std::vector< OffsetType > &rowOffsets, LO lclColInds[], SC vals[], std::function< LO(const GO)> gblToLcl) const
 Build a locally indexed version of CRS storage. More...
 

Detailed Description

template<class SC, class GO>
class Tpetra::Details::Impl::CooMatrixImpl< SC, GO >

Implementation detail of Tpetra::Details::CooMatrix (which see below).

Definition at line 97 of file Tpetra_Details_CooMatrix.hpp.

Member Typedef Documentation

template<class SC, class GO>
typedef char Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::packet_type

Type for packing and unpacking data.

Definition at line 115 of file Tpetra_Details_CooMatrix.hpp.

Constructor & Destructor Documentation

template<class SC, class GO>
Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::CooMatrixImpl ( )
default

Default constructor.

Member Function Documentation

template<class SC, class GO>
void Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::sumIntoGlobalValue ( const GO  gblRowInd,
const GO  gblColInd,
const SC &  val 
)
inline

Insert one entry locally into the sparse matrix, if it does not exist there yet. If it does exist, sum the values.

Parameters
gblRowInd[in] Global row index of the entry to insert.
gblColInd[in] Global column index of the entry to insert.
val[in] Value of the matrix entry to insert / sum.

Definition at line 127 of file Tpetra_Details_CooMatrix.hpp.

template<class SC, class GO>
void Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::sumIntoGlobalValues ( const GO  gblRowInds[],
const GO  gblColInds[],
const SC  vals[],
const std::size_t  numEnt 
)
inline

Insert multiple entries locally into the sparse matrix.

This works like multiple calls to sumIntoGlobalValue.

Parameters
gblRowInd[in] Global row indices of the entries to insert.
gblColInd[in] Global column indices of the entries to insert.
val[in] Values of the matrix entries to insert / sum.
numEnt[in] Number of entries to insert.

Definition at line 150 of file Tpetra_Details_CooMatrix.hpp.

template<class SC, class GO>
std::size_t Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::getLclNumEntries ( ) const
inline

Number of entries in the sparse matrix on the calling process.

Definition at line 170 of file Tpetra_Details_CooMatrix.hpp.

template<class SC, class GO>
void Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::forAllEntries ( std::function< void(const GO, const GO, const SC &)>  f) const
inline

Execute the given function for all entries of the sparse matrix, sequentially (no thread parallelism). Do not modify entries.

Definition at line 179 of file Tpetra_Details_CooMatrix.hpp.

template<class SC, class GO>
void Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::mergeIntoRow ( const GO  tgtGblRow,
const CooMatrixImpl< SC, GO > &  src,
const GO  srcGblRow 
)
inline

Into global row tgtGblRow of *this, merge global row srcGblRow of src.

For matrix entries with the same row and column indices, sum the values into the entry in tgtEntries.

Definition at line 193 of file Tpetra_Details_CooMatrix.hpp.

template<class SC, class GO>
int Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::countPackRow ( int &  numPackets,
const GO  gblRow,
const ::Teuchos::Comm< int > &  comm,
std::ostream *  errStrm = NULL 
) const
inline

Count the number of packets (bytes, in this case) needed to pack the given row of the matrix.

Parameters
numPackets[out] Number of packets (bytes, in this case) needed for the row. Must be an int for MPI's sake.
gblRow[in] Global index of the row to pack.
comm[in] Communicator for packing.
Returns
Error code; MPI_SUCESSS (0) if no error.

Definition at line 255 of file Tpetra_Details_CooMatrix.hpp.

template<class SC, class GO>
void Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::packRow ( packet_type  outBuf[],
const int  outBufSize,
int &  outBufCurPos,
const ::Teuchos::Comm< int > &  comm,
std::vector< GO > &  gblRowInds,
std::vector< GO > &  gblColInds,
std::vector< SC > &  vals,
const GO  gblRow 
) const
inline

Pack the given row of the matrix.

Parameters
outBuf[out] Output pack buffer.
outBufSize[out] Total output buffer size in bytes.
outBufCurPos[in/out] Current position from which to start writing to the output buffer. This corresponds to the 'position' in/out argument of MPI_Pack.
comm[in] The communicator (MPI wants this).
gblRowInds[in/out] Temporary space for row indices.
gblColInds[in/out] Temporary space for column indices.
vals[in/out] Temporary space for matrix values.
gblRow[in] Global index of the row to pack.

Definition at line 338 of file Tpetra_Details_CooMatrix.hpp.

template<class SC, class GO>
GO Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::getMyGlobalRowIndices ( std::vector< GO > &  rowInds) const
inline

Get the global row indices on this process, sorted and made unique, and return the minimum global row index on this process.

Parameters
rowInds[out] The global row indices on this process.
Returns
Minimum global row index on this process.

Definition at line 407 of file Tpetra_Details_CooMatrix.hpp.

template<class SC, class GO>
template<class OffsetType , class LO >
void Tpetra::Details::Impl::CooMatrixImpl< SC, GO >::buildLocallyIndexedCrs ( std::vector< OffsetType > &  rowOffsets,
LO  lclColInds[],
SC  vals[],
std::function< LO(const GO)>  gblToLcl 
) const
inline

Build a locally indexed version of CRS storage.

Build a locally indexed version of compressed row sparse (CRS, also known as "compressed sparse row," CSR) storage.

Parameters
rowOffsets[out] Row offsets.
lclColInds[out] The matrix's local column indices; must have at least getLclNumEntries() entries.
vals[out] The matrix's values; must have at least getLclNumEntries() entries.
gblToLcl[in] Closure that can convert a global column index to a local column index.

Definition at line 480 of file Tpetra_Details_CooMatrix.hpp.


The documentation for this class was generated from the following file: