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

#include <CSRMatrixOperationsDevice.h>

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

Public Types

using allocator_type = typename Config::allocator_type
 
using config_type = Config
 
using gidx_t = typename Config::gidx_t
 
using lidx_t = typename Config::lidx_t
 
using localmatrixdata_t = typename matrixdata_t::localmatrixdata_t
 
using localops_t = CSRLocalMatrixOperationsDevice< Config >
 
using matrixdata_t = CSRMatrixData< Config >
 
using scalar_t = typename Config::scalar_t
 

Public Member Functions

void axpy (AMP::Scalar alpha, const MatrixData &X, MatrixData &Y) override
 Compute the linear combination of two matrices.
 
void copy (const MatrixData &X, MatrixData &Y) override
 Set Y matrix with the same non-zero and distributed structure as x and copy the coefficients.
 
void copyCast (const MatrixData &X, MatrixData &Y) override
 Set Y matrix with the same non-zero and distributed structure as x and copy the coefficients after up/down casting.
 
 CSRMatrixOperationsDevice ()=default
 
 CSRMatrixOperationsDevice (int64_t, AMP::IO::RestartManager *)
 
void extractDiagonal (MatrixData const &A, std::shared_ptr< Vector > buf) override
 Extract the diagonal values into a vector.
 
uint64_t getID () const
 Get a unique id hash for the vector operation.
 
void getRowSums (MatrixData const &, std::shared_ptr< Vector >) override
 Extract the row sums into a vector.
 
void getRowSumsAbsolute (MatrixData const &, std::shared_ptr< Vector >, const bool) override
 Extract the absolute row sums into a vector.
 
AMP::Scalar LinfNorm (const MatrixData &X) const override
 Compute the maximum row sum.
 
void matMatMult (std::shared_ptr< MatrixData > A, std::shared_ptr< MatrixData > B, std::shared_ptr< MatrixData > C) override
 Compute the product of two matrices.
 
void mult (std::shared_ptr< const Vector > x, MatrixData const &A, std::shared_ptr< Vector > y) override
 Matrix-vector multiplication.
 
void multTranspose (std::shared_ptr< const Vector > in, MatrixData const &A, std::shared_ptr< Vector > out) override
 Matrix transpose-vector multiplication.
 
virtual void registerChildObjects (AMP::IO::RestartManager *manager) const
 Register any child objects.
 
void scale (AMP::Scalar alpha, MatrixData &A) override
 Scale the matrix by a scalar.
 
void scale (AMP::Scalar, std::shared_ptr< const Vector >, MatrixData &) override
 Scale the matrix by a scalar and diagonal matrix.
 
void scaleInv (AMP::Scalar, std::shared_ptr< const Vector >, MatrixData &) override
 Scale the matrix by a scalar and inverse of diagonal matrix.
 
void setDiagonal (std::shared_ptr< const Vector > in, MatrixData &A) override
 Set the diagonal to the values in a vector.
 
void setIdentity (MatrixData &A) override
 Set the matrix to the identity matrix.
 
void setScalar (AMP::Scalar alpha, MatrixData &A) override
 Set the non-zeros of the matrix to a scalar.
 
std::string type () const override
 Return the type of the matrix operations class.
 
void writeRestart (int64_t fid) const override
 Write restart data to file.
 
void zero (MatrixData &A) override
 Set the non-zeros of the matrix to zero.
 

Static Public Member Functions

template<typename ConfigIn >
static void copyCast (CSRMatrixData< typename ConfigIn::template set_alloc_t< Config::allocator > > *X, matrixdata_t *Y)
 

Protected Attributes

uint64_t d_hash = 0
 unique hash for object
 
std::map< std::pair< std::shared_ptr< matrixdata_t >, std::shared_ptr< matrixdata_t > >, CSRMatrixSpGEMMDevice< Config > > d_SpGEMMHelpers
 

Detailed Description

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

Definition at line 15 of file CSRMatrixOperationsDevice.h.

Member Typedef Documentation

◆ allocator_type

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

Definition at line 21 of file CSRMatrixOperationsDevice.h.

◆ config_type

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::config_type = Config

Definition at line 20 of file CSRMatrixOperationsDevice.h.

◆ gidx_t

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

Definition at line 27 of file CSRMatrixOperationsDevice.h.

◆ lidx_t

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

Definition at line 28 of file CSRMatrixOperationsDevice.h.

