Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AMP::LinearAlgebra::MatrixOperations Class Referenceabstract

#include <MatrixOperations.h>

Inheritance diagram for AMP::LinearAlgebra::MatrixOperations:
Inheritance graph
[legend]

Public Member Functions

virtual void axpy (AMP::Scalar alpha, const MatrixData &X, MatrixData &Y)=0
 Compute the linear combination of two matrices.
 
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.
 
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 up/down casting.
 
virtual void extractDiagonal (MatrixData const &A, std::shared_ptr< Vector > buf)=0
 Extract the diagonal values into a vector.
 
uint64_t getID () const
 Get a unique id hash for the vector operation.
 
virtual void getRowSums (MatrixData const &A, std::shared_ptr< Vector > buf)
 Extract the row sums into a vector.
 
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 AMP::Scalar LinfNorm (const MatrixData &X) const =0
 Compute the maximum row sum.
 
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 mult (std::shared_ptr< const Vector > x, MatrixData const &A, std::shared_ptr< Vector > y)=0
 Matrix-vector multiplication.
 
virtual void multTranspose (std::shared_ptr< const Vector > in, MatrixData const &A, std::shared_ptr< Vector > out)=0
 Matrix transpose-vector multiplication.
 
virtual void registerChildObjects (AMP::IO::RestartManager *manager) const
 Register any child objects.
 
virtual void scale (AMP::Scalar alpha, MatrixData &A)=0
 Scale the matrix by a scalar.
 
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 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 setDiagonal (std::shared_ptr< const Vector > in, MatrixData &A)=0
 Set the diagonal to the values in a vector.
 
virtual void setIdentity (MatrixData &A)=0
 Set the matrix to the identity matrix.
 
virtual void setScalar (AMP::Scalar alpha, MatrixData &A)=0
 Set the non-zeros of the matrix to a scalar.
 
virtual std::string type () const
 Return the type of the matrix operations class.
 
virtual void writeRestart (int64_t fid) const
 Write restart data to file.
 
virtual void zero (MatrixData &A)=0
 Set the non-zeros of the matrix to zero.
 
virtual ~MatrixOperations ()
 Destructor.
 

Protected Member Functions

 MatrixOperations ()
 

Protected Attributes

uint64_t d_hash = 0
 unique hash for object
 

Detailed Description

Definition at line 16 of file MatrixOperations.h.

Constructor & Destructor Documentation

◆ ~MatrixOperations()

virtual AMP::LinearAlgebra::MatrixOperations::~MatrixOperations ( )
inlinevirtual

Destructor.

Definition at line 20 of file MatrixOperations.h.

◆ MatrixOperations()

AMP::LinearAlgebra::MatrixOperations::MatrixOperations ( )
protected

Member Function Documentation

◆ axpy()

virtual void AMP::LinearAlgebra::MatrixOperations::axpy ( AMP::Scalar  alpha,
const MatrixData X,
MatrixData Y 
)
pure virtual

Compute the linear combination of two matrices.

Parameters
[in]alphascalar
[in]Xmatrix
[out]YOutput matrix Y

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

Implemented in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, AMP::LinearAlgebra::DenseSerialMatrixOperations, AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >, AMP::LinearAlgebra::NativePetscMatrixOperations, and AMP::LinearAlgebra::EpetraMatrixOperations.

◆ copy()

virtual void AMP::LinearAlgebra::MatrixOperations::copy ( const MatrixData x,
MatrixData y 
)
pure virtual

Set this 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

Implemented in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, AMP::LinearAlgebra::DenseSerialMatrixOperations, AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >, AMP::LinearAlgebra::NativePetscMatrixOperations, and AMP::LinearAlgebra::EpetraMatrixOperations.

◆ copyCast()

virtual void AMP::LinearAlgebra::MatrixOperations::copyCast ( const MatrixData x,
MatrixData y 
)
virtual

Set this 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 in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, and AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >.

◆ extractDiagonal()

virtual void AMP::LinearAlgebra::MatrixOperations::extractDiagonal ( MatrixData const &  A,
std::shared_ptr< Vector buf 
)
pure virtual

◆ getID()

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

Get a unique id hash for the vector operation.

◆ getRowSums()

virtual void AMP::LinearAlgebra::MatrixOperations::getRowSums ( MatrixData const &  A,
std::shared_ptr< Vector buf 
)
virtual

Extract the row sums into a vector.

Parameters
[in]AThe matrix to get the row sums from
[in]bufVector to store the row sums to

Reimplemented in AMP::LinearAlgebra::DenseSerialMatrixOperations, AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >, and AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >.

◆ getRowSumsAbsolute()

virtual void AMP::LinearAlgebra::MatrixOperations::getRowSumsAbsolute ( MatrixData const &  A,
std::shared_ptr< Vector buf,
const bool  remove_zeros = false 
)
virtual

Extract the absolute row sums into a vector.

