Advanced Multi-Physics (AMP)
On-Line Documentation
CSRMatrix.h
Go to the documentation of this file.
1#ifndef included_AMP_CSRMatrix
2#define included_AMP_CSRMatrix
3
4#include "AMP/matrices/CSRConfig.h"
5#include "AMP/matrices/Matrix.h"
6#include "AMP/utils/Memory.h"
7#include "AMP/vectors/Vector.h"
8#include <memory>
9
10namespace AMP::IO {
11class RestartManager;
12}
13
14namespace AMP::LinearAlgebra {
15
16template<typename Policy>
17class CSRMatrixData;
18
24template<class Config>
25class CSRMatrix : public Matrix
26{
27public:
29 using allocator_type = typename Config::allocator_type;
31 static_assert( std::is_same_v<typename allocator_type::value_type, void> );
32
33 CSRMatrix() = delete;
34
38 explicit CSRMatrix( std::shared_ptr<MatrixParametersBase> params );
39
40
44 explicit CSRMatrix( std::shared_ptr<MatrixData> data );
45
46 CSRMatrix( const CSRMatrix & ) = delete;
47
48 CSRMatrix &operator=( const CSRMatrix & ) = delete;
49
52 virtual ~CSRMatrix();
53
55 virtual std::string type() const override { return "CSRMatrix"; }
56
58 virtual std::uint16_t mode() const override
59 {
60 return static_cast<std::uint16_t>( Config::mode );
61 }
62
66 shared_ptr transpose() const override;
67
71 shared_ptr clone() const override;
72
79
86
91 template<typename ConfigOut>
93
98 template<typename ConfigOut>
100
103
110
116
122
124
125protected:
130 void multiply( shared_ptr other_op, shared_ptr &result ) override;
131};
132} // namespace AMP::LinearAlgebra
133
134
135#endif
Class to manage reading/writing restart data.
An concrete class for dealing with dense serial matrices.
Definition CSRMatrix.h:26
virtual std::uint16_t mode() const override
Return CSR mode of the matrix.
Definition CSRMatrix.h:58
shared_ptr migrate(AMP::Utilities::Backend backend) const
Return a copy of the matrix with the specified ConfigOut.
Vector::shared_ptr extractDiagonal(Vector::shared_ptr buf=Vector::shared_ptr()) const override
Extract the diagonal from a matrix.
typename Config::allocator_type allocator_type
Definition CSRMatrix.h:29
Vector::shared_ptr createOutputVector() const override
Get a left vector( For , is a left vector )
shared_ptr migrate() const
Return a copy of the matrix with the specified ConfigOut.
Vector::shared_ptr createInputVector() const override
Get a right vector( For , is a right vector )
shared_ptr clone() const override
Return a matrix with the same non-zero and distributed structure.
CSRMatrix(std::shared_ptr< MatrixData > data)
Constructor.
CSRMatrix & operator=(const CSRMatrix &)=delete
CSRMatrixData< Config > matrixdata_t
Definition CSRMatrix.h:30
shared_ptr migrate(AMP::Utilities::MemoryType memType, AMP::Utilities::Backend backend) const
Return a copy of the matrix in the specified memory space.
void setBackend(AMP::Utilities::Backend backend) override
Replace current backend with different one, no-op if same.
CSRMatrix(std::shared_ptr< MatrixParametersBase > params)
Constructor.
virtual ~CSRMatrix()
Destructor.
shared_ptr migrate(AMP::Utilities::MemoryType memType) const
Return a copy of the matrix in the specified memory space.
CSRMatrix(int64_t fid, AMP::IO::RestartManager *manager)
CSRMatrix(const CSRMatrix &)=delete
shared_ptr transpose() const override
Return a new matrix that is the transpose of this one.
virtual std::string type() const override
Return the type of the matrix.
Definition CSRMatrix.h:55
void multiply(shared_ptr other_op, shared_ptr &result) override
Multiply two matrices and store in a third.
An abstract interface for using and manipulating matrices.
Definition Matrix.h:30
std::shared_ptr< Matrix > shared_ptr
Convenience typedef.
Definition Matrix.h:33
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60
Backend
Enum to store the backend used for gpu acceleration.
Definition Backend.h:21
MemoryType
Enum to store pointer type.
Definition Memory.h:21



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