◆ localmatrixdata_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::localmatrixdata_t = typename matrixdata_t::localmatrixdata_t

Definition at line 23 of file CSRMatrixOperationsDevice.h.

◆ localops_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::localops_t = CSRLocalMatrixOperationsDevice<Config>

Definition at line 25 of file CSRMatrixOperationsDevice.h.

◆ matrixdata_t

template<typename Config >
using AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::matrixdata_t = CSRMatrixData<Config>

Definition at line 22 of file CSRMatrixOperationsDevice.h.

◆ scalar_t

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

Definition at line 29 of file CSRMatrixOperationsDevice.h.

Constructor & Destructor Documentation

◆ CSRMatrixOperationsDevice() [1/2]

template<typename Config >
AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::CSRMatrixOperationsDevice ( )
default

◆ CSRMatrixOperationsDevice() [2/2]

template<typename Config >
AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::CSRMatrixOperationsDevice ( int64_t  ,
AMP::IO::RestartManager  
)
inline

Definition at line 169 of file CSRMatrixOperationsDevice.h.

Member Function Documentation

◆ axpy()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::axpy ( AMP::Scalar  alpha,
const MatrixData X,
MatrixData Y 
)
overridevirtual

Compute the linear combination of two matrices.

Parameters
[in]alphascalar
[in]Xmatrix
[out]YThe output matrix

Compute \(\mathbf{THIS} = \alpha\mathbf{X} + \mathbf{THIS}\)

Implements AMP::LinearAlgebra::MatrixOperations.

◆ copy()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::copy ( const MatrixData X,
MatrixData Y 
)
overridevirtual

Set Y matrix with the same non-zero and distributed structure as x and copy the coefficients.

Parameters
[in]Xmatrix data to copy from
[in]Ymatrix data to copy to

Implements AMP::LinearAlgebra::MatrixOperations.

◆ copyCast() [1/2]

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::copyCast ( const MatrixData X,
MatrixData Y 
)
overridevirtual

Set Y matrix with the same non-zero and distributed structure as x and copy the coefficients after up/down casting.

Parameters
[in]Xmatrix data to copy from
[in]Ymatrix data to copy to after up/down casting the coefficients

Reimplemented from AMP::LinearAlgebra::MatrixOperations.

◆ copyCast() [2/2]

template<typename Config >
template<typename ConfigIn >
static void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::copyCast ( CSRMatrixData< typename ConfigIn::template set_alloc_t< Config::allocator > > *  X,
matrixdata_t Y 
)
static

◆ extractDiagonal()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::extractDiagonal ( MatrixData const &  A,
std::shared_ptr< Vector buf 
)
overridevirtual

Extract the diagonal values into a vector.

Parameters
[in]AThe matrix to read from
[out]bufBuffer to write diagonal into

Implements AMP::LinearAlgebra::MatrixOperations.

◆ getID()

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

Get a unique id hash for the vector operation.

◆ getRowSums()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::getRowSums ( MatrixData const &  ,
std::shared_ptr< Vector  
)
inlineoverridevirtual

Extract the row sums into a vector.

Reimplemented from AMP::LinearAlgebra::MatrixOperations.

Definition at line 117 of file CSRMatrixOperationsDevice.h.

References AMP_ERROR.

◆ getRowSumsAbsolute()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::getRowSumsAbsolute ( MatrixData const &  ,
std::shared_ptr< Vector ,
const bool   
)
inlineoverridevirtual

Extract the absolute row sums into a vector.

Reimplemented from AMP::LinearAlgebra::MatrixOperations.

Definition at line 124 of file CSRMatrixOperationsDevice.h.

References AMP_ERROR.

◆ LinfNorm()

template<typename Config >
AMP::Scalar AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::LinfNorm ( const MatrixData X) const
overridevirtual

Compute the maximum row sum.

Parameters
[in]XData for the input matrix
Returns
The L-infinity norm of the matrix

Implements AMP::LinearAlgebra::MatrixOperations.

◆ matMatMult()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::matMatMult ( std::shared_ptr< MatrixData A,
std::shared_ptr< MatrixData B,
std::shared_ptr< MatrixData C 
)
overridevirtual

Compute the product of two matrices.

Parameters
[in]ALeft multiplicand
[in]BRight multiplicand
[out]CThe product \(\mathbf{AB}\).

Implements AMP::LinearAlgebra::MatrixOperations.

