GEOS
Public Types | Public Member Functions | List of all members
geos::HypreMatrix Class Referencefinal

Wrapper class for hypre's ParCSRMatrix. More...

#include <HypreMatrix.hpp>

Inheritance diagram for geos::HypreMatrix:
Inheritance graph
[legend]

Public Types

using Vector = HypreVector
 Compatible vector type.
 
using Export = HypreExport
 Associated exporter type.
 
using HYPRE_IJMatrix = hypre_IJMatrix_struct *
 IJMatrix pointer alias.
 
using HYPRE_ParCSRMatrix = hypre_ParCSRMatrix_struct *
 ParCSRMatrix pointer alias.
 
- Public Types inherited from geos::LinearOperator< HypreVector >
using Vector = HypreVector
 Alias for template parameter.
 

Public Member Functions

HYPRE_ParCSRMatrix const & unwrapped () const
 Returns a pointer to implementation. More...
 
HYPRE_IJMatrix const & unwrappedIJ () const
 Returns a pointer to implementation. More...
 
Constructor/Destructor Methods
 HypreMatrix ()
 Empty matrix constructor. More...
 
 HypreMatrix (HypreMatrix const &src)
 Copy constructor. More...
 
 HypreMatrix (HypreMatrix &&src) noexcept
 Move constructor. More...
 
HypreMatrixoperator= (HypreMatrix const &src)
 Copy assignment. More...
 
HypreMatrixoperator= (HypreMatrix &&src) noexcept
 Move assignment. More...
 
 ~HypreMatrix () override
 Virtual destructor.
 
MatrixBase interface
virtual void create (CRSMatrixView< real64 const, globalIndex const > const &localMatrix, localIndex const numLocalColumns, MPI_Comm const &comm) override
 Create parallel matrix from a local CRS matrix. More...
 
virtual void createWithLocalSize (localIndex const localRows, localIndex const localCols, localIndex const maxEntriesPerRow, MPI_Comm const &comm) override
 Create a rectangular matrix from number of rows/columns. More...
 
virtual void createWithGlobalSize (globalIndex const globalRows, globalIndex const globalCols, localIndex const maxEntriesPerRow, MPI_Comm const &comm) override
 Create a rectangular matrix from number of rows/columns. More...
 
virtual void open () override
 Open matrix for adding new entries. More...
 
virtual void close () override
 Assemble and compress the matrix. More...
 
virtual bool created () const override
 Query matrix creation status. More...
 
virtual void reset () override
 Reset the matrix to default state.
 
virtual void set (real64 const value) override
 Set all non-zero elements to a value. More...
 
virtual void zero () override
 Set all elements to zero.
 
virtual void add (globalIndex const rowIndex, globalIndex const colIndex, real64 const value) override
 Add to one element. More...
 
virtual void set (globalIndex const rowIndex, globalIndex const colIndex, real64 const value) override
 Set one element. More...
 
virtual void insert (globalIndex const rowIndex, globalIndex const colIndex, real64 const value) override
 Insert one element. More...
 
virtual void add (globalIndex const rowIndex, globalIndex const *colIndices, real64 const *values, localIndex const size) override
 Add elements to one row using c-style arrays. More...
 
virtual void set (globalIndex const rowIndex, globalIndex const *colIndices, real64 const *values, localIndex const size) override
 Set elements to one row using c-style arrays. More...
 
virtual void insert (globalIndex const rowIndex, globalIndex const *colIndices, real64 const *values, localIndex const size) override
 Insert elements to one row using c-style arrays. More...
 
virtual void add (globalIndex const rowIndex, arraySlice1d< globalIndex const > const &colIndices, arraySlice1d< real64 const > const &values) override
 Add elements to one row using array1d. More...
 
virtual void set (globalIndex const rowIndex, arraySlice1d< globalIndex const > const &colIndices, arraySlice1d< real64 const > const &values) override
 Set elements of one row using array1d. More...
 
virtual void insert (globalIndex const rowIndex, arraySlice1d< globalIndex const > const &colIndices, arraySlice1d< real64 const > const &values) override
 Insert elements of one row using array1d. More...
 
virtual void add (arraySlice1d< globalIndex const > const &rowIndices, arraySlice1d< globalIndex const > const &colIndices, arraySlice2d< real64 const > const &values) override
 Add a dense block of values. More...
 
virtual void set (arraySlice1d< globalIndex const > const &rowIndices, arraySlice1d< globalIndex const > const &colIndices, arraySlice2d< real64 const > const &values) override
 Set a dense block of values. More...
 
virtual void insert (arraySlice1d< globalIndex const > const &rowIndices, arraySlice1d< globalIndex const > const &colIndices, arraySlice2d< real64 const > const &values) override
 Insert a dense block of values. More...
 
virtual void add (globalIndex const *rowIndices, globalIndex const *colIndices, real64 const *values, localIndex const numRows, localIndex const numCols) override
 Add a dense block of values. More...
 
virtual void set (globalIndex const *rowIndices, globalIndex const *colIndices, real64 const *values, localIndex const numRows, localIndex const numCols) override
 Set a dense block of values. More...
 
