Advanced Multi-Physics (AMP)
On-Line Documentation
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
AMP::LinearAlgebra::CSRMatrixData< Config > Class Template Reference

#include <CSRMatrixData.h>

Inheritance diagram for AMP::LinearAlgebra::CSRMatrixData< Config >:
Inheritance graph
[legend]

Public Types

using allocator_type = typename Config::allocator_type
 
using gidx_t = typename Config::gidx_t
 
using gidxAllocator_t = typename std::allocator_traits< allocator_type >::template rebind_alloc< gidx_t >
 
using lidx_t = typename Config::lidx_t
 
using lidxAllocator_t = typename std::allocator_traits< allocator_type >::template rebind_alloc< lidx_t >
 
using localmatrixdata_t = CSRLocalMatrixData< Config >
 
using mask_t = typename localmatrixdata_t::mask_t
 
using scalar_t = typename Config::scalar_t
 
using scalarAllocator_t = typename std::allocator_traits< allocator_type >::template rebind_alloc< scalar_t >
 

Public Member Functions

template<class TYPE >
void addValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const TYPE *values)
 Add values to those in the matrix.
 
void addValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const void *values, const typeID &id) override
 Add values to those in the matrix.
 
void assemble (bool force_dm_reset=false)
 Convenience function to triger internal setup.
 
size_t beginCol () const override
 Get the global id of the first column in diagonal block (inclusive)
 
size_t beginRow () const override
 Get the global id of the first stored row (inclusive)
 
std::shared_ptr< MatrixDatacloneMatrixData () const override
 Clone the data.
 
 CSRMatrixData ()
 Empty constructor.
 
 CSRMatrixData (const CSRMatrixData &)=delete
 Copy constructor.
 
 CSRMatrixData (int64_t fid, AMP::IO::RestartManager *manager)
 Constructor from restart data.
 
 CSRMatrixData (std::shared_ptr< MatrixParametersBase > params)
 Constructor.
 
size_t endCol () const override
 Get the global id of the last column in diagonal block (exclusive)
 
size_t endRow () const override
 Get the global id of the last stored row (exclusive)
 
virtual AMP::Utilities::Backend getBackend () const
 Get the backend.
 
typeID getCoeffType () const override
 Return the typeid of the matrix coeffs.
 
std::vector< size_t > getColumnIDs (size_t row) const override
 Get the global indices of nonzeros in a given row.
 
virtual AMP_MPI getComm () const
 Get the comm.
 
std::shared_ptr< localmatrixdata_tgetDiagMatrix ()
 Get pointer to diagonal block.
 
std::shared_ptr< const localmatrixdata_tgetDiagMatrix () const
 
lidx_tgetDiagRowStarts ()
 Get row pointers from diagonal block.
 
uint64_t getID () const
 Get a unique id hash for the vector.
 
std::shared_ptr< CommunicationListgetLeftCommList () const
 Get the CommList associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )
 
std::shared_ptr< Discretization::DOFManagergetLeftDOFManager () const override
 Get the DOFManager associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )
 
virtual std::shared_ptr< VariablegetLeftVariable () const
 Get the variable associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )
 
auto getMemoryLocation () const
 Get the memory space where data is stored.
 
lidx_tgetOffDiagRowStarts ()
 Get row pointers from off-diagonal block.
 
std::shared_ptr< localmatrixdata_tgetOffdMatrix ()
 Get pointer to off-diagonal block.
 
std::shared_ptr< const localmatrixdata_tgetOffdMatrix () const
 
std::shared_ptr< CommunicationListgetRightCommList () const
 Get the CommList associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a right vector )
 
std::shared_ptr< Discretization::DOFManagergetRightDOFManager () const override
 Get the DOFManager associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )
 
virtual std::shared_ptr< VariablegetRightVariable () const
 Get the variable associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )
 
void getRowByGlobalID (size_t row, std::vector< size_t > &cols, std::vector< double > &values) const override
 Retrieve a row of the matrix in compressed format.
 
template<class TYPE >
void getValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, TYPE *values) const
 Get values in the matrix.
 
void getValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, void *values, const typeID &id) const override
 Get values from the matrix.
 
void globalToLocalColumns ()
 Convert global columns in blocks to local columns and free global columns.
 
bool hasOffDiag () const
 Check if off-diagonal block is non-empty.
 
bool isEmpty () const noexcept
 Check if matrix is globally square.
 
bool isSquare () const noexcept
 Check if matrix is globally square.
 
void makeConsistent (AMP::LinearAlgebra::ScatterType t) override
 Perform communication to ensure values in the matrix are the same across cores.
 
template<typename ConfigOut >
std::shared_ptr< CSRMatrixData< ConfigOut > > migrate (AMP::Utilities::Backend backend) const
 Migrate data to different configuration, mostly for moving memory spaces.
 