Parameters
[in]AThe matrix to get the row sums from
[in]bufVector to store the row sums to
[in]remove_zerosIf true zero values in sum are replaced with ones

Reimplemented in AMP::LinearAlgebra::DenseSerialMatrixOperations, AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >, and AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >.

◆ LinfNorm()

virtual AMP::Scalar AMP::LinearAlgebra::MatrixOperations::LinfNorm ( const MatrixData X) const
pure virtual

◆ matMatMult()

virtual void AMP::LinearAlgebra::MatrixOperations::matMatMult ( std::shared_ptr< MatrixData A,
std::shared_ptr< MatrixData B,
std::shared_ptr< MatrixData C 
)
pure virtual

◆ mult()

virtual void AMP::LinearAlgebra::MatrixOperations::mult ( std::shared_ptr< const Vector x,
MatrixData const &  A,
std::shared_ptr< Vector y 
)
pure virtual

Matrix-vector multiplication.

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

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

Implemented in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, AMP::LinearAlgebra::DenseSerialMatrixOperations, AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >, AMP::LinearAlgebra::NativePetscMatrixOperations, and AMP::LinearAlgebra::EpetraMatrixOperations.

◆ multTranspose()

virtual void AMP::LinearAlgebra::MatrixOperations::multTranspose ( std::shared_ptr< const Vector in,
MatrixData const &  A,
std::shared_ptr< Vector out 
)
pure virtual

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}\).

Implemented in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, AMP::LinearAlgebra::DenseSerialMatrixOperations, AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >, AMP::LinearAlgebra::NativePetscMatrixOperations, and AMP::LinearAlgebra::EpetraMatrixOperations.

◆ registerChildObjects()

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

Register any child objects.

This function will register child objects with the manager

Parameters
managerRestart manager

◆ scale() [1/2]

virtual void AMP::LinearAlgebra::MatrixOperations::scale ( AMP::Scalar  alpha,
MatrixData A 
)
pure virtual

Scale the matrix by a scalar.

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

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

Implemented in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, AMP::LinearAlgebra::DenseSerialMatrixOperations, AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >, AMP::LinearAlgebra::NativePetscMatrixOperations, and AMP::LinearAlgebra::EpetraMatrixOperations.

◆ scale() [2/2]

virtual void AMP::LinearAlgebra::MatrixOperations::scale ( AMP::Scalar  alpha,
std::shared_ptr< const Vector D,
MatrixData A 
)
pure virtual

Scale the matrix by a scalar and diagonal matrix.

Parameters
[in]alphaThe value to scale by
[in]DA vector representing the diagonal matrix
[in]AThe input matrix A

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

Implemented in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, AMP::LinearAlgebra::DenseSerialMatrixOperations, AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >, AMP::LinearAlgebra::NativePetscMatrixOperations, and AMP::LinearAlgebra::EpetraMatrixOperations.

◆ scaleInv()

virtual void AMP::LinearAlgebra::MatrixOperations::scaleInv ( AMP::Scalar  alpha,
std::shared_ptr< const Vector D,
MatrixData A 
)
pure virtual

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

Parameters
[in]alphaThe value to scale by
[in]DA vector representing the diagonal matrix
[in]AThe input matrix A

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

Implemented in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, AMP::LinearAlgebra::DenseSerialMatrixOperations, AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >, AMP::LinearAlgebra::NativePetscMatrixOperations, and AMP::LinearAlgebra::EpetraMatrixOperations.

◆ setDiagonal()

virtual void AMP::LinearAlgebra::MatrixOperations::setDiagonal ( std::shared_ptr< const Vector in,
MatrixData A 
)
pure virtual

◆ setIdentity()

virtual void AMP::LinearAlgebra::MatrixOperations::setIdentity ( MatrixData A)
pure virtual

◆ setScalar()

virtual void AMP::LinearAlgebra::MatrixOperations::setScalar ( AMP::Scalar  alpha,
MatrixData A 
)
pure virtual

◆ type()

virtual std::string AMP::LinearAlgebra::MatrixOperations::type ( ) const
inlinevirtual

Return the type of the matrix operations class.

Reimplemented in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, and AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >.

Definition at line 143 of file MatrixOperations.h.

◆ writeRestart()

virtual void AMP::LinearAlgebra::MatrixOperations::writeRestart ( int64_t  fid) const
virtual

Write restart data to file.

This function will write the mesh to an HDF5 file

Parameters
fidFile identifier to write

Reimplemented in AMP::LinearAlgebra::CSRMatrixOperationsDefault< Config >, and AMP::LinearAlgebra::CSRMatrixOperationsDevice< Config >.

◆ zero()

virtual void AMP::LinearAlgebra::MatrixOperations::zero ( MatrixData A)
pure virtual

Member Data Documentation

◆ d_hash

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

unique hash for object

Definition at line 169 of file MatrixOperations.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