virtual void insert (globalIndex const *rowIndices, globalIndex const *colIndices, real64 const *values, localIndex const numRows, localIndex const numCols) override
 Insert dense matrix. More...
 
virtual void insert (arrayView1d< globalIndex const > const &rowIndices, arrayView1d< globalIndex const > const &colIndices, arrayView1d< real64 const > const &values) override
 Insert values stored in 3 linear vectors. More...
 
virtual void apply (HypreVector const &src, HypreVector &dst) const override
 Apply operator to a vector, dst = this(src). More...
 
virtual void applyTranspose (HypreVector const &src, HypreVector &dst) const override
 Apply transpose of the matrix to a vector. More...
 
virtual void multiply (HypreMatrix const &src, HypreMatrix &dst) const override
 Matrix/Matrix multiplication. More...
 
virtual void leftMultiplyTranspose (HypreMatrix const &src, HypreMatrix &dst) const override
 Matrix/Matrix transpose multiplication. More...
 
virtual void rightMultiplyTranspose (HypreMatrix const &src, HypreMatrix &dst) const override
 Matrix/Matrix transpose multiplication. More...
 
virtual void multiplyRAP (HypreMatrix const &R, HypreMatrix const &P, HypreMatrix &dst) const override
 Compute the triple product dst = R * this * P More...
 
virtual void multiplyPtAP (HypreMatrix const &P, HypreMatrix &dst) const override
 Compute the triple product dst = P^T * this * P More...
 
virtual void gemv (real64 const alpha, HypreVector const &x, real64 const beta, HypreVector &y, bool useTranspose=false) const override
 Compute gemv y = alpha*A*x + beta*y. More...
 
virtual void scale (real64 const scalingFactor) override
 Multiply all elements by scalingFactor. More...
 
virtual void leftScale (HypreVector const &vec) override
 Pre-multiplies (left) with diagonal matrix consisting of the values in vec. More...
 
virtual void rescaleRows (arrayView1d< globalIndex const > const &rowIndices, RowSumType const rowSumType) override
 Rescales selected rows of matrix using row sum reciprocal as a factor. More...
 
virtual void rightScale (HypreVector const &vec) override
 Post-multiplies (right) with diagonal matrix consisting of the values in vec. More...
 
virtual void leftRightScale (HypreVector const &vecLeft, HypreVector const &vecRight) override
 Post-multiplies (right) with diagonal matrix consisting of the values in vecRight and pre-multiplies (left) with diagonal matrix consisting of the values in vec. More...
 
virtual void transpose (HypreMatrix &dst) const override
 Matrix transposition. More...
 
virtual void separateComponentFilter (HypreMatrix &dst, integer const dofPerPoint) const override
 Apply a separate component approximation (filter) to this matrix. More...
 
virtual real64 clearRow (globalIndex const row, bool const keepDiag=false, real64 const diagValue=0.0) override
 Clear a row, and optionally set diagonal element to diagValue. More...
 
virtual void addEntries (HypreMatrix const &src, MatrixPatternOp const op, real64 const scale) override
 Add entries of another matrix to this. More...
 
virtual void addDiagonal (HypreVector const &src, real64 const scale) override
 Add (scaled) entries of a vector to the diagonal of this matrix. More...
 
virtual void clampEntries (real64 const lo, real64 const hi, bool const excludeDiag) override
 Clamp each matrix value between values of lo and hi. More...
 
virtual localIndex maxRowLength () const override
 Returns the number of nonzero entries in the longest row of the matrix. More...
 
virtual localIndex rowLength (globalIndex const globalRowIndex) const override
 Get row length via global row index. More...
 
virtual void getRowLengths (arrayView1d< localIndex > const &lengths) const override
 Get the row lengths of every local row. More...
 
virtual void getRowCopy (globalIndex globalRowIndex, arraySlice1d< globalIndex > const &colIndices, arraySlice1d< real64 > const &values) const override
 Returns a copy of the data in row globalRow. More...
 
virtual void extractDiagonal (HypreVector &dst) const override
 Extract diagonal values into a vector. More...
 
virtual void getRowSums (HypreVector &dst, RowSumType const rowSumType) const override
 Populate a vector with row sums of this. More...
 
virtual globalIndex numGlobalRows () const override
 Get the number of global rows. More...
 
virtual globalIndex numGlobalCols () const override
 Get the number of global columns. More...
 
virtual localIndex numLocalRows () const override
 Get the number of local rows. More...
 
virtual localIndex numLocalCols () const override
 Get the number of local columns. More...
 
virtual globalIndex ilower () const override
 Returns the index of the first global row owned by that processor. More...
 
virtual globalIndex iupper () const override
 Returns index one past the last global row owned by that processor. More...
 
virtual globalIndex jlower () const override
 Returns the index of the first global col owned by that processor. More...
 
virtual globalIndex jupper () const override
 Returns index one past the last global col owned by that processor. More...
 
virtual localIndex numLocalNonzeros () const override
 Returns the number of nonzeros in the local portion of the matrix. More...
 
virtual globalIndex numGlobalNonzeros () const override
 Returns the total number of nonzeros in the matrix. More...
 