virtual std::uint16_t mode () const override
 Return CSR mode of the matrix.
 
size_t numberColumnIDs (size_t row) const override
 Given a row, retrieve the number of non-zero column indices of the matrix.
 
auto numberOfNonZeros () const
 Get total number of nonzeros in both blocks.
 
auto numberOfNonZerosDiag () const
 Get total number of nonzeros in diagonal block.
 
auto numberOfNonZerosOffDiag () const
 Get total number of nonzeros in off-diagonal block.
 
size_t numGlobalColumns () const override
 Get the number of global columns in the matrix.
 
size_t numGlobalRows () const override
 Get the number of global rows in the matrix.
 
size_t numLocalColumns () const override
 Get the number of local columns in the matrix.
 
size_t numLocalRows () const override
 Get the number of local rows in the matrix.
 
void printStats (bool verbose, bool show_zeros) const
 Print information about matrix blocks.
 
void registerChildObjects (AMP::IO::RestartManager *manager) const override
 Register any child objects.
 
void removeRange (AMP::Scalar bnd_lo, AMP::Scalar bnd_up) override
 Remove matrix entries within given range.
 
void resetDOFManagers (bool force_dm_reset=false)
 Replace left/right DOFManagers and CommunicationLists to match NNZ structure.
 
virtual void setBackend (AMP::Utilities::Backend backend)
 
void setNNZ (bool do_accum)
 Set the number of nonzeros in each block and allocate space internally.
 
void setNNZ (const lidx_t *nnz_diag, const lidx_t *nnz_offd)
 Set the number of nonzeros in each block and allocate space internally.
 
void setNNZ (lidx_t tot_nnz_diag, lidx_t tot_nnz_offd)
 Set the number of nonzeros in each block and allocate space internally.
 
template<class TYPE >
void setValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const TYPE *values)
 Set values in the matrix.
 
void setValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const void *values, const typeID &id) override
 Set values in the matrix.
 
std::shared_ptr< MatrixDatashared_from_this ()
 
std::shared_ptr< const MatrixDatashared_from_this () const
 
std::shared_ptr< localmatrixdata_tsubsetCols (const gidx_t idx_lo, const gidx_t idx_up, const bool is_diag) const
 Extract subset of each row containing global columns in some range.
 
std::shared_ptr< localmatrixdata_tsubsetRows (const std::vector< gidx_t > &rows) const
 Extract subset of locally owned rows into new local matrix.
 
std::shared_ptr< MatrixDatatranspose () const override
 Transpose.
 
std::string type () const override
 Return the type of the matrix.
 
void writeRestart (int64_t fid) const override
 Write restart data to file.
 
virtual ~CSRMatrixData ()
 Destructor.
 

Public Attributes

AMP::Utilities::MemoryType d_memory_location
 Memory location, set by examining type of Allocator.
 

Protected Member Functions

void readRestartMapData (const int64_t fid, const std::string &prefix, std::map< gidx_t, std::map< gidx_t, scalar_t > > &data)
 
void setOtherData (std::map< gidx_t, std::map< gidx_t, scalar_t > > &, AMP::LinearAlgebra::ScatterType)
 Update matrix data off-core.
 
std::shared_ptr< localmatrixdata_ttransposeOffd (std::shared_ptr< MatrixParametersBase > params) const
 
void writeRestartMapData (const int64_t fid, const std::string &prefix, const std::map< gidx_t, std::map< gidx_t, scalar_t > > &data) const
 

Protected Attributes

std::shared_ptr< localmatrixdata_td_diag_matrix
 Diagonal matrix block [d_first_row,d_last_row] x [d_first_col,d_last_col].
 
gidx_t d_first_col = 0
 Global index of first column of diagonal block.
 
gidx_t d_first_row = 0
 Global index of first row of this block.
 
std::map< gidx_t, std::map< gidx_t, scalar_t > > d_ghost_data
 \(A_{i,j}\) storage of off core matrix data to set
 
gidxAllocator_t d_gidxAllocator
 Allocator for gidx_t matched to template parameter.
 
uint64_t d_hash = 0
 
bool d_is_square = true
 Matrix is square if true.
 
gidx_t d_last_col = 0
 Global index of last column of diagonal block.
 
gidx_t d_last_row = 0
 Global index of last row of this block.
 
std::shared_ptr< CommunicationListd_leftCommList
 CommunicationList for left vectors.
 
std::shared_ptr< Discretization::DOFManagerd_leftDOFManager
 DOFManager for left vectors.
 
lidxAllocator_t d_lidxAllocator
 Allocator for lidx_t matched to template parameter.
 
