1#ifndef included_MatrixOperations_H_
2#define included_MatrixOperations_H_
4#include "AMP/utils/typeid.h"
5#include "AMP/vectors/Scalar.h"
29 mult( std::shared_ptr<const Vector> x,
MatrixData const &A, std::shared_ptr<Vector> y ) = 0;
39 std::shared_ptr<Vector> out ) = 0;
70 std::shared_ptr<MatrixData> B,
71 std::shared_ptr<MatrixData> C ) = 0;
116 std::shared_ptr<Vector> buf,
117 const bool remove_zeros =
false );
143 virtual std::string
type()
const {
return "MatrixOperations"; }
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 ~MatrixOperations()
Destructor.
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.