virtual real64 normInf () const override
 Returns the infinity norm of the matrix. More...
 
virtual real64 norm1 () const override
 Returns the one norm of the matrix. More...
 
virtual real64 normFrobenius () const override
 Returns the Frobenius norm of the matrix. More...
 
virtual real64 normMax () const override
 Returns the max norm of the matrix (the largest absolute element value). More...
 
virtual real64 normMax (arrayView1d< globalIndex const > const &rowIndices) const override
 Returns the max norm of the matrix on a subset of rows. More...
 
virtual localIndex getLocalRowID (globalIndex const index) const override
 Map a global row index to local row index. More...
 
virtual globalIndex getGlobalRowID (localIndex const index) const override
 Map a local row index to global row index. More...
 
virtual MPI_Comm comm () const override
 Get the MPI communicator the matrix was created with. More...
 
virtual void print (std::ostream &os=std::cout) const override
 Print the matrix in Trilinos format to a stream. More...
 
virtual void write (string const &filename, LAIOutputFormat const format=LAIOutputFormat::MATRIX_MARKET) const override
 Write the matrix to filename in a matlab-compatible format. More...
 
virtual void createWithLocalSize (localIndex const localSize, localIndex const maxEntriesPerRow, MPI_Comm const &comm)
 Create a square matrix from local number of rows. More...
 
virtual void createWithLocalSize (localIndex const localRows, localIndex const localCols, localIndex const maxEntriesPerRow, MPI_Comm const &comm)=0
 Create a rectangular matrix from number of rows/columns. More...
 
virtual void createWithGlobalSize (globalIndex const globalSize, localIndex const maxEntriesPerRow, MPI_Comm const &comm)
 Create a square matrix from global number of rows. More...
 
virtual void createWithGlobalSize (globalIndex const globalRows, globalIndex const globalCols, localIndex const maxEntriesPerRow, MPI_Comm const &comm)=0
 Create a rectangular matrix from number of rows/columns. More...
 
bool closed () const
 Query matrix closed status. More...
 
bool assembled () const
 Query matrix assembled status. More...
 
bool insertable () const
 Query matrix status. More...
 
bool modifiable () const
 Query matrix status. More...
 
bool ready () const
 Query matrix ready status. More...
 
virtual void residual (Vector const &x, Vector const &b, Vector &r) const override
 Compute residual r = b - A * x. More...
 
void setDofManager (DofManager const *const dofManager)
 Associate a DofManager with this matrix. More...
 
DofManager const * dofManager () const
 
virtual void create (CRSMatrixView< real64 const, globalIndex const > const &localMatrix, localIndex const numLocalColumns, MPI_Comm const &comm)
 Create parallel matrix from a local CRS matrix. More...
 
- Public Member Functions inherited from geos::LinearOperator< HypreVector >
 LinearOperator ()=default
 Constructor.
 
virtual ~LinearOperator ()=default
 Destructor.
 

Detailed Description

Wrapper class for hypre's ParCSRMatrix.

This class creates and provides basic support for the HYPRE_ParCSRMatrix object type used in Hypre using the linear-algebraic system interface (IJ interface).

Definition at line 54 of file HypreMatrix.hpp.

Constructor & Destructor Documentation

◆ HypreMatrix() [1/3]

geos::HypreMatrix::HypreMatrix ( )

Empty matrix constructor.

Create an empty (distributed) matrix.

◆ HypreMatrix() [2/3]

geos::HypreMatrix::HypreMatrix ( HypreMatrix const &  src)

Copy constructor.

Parameters
[in]srcmatrix to be copied

◆ HypreMatrix() [3/3]

geos::HypreMatrix::HypreMatrix ( HypreMatrix &&  src)
noexcept

Move constructor.

Parameters
srcmatrix to be moved from

Member Function Documentation

◆ add() [1/5]

virtual void geos::HypreMatrix::add ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const > const &  values 
)
overridevirtual

Add a dense block of values.

Parameters
rowIndicesGlobal row indices
colIndicesGlobal col indices
valuesDense local matrix of values

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ add() [2/5]

virtual void geos::HypreMatrix::add ( globalIndex const *  rowIndices,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  numRows,
localIndex const  numCols 
)
overridevirtual

Add a dense block of values.

Parameters
rowIndicesGlobal row indices
colIndicesGlobal col indices
valuesDense local matrix of values
numRowsNumber of row indices
numColsNumber of column indices
Note
Row major layout assumed in values

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ add() [3/5]

virtual void geos::HypreMatrix::add ( globalIndex const  rowIndex,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice1d< real64 const > const &  values 
)
overridevirtual

Add elements to one row using array1d.

Parameters
rowIndexGlobal row index
colIndicesGlobal column indices
valuesValues to add to prescribed locations

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ add() [4/5]

virtual void geos::HypreMatrix::add ( globalIndex const  rowIndex,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  size 
)
overridevirtual

Add elements to one row using c-style arrays.

Parameters
rowIndexGlobal row index
colIndicesGlobal column indices
valuesValues to add to prescribed locations
sizeNumber of elements

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ add() [5/5]

