Advanced Multi-Physics (AMP)
On-Line Documentation
MatrixOperations.h
Go to the documentation of this file.
1#ifndef included_MatrixOperations_H_
2#define included_MatrixOperations_H_
3
4#include "AMP/utils/typeid.h"
5#include "AMP/vectors/Scalar.h"
6
7namespace AMP::IO {
8class RestartManager;
9}
10
11namespace AMP::LinearAlgebra {
12
13class Vector;
14class MatrixData;
15
17{
18public:
20 virtual ~MatrixOperations() {}
21
28 virtual void
29 mult( std::shared_ptr<const Vector> x, MatrixData const &A, std::shared_ptr<Vector> y ) = 0;
30
37 virtual void multTranspose( std::shared_ptr<const Vector> in,
38 MatrixData const &A,
39 std::shared_ptr<Vector> out ) = 0;
40
46 virtual void scale( AMP::Scalar alpha, MatrixData &A ) = 0;
47
54 virtual void scale( AMP::Scalar alpha, std::shared_ptr<const Vector> D, MatrixData &A ) = 0;
55
62 virtual void scaleInv( AMP::Scalar alpha, std::shared_ptr<const Vector> D, MatrixData &A ) = 0;
63
69 virtual void matMatMult( std::shared_ptr<MatrixData> A,
70 std::shared_ptr<MatrixData> B,
71 std::shared_ptr<MatrixData> C ) = 0;
72
79 virtual void axpy( AMP::Scalar alpha, const MatrixData &X, MatrixData &Y ) = 0;
80
85 virtual void setScalar( AMP::Scalar alpha, MatrixData &A ) = 0;
86
90 virtual void zero( MatrixData &A ) = 0;
91
96 virtual void setDiagonal( std::shared_ptr<const Vector> in, MatrixData &A ) = 0;
97
102 virtual void extractDiagonal( MatrixData const &A, std::shared_ptr<Vector> buf ) = 0;
103
108 virtual void getRowSums( MatrixData const &A, std::shared_ptr<Vector> buf );
109
115 virtual void getRowSumsAbsolute( MatrixData const &A,
116 std::shared_ptr<Vector> buf,
117 const bool remove_zeros = false );
118
121 virtual void setIdentity( MatrixData &A ) = 0;
122
126 virtual AMP::Scalar LinfNorm( const MatrixData &X ) const = 0;
127
133 virtual void copy( const MatrixData &x, MatrixData &y ) = 0;
134
140 virtual void copyCast( const MatrixData &x, MatrixData &y );
141
143 virtual std::string type() const { return "MatrixOperations"; }
144
146 uint64_t getID() const;
147
148public: // Write/read restart data
154 virtual void registerChildObjects( AMP::IO::RestartManager *manager ) const;
155
161 virtual void writeRestart( int64_t fid ) const;
162
163
164protected:
166
167protected:
169 uint64_t d_hash = 0;
170};
171
172} // namespace AMP::LinearAlgebra
173
174#endif // included_MatrixOperations_H_
#define X(C)
Class to manage reading/writing restart data.
virtual void matMatMult(std::shared_ptr< MatrixData > A, std::shared_ptr< MatrixData > B, std::shared_ptr< MatrixData > C)=0
Compute the product of two matrices.
virtual void zero(MatrixData &A)=0
Set the non-zeros of the matrix to zero.
virtual void extractDiagonal(MatrixData const &A, std::shared_ptr< Vector > buf)=0
Extract the diagonal values into a vector.
virtual void setScalar(AMP::Scalar alpha, MatrixData &A)=0
Set the non-zeros of the matrix to a scalar.
virtual void scale(AMP::Scalar alpha, MatrixData &A)=0
Scale the matrix by a scalar.
virtual void setDiagonal(std::shared_ptr< const Vector > in, MatrixData &A)=0
Set the diagonal to the values in a vector.
virtual void registerChildObjects(AMP::IO::RestartManager *manager) const
Register any child objects.
virtual std::string type() const
Return the type of the matrix operations class.
uint64_t d_hash
unique hash for object
virtual void mult(std::shared_ptr< const Vector > x, MatrixData const &A, std::shared_ptr< Vector > y)=0
Matrix-vector multiplication.
virtual void copyCast(const MatrixData &x, MatrixData &y)
Set this matrix with the same non-zero and distributed structure as x and copy the coefficients after...
virtual AMP::Scalar LinfNorm(const MatrixData &X) const =0
Compute the maximum row sum.
virtual void scaleInv(AMP::Scalar alpha, std::shared_ptr< const Vector > D, MatrixData &A)=0
Scale the matrix by a scalar and inverse of diagonal matrix.
virtual void setIdentity(MatrixData &A)=0
Set the matrix to the identity matrix.
virtual void scale(AMP::Scalar alpha, std::shared_ptr< const Vector > D, MatrixData &A)=0
Scale the matrix by a scalar and diagonal matrix.
virtual void writeRestart(int64_t fid) const
Write restart data to file.
virtual void getRowSums(MatrixData const &A, std::shared_ptr< Vector > buf)
Extract the row sums into a vector.
virtual void axpy(AMP::Scalar alpha, const MatrixData &X, MatrixData &Y)=0
Compute the linear combination of two matrices.
uint64_t getID() const
Get a unique id hash for the vector operation.
virtual void getRowSumsAbsolute(MatrixData const &A, std::shared_ptr< Vector > buf, const bool remove_zeros=false)
Extract the absolute row sums into a vector.
virtual void multTranspose(std::shared_ptr< const Vector > in, MatrixData const &A, std::shared_ptr< Vector > out)=0
Matrix transpose-vector multiplication.
virtual void copy(const MatrixData &x, MatrixData &y)=0
Set this matrix with the same non-zero and distributed structure as x and copy the coefficients.
Scalar is a class used to store a scalar variable that may be different types/precision.
Definition Scalar.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