GEOSX
Public Types | Public Member Functions | List of all members
geosx::EpetraMatrix Class Referencefinal

Wrapper class for Epetra's CrsMatrix. More...

#include <EpetraMatrix.hpp>

Inheritance diagram for geosx::EpetraMatrix:
Inheritance graph
[legend]

Public Types

using Vector = EpetraVector
 Compatible vector type.
 
- Public Types inherited from geosx::LinearOperator< EpetraVector >
using Vector = EpetraVector
 Alias for template parameter.
 

Public Member Functions

Epetra_FECrsMatrix const & unwrapped () const
 Returns a const pointer to the underlying matrix. More...
 
Epetra_FECrsMatrix & unwrapped ()
 Returns a non-const pointer to the underlying matrix. More...
 
Constructor/Destructor methods
 EpetraMatrix ()
 Empty matrix constructor. More...
 
 EpetraMatrix (EpetraMatrix const &src)
 Copy constructor. More...
 
virtual ~EpetraMatrix () override
 Virtual destructor.
 
MatrixBase interface
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, MatrixLayout::ROW_MAJOR > 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, MatrixLayout::ROW_MAJOR > 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, MatrixLayout::ROW_MAJOR > const &values) override
 Insert a dense block of values. More...
 
virtual void add (arraySlice1d< globalIndex const > const &rowIndices, arraySlice1d< globalIndex const > const &colIndices, arraySlice2d< real64 const, MatrixLayout::COL_MAJOR > 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, MatrixLayout::COL_MAJOR > 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, MatrixLayout::COL_MAJOR > 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 apply (EpetraVector const &src, EpetraVector &dst) const override
 Apply operator to a vector. More...
 
virtual void applyTranspose (EpetraVector const &src, EpetraVector &dst) const override
 Apply transpose of the matrix to a vector. More...
 
virtual void multiply (EpetraMatrix const &src, EpetraMatrix &dst) const override
 Matrix/Matrix multiplication. More...
 
virtual void leftMultiplyTranspose (EpetraMatrix const &src, EpetraMatrix &dst) const override
 Matrix/Matrix transpose multiplication. More...
 
virtual void rightMultiplyTranspose (EpetraMatrix const &src, EpetraMatrix &dst) const override
 Matrix/Matrix transpose multiplication. More...
 
virtual void multiplyRAP (EpetraMatrix const &R, EpetraMatrix const &P, EpetraMatrix &dst) const override
 Compute the triple product dst = R * this * P More...
 
virtual void multiplyPtAP (EpetraMatrix const &P, EpetraMatrix &dst) const override
 Compute the triple product dst = P^T * this * P More...
 
virtual void gemv (real64 const alpha, EpetraVector const &x, real64 const beta, EpetraVector &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 (EpetraVector const &vec) override
 Pre-multiplies (left) with diagonal matrix consisting of the values in vec. More...
 
virtual void rightScale (EpetraVector const &vec) override
 Post-multiplies (right) with diagonal matrix consisting of the values in vec. More...
 
virtual void leftRightScale (EpetraVector const &vecLeft, EpetraVector 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 (EpetraMatrix &dst) const override
 Matrix transposition. 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 (EpetraMatrix const &src, real64 const scale=1.0, bool const samePattern=true) override
 Add entries of another matrix to this. More...
 
virtual void addDiagonal (EpetraVector const &src) override
 Add entries of a vector to the diagonal of this matrix. More...
 
virtual localIndex maxRowLength () const override
 Returns the number of nonzero entries in the longest row of the matrix. More...
 
virtual localIndex localRowLength (localIndex localRowIndex) const override
 Get row length via local row index. More...
 
virtual localIndex globalRowLength (globalIndex globalRowIndex) const override
 Get row length via global row index. More...
 
virtual void getRowCopy (globalIndex globalRow, arraySlice1d< globalIndex > const &colIndices, arraySlice1d< real64 > const &values) const override
 Returns a copy of the data in row globalRow. More...
 
virtual real64 getDiagValue (globalIndex globalRow) const override
 get diagonal element value on a given row More...
 
virtual void extractDiagonal (EpetraVector &dst) const override
 Extract diagonal values into a vector. More...
 
virtual globalIndex numGlobalRows () const override
 Returns the number of global rows. More...
 
virtual globalIndex numGlobalCols () const override
 Returns the number of global columns. More...
 
virtual localIndex numLocalRows () const override
 Return the local number of columns on each processor. More...
 
virtual localIndex numLocalCols () const override
 Return the local number of columns on each processor. 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 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 getComm () 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...
 
- Public Member Functions inherited from geosx::LinearOperator< EpetraVector >
 LinearOperator ()=default
 Constructor.
 
virtual ~LinearOperator ()=default
 Destructor.
 

Detailed Description

Wrapper class for Epetra's CrsMatrix.

Definition at line 39 of file EpetraMatrix.hpp.

Constructor & Destructor Documentation

◆ EpetraMatrix() [1/2]

geosx::EpetraMatrix::EpetraMatrix ( )

Empty matrix constructor.

Create an empty (distributed) matrix.

◆ EpetraMatrix() [2/2]

geosx::EpetraMatrix::EpetraMatrix ( EpetraMatrix const &  src)

Copy constructor.

Parameters
[in]srcthe matrix to be copied

Member Function Documentation

◆ add() [1/6]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ add() [2/6]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ add() [3/6]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ add() [4/6]

virtual void geosx::EpetraMatrix::add ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::ROW_MAJOR > const &  values 
)
overridevirtual

Add a dense block of values.

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

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ add() [5/6]

virtual void geosx::EpetraMatrix::add ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::COL_MAJOR > const &  values 
)
overridevirtual

Add a dense block of values.

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

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ add() [6/6]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ addDiagonal()

virtual void geosx::EpetraMatrix::addDiagonal ( EpetraVector const &  src)
overridevirtual

Add entries of a vector to the diagonal of this matrix.

Parameters
srcthe source vector
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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ addEntries()

virtual void geosx::EpetraMatrix::addEntries ( EpetraMatrix const &  src,
real64 const  scale = 1.0,
bool const  samePattern = true 
)
overridevirtual

Add entries of another matrix to this.

Parameters
srcthe source matrix
scalefactor to scale entries of src by
samePatternwhether to keep the original pattern or to extend it
Note
Sparsity pattern of this must be a superset of sparsity of src. this and src must have the same parallel row distribution.

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ apply()

virtual void geosx::EpetraMatrix::apply ( EpetraVector const &  src,
EpetraVector dst 
) const
overridevirtual

Apply operator to a vector.

Parameters
srcInput vector (x).
dstOutput vector (b).
Warning
src and dst cannot alias the same vector (some implementations may allow this).

Implements geosx::LinearOperator< EpetraVector >.

◆ applyTranspose()

virtual void geosx::EpetraMatrix::applyTranspose ( EpetraVector const &  src,
EpetraVector dst 
) const
overridevirtual

Apply transpose of the matrix to a vector.

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

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ clearRow()

virtual real64 geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ close()

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ created()

virtual bool geosx::EpetraMatrix::created ( ) const
overridevirtual

Query matrix creation status.

Returns
true if matrix has been created

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ createWithGlobalSize()

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ createWithLocalSize()

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ extractDiagonal()

virtual void geosx::EpetraMatrix::extractDiagonal ( EpetraVector dst) const
overridevirtual

Extract diagonal values into a vector.

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

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ gemv()

virtual void geosx::EpetraMatrix::gemv ( real64 const  alpha,
EpetraVector const &  x,
real64 const  beta,
EpetraVector 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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ getComm()

virtual MPI_Comm geosx::EpetraMatrix::getComm ( ) 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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ getDiagValue()

virtual real64 geosx::EpetraMatrix::getDiagValue ( globalIndex  globalRow) const
overridevirtual

get diagonal element value on a given row

Parameters
globalRowglobal row index
Returns
value of diagonal element on the row

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ getGlobalRowID()

virtual globalIndex geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ getLocalRowID()

virtual localIndex geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ getRowCopy()

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ globalRowLength()

virtual localIndex geosx::EpetraMatrix::globalRowLength ( globalIndex  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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ ilower()

virtual globalIndex geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ insert() [1/6]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ insert() [2/6]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ insert() [3/6]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ insert() [4/6]

virtual void geosx::EpetraMatrix::insert ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::ROW_MAJOR > const &  values 
)
overridevirtual

Insert a dense block of values.

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

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ insert() [5/6]

virtual void geosx::EpetraMatrix::insert ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::COL_MAJOR > const &  values 
)
overridevirtual

Insert a dense block of values.

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

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ insert() [6/6]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ iupper()

virtual globalIndex geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ jlower()

virtual globalIndex geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ jupper()

virtual globalIndex geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ leftMultiplyTranspose()

virtual void geosx::EpetraMatrix::leftMultiplyTranspose ( EpetraMatrix const &  src,
EpetraMatrix dst 
) const
overridevirtual

Matrix/Matrix transpose multiplication.

Compute this^T * B = C.

Parameters
srcInput matrix (B).
dstOutput matrix (C).

Note that the output matrix C should have the same row-map as this. If close() has already been called on C, then C's sparsity pattern must already contain the nonzero entries produced by the product this*B.

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ leftRightScale()

virtual void geosx::EpetraMatrix::leftRightScale ( EpetraVector const &  vecLeft,
EpetraVector 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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ leftScale()

virtual void geosx::EpetraMatrix::leftScale ( EpetraVector const &  vec)
overridevirtual

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

Parameters
vecVector to pre-multiply with.

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ localRowLength()

virtual localIndex geosx::EpetraMatrix::localRowLength ( localIndex  localRowIndex) const
overridevirtual

Get row length via local row index.

Parameters
[in]localRowIndexthe local row index
Returns
the number of nonzero entries in the row

TODO: Breaks the goal of hiding local row indexing from user. Revise use cases to use ilower() and iupper().

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ maxRowLength()

virtual localIndex geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ multiply()

virtual void geosx::EpetraMatrix::multiply ( EpetraMatrix const &  src,
EpetraMatrix dst 
) const
overridevirtual

Matrix/Matrix multiplication.

Compute this * B = C.

Parameters
srcInput matrix (B).
dstOutput matrix (C).

Note that the output matrix C should have the same row-map as this. If close() has already been called on C, then C's sparsity pattern must already contain the nonzero entries produced by the product this*B.

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ multiplyPtAP()

virtual void geosx::EpetraMatrix::multiplyPtAP ( EpetraMatrix const &  P,
EpetraMatrix 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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ multiplyRAP()

virtual void geosx::EpetraMatrix::multiplyRAP ( EpetraMatrix const &  R,
EpetraMatrix const &  P,
EpetraMatrix 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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ norm1()

virtual real64 geosx::EpetraMatrix::norm1 ( ) const
overridevirtual

Returns the one norm of the matrix.

Returns
the value of 1-norm

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ normFrobenius()

virtual real64 geosx::EpetraMatrix::normFrobenius ( ) const
overridevirtual

Returns the Frobenius norm of the matrix.

Returns
the value of Frobenius norm

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ normInf()

virtual real64 geosx::EpetraMatrix::normInf ( ) const
overridevirtual

Returns the infinity norm of the matrix.

Returns
the value of infinity norm

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ numGlobalCols()

virtual globalIndex geosx::EpetraMatrix::numGlobalCols ( ) const
overridevirtual

Returns the number of global columns.

Returns
number of global columns

Implements geosx::LinearOperator< EpetraVector >.

◆ numGlobalNonzeros()

virtual globalIndex geosx::EpetraMatrix::numGlobalNonzeros ( ) const
overridevirtual

Returns the total number of nonzeros in the matrix.

Returns
the total number of nonzeros in the matrix

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ numGlobalRows()

virtual globalIndex geosx::EpetraMatrix::numGlobalRows ( ) const
overridevirtual

Returns the number of global rows.

Returns
number of global rows

Implements geosx::LinearOperator< EpetraVector >.

◆ numLocalCols()

virtual localIndex geosx::EpetraMatrix::numLocalCols ( ) const
overridevirtual

Return the local number of columns on each processor.

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

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ numLocalNonzeros()

virtual localIndex geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ numLocalRows()

virtual localIndex geosx::EpetraMatrix::numLocalRows ( ) const
overridevirtual

Return the local number of columns on each processor.

Returns
number of local columns

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ open()

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ print()

virtual void geosx::EpetraMatrix::print ( std::ostream &  os = std::cout) const
overridevirtual

Print the matrix in Trilinos format to a stream.

Parameters
osthe output stream

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ rightMultiplyTranspose()

virtual void geosx::EpetraMatrix::rightMultiplyTranspose ( EpetraMatrix const &  src,
EpetraMatrix dst 
) const
overridevirtual

Matrix/Matrix transpose multiplication.

Compute B * this^T = C.

Parameters
srcInput matrix (B).
dstOutput matrix (C).

Note that the output matrix C should have the same row-map as this. If close() has already been called on C, then C's sparsity pattern must already contain the nonzero entries produced by the product this*B.

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ rightScale()

virtual void geosx::EpetraMatrix::rightScale ( EpetraVector const &  vec)
overridevirtual

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

Parameters
vecVector to post-multiply with.

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ scale()

virtual void geosx::EpetraMatrix::scale ( real64 const  scalingFactor)
overridevirtual

Multiply all elements by scalingFactor.

Parameters
scalingFactorScaling factor.

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ set() [1/7]

virtual void geosx::EpetraMatrix::set ( real64 const  value)
overridevirtual

Set all non-zero elements to a value.

Parameters
valuethe value to set all elements to

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ set() [2/7]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ set() [3/7]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ set() [4/7]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ set() [5/7]

virtual void geosx::EpetraMatrix::set ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::ROW_MAJOR > const &  values 
)
overridevirtual

Set a dense block of values.

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

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ set() [6/7]

virtual void geosx::EpetraMatrix::set ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::COL_MAJOR > const &  values 
)
overridevirtual

Set a dense block of values.

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

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ set() [7/7]

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ transpose()

virtual void geosx::EpetraMatrix::transpose ( EpetraMatrix dst) const
overridevirtual

Matrix transposition.

Compute B = this^T.

Parameters
dstOutput matrix (B).

Implements geosx::MatrixBase< EpetraMatrix, EpetraVector >.

◆ unwrapped() [1/2]

Epetra_FECrsMatrix const& geosx::EpetraMatrix::unwrapped ( ) const

Returns a const pointer to the underlying matrix.

Returns
const pointer to the underlying matrix

◆ unwrapped() [2/2]

Epetra_FECrsMatrix& geosx::EpetraMatrix::unwrapped ( )

Returns a non-const pointer to the underlying matrix.

Returns
non-const pointer to the underlying matrix

◆ write()

virtual void geosx::EpetraMatrix::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 geosx::MatrixBase< EpetraMatrix, EpetraVector >.


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