std::shared_ptr< localmatrixdata_td_offd_matrix
 Diagonal matrix block [d_first_row,d_last_row] x ]d_first_col,d_last_col[.
 
std::map< gidx_t, std::map< gidx_t, scalar_t > > d_other_data
 \(A_{i,j}\) storage of off core matrix data
 
std::shared_ptr< MatrixParametersBased_pParameters
 
std::shared_ptr< CommunicationListd_rightCommList
 CommunicationList for right vectors.
 
std::shared_ptr< Discretization::DOFManagerd_rightDOFManager
 DOFManager for right vectors.
 
scalarAllocator_t d_scalarAllocator
 Allocator for scalar_t matched to template parameter.
 
std::weak_ptr< MatrixDataweak_ptr_
 

Friends

template<typename C >
class CSRMatrixData
 
template<typename C >
class CSRMatrixSpGEMMDefault
 

Detailed Description

template<typename Config>
class AMP::LinearAlgebra::CSRMatrixData< Config >

Definition at line 30 of file CSRMatrixData.h.

Member Typedef Documentation

◆ allocator_type

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixData< Config >::allocator_type = typename Config::allocator_type

Definition at line 41 of file CSRMatrixData.h.

◆ gidx_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixData< Config >::gidx_t = typename Config::gidx_t

Definition at line 38 of file CSRMatrixData.h.

◆ gidxAllocator_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixData< Config >::gidxAllocator_t = typename std::allocator_traits<allocator_type>::template rebind_alloc<gidx_t>

Definition at line 43 of file CSRMatrixData.h.

◆ lidx_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixData< Config >::lidx_t = typename Config::lidx_t

Definition at line 39 of file CSRMatrixData.h.

◆ lidxAllocator_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixData< Config >::lidxAllocator_t = typename std::allocator_traits<allocator_type>::template rebind_alloc<lidx_t>

Definition at line 45 of file CSRMatrixData.h.

◆ localmatrixdata_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixData< Config >::localmatrixdata_t = CSRLocalMatrixData<Config>

Definition at line 49 of file CSRMatrixData.h.

◆ mask_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixData< Config >::mask_t = typename localmatrixdata_t::mask_t

Definition at line 50 of file CSRMatrixData.h.

◆ scalar_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixData< Config >::scalar_t = typename Config::scalar_t

Definition at line 40 of file CSRMatrixData.h.

◆ scalarAllocator_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixData< Config >::scalarAllocator_t = typename std::allocator_traits<allocator_type>::template rebind_alloc<scalar_t>

Definition at line 47 of file CSRMatrixData.h.

Constructor & Destructor Documentation

◆ CSRMatrixData() [1/4]

template<typename Config >
AMP::LinearAlgebra::CSRMatrixData< Config >::CSRMatrixData ( std::shared_ptr< MatrixParametersBase params)
explicit

Constructor.

Parameters
[in]paramsDescription of the matrix

◆ ~CSRMatrixData()

template<typename Config >
virtual AMP::LinearAlgebra::CSRMatrixData< Config >::~CSRMatrixData ( )
virtual

Destructor.

◆ CSRMatrixData() [2/4]

template<typename Config >
AMP::LinearAlgebra::CSRMatrixData< Config >::CSRMatrixData ( )

Empty constructor.

◆ CSRMatrixData() [3/4]

template<typename Config >
AMP::LinearAlgebra::CSRMatrixData< Config >::CSRMatrixData ( const CSRMatrixData< Config > &  )
delete

Copy constructor.

◆ CSRMatrixData() [4/4]

template<typename Config >
AMP::LinearAlgebra::CSRMatrixData< Config >::CSRMatrixData ( int64_t  fid,
AMP::IO::RestartManager manager 
)

Constructor from restart data.

Member Function Documentation

◆ addValuesByGlobalID() [1/2]

template<class TYPE >
void AMP::LinearAlgebra::MatrixData::addValuesByGlobalID ( size_t  num_rows,
size_t  num_cols,
const size_t *  rows,
const size_t *  cols,
const TYPE *  values 
)
inherited

Add values to those in the matrix.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[in]valuesThe values to add to the matrix (row-major ordering)

This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.

◆ addValuesByGlobalID() [2/2]

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::addValuesByGlobalID ( size_t  num_rows,
size_t  num_cols,
const size_t *  rows,
const size_t *  cols,
const void *  values,
const typeID id 
)
overridevirtual

Add values to those in the matrix.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[in]valuesThe values to add to the matrix
[in]idtypeID of raw data

If the matrix has not allocated a particular (row,col) specified, those values will be ignored.

Implements AMP::LinearAlgebra::MatrixData.

◆ assemble()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::assemble ( bool  force_dm_reset = false)

Convenience function to triger internal setup.

Parameters
[in]force_dm_resetFlag to force DOFManager/CommList resets

This just calls globalToLocalColumns and resetDOFManagers in succession.

◆ beginCol()

template<typename Config >
size_t AMP::LinearAlgebra::CSRMatrixData< Config >::beginCol ( ) const
overridevirtual

Get the global id of the first column in diagonal block (inclusive)

Reimplemented from AMP::LinearAlgebra::MatrixData.

◆ beginRow()

template<typename Config >
size_t AMP::LinearAlgebra::CSRMatrixData< Config >::beginRow ( ) const
overridevirtual

Get the global id of the first stored row (inclusive)

Reimplemented from AMP::LinearAlgebra::MatrixData.

◆ cloneMatrixData()

template<typename Config >
std::shared_ptr< MatrixData > AMP::LinearAlgebra::CSRMatrixData< Config >::cloneMatrixData ( ) const
overridevirtual

Clone the data.

Implements AMP::LinearAlgebra::MatrixData.

◆ endCol()

template<typename Config >
size_t AMP::LinearAlgebra::CSRMatrixData< Config >::endCol ( ) const
overridevirtual

Get the global id of the last column in diagonal block (exclusive)

Reimplemented from AMP::LinearAlgebra::MatrixData.

◆ endRow()

template<typename Config >
size_t AMP::LinearAlgebra::CSRMatrixData< Config >::endRow ( ) const
overridevirtual

Get the global id of the last stored row (exclusive)

Reimplemented from AMP::LinearAlgebra::MatrixData.

◆ getBackend()

virtual AMP::Utilities::Backend AMP::LinearAlgebra::MatrixData::getBackend ( ) const
inlinevirtualinherited

Get the backend.

Definition at line 268 of file MatrixData.h.

References AMP_ASSERT, and AMP::LinearAlgebra::MatrixData::d_pParameters.

◆ getCoeffType()

template<typename Config >
typeID AMP::LinearAlgebra::CSRMatrixData< Config >::getCoeffType ( ) const
inlineoverridevirtual

Return the typeid of the matrix coeffs.

Implements AMP::LinearAlgebra::MatrixData.

Definition at line 209 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::type().

◆ getColumnIDs()

template<typename Config >
std::vector< size_t > AMP::LinearAlgebra::CSRMatrixData< Config >::getColumnIDs ( size_t  row) const
overridevirtual

Get the global indices of nonzeros in a given row.

Implements AMP::LinearAlgebra::MatrixData.

◆ getComm()

virtual AMP_MPI AMP::LinearAlgebra::MatrixData::getComm ( ) const
inlinevirtualinherited

◆ getDiagMatrix() [1/2]

template<typename Config >
std::shared_ptr< localmatrixdata_t > AMP::LinearAlgebra::CSRMatrixData< Config >::getDiagMatrix ( )
inline

Get pointer to diagonal block.

Definition at line 216 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_diag_matrix.

◆ getDiagMatrix() [2/2]

template<typename Config >
std::shared_ptr< const localmatrixdata_t > AMP::LinearAlgebra::CSRMatrixData< Config >::getDiagMatrix ( ) const
inline

◆ getDiagRowStarts()

template<typename Config >
lidx_t * AMP::LinearAlgebra::CSRMatrixData< Config >::getDiagRowStarts ( )
inline

Get row pointers from diagonal block.

Definition at line 224 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_diag_matrix.

◆ getID()

uint64_t AMP::LinearAlgebra::MatrixData::getID ( ) const
inherited

Get a unique id hash for the vector.

◆ getLeftCommList()

template<typename Config >
std::shared_ptr< CommunicationList > AMP::LinearAlgebra::CSRMatrixData< Config >::getLeftCommList ( ) const

Get the CommList associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )

Returns
The CommList associated with a left vector

◆ getLeftDOFManager()

template<typename Config >
std::shared_ptr< Discretization::DOFManager > AMP::LinearAlgebra::CSRMatrixData< Config >::getLeftDOFManager ( ) const
overridevirtual

Get the DOFManager associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )

Returns
The DOFManager associated with a left vector

Implements AMP::LinearAlgebra::MatrixData.

◆ getLeftVariable()

virtual std::shared_ptr< Variable > AMP::LinearAlgebra::MatrixData::getLeftVariable ( ) const
inlinevirtualinherited

Get the variable associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )

Returns
The variable associated with a left vector

Definition at line 215 of file MatrixData.h.

References AMP::LinearAlgebra::MatrixData::d_pParameters.

◆ getMemoryLocation()

template<typename Config >
auto AMP::LinearAlgebra::CSRMatrixData< Config >::getMemoryLocation ( ) const
inline

Get the memory space where data is stored.

Definition at line 248 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_memory_location.

◆ getOffDiagRowStarts()

template<typename Config >
lidx_t * AMP::LinearAlgebra::CSRMatrixData< Config >::getOffDiagRowStarts ( )
inline

Get row pointers from off-diagonal block.

Definition at line 227 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_offd_matrix.

◆ getOffdMatrix() [1/2]

template<typename Config >
std::shared_ptr< localmatrixdata_t > AMP::LinearAlgebra::CSRMatrixData< Config >::getOffdMatrix ( )
inline