virtual void geos::HypreMatrix::add ( globalIndex const  rowIndex,
globalIndex const  colIndex,
real64 const  value 
)
overridevirtual

Add to one element.

Parameters
rowIndexGlobal row index
colIndexGlobal column index
valueValue to add to prescribed location

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ addDiagonal()

virtual void geos::HypreMatrix::addDiagonal ( HypreVector const &  src,
real64 const  scale 
)
overridevirtual

Add (scaled) entries of a vector to the diagonal of this matrix.

Parameters
srcthe source vector
scaleoptional scaling factor
Note
this must be square and have a (possibly zero) diagonal entry in every row. this and src must have the same parallel row distribution.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ addEntries()

virtual void geos::HypreMatrix::addEntries ( HypreMatrix const &  src,
MatrixPatternOp const  op,
real64 const  scale 
)
overridevirtual

Add entries of another matrix to this.

Parameters
srcthe source matrix
ophandling of nonzero patterns, see MatrixPatternOp
scalefactor to scale entries of src by
Note
Sparsity pattern of this must be a superset of sparsity of src. this and src must have the same parallel row distribution.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ apply()

virtual void geos::HypreMatrix::apply ( HypreVector const &  src,
HypreVector dst 
) const
overridevirtual

Apply operator to a vector, dst = this(src).

Parameters
srcinput vector
dstoutput vector
Warning
src and dst cannot alias the same vector (some implementations may allow this).

Implements geos::LinearOperator< HypreVector >.

◆ applyTranspose()

virtual void geos::HypreMatrix::applyTranspose ( HypreVector const &  src,
HypreVector dst 
) const
overridevirtual

Apply transpose of the matrix to a vector.

Parameters
srcInput vector (x).
dstOutput vector (b).

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ assembled()

bool geos::MatrixBase< MATRIX, VECTOR >::assembled
inline

Query matrix assembled status.

Returns
true if matrix has been opened and closed since creation; false otherwise

Definition at line 108 of file MatrixBase.hpp.

◆ clampEntries()

virtual void geos::HypreMatrix::clampEntries ( real64 const  lo,
real64 const  hi,
bool const  excludeDiag 
)
overridevirtual

Clamp each matrix value between values of lo and hi.

Parameters
lomin value
himax value
excludeDiagiff true, diagonal values are unchanged

Effectively sets each matrix value v to min(max(v, lo), hi).

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ clearRow()

virtual real64 geos::HypreMatrix::clearRow ( globalIndex const  row,
bool const  keepDiag = false,
real64 const  diagValue = 0.0 
)
overridevirtual

Clear a row, and optionally set diagonal element to diagValue.

Parameters
rowglobalIndex of the row to be cleared.
diagValue(Optional) set diagonal element to desired value.
keepDiagif true, diagValue is ignored and original diagonal is preserved
Returns
original diagonal value if matrix is square; zero otherwise
Note
diagValue and keepDiag are ignored if the matrix is not square

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ close()

virtual void geos::HypreMatrix::close ( )
overridevirtual

Assemble and compress the matrix.

Compresses the matrix to CSR format with contiguous memory on each processor. Prevents from adding new entries in the sparsity pattern but allows for modification of existing entries.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ closed()

bool geos::MatrixBase< MATRIX, VECTOR >::closed
inline

Query matrix closed status.

Returns
true if matrix has been opened and has not been closed since; false otherwise

Definition at line 102 of file MatrixBase.hpp.

◆ comm()

virtual MPI_Comm geos::HypreMatrix::comm ( ) const
overridevirtual

Get the MPI communicator the matrix was created with.

Returns
MPI communicator passed in create...()
Note
when build without MPI, may return anything (MPI_Comm will be a mock type defined in MpiWrapper)

Implements geos::LinearOperator< HypreVector >.

◆ create() [1/2]

virtual void geos::MatrixBase< MATRIX, VECTOR >::create
inline

Create parallel matrix from a local CRS matrix.

Parameters
localMatrixThe input local matrix.
numLocalColumnsnumber of local columns (not available from localMatrix in general)
commThe MPI communicator to use.
Note
Copies values, so that localMatrix does not need to retain its values after the call.
Todo:
Replace generic implementation with more efficient ones in each package.

Definition at line 248 of file MatrixBase.hpp.

◆ create() [2/2]

virtual void geos::HypreMatrix::create ( CRSMatrixView< real64 const, globalIndex const > const &  localMatrix,
localIndex const  numLocalColumns,
MPI_Comm const &  comm 
)
overridevirtual

Create parallel matrix from a local CRS matrix.

Parameters
localMatrixThe input local matrix.
numLocalColumnsnumber of local columns (not available from localMatrix in general)
commThe MPI communicator to use.
Note
Copies values, so that localMatrix does not need to retain its values after the call.
Todo:
Replace generic implementation with more efficient ones in each package.

Reimplemented from geos::MatrixBase< HypreMatrix, HypreVector >.

◆ created()

virtual bool geos::HypreMatrix::created ( ) const
overridevirtual

Query matrix creation status.

Returns
true if matrix has been created

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ createWithGlobalSize() [1/3]

