Advanced Multi-Physics (AMP)
On-Line Documentation
CSRMatrixOperationsDevice.h
Go to the documentation of this file.
1#ifndef included_CSRMatrixOperationsDevice_H_
2#define included_CSRMatrixOperationsDevice_H_
3
4#include "AMP/matrices/data/MatrixData.h"
5#include "AMP/matrices/operations/MatrixOperations.h"
6#include "AMP/matrices/operations/device/CSRLocalMatrixOperationsDevice.h"
7#include "AMP/matrices/operations/device/spgemm/CSRMatrixSpGEMMDevice.h"
8#include "AMP/vectors/Vector.h"
9
10#include <map>
11
12namespace AMP::LinearAlgebra {
13
14template<typename Config>
16{
17public:
18 static_assert( std::is_same_v<typename Config::allocator_type::value_type, void> );
19
20 using config_type = Config;
21 using allocator_type = typename Config::allocator_type;
24
26
27 using gidx_t = typename Config::gidx_t;
28 using lidx_t = typename Config::lidx_t;
29 using scalar_t = typename Config::scalar_t;
30
37 void mult( std::shared_ptr<const Vector> x,
38 MatrixData const &A,
39 std::shared_ptr<Vector> y ) override;
40
47 void multTranspose( std::shared_ptr<const Vector> in,
48 MatrixData const &A,
49 std::shared_ptr<Vector> out ) override;
50
56 void scale( AMP::Scalar alpha, MatrixData &A ) override;
57
61 void scale( AMP::Scalar, std::shared_ptr<const Vector>, MatrixData & ) override
62 {
63 AMP_ERROR( "Not implemented" );
64 }
65
69 void scaleInv( AMP::Scalar, std::shared_ptr<const Vector>, MatrixData & ) override
70 {
71 AMP_ERROR( "Not implemented" );
72 }
73
79 void matMatMult( std::shared_ptr<MatrixData> A,
80 std::shared_ptr<MatrixData> B,
81 std::shared_ptr<MatrixData> C ) override;
82
89 void axpy( AMP::Scalar alpha, const MatrixData &X, MatrixData &Y ) override;
90
95 void setScalar( AMP::Scalar alpha, MatrixData &A ) override;
96
101 void zero( MatrixData &A ) override;
102
107 void setDiagonal( std::shared_ptr<const Vector> in, MatrixData &A ) override;
108
113 void extractDiagonal( MatrixData const &A, std::shared_ptr<Vector> buf ) override;
114
117 void getRowSums( MatrixData const &, std::shared_ptr<Vector> ) override
118 {
119 AMP_ERROR( "Not implemented" );
120 }
121
124 void getRowSumsAbsolute( MatrixData const &, std::shared_ptr<Vector>, const bool ) override
125 {
126 AMP_ERROR( "Not implemented" );
127 }
128
132 void setIdentity( MatrixData &A ) override;
133
138 AMP::Scalar LinfNorm( const MatrixData &X ) const override;
139
145 void copy( const MatrixData &X, MatrixData &Y ) override;
146
152 void copyCast( const MatrixData &X, MatrixData &Y ) override;
153
154 template<typename ConfigIn>
155 static void
156 copyCast( CSRMatrixData<typename ConfigIn::template set_alloc_t<Config::allocator>> *X,
157 matrixdata_t *Y );
158
159 std::string type() const override { return "CSRMatrixOperationsDevice"; }
160
166 void writeRestart( int64_t fid ) const override;
167
170
171protected:
172 std::map<std::pair<std::shared_ptr<matrixdata_t>, std::shared_ptr<matrixdata_t>>,
175};
176
177} // namespace AMP::LinearAlgebra
178
179#endif
#define X(C)
Class to manage reading/writing restart data.
CSRLocalMatrixData< Config > localmatrixdata_t
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 getRowSums(MatrixData const &, std::shared_ptr< Vector >) override
Extract the row sums into a vector.
void setScalar(AMP::Scalar alpha, MatrixData &A) override
Set the non-zeros of the matrix to a scalar.
void multTranspose(std::shared_ptr< const Vector > in, MatrixData const &A, std::shared_ptr< Vector > out) override
Matrix transpose-vector multiplication.
void scale(AMP::Scalar alpha, MatrixData &A) override
Scale the matrix by a scalar.
typename matrixdata_t::localmatrixdata_t localmatrixdata_t
void getRowSumsAbsolute(MatrixData const &, std::shared_ptr< Vector >, const bool) override
Extract the absolute row sums into a vector.
void scale(AMP::Scalar, std::shared_ptr< const Vector >, MatrixData &) override
Scale the matrix by a scalar and diagonal matrix.
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...
AMP::Scalar LinfNorm(const MatrixData &X) const override
Compute the maximum row sum.
void writeRestart(int64_t fid) const override
Write restart data to file.
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 setDiagonal(std::shared_ptr< const Vector > in, MatrixData &A) override
Set the diagonal to the values in a vector.
void axpy(AMP::Scalar alpha, const MatrixData &X, MatrixData &Y) override
Compute the linear combination of two matrices.
void mult(std::shared_ptr< const Vector > x, MatrixData const &A, std::shared_ptr< Vector > y) override
Matrix-vector multiplication.
void extractDiagonal(MatrixData const &A, std::shared_ptr< Vector > buf) override
Extract the diagonal values into a vector.
std::map< std::pair< std::shared_ptr< matrixdata_t >, std::shared_ptr< matrixdata_t > >, CSRMatrixSpGEMMDevice< Config > > d_SpGEMMHelpers
CSRMatrixOperationsDevice(int64_t, AMP::IO::RestartManager *)
static void copyCast(CSRMatrixData< typename ConfigIn::template set_alloc_t< Config::allocator > > *X, matrixdata_t *Y)
void scaleInv(AMP::Scalar, std::shared_ptr< const Vector >, MatrixData &) override
Scale the matrix by a scalar and inverse of diagonal matrix.
void zero(MatrixData &A) override
Set the non-zeros of the matrix to zero.
std::string type() const override
Return the type of the matrix operations class.
void setIdentity(MatrixData &A) override
Set the matrix to the identity matrix.
Scalar is a class used to store a scalar variable that may be different types/precision.
Definition Scalar.h:21
#define AMP_ERROR(MSG)
Throw error.



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:40.
Comments on this page