Get pointer to off-diagonal block.

Definition at line 220 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_offd_matrix.

◆ getOffdMatrix() [2/2]

template<typename Config >
std::shared_ptr< const localmatrixdata_t > AMP::LinearAlgebra::CSRMatrixData< Config >::getOffdMatrix ( ) const
inline

◆ getRightCommList()

template<typename Config >
std::shared_ptr< CommunicationList > AMP::LinearAlgebra::CSRMatrixData< Config >::getRightCommList ( ) const

Get the CommList associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a right vector )

Returns
The CommList associated with a right vector

◆ getRightDOFManager()

template<typename Config >
std::shared_ptr< Discretization::DOFManager > AMP::LinearAlgebra::CSRMatrixData< Config >::getRightDOFManager ( ) const
overridevirtual

Get the DOFManager associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )

Returns
The DOFManager associated with a right vector

Implements AMP::LinearAlgebra::MatrixData.

◆ getRightVariable()

virtual std::shared_ptr< Variable > AMP::LinearAlgebra::MatrixData::getRightVariable ( ) const
inlinevirtualinherited

Get the variable associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )

Returns
The variable associated with a right vector

Definition at line 205 of file MatrixData.h.

References AMP::LinearAlgebra::MatrixData::d_pParameters.

◆ getRowByGlobalID()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::getRowByGlobalID ( size_t  row,
std::vector< size_t > &  cols,
std::vector< double > &  values 
) const
overridevirtual

Retrieve a row of the matrix in compressed format.

Parameters
[in]rowWhich row
[out]colsThe column ids of the returned values
[out]valuesThe values in the row

Implements AMP::LinearAlgebra::MatrixData.

◆ getValuesByGlobalID() [1/2]

template<class TYPE >
void AMP::LinearAlgebra::MatrixData::getValuesByGlobalID ( size_t  num_rows,
size_t  num_cols,
const size_t *  rows,
const size_t *  cols,
TYPE *  values 
) const
inherited

Get values in the matrix.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[out]valuesThe values to get from the matrix (row-major ordering)

This method will return zero for any entries that have not been allocated or are not ghosts on the current processor.

◆ getValuesByGlobalID() [2/2]

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::getValuesByGlobalID ( size_t  num_rows,
size_t  num_cols,
const size_t *  rows,
const size_t *  cols,
void *  values,
const typeID id 
) const
overridevirtual

Get values from the matrix.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[out]valuesPlace to write retrieved values
[in]idtypeID of raw data

If the matrix has not allocated a particular (row,col) specified those values will be set to zero.

Implements AMP::LinearAlgebra::MatrixData.

◆ globalToLocalColumns()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::globalToLocalColumns ( )

Convert global columns in blocks to local columns and free global columns.

◆ hasOffDiag()

template<typename Config >
bool AMP::LinearAlgebra::CSRMatrixData< Config >::hasOffDiag ( ) const
inline

Check if off-diagonal block is non-empty.

Definition at line 245 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_offd_matrix.

◆ isEmpty()

template<typename Config >
bool AMP::LinearAlgebra::CSRMatrixData< Config >::isEmpty ( ) const
inlinenoexcept

◆ isSquare()

template<typename Config >
bool AMP::LinearAlgebra::CSRMatrixData< Config >::isSquare ( ) const
inlinenoexcept

Check if matrix is globally square.

Definition at line 230 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_is_square.

◆ makeConsistent()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::makeConsistent ( AMP::LinearAlgebra::ScatterType  t)
overridevirtual

Perform communication to ensure values in the matrix are the same across cores.

Implements AMP::LinearAlgebra::MatrixData.

◆ migrate()

template<typename Config >
template<typename ConfigOut >
std::shared_ptr< CSRMatrixData< ConfigOut > > AMP::LinearAlgebra::CSRMatrixData< Config >::migrate ( AMP::Utilities::Backend  backend) const

Migrate data to different configuration, mostly for moving memory spaces.

◆ mode()

template<typename Config >
virtual std::uint16_t AMP::LinearAlgebra::CSRMatrixData< Config >::mode ( ) const
inlineoverridevirtual

Return CSR mode of the matrix.

Reimplemented from AMP::LinearAlgebra::MatrixData.

Definition at line 80 of file CSRMatrixData.h.

◆ numberColumnIDs()

template<typename Config >
size_t AMP::LinearAlgebra::CSRMatrixData< Config >::numberColumnIDs ( size_t  row) const
overridevirtual

Given a row, retrieve the number of non-zero column indices of the matrix.

Parameters
[in]rowWhich row

Implements AMP::LinearAlgebra::MatrixData.

◆ numberOfNonZeros()

template<typename Config >
auto AMP::LinearAlgebra::CSRMatrixData< Config >::numberOfNonZeros ( ) const
inline

Get total number of nonzeros in both blocks.