virtual void geos::HypreMatrix::createWithGlobalSize ( globalIndex const  globalRows,
globalIndex const  globalCols,
localIndex const  maxEntriesPerRow,
MPI_Comm const &  comm 
)
overridevirtual

Create a rectangular matrix from number of rows/columns.

Parameters
commMPI communicator.
globalRowsGlobal number of rows.
globalColsGlobal number of columns.
maxEntriesPerRowMaximum number of entries per row (hint).

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ createWithGlobalSize() [2/3]

virtual void geos::MatrixBase< MATRIX, VECTOR >::createWithGlobalSize

Create a rectangular matrix from number of rows/columns.

Parameters
commMPI communicator.
globalRowsGlobal number of rows.
globalColsGlobal number of columns.
maxEntriesPerRowMaximum number of entries per row (hint).

◆ createWithGlobalSize() [3/3]

virtual void geos::MatrixBase< MATRIX, VECTOR >::createWithGlobalSize
inline

Create a square matrix from global number of rows.

Create a square matrix with an (approximately) even partitioning of rows.

Parameters
globalSizeGlobal dimensions for a square matrix.
maxEntriesPerRowMaximum number of non-zero entries per row.
commMPI communicator.

Definition at line 204 of file MatrixBase.hpp.

◆ createWithLocalSize() [1/3]

virtual void geos::HypreMatrix::createWithLocalSize ( localIndex const  localRows,
localIndex const  localCols,
localIndex const  maxEntriesPerRow,
MPI_Comm const &  comm 
)
overridevirtual

Create a rectangular matrix from number of rows/columns.

Parameters
commMPI communicator.
localRowsLocal number of rows.
localColsLocal number of columns.
maxEntriesPerRowMaximum number of entries per row (hint).

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ createWithLocalSize() [2/3]

virtual void geos::MatrixBase< MATRIX, VECTOR >::createWithLocalSize

Create a rectangular matrix from number of rows/columns.

Parameters
commMPI communicator.
localRowsLocal number of rows.
localColsLocal number of columns.
maxEntriesPerRowMaximum number of entries per row (hint).

◆ createWithLocalSize() [3/3]

virtual void geos::MatrixBase< MATRIX, VECTOR >::createWithLocalSize
inline

Create a square matrix from local number of rows.

Parameters
localSizelocal number of rows for square matrix.
maxEntriesPerRowMaximum number of non-zero entries per row.
commMPI communicator.

Definition at line 186 of file MatrixBase.hpp.

◆ dofManager()

DofManager const* geos::MatrixBase< MATRIX, VECTOR >::dofManager
inline
Returns
the associated DofManager

Definition at line 165 of file MatrixBase.hpp.

◆ extractDiagonal()

virtual void geos::HypreMatrix::extractDiagonal ( HypreVector dst) const
overridevirtual

Extract diagonal values into a vector.

Parameters
dstthe target vector, must have the same row partitioning as this

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ gemv()

virtual void geos::HypreMatrix::gemv ( real64 const  alpha,
HypreVector const &  x,
real64 const  beta,
HypreVector y,
bool  useTranspose = false 
) const
overridevirtual

Compute gemv y = alpha*A*x + beta*y.

Note
The naming convention follows the BLAS library.
Parameters
alphaScalar factor for added matvec product.
xInput vector.
betaScalar factor for right hand side.
yOutput vector.
useTransposeBoolean, set to true to use A^T.
Warning
x and y cannot alias the same vector.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ getGlobalRowID()

virtual globalIndex geos::HypreMatrix::getGlobalRowID ( localIndex const  index) const
overridevirtual

Map a local row index to global row index.

Parameters
indexthe local row index (between 0 and number of local rows)
Returns
the global row index corresponding to index

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ getLocalRowID()

virtual localIndex geos::HypreMatrix::getLocalRowID ( globalIndex const  index) const
overridevirtual

Map a global row index to local row index.

Parameters
indexthe global row index
Returns
the local row index corresponding to index, or -1 if not a local row

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ getRowCopy()

virtual void geos::HypreMatrix::getRowCopy ( globalIndex  globalRow,
arraySlice1d< globalIndex > const &  colIndices,
arraySlice1d< real64 > const &  values 
) const
overridevirtual

Returns a copy of the data in row globalRow.

Parameters
[in]globalRowthe index of global row to extract
[out]colIndicesthe output array of global column indices (must have a large enough size)
[out]valuesthe output array of values (must have a large enough size)

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ getRowLengths()

virtual void geos::HypreMatrix::getRowLengths ( arrayView1d< localIndex > const &  lengths) const
overridevirtual

Get the row lengths of every local row.

Parameters
lengthsan array view to be populated with row lengths
Note
The implementation may move the view's buffer to a different memory space.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ getRowSums()

virtual void geos::HypreMatrix::getRowSums ( HypreVector dst,
RowSumType const  rowSumType 
) const
overridevirtual

Populate a vector with row sums of this.

Parameters
dstthe target vector, must have the same row partitioning as this
rowSumTypetype of row sum operation to perform

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ ilower()

virtual globalIndex geos::HypreMatrix::ilower ( ) const
overridevirtual

Returns the index of the first global row owned by that processor.

