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

#include <NativePetscMatrixOperations.h>

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

Public Member Functions

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.
 
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 void registerChildObjects (AMP::IO::RestartManager *manager) const
 Register any child objects.
 
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.
 

Protected Attributes

uint64_t d_hash = 0
 unique hash for object
 

Private Member Functions

void axpy (AMP::Scalar alpha, const MatrixData &X, MatrixData &Y) override
 Compute the linear combination of two matrices.
 
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 extractDiagonal (MatrixData const &A, std::shared_ptr< Vector > buf) override
 Extract the diagonal values into a vector.
 
AMP::Scalar LinfNorm (const MatrixData &X) const override
 Compute the maximum row sum.
 
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 mult (std::shared_ptr< const Vector > x, MatrixData const &A, std::shared_ptr< Vector > y) override
 Matrix-vector multiplication.
 
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.
 
void scale (AMP::Scalar, std::shared_ptr< const Vector >, MatrixData &) override
 Scale the matrix by a scalar and diagonal matrix.
 
void scaleInv (AMP::Scalar, std::shared_ptr< const Vector >, MatrixData &) override
 Scale the matrix by a scalar and inverse of diagonal matrix.
 
void setDiagonal (std::shared_ptr< const Vector > in, MatrixData &A) override
 Set the diagonal to the values in a vector.
 
void setIdentity (MatrixData &A) override
 Set the matrix to the identity matrix.
 
void setScalar (AMP::Scalar alpha, MatrixData &A) override
 Set the non-zeros of the matrix to a scalar.
 
void zero (MatrixData &A) override
 Set the non-zeros of the matrix to zero.
 

Detailed Description

Definition at line 8 of file NativePetscMatrixOperations.h.

Member Function Documentation

◆ axpy()

void AMP::LinearAlgebra::NativePetscMatrixOperations::axpy ( AMP::Scalar  alpha,
const MatrixData X,
MatrixData Y 
)
overrideprivatevirtual

Compute the linear combination of two matrices.

Parameters
[in]alphascalar
[in]Xmatrix
[in,out]Ymatrix

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

Implements AMP::LinearAlgebra::MatrixOperations.

◆ copy()

void AMP::LinearAlgebra::NativePetscMatrixOperations::copy ( const MatrixData X,
MatrixData Y 
)
overrideprivatevirtual

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

Implements AMP::LinearAlgebra::MatrixOperations.

◆ copyCast()

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

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()

void AMP::LinearAlgebra::NativePetscMatrixOperations::extractDiagonal ( MatrixData const &  A,
std::shared_ptr< Vector buf 
)
overrideprivatevirtual

Extract the diagonal values into a vector.

Parameters
[in]AThe matrix to extract
[out]bufThe buffer to store diagonals

Implements AMP::LinearAlgebra::MatrixOperations.

◆ getID()

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

Get a unique id hash for the vector operation.

◆ getRowSums()

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

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 
)
virtualinherited

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()

AMP::Scalar AMP::LinearAlgebra::NativePetscMatrixOperations::LinfNorm ( const MatrixData X) const
overrideprivatevirtual

Compute the maximum row sum.

Returns
The L-infinity norm of the matrix

Implements AMP::LinearAlgebra::MatrixOperations.

◆ matMatMult()

void AMP::LinearAlgebra::NativePetscMatrixOperations::matMatMult ( std::shared_ptr< MatrixData A,
std::shared_ptr< MatrixData B,
std::shared_ptr< MatrixData C 
)
overrideprivatevirtual

Compute the product of two matrices.

Parameters
[in]AA multiplicand
[in]BA multiplicand
[in]CThe product \(\mathbf{AB}\).

Implements AMP::LinearAlgebra::MatrixOperations.

◆ mult()

void AMP::LinearAlgebra::NativePetscMatrixOperations::mult ( std::shared_ptr< const Vector x,
MatrixData const &  A,
std::shared_ptr< Vector y 
)
overrideprivatevirtual

Matrix-vector multiplication.

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

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

Implements AMP::LinearAlgebra::MatrixOperations.

◆ multTranspose()

void AMP::LinearAlgebra::NativePetscMatrixOperations::multTranspose ( std::shared_ptr< const Vector in,
MatrixData const &  A,
std::shared_ptr< Vector out 
)
overrideprivatevirtual

Matrix transpose-vector multiplication.

Parameters
[in]inThe vector to multiply
[in]AThe input matrix A
[out]outThe resulting vector A

Compute \(\mathbf{A}^T\mathbf{in} = \mathbf{out}\).

Implements AMP::LinearAlgebra::MatrixOperations.

◆ registerChildObjects()

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

Register any child objects.

This function will register child objects with the manager

Parameters
managerRestart manager

◆ scale() [1/2]

void AMP::LinearAlgebra::NativePetscMatrixOperations::scale ( AMP::Scalar  alpha,
MatrixData A 
)
overrideprivatevirtual

Scale the matrix by a scalar.

Parameters
[in]alphaThe value to scale by
[out]AThe resulting vector A

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

Implements AMP::LinearAlgebra::MatrixOperations.

◆ scale() [2/2]

void AMP::LinearAlgebra::NativePetscMatrixOperations::scale ( AMP::Scalar  ,
std::shared_ptr< const Vector ,
MatrixData  
)
overrideprivatevirtual

Scale the matrix by a scalar and diagonal matrix.

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

Implements AMP::LinearAlgebra::MatrixOperations.

◆ scaleInv()

void AMP::LinearAlgebra::NativePetscMatrixOperations::scaleInv ( AMP::Scalar  ,
std::shared_ptr< const Vector ,
MatrixData  
)
overrideprivatevirtual

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

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

Implements AMP::LinearAlgebra::MatrixOperations.

◆ setDiagonal()

void AMP::LinearAlgebra::NativePetscMatrixOperations::setDiagonal ( std::shared_ptr< const Vector in,
MatrixData A 
)
overrideprivatevirtual

Set the diagonal to the values in a vector.

Parameters
[in]inThe values to set the diagonal to
[out]AData to set

Implements AMP::LinearAlgebra::MatrixOperations.

◆ setIdentity()

void AMP::LinearAlgebra::NativePetscMatrixOperations::setIdentity ( MatrixData A)
overrideprivatevirtual

Set the matrix to the identity matrix.

Implements AMP::LinearAlgebra::MatrixOperations.

◆ setScalar()

void AMP::LinearAlgebra::NativePetscMatrixOperations::setScalar ( AMP::Scalar  alpha,
MatrixData A 
)
overrideprivatevirtual

Set the non-zeros of the matrix to a scalar.

Parameters
[in]alphaThe value to set the non-zeros to
[out]AData to set

Implements AMP::LinearAlgebra::MatrixOperations.

◆ type()

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

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
virtualinherited

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()

void AMP::LinearAlgebra::NativePetscMatrixOperations::zero ( MatrixData A)
overrideprivatevirtual

Set the non-zeros of the matrix to zero.

May not deallocate space.

Implements AMP::LinearAlgebra::MatrixOperations.

Member Data Documentation

◆ d_hash

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

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