Definition at line 236 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_diag_matrix, and AMP::LinearAlgebra::CSRMatrixData< Config >::d_offd_matrix.

◆ numberOfNonZerosDiag()

template<typename Config >
auto AMP::LinearAlgebra::CSRMatrixData< Config >::numberOfNonZerosDiag ( ) const
inline

Get total number of nonzeros in diagonal block.

Definition at line 239 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_diag_matrix.

◆ numberOfNonZerosOffDiag()

template<typename Config >
auto AMP::LinearAlgebra::CSRMatrixData< Config >::numberOfNonZerosOffDiag ( ) const
inline

Get total number of nonzeros in off-diagonal block.

Definition at line 242 of file CSRMatrixData.h.

References AMP::LinearAlgebra::CSRMatrixData< Config >::d_offd_matrix.

◆ numGlobalColumns()

template<typename Config >
size_t AMP::LinearAlgebra::CSRMatrixData< Config >::numGlobalColumns ( ) const
overridevirtual

Get the number of global columns in the matrix.

Reimplemented from AMP::LinearAlgebra::MatrixData.

Referenced by AMP::LinearAlgebra::CSRMatrixData< Config >::printStats().

◆ numGlobalRows()

template<typename Config >
size_t AMP::LinearAlgebra::CSRMatrixData< Config >::numGlobalRows ( ) const
overridevirtual

Get the number of global rows in the matrix.

Reimplemented from AMP::LinearAlgebra::MatrixData.

Referenced by AMP::LinearAlgebra::CSRMatrixData< Config >::printStats().

◆ numLocalColumns()

template<typename Config >
size_t AMP::LinearAlgebra::CSRMatrixData< Config >::numLocalColumns ( ) const
overridevirtual

Get the number of local columns in the matrix.

Reimplemented from AMP::LinearAlgebra::MatrixData.

◆ numLocalRows()

template<typename Config >
size_t AMP::LinearAlgebra::CSRMatrixData< Config >::numLocalRows ( ) const
overridevirtual

Get the number of local rows in the matrix.

Reimplemented from AMP::LinearAlgebra::MatrixData.

◆ printStats()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::printStats ( bool  verbose,
bool  show_zeros 
) const
inline

◆ readRestartMapData()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::readRestartMapData ( const int64_t  fid,
const std::string &  prefix,
std::map< gidx_t, std::map< gidx_t, scalar_t > > &  data 
)
protected

◆ registerChildObjects()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::registerChildObjects ( AMP::IO::RestartManager manager) const
overridevirtual

Register any child objects.

This function will register child objects with the manager

Parameters
managerRestart manager

Reimplemented from AMP::LinearAlgebra::MatrixData.

◆ removeRange()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::removeRange ( AMP::Scalar  bnd_lo,
AMP::Scalar  bnd_up 
)
overridevirtual

Remove matrix entries within given range.

Parameters
[in]bnd_loLower bound of range to discard
[in]bnd_upUpper bound of range to discard

Implements AMP::LinearAlgebra::MatrixData.

◆ resetDOFManagers()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::resetDOFManagers ( bool  force_dm_reset = false)

Replace left/right DOFManagers and CommunicationLists to match NNZ structure.

Parameters
[in]force_dm_resetFlag to force DOFManager/CommList resets

This is necessary for matrices not created from pairs of vectors, e.g. result matrices from SpGEMM and prolongators in AMG

◆ setBackend()

virtual void AMP::LinearAlgebra::MatrixData::setBackend ( AMP::Utilities::Backend  backend)
inlinevirtualinherited

Definition at line 274 of file MatrixData.h.

References AMP_ASSERT, and AMP::LinearAlgebra::MatrixData::d_pParameters.

◆ setNNZ() [1/3]

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::setNNZ ( bool  do_accum)

Set the number of nonzeros in each block and allocate space internally.

Parameters
[in]do_accumFlag for whether entries in row pointers need to be accumulated

This version assumes that either the nnz per row have been written into the row_pointer fields of the individual blocks, or the accumulated row pointers have been written.

◆ setNNZ() [2/3]

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::setNNZ ( const lidx_t nnz_diag,
const lidx_t nnz_offd 
)

Set the number of nonzeros in each block and allocate space internally.

Parameters
[in]nnz_diagNumber of nonzeros in each row of diagonal block
[in]nnz_offdNumber of nonzeros in each row of off-diagonal block

◆ setNNZ() [3/3]

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::setNNZ ( lidx_t  tot_nnz_diag,
lidx_t  tot_nnz_offd 
)

Set the number of nonzeros in each block and allocate space internally.

Parameters
[in]tot_nnz_diagNumber of nonzeros in whole diagonal block
[in]tot_nnz_offdNumber of nonzeros in whole off-diagonal block

◆ setOtherData()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::setOtherData ( std::map< gidx_t, std::map< gidx_t, scalar_t > > &  ,
AMP::LinearAlgebra::ScatterType   
)
protected