Returns
the index of the first global row owned by that processor

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ insert() [1/6]

virtual void geos::HypreMatrix::insert ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const > const &  values 
)
overridevirtual

Insert a dense block of values.

Parameters
rowIndicesGlobal row indices
colIndicesGlobal col indices
valuesDense local matrix of values

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ insert() [2/6]

virtual void geos::HypreMatrix::insert ( arrayView1d< globalIndex const > const &  rowIndices,
arrayView1d< globalIndex const > const &  colIndices,
arrayView1d< real64 const > const &  values 
)
overridevirtual

Insert values stored in 3 linear vectors.

Parameters
rowIndicesArray of global row indices
colIndicesArray of global column indices
valuesArray of values

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ insert() [3/6]

virtual void geos::HypreMatrix::insert ( globalIndex const *  rowIndices,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  numRows,
localIndex const  numCols 
)
overridevirtual

Insert dense matrix.

Parameters
rowIndicesGlobal row indices
colIndicesGlobal col indices
valuesDense local matrix of values
numRowsNumber of row indices
numColsNumber of column indices
Note
Row major layout assumed in values

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ insert() [4/6]

virtual void geos::HypreMatrix::insert ( globalIndex const  rowIndex,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice1d< real64 const > const &  values 
)
overridevirtual

Insert elements of one row using array1d.

Parameters
rowIndexGlobal row index
colIndicesGlobal column indices
valuesValues to add to prescribed locations

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ insert() [5/6]

virtual void geos::HypreMatrix::insert ( globalIndex const  rowIndex,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  size 
)
overridevirtual

Insert elements to one row using c-style arrays.

Parameters
rowIndexGlobal row index
colIndicesGlobal column indices
valuesValues to add to prescribed locations
sizeNumber of elements

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ insert() [6/6]

virtual void geos::HypreMatrix::insert ( globalIndex const  rowIndex,
globalIndex const  colIndex,
real64 const  value 
)
overridevirtual

Insert one element.

Parameters
rowIndexGlobal row index
colIndexGlobal column index
valueValue to insert at prescribed location

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ insertable()

bool geos::MatrixBase< MATRIX, VECTOR >::insertable
inline

Query matrix status.

Returns
true if matrix has NOT been assembled yet (not closed since last create() call) and is currently open for insertion of new entries

Definition at line 130 of file MatrixBase.hpp.

◆ iupper()

virtual globalIndex geos::HypreMatrix::iupper ( ) const
overridevirtual

Returns index one past the last global row owned by that processor.

Returns
the next index after last global row owned by that processor
Note
The intention is for [ilower; iupper) to be used as a half-open index range

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ jlower()

virtual globalIndex geos::HypreMatrix::jlower ( ) const
overridevirtual

Returns the index of the first global col owned by that processor.

Returns
index of the first owned global col
Note
Matrix implementations don't physically "own" column ranges the same way they do row ranges. Instead, the column range refers to the "diagonal" block of columns which would correspond to the local range of entries of a vector created with the same local/global size as the number of matrix columns.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ jupper()

virtual globalIndex geos::HypreMatrix::jupper ( ) const
overridevirtual

Returns index one past the last global col owned by that processor.

Returns
index one past the last owned global col
Note
The intention is for [jlower; jupper) to be used as a half-open index range.
Also see note for jlower() about the meaning of "owned" columns.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ leftMultiplyTranspose()

virtual void geos::HypreMatrix::leftMultiplyTranspose ( HypreMatrix const &  src,
HypreMatrix dst 
) const
overridevirtual

Matrix/Matrix transpose multiplication.

Compute this^T * B = C.

Parameters
srcInput matrix (B).
dstOutput matrix (C).
Note
The output matrix dst doesn't need to be created beforehand.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ leftRightScale()

virtual void geos::HypreMatrix::leftRightScale ( HypreVector const &  vecLeft,
HypreVector const &  vecRight 
)
overridevirtual

Post-multiplies (right) with diagonal matrix consisting of the values in vecRight and pre-multiplies (left) with diagonal matrix consisting of the values in vec.

Parameters
vecLeftvec to pre-multiply with.
vecRightvec to post-multiply with.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ leftScale()

virtual void geos::HypreMatrix::leftScale ( HypreVector const &  vec)
overridevirtual

Pre-multiplies (left) with diagonal matrix consisting of the values in vec.

Parameters
vecVector to pre-multiply with.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ maxRowLength()

virtual localIndex geos::HypreMatrix::maxRowLength ( ) const
overridevirtual

Returns the number of nonzero entries in the longest row of the matrix.

Returns
the max length of a row

Collective.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ modifiable()

bool geos::MatrixBase< MATRIX, VECTOR >::modifiable
inline

Query matrix status.

Returns
true if matrix has been assembled and is currently open; this implies individual entries within existing sparsity pattern can be altered via set()/add() methods.

Definition at line 123 of file MatrixBase.hpp.

◆ multiply()

virtual void geos::HypreMatrix::multiply ( HypreMatrix const &  src,
HypreMatrix dst 
) const
overridevirtual

Matrix/Matrix multiplication.

Compute this * B = C.