◆ mult()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::mult ( std::shared_ptr< const Vector x,
MatrixData const &  A,
std::shared_ptr< Vector y 
)
overridevirtual

Matrix-vector multiplication.

Parameters
[in]xThe vector to multiply
[in]AThe input matrix A
[out]yThe resulting vector

Compute \(\mathbf{Ax} = \mathbf{y}\).

Implements AMP::LinearAlgebra::MatrixOperations.

◆ multTranspose()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::multTranspose ( std::shared_ptr< const Vector in,
MatrixData const &  A,
std::shared_ptr< Vector out 
)
overridevirtual

Matrix transpose-vector multiplication.

Parameters
[in]inThe vector to multiply
[in]AThe input matrix A
[out]outThe resulting vectory

Compute \(\mathbf{A}^T\mathbf{in} = \mathbf{out}\).

Implements AMP::LinearAlgebra::MatrixOperations.

◆ registerChildObjects()

virtual void AMP::LinearAlgebra::MatrixOperations::registerChildObjects ( AMP::IO::RestartManager manager) const
virtualinherited

Register any child objects.

This function will register child objects with the manager

Parameters
managerRestart manager

◆ scale() [1/2]

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::scale ( AMP::Scalar  alpha,
MatrixData A 
)
overridevirtual

Scale the matrix by a scalar.

Parameters
[in]alphaThe value to scale by
[in,out]AThe matrix A

Compute \(\mathbf{A} = \alpha\mathbf{A}\)

Implements AMP::LinearAlgebra::MatrixOperations.

◆ scale() [2/2]

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::scale ( AMP::Scalar  ,
std::shared_ptr< const Vector ,
MatrixData  
)
inlineoverridevirtual

Scale the matrix by a scalar and diagonal matrix.

Compute \(\mathbf{A} = \alpha\mathbf{D}\mathbf{A}\)

Implements AMP::LinearAlgebra::MatrixOperations.

Definition at line 61 of file CSRMatrixOperationsDevice.h.

References AMP_ERROR.

◆ scaleInv()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::scaleInv ( AMP::Scalar  ,
std::shared_ptr< const Vector ,
MatrixData  
)
inlineoverridevirtual

Scale the matrix by a scalar and inverse of diagonal matrix.

Compute \(\mathbf{A} = \alpha\mathbf{D}^{-1}\mathbf{A}\)

Implements AMP::LinearAlgebra::MatrixOperations.

Definition at line 69 of file CSRMatrixOperationsDevice.h.

References AMP_ERROR.

◆ setDiagonal()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::setDiagonal ( std::shared_ptr< const Vector in,
MatrixData A 
)
overridevirtual

Set the diagonal to the values in a vector.

Parameters
[in]inThe values to set the diagonal to
[out]AThe matrix to set

Implements AMP::LinearAlgebra::MatrixOperations.

◆ setIdentity()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::setIdentity ( MatrixData A)
overridevirtual

Set the matrix to the identity matrix.

Parameters
[out]AThe matrix to set

Implements AMP::LinearAlgebra::MatrixOperations.

◆ setScalar()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::setScalar ( AMP::Scalar  alpha,
MatrixData A 
)
overridevirtual

Set the non-zeros of the matrix to a scalar.

Parameters
[in]alphaThe value to set the non-zeros to
[out]AThe input matrix A

Implements AMP::LinearAlgebra::MatrixOperations.

◆ type()

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

Return the type of the matrix operations class.

Reimplemented from AMP::LinearAlgebra::MatrixOperations.

Definition at line 159 of file CSRMatrixOperationsDevice.h.

◆ writeRestart()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< 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::MatrixOperations.

◆ zero()

template<typename Config >
void AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::zero ( MatrixData A)
overridevirtual

Set the non-zeros of the matrix to zero.

Parameters
[in]AThe input matrix A

Does not deallocate space.

Implements AMP::LinearAlgebra::MatrixOperations.

Member Data Documentation

◆ d_hash

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

unique hash for object

Definition at line 169 of file MatrixOperations.h.

◆ d_SpGEMMHelpers

template<typename Config >
std::map<std::pair<std::shared_ptr<matrixdata_t>, std::shared_ptr<matrixdata_t> >, CSRMatrixSpGEMMDevice<Config> > AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >::d_SpGEMMHelpers
protected

Definition at line 174 of file CSRMatrixOperationsDevice.h.


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



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