A class that wraps an Epetra_CrsMatrix. More...
#include <ManagedEpetraMatrix.h>

Public Types | |
| using | const_shared_ptr = std::shared_ptr< const Matrix > |
| using | shared_ptr = std::shared_ptr< Matrix > |
| Convenience typedef. | |
Public Member Functions | |
| template<typename T = double> | |
| void | addValueByGlobalID (size_t row, size_t col, T value) |
| Add values to those in the matrix. | |
| template<typename T > | |
| void | addValuesByGlobalID (size_t num_rows, size_t num_cols, size_t *rows, size_t *cols, T *values) |
| Add values to those in the matrix. | |
| void | axpy (AMP::Scalar alpha, const Matrix &X) |
| Compute the linear combination of two matrices. | |
| void | axpy (AMP::Scalar alpha, std::shared_ptr< const Matrix > X) |
| Compute the linear combination of two matrices. | |
| size_t | beginRow () const |
| Get the global id of the beginning row. | |
| std::shared_ptr< Matrix > | clone () const override |
| Return a matrix with the same non-zero and distributed structure. | |
| virtual void | copy (std::shared_ptr< const Matrix > X) |
| Set this matrix with the same non-zero and distributed structure as x and copy the coefficients. | |
| void | copyCast (std::shared_ptr< const Matrix > X) |
| Set this matrix with the same non-zero and distributed structure as x and copy the coefficients after up/down casting. | |
| Vector::shared_ptr | createInputVector () const override |
| Get a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector ) | |
| Vector::shared_ptr | createOutputVector () const override |
| Get a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector ) | |
| size_t | endRow () const |
| Get the global id of the ending row. | |
| Vector::shared_ptr | extractDiagonal (Vector::shared_ptr buf=Vector::shared_ptr()) const override |
| Extract the diagonal from a matrix. | |
| std::vector< size_t > | getColumnIDs (size_t row) const |
| Given a row, retrieve the non-zero column indices of the matrix in compressed format. | |
| AMP_MPI | getComm () const |
| Get the comm. | |
| Epetra_CrsMatrix & | getEpetra_CrsMatrix () |
| const Epetra_CrsMatrix & | getEpetra_CrsMatrix () const |
| Return an Epetra_CrsMatrix. | |
| uint64_t | getID () const |
| Get a unique id hash for the matrix. | |
| virtual std::shared_ptr< Discretization::DOFManager > | getLeftDOFManager () const |
| Get the DOFManager associated with a left vector. For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector. | |
| std::shared_ptr< MatrixData > | getMatrixData () |
| Return the pointer to the MatrixData. | |
| std::shared_ptr< const MatrixData > | getMatrixData () const |
| Return the pointer to the MatrixData. | |
| virtual std::shared_ptr< Discretization::DOFManager > | getRightDOFManager () const |
| Get the DOFManager associated with a right vector. For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector. | |
| template<typename T = double> | |
| void | getRowByGlobalID (size_t row, std::vector< size_t > &cols, std::vector< T > &values) const |
| Retrieve a row of the matrix in compressed format. | |
| Vector::shared_ptr | getRowSums (Vector::shared_ptr buf=Vector::shared_ptr()) const |
| Get sum of each row in matrix. | |
| Vector::shared_ptr | getRowSumsAbsolute (Vector::shared_ptr buf=Vector::shared_ptr(), const bool remove_zeros=false) const |
| Get absolute sum of each row in matrix. | |
| template<typename T = double> | |
| T | getValueByGlobalID (size_t row, size_t col) const |
| Get values in the matrix. | |
| template<typename T > | |
| void | getValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, T *values) const |
| Get values in the matrix. | |
| AMP::Scalar | LinfNorm () const |
| Compute the maximum row sum. | |
| void | makeConsistent (AMP::LinearAlgebra::ScatterType t) |
| Perform communication to ensure values in the matrix are the same across cores. | |
| ManagedEpetraMatrix (Epetra_CrsMatrix *m, bool dele=false) | |
| Constructor from Epetra_CrsMatrix. | |
| ManagedEpetraMatrix (std::shared_ptr< MatrixData > data) | |
| ManagedEpetraMatrix (std::shared_ptr< MatrixParameters > p) | |
| Constructor. | |
| virtual std::uint16_t | mode () const |
| Return CSR mode of the matrix. | |
| void | mult (std::shared_ptr< const Vector > in, std::shared_ptr< Vector > out) |
| Matrix-vector multiplication. | |
| void | multTranspose (std::shared_ptr< const Vector > in, std::shared_ptr< Vector > out) |
| Matrix transpose-vector multiplication. | |
| size_t | numberColumnIDs (size_t row) const |
| Given a row, retrieve the number of non-zero column indices of the matrix. | |
| size_t | numGlobalColumns () const |
| Get the number of global columns in the matrix. | |
| size_t | numGlobalRows () const |
| Get the number of global rows in the matrix. | |
| size_t | numLocalColumns () const |
| Get the number of local columns in the matrix. | |
| size_t | numLocalRows () const |
| Get the number of local rows in the matrix. | |
| virtual void | registerChildObjects (AMP::IO::RestartManager *manager) const |
| Register any child objects. | |
| void | scale (AMP::Scalar alpha) |
| Scale the matrix by a scalar. | |
| void | scale (AMP::Scalar alpha, Vector::const_shared_ptr D) |
| Diagonally scale matrix. | |
| void | scaleInv (AMP::Scalar alpha, Vector::const_shared_ptr D) |
| Scale matrix by inverse of diagonal matrix. | |
| virtual void | setBackend (AMP::Utilities::Backend) |
| Replace current backend with different one, no-op if same, no-op if not a CSRMatrix. | |
| void | setDiagonal (Vector::const_shared_ptr in) |
| Set the diagonal to the values in a vector. | |
| void | setIdentity () |
| Set the matrix to the identity matrix. | |
| template<typename T = double> | |
| void | setRowByGlobalID (size_t row, const std::vector< size_t > &cols, const std::vector< T > &values) |
| Set values for a row in the matrix. | |
| void | setScalar (AMP::Scalar alpha) |
| Set the non-zeros of the matrix to a scalar. | |
| template<typename T = double> | |
| void | setValueByGlobalID (size_t row, size_t col, T value) |
| Set values in the matrix. | |
| template<typename T > | |
| void | setValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const T *values) |
| Set values in the matrix. | |
| std::shared_ptr< Matrix > | transpose () const override |
| Return a new matrix that is the transpose of this one. | |
| virtual void | writeRestart (int64_t fid) const |
| Write restart data to file. | |
| void | zero () |
| Set the non-zeros of the matrix to zero. | |
| virtual | ~ManagedEpetraMatrix () |
| Destructor. | |
Static Public Member Functions | |
| static shared_ptr | matMatMult (shared_ptr A, shared_ptr B) |
| Compute the product of two matrices. | |
| static void | matMatMult (shared_ptr A, shared_ptr B, shared_ptr C) |
| Compute the product of two matrices. | |
Protected Member Functions | |
| ManagedEpetraMatrix ()=delete | |
| Empty constructor. | |
| ManagedEpetraMatrix (const ManagedEpetraMatrix &rhs) | |
| Copy constructor. | |
| void | multiply (shared_ptr other_op, shared_ptr &result) override |
| Multiply two matrices and store in a third result = this * other_op. | |
| ManagedEpetraMatrix & | operator= (const ManagedEpetraMatrix &rhs)=delete |
| Assignment operator. | |
| std::string | type () const override |
| Return the type of the matrix. | |
Protected Attributes | |
| std::shared_ptr< MatrixData > | d_matrixData |
| Pointer to data. | |
| std::shared_ptr< MatrixOperations > | d_matrixOps |
A class that wraps an Epetra_CrsMatrix.
This class stores an Epetra_FECrsMatrix and provides the AMP interface to this matrix.
Definition at line 25 of file ManagedEpetraMatrix.h.
|
inherited |
|
inherited |
|
protecteddelete |
Empty constructor.
|
protected |
Copy constructor.
|
explicit |
Constructor.
| [in] | p | The description of the matrix |
| AMP::LinearAlgebra::ManagedEpetraMatrix::ManagedEpetraMatrix | ( | std::shared_ptr< MatrixData > | data | ) |
|
explicit |
Constructor from Epetra_CrsMatrix.
| [in] | m | Matrix to wrap |
| [in] | dele | If true, this class deletes the matrix |
|
inlinevirtual |
Destructor.
Definition at line 57 of file ManagedEpetraMatrix.h.
|
inlineinherited |
Add values to those in the matrix.
| [in] | row | The row id of value |
| [in] | col | The column id of value |
| [in] | value | The value to add to the matrix |
This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.
Definition at line 355 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::addValuesByGlobalID().
|
inlineinherited |
Add values to those in the matrix.
| [in] | num_rows | The number of rows represented in values |
| [in] | num_cols | The number of cols represented in values |
| [in] | rows | The row ids of values |
| [in] | cols | The column ids of values |
| [in] | values | The values to add to the matrix (row-major ordering) |
This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.
Definition at line 210 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
Referenced by AMP::LinearAlgebra::Matrix::addValueByGlobalID().
|
inherited |
Compute the linear combination of two matrices.
| [in] | alpha | scalar |
| [in] | X | matrix |
Compute \(\mathbf{THIS} = \alpha\mathbf{X} + \mathbf{THIS}\)
|
inherited |
Compute the linear combination of two matrices.
| [in] | alpha | scalar |
| [in] | X | matrix |
Compute \(\mathbf{THIS} = \alpha\mathbf{X} + \mathbf{THIS}\)
|
inlineinherited |
Get the global id of the beginning row.
Definition at line 317 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
overridevirtual |
Return a matrix with the same non-zero and distributed structure.
Implements AMP::LinearAlgebra::Matrix.
Set this matrix with the same non-zero and distributed structure as x and copy the coefficients.
Reimplemented in AMP::LinearAlgebra::NativePetscMatrix.
Set this matrix with the same non-zero and distributed structure as x and copy the coefficients after up/down casting.
|
overridevirtual |
Get a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )
Implements AMP::LinearAlgebra::Matrix.
|
overridevirtual |
Get a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )
Implements AMP::LinearAlgebra::Matrix.
|
inlineinherited |
Get the global id of the ending row.
Definition at line 322 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
overridevirtual |
Extract the diagonal from a matrix.
| [in] | buf | An optional vector to use as a buffer |
Implements AMP::LinearAlgebra::Matrix.
Given a row, retrieve the non-zero column indices of the matrix in compressed format.
| [in] | row | Which row |
Definition at line 281 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inlineinherited |
Get the comm.
Definition at line 325 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
| Epetra_CrsMatrix & AMP::LinearAlgebra::ManagedEpetraMatrix::getEpetra_CrsMatrix | ( | ) |
| const Epetra_CrsMatrix & AMP::LinearAlgebra::ManagedEpetraMatrix::getEpetra_CrsMatrix | ( | ) | const |
Return an Epetra_CrsMatrix.
|
inherited |
Get a unique id hash for the matrix.
|
inlinevirtualinherited |
Get the DOFManager associated with a left vector. For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector.
Reimplemented in AMP::LinearAlgebra::NativePetscMatrix.
Definition at line 340 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inlineinherited |
Return the pointer to the MatrixData.
Definition at line 388 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inlineinherited |
Return the pointer to the MatrixData.
Definition at line 391 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inlinevirtualinherited |
Get the DOFManager associated with a right vector. For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector.
Reimplemented in AMP::LinearAlgebra::NativePetscMatrix.
Definition at line 331 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inlineinherited |
Retrieve a row of the matrix in compressed format.
| [in] | row | Which row |
| [out] | cols | The column ids of the returned values |
| [out] | values | The values in the row |
Definition at line 267 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inherited |
Get sum of each row in matrix.
| [in] | buf | An optional vector to use as a buffer |
|
inherited |
Get absolute sum of each row in matrix.
| [in] | buf | An optional vector to use as a buffer |
| [in] | remove_zeros | Do we want to remove zeros |
Get values in the matrix.
| [in] | row | The row id of value |
| [in] | col | The column id of value |
This method will return zero for any values that have not been allocated.
Definition at line 380 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::getValuesByGlobalID().
|
inlineinherited |
Get values in the matrix.
| [in] | num_rows | The number of rows represented in values |
| [in] | num_cols | The number of cols represented in values |
| [in] | rows | The row ids of values |
| [in] | cols | The column ids of values |
| [out] | values | The values to get from the matrix (row-major ordering) |
This method will return zero for any entries that have not been allocated or are not ghosts on the current processor.
Definition at line 255 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
Referenced by AMP::LinearAlgebra::Matrix::getValueByGlobalID().
|
inherited |
Compute the maximum row sum.
|
inlineinherited |
Perform communication to ensure values in the matrix are the same across cores.
Definition at line 289 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
staticinherited |
Compute the product of two matrices.
| [in] | A | Left multiplicand |
| [in] | B | Right multiplicand |
|
staticinherited |
Compute the product of two matrices.
| [in] | A | Left multiplicand |
| [in] | B | Right multiplicand |
| [in,out] | C | Result matrix |
|
virtualinherited |
Return CSR mode of the matrix.
Reimplemented in AMP::LinearAlgebra::CSRMatrix< Config >.
|
inherited |
Matrix-vector multiplication.
| [in] | in | The vector to multiply |
| [out] | out | The resulting vectory |
Compute \(\mathbf{Ain} = \mathbf{out}\).
|
overrideprotectedvirtual |
Multiply two matrices and store in a third result = this * other_op.
| [in] | other_op | The other matrix to multiply |
| [out] | result | The matrix to store the result |
Implements AMP::LinearAlgebra::Matrix.
|
inherited |
Matrix transpose-vector multiplication.
| [in] | in | The vector to multiply |
| [out] | out | The resulting vectory |
Compute \(\mathbf{A}^T\mathbf{in} = \mathbf{out}\).
Given a row, retrieve the number of non-zero column indices of the matrix.
| [in] | row | Which row |
Definition at line 276 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inlineinherited |
Get the number of global columns in the matrix.
Definition at line 312 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inlineinherited |
Get the number of global rows in the matrix.
Definition at line 302 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inlineinherited |
Get the number of local columns in the matrix.
Definition at line 307 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
inlineinherited |
Get the number of local rows in the matrix.
Definition at line 297 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
|
protecteddelete |
Assignment operator.
|
virtualinherited |
Register any child objects.
This function will register child objects with the manager
| manager | Restart manager |
|
inherited |
Scale the matrix by a scalar.
| [in] | alpha | The value to scale by |
Compute \(\mathbf{A} = \alpha\mathbf{A}\)
|
inherited |
Diagonally scale matrix.
| [in] | alpha | Scaling applied to all rows |
| [in] | D | Vector of scales, one for each row |
Compute \(\mathbf{A} = \alpha\mathbf{D}\mathbf{A}\)
|
inherited |
Scale matrix by inverse of diagonal matrix.
| [in] | alpha | Scaling applied to all rows |
| [in] | D | Array of inverse scales, one for each row |
Compute \(\mathbf{A} = \alpha\mathbf{D}^{-1}\mathbf{A}\)
|
virtualinherited |
Replace current backend with different one, no-op if same, no-op if not a CSRMatrix.
Reimplemented in AMP::LinearAlgebra::CSRMatrix< Config >.
|
inherited |
Set the diagonal to the values in a vector.
| [in] | in | The values to set the diagonal to |
|
inherited |
Set the matrix to the identity matrix.
|
inlineinherited |
Set values for a row in the matrix.
| [in] | row | Which row |
| [in] | cols | The column ids to set |
| [in] | values | The values to set |
Definition at line 239 of file Matrix.h.
References AMP_ASSERT, and AMP::LinearAlgebra::Matrix::d_matrixData.
|
inherited |
Set the non-zeros of the matrix to a scalar.
| [in] | alpha | The value to set the non-zeros to |
|
inlineinherited |
Set values in the matrix.
| [in] | row | The row id of value |
| [in] | col | The column id of value |
| [in] | value | The value to set to the matrix |
This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.
Definition at line 369 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::setValuesByGlobalID().
|
inlineinherited |
Set values in the matrix.
| [in] | num_rows | The number of rows represented in values |
| [in] | num_cols | The number of cols represented in values |
| [in] | rows | The row ids of values |
| [in] | cols | The column ids of values |
| [in] | values | The values to set to the matrix (row-major ordering) |
This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.
Definition at line 226 of file Matrix.h.
References AMP::LinearAlgebra::Matrix::d_matrixData.
Referenced by AMP::LinearAlgebra::Matrix::setValueByGlobalID().
|
overridevirtual |
Return a new matrix that is the transpose of this one.
Reimplemented from AMP::LinearAlgebra::Matrix.
|
inlineoverrideprotectedvirtual |
Return the type of the matrix.
Implements AMP::LinearAlgebra::Matrix.
Definition at line 40 of file ManagedEpetraMatrix.h.
Write restart data to file.
This function will write the mesh to an HDF5 file
| fid | File identifier to write |
|
inherited |
Set the non-zeros of the matrix to zero.
May not deallocate space.
|
protectedinherited |
Pointer to data.
Definition at line 439 of file Matrix.h.
Referenced by AMP::LinearAlgebra::Matrix::addValuesByGlobalID(), AMP::LinearAlgebra::Matrix::beginRow(), AMP::LinearAlgebra::Matrix::endRow(), AMP::LinearAlgebra::Matrix::getColumnIDs(), AMP::LinearAlgebra::Matrix::getComm(), AMP::LinearAlgebra::Matrix::getLeftDOFManager(), AMP::LinearAlgebra::Matrix::getMatrixData(), AMP::LinearAlgebra::Matrix::getMatrixData(), AMP::LinearAlgebra::Matrix::getRightDOFManager(), AMP::LinearAlgebra::Matrix::getRowByGlobalID(), AMP::LinearAlgebra::Matrix::getValuesByGlobalID(), AMP::LinearAlgebra::Matrix::makeConsistent(), AMP::LinearAlgebra::Matrix::numberColumnIDs(), AMP::LinearAlgebra::Matrix::numGlobalColumns(), AMP::LinearAlgebra::Matrix::numGlobalRows(), AMP::LinearAlgebra::Matrix::numLocalColumns(), AMP::LinearAlgebra::Matrix::numLocalRows(), AMP::LinearAlgebra::Matrix::setRowByGlobalID(), and AMP::LinearAlgebra::Matrix::setValuesByGlobalID().
|
protectedinherited |
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:42. Comments on this page |