Parameters
srcInput matrix (B).
dstOutput matrix (C).
Note
The output matrix dst doesn't need to be created beforehand.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ multiplyPtAP()

virtual void geos::HypreMatrix::multiplyPtAP ( HypreMatrix const &  P,
HypreMatrix dst 
) const
overridevirtual

Compute the triple product dst = P^T * this * P

Parameters
Pthe "prolongation" matrix
dstthe resulting product matrix (will be re-created as needed)

Reimplemented from geos::MatrixBase< HypreMatrix, HypreVector >.

◆ multiplyRAP()

virtual void geos::HypreMatrix::multiplyRAP ( HypreMatrix const &  R,
HypreMatrix const &  P,
HypreMatrix dst 
) const
overridevirtual

Compute the triple product dst = R * this * P

Parameters
Rthe "restriction" matrix
Pthe "prolongation" matrix
dstthe resulting product matrix (will be re-created as needed)

Reimplemented from geos::MatrixBase< HypreMatrix, HypreVector >.

◆ norm1()

virtual real64 geos::HypreMatrix::norm1 ( ) const
overridevirtual

Returns the one norm of the matrix.

Returns
the value of 1-norm

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ normFrobenius()

virtual real64 geos::HypreMatrix::normFrobenius ( ) const
overridevirtual

Returns the Frobenius norm of the matrix.

Returns
the value of Frobenius norm

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ normInf()

virtual real64 geos::HypreMatrix::normInf ( ) const
overridevirtual

Returns the infinity norm of the matrix.

Returns
the value of infinity norm

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ normMax() [1/2]

virtual real64 geos::HypreMatrix::normMax ( ) const
overridevirtual

Returns the max norm of the matrix (the largest absolute element value).

Returns
the value of max norm

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ normMax() [2/2]

virtual real64 geos::HypreMatrix::normMax ( arrayView1d< globalIndex const > const &  rowIndices) const
overridevirtual

Returns the max norm of the matrix on a subset of rows.

Parameters
rowIndicesglobal indices of rows to compute norm over
Returns
the value of max norm

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ numGlobalCols()

virtual globalIndex geos::HypreMatrix::numGlobalCols ( ) const
overridevirtual

Get the number of global columns.

Returns
Number of global columns in the operator.

Implements geos::LinearOperator< HypreVector >.

◆ numGlobalNonzeros()

virtual globalIndex geos::HypreMatrix::numGlobalNonzeros ( ) const
overridevirtual

Returns the total number of nonzeros in the matrix.

Returns
the total number of nonzeros in the matrix

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ numGlobalRows()

virtual globalIndex geos::HypreMatrix::numGlobalRows ( ) const
overridevirtual

Get the number of global rows.

Returns
Number of global rows in the operator.

Implements geos::LinearOperator< HypreVector >.

◆ numLocalCols()

virtual localIndex geos::HypreMatrix::numLocalCols ( ) const
overridevirtual

Get the number of local columns.

Returns
Number of local columns in the operator.
Note
The use of term "local columns" refers not to physical partitioning of columns across ranks (as e.g. matrices are partitioned by rows and typically physically store all column entries), but to the partitioning of a compatible vector object that this operator can be applied to.

Implements geos::LinearOperator< HypreVector >.

◆ numLocalNonzeros()

virtual localIndex geos::HypreMatrix::numLocalNonzeros ( ) const
overridevirtual

Returns the number of nonzeros in the local portion of the matrix.

Returns
the number of nonzeros in the local portion of the matrix

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ numLocalRows()

virtual localIndex geos::HypreMatrix::numLocalRows ( ) const
overridevirtual

Get the number of local rows.

Returns
Number of local rows in the operator.

Implements geos::LinearOperator< HypreVector >.

◆ open()

virtual void geos::HypreMatrix::open ( )
overridevirtual

Open matrix for adding new entries.

Note
Adding entries that result in modifications of sparsity pattern may not be allowed by most implementations. An error will be raised in that case.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ operator=() [1/2]

HypreMatrix& geos::HypreMatrix::operator= ( HypreMatrix &&  src)
noexcept

Move assignment.

Parameters
srcmatrix to be moved from
Returns
the new vector

◆ operator=() [2/2]

HypreMatrix& geos::HypreMatrix::operator= ( HypreMatrix const &  src)

Copy assignment.

Parameters
srcmatrix to be copied
Returns
the new vector

◆ print()

virtual void geos::HypreMatrix::print ( std::ostream &  os = std::cout) const
overridevirtual

Print the matrix in Trilinos format to a stream.

Parameters
osthe output stream

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ ready()

bool geos::MatrixBase< MATRIX, VECTOR >::ready
inline

Query matrix ready status.

Returns
true if matrix has been assembled and is currently closed; this implies it's ready to be used or re-opened for adding/setting values

Definition at line 115 of file MatrixBase.hpp.

◆ rescaleRows()

virtual void geos::HypreMatrix::rescaleRows ( arrayView1d< globalIndex const > const &  rowIndices,
RowSumType const  rowSumType 
)
overridevirtual

Rescales selected rows of matrix using row sum reciprocal as a factor.