Update matrix data off-core.

◆ setValuesByGlobalID() [1/2]

template<class TYPE >
void AMP::LinearAlgebra::MatrixData::setValuesByGlobalID ( size_t  num_rows,
size_t  num_cols,
const size_t *  rows,
const size_t *  cols,
const TYPE *  values 
)
inherited

Set values in the matrix.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[in]valuesThe values to set to the matrix (row-major ordering)

This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.

◆ setValuesByGlobalID() [2/2]

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::setValuesByGlobalID ( size_t  num_rows,
size_t  num_cols,
const size_t *  rows,
const size_t *  cols,
const void *  values,
const typeID id 
)
overridevirtual

Set values in the matrix.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[in]valuesThe values to set to the matrix
[in]idtypeID of raw data

If the matrix has not allocated a particular (row,col) specified, those values will be ignored.

Implements AMP::LinearAlgebra::MatrixData.

◆ shared_from_this() [1/2]

std::shared_ptr< MatrixData > AMP::enable_shared_from_this< MatrixData >::shared_from_this ( )
inlineinherited

Definition at line 28 of file enable_shared_from_this.h.

◆ shared_from_this() [2/2]

std::shared_ptr< const MatrixData > AMP::enable_shared_from_this< MatrixData >::shared_from_this ( ) const
inlineinherited

Definition at line 46 of file enable_shared_from_this.h.

◆ subsetCols()

template<typename Config >
std::shared_ptr< localmatrixdata_t > AMP::LinearAlgebra::CSRMatrixData< Config >::subsetCols ( const gidx_t  idx_lo,
const gidx_t  idx_up,
const bool  is_diag 
) const

Extract subset of each row containing global columns in some range.

Parameters
[in]idx_loLower global column index (inclusive)
[in]idx_upUpper global column index (exclusive)
[in]is_diagFlag if produced matrix should be marked as diag block
Returns
shared_ptr to CSRLocalMatrixData holding the extracted nonzeros

Returned matrix concatenates contributions for both diag and offd components. Row and column extents are inherited from this matrix, but are neither sorted nor converted to local indices.

◆ subsetRows()

template<typename Config >
std::shared_ptr< localmatrixdata_t > AMP::LinearAlgebra::CSRMatrixData< Config >::subsetRows ( const std::vector< gidx_t > &  rows) const

Extract subset of locally owned rows into new local matrix.

Parameters
[in]rowsvector of global row indices to extract
Returns
shared_ptr to CSRLocalMatrixData holding the extracted rows

Returned matrix concatenates contributions for both diag and offd components. Row extents are set to [0,rows.size) and column extents are set to [0,numGlobalColumns).

◆ transpose()

template<typename Config >
std::shared_ptr< MatrixData > AMP::LinearAlgebra::CSRMatrixData< Config >::transpose ( ) const
overridevirtual

Transpose.

Implements AMP::LinearAlgebra::MatrixData.

◆ transposeOffd()

template<typename Config >
std::shared_ptr< localmatrixdata_t > AMP::LinearAlgebra::CSRMatrixData< Config >::transposeOffd ( std::shared_ptr< MatrixParametersBase params) const
protected

◆ type()

template<typename Config >
std::string AMP::LinearAlgebra::CSRMatrixData< Config >::type ( ) const
inlineoverridevirtual

Return the type of the matrix.

Implements AMP::LinearAlgebra::MatrixData.

Definition at line 77 of file CSRMatrixData.h.

Referenced by AMP::LinearAlgebra::CSRMatrixData< Config >::getCoeffType().

◆ writeRestart()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::writeRestart ( int64_t  fid) const
overridevirtual

Write restart data to file.

This function will write the mesh to an HDF5 file

Parameters
fidFile identifier to write

Reimplemented from AMP::LinearAlgebra::MatrixData.

◆ writeRestartMapData()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixData< Config >::writeRestartMapData ( const int64_t  fid,
const std::string &  prefix,
const std::map< gidx_t, std::map< gidx_t, scalar_t > > &  data 
) const
protected

Friends And Related Symbol Documentation

◆ CSRMatrixData

template<typename Config >
template<typename C >
friend class CSRMatrixData
friend

Definition at line 36 of file CSRMatrixData.h.

◆ CSRMatrixSpGEMMDefault

template<typename Config >
template<typename C >
friend class CSRMatrixSpGEMMDefault
friend

Definition at line 34 of file CSRMatrixData.h.

Member Data Documentation

◆ d_diag_matrix

template<typename Config >
std::shared_ptr<localmatrixdata_t> AMP::LinearAlgebra::CSRMatrixData< Config >::d_diag_matrix
protected

◆ d_first_col

template<typename Config >
gidx_t AMP::LinearAlgebra::CSRMatrixData< Config >::d_first_col = 0
protected

Global index of first column of diagonal block.

Definition at line 373 of file CSRMatrixData.h.

◆ d_first_row

template<typename Config >
gidx_t AMP::LinearAlgebra::CSRMatrixData< Config >::d_first_row = 0
protected

Global index of first row of this block.

Definition at line 369 of file CSRMatrixData.h.

◆ d_ghost_data

template<typename Config >
std::map<gidx_t, std::map<gidx_t, scalar_t> > AMP::LinearAlgebra::CSRMatrixData< Config >::d_ghost_data
protected

\(A_{i,j}\) storage of off core matrix data to set

Definition at line 403 of file CSRMatrixData.h.

◆ d_gidxAllocator

template<typename Config >
gidxAllocator_t AMP::LinearAlgebra::CSRMatrixData< Config >::d_gidxAllocator
mutableprotected

Allocator for gidx_t matched to template parameter.

Definition at line 378 of file CSRMatrixData.h.

◆ d_hash

uint64_t AMP::LinearAlgebra::MatrixData::d_hash = 0
protectedinherited

Definition at line 311 of file MatrixData.h.

◆ d_is_square

template<typename Config >
bool AMP::LinearAlgebra::CSRMatrixData< Config >::d_is_square = true
protected

Matrix is square if true.

Definition at line 367 of file CSRMatrixData.h.

Referenced by AMP::LinearAlgebra::CSRMatrixData< Config >::isSquare().

◆ d_last_col

template<typename Config >
gidx_t AMP::LinearAlgebra::CSRMatrixData< Config >::d_last_col = 0
protected

Global index of last column of diagonal block.

Definition at line 375 of file CSRMatrixData.h.

◆ d_last_row

template<typename Config >
gidx_t AMP::LinearAlgebra::CSRMatrixData< Config >::d_last_row = 0
protected

Global index of last row of this block.

Definition at line 371 of file CSRMatrixData.h.

◆ d_leftCommList

template<typename Config >
std::shared_ptr<CommunicationList> AMP::LinearAlgebra::CSRMatrixData< Config >::d_leftCommList
protected

CommunicationList for left vectors.

Definition at line 395 of file CSRMatrixData.h.

◆ d_leftDOFManager

template<typename Config >
std::shared_ptr<Discretization::DOFManager> AMP::LinearAlgebra::CSRMatrixData< Config >::d_leftDOFManager
protected

DOFManager for left vectors.

Definition at line 390 of file CSRMatrixData.h.

◆ d_lidxAllocator

template<typename Config >
lidxAllocator_t AMP::LinearAlgebra::CSRMatrixData< Config >::d_lidxAllocator
mutableprotected

Allocator for lidx_t matched to template parameter.

Definition at line 380 of file CSRMatrixData.h.

◆ d_memory_location

template<typename Config >
AMP::Utilities::MemoryType AMP::LinearAlgebra::CSRMatrixData< Config >::d_memory_location

Memory location, set by examining type of Allocator.

Definition at line 363 of file CSRMatrixData.h.

Referenced by AMP::LinearAlgebra::CSRMatrixData< Config >::getMemoryLocation(), and AMP::LinearAlgebra::CSRMatrixData< Config >::printStats().

◆ d_offd_matrix

template<typename Config >
std::shared_ptr<localmatrixdata_t> AMP::LinearAlgebra::CSRMatrixData< Config >::d_offd_matrix
protected

◆ d_other_data

template<typename Config >
std::map<gidx_t, std::map<gidx_t, scalar_t> > AMP::LinearAlgebra::CSRMatrixData< Config >::d_other_data
protected

\(A_{i,j}\) storage of off core matrix data

Definition at line 400 of file CSRMatrixData.h.

◆ d_pParameters

std::shared_ptr<MatrixParametersBase> AMP::LinearAlgebra::MatrixData::d_pParameters
protectedinherited

◆ d_rightCommList

template<typename Config >
std::shared_ptr<CommunicationList> AMP::LinearAlgebra::CSRMatrixData< Config >::d_rightCommList
protected

CommunicationList for right vectors.

Definition at line 397 of file CSRMatrixData.h.

◆ d_rightDOFManager

template<typename Config >
std::shared_ptr<Discretization::DOFManager> AMP::LinearAlgebra::CSRMatrixData< Config >::d_rightDOFManager
protected

DOFManager for right vectors.

Definition at line 392 of file CSRMatrixData.h.

◆ d_scalarAllocator

template<typename Config >
scalarAllocator_t AMP::LinearAlgebra::CSRMatrixData< Config >::d_scalarAllocator
mutableprotected

Allocator for scalar_t matched to template parameter.

Definition at line 382 of file CSRMatrixData.h.

◆ weak_ptr_

std::weak_ptr<MatrixData > AMP::enable_shared_from_this< MatrixData >::weak_ptr_
mutableprotectedinherited

Definition at line 69 of file enable_shared_from_this.h.


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page