Parameters
rowIndicesglobal indicies of rows to scale (all must be locally owned)
rowSumTypetype of row sums to use as scaling factors

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ residual()

virtual void geos::MatrixBase< MATRIX, VECTOR >::residual
inlineoverride

Compute residual r = b - A * x.

Overrides LinearOperator::residual().

Parameters
xInput solution.
bInput right hand side.
rOutput residual.
Warning
x and r cannot alias the same vector, but b and r can.

Definition at line 551 of file MatrixBase.hpp.

◆ rightMultiplyTranspose()

virtual void geos::HypreMatrix::rightMultiplyTranspose ( HypreMatrix const &  src,
HypreMatrix dst 
) const
overridevirtual

Matrix/Matrix transpose multiplication.

Compute B * this^T = C.

Parameters
srcInput matrix (B).
dstOutput matrix (C).
Note
The output matrix dst doesn't need to be created beforehand.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ rightScale()

virtual void geos::HypreMatrix::rightScale ( HypreVector const &  vec)
overridevirtual

Post-multiplies (right) with diagonal matrix consisting of the values in vec.

Parameters
vecVector to post-multiply with.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ rowLength()

virtual localIndex geos::HypreMatrix::rowLength ( globalIndex const  globalRowIndex) const
overridevirtual

Get row length via global row index.

Parameters
[in]globalRowIndexthe global row index
Returns
the number of nonzero entries in the row

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ scale()

virtual void geos::HypreMatrix::scale ( real64 const  scalingFactor)
overridevirtual

Multiply all elements by scalingFactor.

Parameters
scalingFactorScaling factor.

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ separateComponentFilter()

virtual void geos::HypreMatrix::separateComponentFilter ( HypreMatrix dst,
integer const  dofPerPoint 
) const
overridevirtual

Apply a separate component approximation (filter) to this matrix.

Parameters
dstthe target (filtered) matrix
dofPerPointnumber of degrees-of-freedom per node

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ set() [1/6]

virtual void geos::HypreMatrix::set ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const > const &  values 
)
overridevirtual

Set a dense block of values.

Parameters
rowIndicesGlobal row indices
colIndicesGlobal col indices
valuesDense local matrix of values

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ set() [2/6]

virtual void geos::HypreMatrix::set ( globalIndex const *  rowIndices,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  numRows,
localIndex const  numCols 
)
overridevirtual

Set a dense block of values.

Parameters
rowIndicesGlobal row indices
colIndicesGlobal col indices
valuesDense local matrix of values
numRowsNumber of row indices
numColsNumber of column indices
Note
Row major layout assumed in values

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ set() [3/6]

virtual void geos::HypreMatrix::set ( globalIndex const  rowIndex,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice1d< real64 const > const &  values 
)
overridevirtual

Set elements of one row using array1d.

Parameters
rowIndexGlobal row index
colIndicesGlobal column indices
valuesValues to add to prescribed locations

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ set() [4/6]

virtual void geos::HypreMatrix::set ( globalIndex const  rowIndex,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  size 
)
overridevirtual

Set elements to one row using c-style arrays.

Parameters
rowIndexGlobal row index
colIndicesGlobal column indices
valuesValues to add to prescribed locations
sizeNumber of elements

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ set() [5/6]

virtual void geos::HypreMatrix::set ( globalIndex const  rowIndex,
globalIndex const  colIndex,
real64 const  value 
)
overridevirtual

Set one element.

Parameters
rowIndexGlobal row index
colIndexGlobal column index
valueValue to set at prescribed location

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ set() [6/6]

virtual void geos::HypreMatrix::set ( real64 const  value)
overridevirtual

Set all non-zero elements to a value.

Parameters
valuethe value to set all elements to

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ setDofManager()

void geos::MatrixBase< MATRIX, VECTOR >::setDofManager
inline

Associate a DofManager with this matrix.

Parameters
dofManagerthe DofManager containing the relevant degrees of freedom

Definition at line 157 of file MatrixBase.hpp.

◆ transpose()

virtual void geos::HypreMatrix::transpose ( HypreMatrix dst) const
overridevirtual

Matrix transposition.

Compute B = this^T.

Parameters
dstOutput matrix (B).

Implements geos::MatrixBase< HypreMatrix, HypreVector >.

◆ unwrapped()

HYPRE_ParCSRMatrix const& geos::HypreMatrix::unwrapped ( ) const

Returns a pointer to implementation.

Returns
the underlying HYPRE_ParCSRMatrix object.

◆ unwrappedIJ()

HYPRE_IJMatrix const& geos::HypreMatrix::unwrappedIJ ( ) const

Returns a pointer to implementation.

Returns
the underlying HYPRE_IJMatrix object.

◆ write()

virtual void geos::HypreMatrix::write ( string const &  filename,
LAIOutputFormat const  format = LAIOutputFormat::MATRIX_MARKET 
) const
overridevirtual

Write the matrix to filename in a matlab-compatible format.

Parameters
filenamename of the output file
formatoutput format

Within octave / matlab:

load filename M = spconvert(filename_root)

Implements geos::MatrixBase< HypreMatrix, HypreVector >.


The documentation for this class was generated from the following file: