GEOSX
Public Types | Protected Attributes | Friends | List of all members
geosx::MatrixBase< MATRIX, VECTOR > Class Template Referenceabstract

Common base template for all matrix wrapper types. More...

#include <MatrixBase.hpp>

Inheritance diagram for geosx::MatrixBase< MATRIX, VECTOR >:
Inheritance graph
[legend]

Public Types

using Matrix = MATRIX
 Type alias for actual derived matrix class.
 
using Vector = VECTOR
 Type alias for a compatible vector class.
 
- Public Types inherited from geosx::LinearOperator< VECTOR >
using Vector = VECTOR
 Alias for template parameter.
 

Protected Member Functions

Constructors/destructor/assignment
 MatrixBase ()
 Constructs a matrix in default state.
 
 MatrixBase (MatrixBase const &)=default
 Copy constructor.
 
 MatrixBase (MatrixBase &&)=default
 Move constructor.
 
MatrixBaseoperator= (MatrixBase const &)=default
 Copy assignment. More...
 
MatrixBaseoperator= (MatrixBase &&)=default
 Move assignment. More...
 
 ~MatrixBase ()=default
 Destructor.
 
Status query methods
bool closed () const
 Query matrix closed status. More...
 
bool assembled () const
 Query matrix assembled status. More...
 
bool ready () const
 Query matrix ready status. More...
 
bool modifiable () const
 Query matrix status. More...
 
bool insertable () const
 Query matrix status. More...
 
virtual bool created () const =0
 Query matrix creation status. More...
 
Create Methods
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 createWithGlobalSize (globalIndex const globalSize, localIndex const maxEntriesPerRow, MPI_Comm const &comm)
 Create a square matrix from global 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 globalRows, globalIndex const globalCols, localIndex const maxEntriesPerRow, MPI_Comm const &comm)=0
 Create a rectangular matrix from number of rows/columns. More...
 
virtual void create (CRSMatrixView< real64 const, globalIndex const > const &localMatrix, MPI_Comm const &comm)
 Create parallel matrix from a local CRS matrix. More...
 
Open/close methods
virtual void open ()=0
 Open matrix for adding new entries. More...
 
virtual void close ()=0
 Assemble and compress the matrix. More...
 
virtual void reset ()
 Reset the matrix to default state.
 
Global modification methods
virtual void set (real64 const value)=0
 Set all non-zero elements to a value. More...
 
virtual void zero ()=0
 Set all elements to zero.
 
Add/Set/Insert Methods

insert method can only be used while the matrix is being filled for the first time, e.g. during sparsity pattern construction. add and set methods can only be used after the matrix has been assembled, and both only accept entries that already exist in the sparsity pattern.

Note
Caution: these methods are not thread-safe.
virtual void add (globalIndex const rowIndex, globalIndex const colIndex, real64 const value)=0
 Add to one element. More...
 
virtual void set (globalIndex const rowIndex, globalIndex const colIndex, real64 const value)=0
 Set one element. More...
 
virtual void insert (globalIndex const rowIndex, globalIndex const colIndex, real64 const value)=0
 Insert one element. More...
 
virtual void add (globalIndex const rowIndex, globalIndex const *colIndices, real64 const *values, localIndex const size)=0
 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)=0
 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)=0
 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)=0
 Add elements to one row using array1d. More...
 
virtual void set (globalIndex const rowIndex, arraySlice1d< globalIndex const > const &colIndices, arraySlice1d< real64 const > const &values)=0
 Set elements of one row using array1d. More...
 
virtual void insert (globalIndex const rowIndex, arraySlice1d< globalIndex const > const &colIndices, arraySlice1d< real64 const > const &values)=0
 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)=0
 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)=0
 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)=0
 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)=0
 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)=0
 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)=0
 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)=0
 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)=0
 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)=0
 Insert dense matrix. More...
 
Linear Algebra Methods
virtual void apply (Vector const &src, Vector &dst) const override=0
 Apply operator to a vector. More...
 
virtual void applyTranspose (Vector const &src, Vector &dst) const =0
 Apply transpose of the matrix to a vector. More...
 
virtual void residual (Vector const &x, Vector const &b, Vector &r) const override
 Compute residual r = Ax - b. More...
 
virtual void multiply (Matrix const &src, Matrix &dst) const =0
 Matrix/Matrix multiplication. More...
 
virtual void leftMultiplyTranspose (Matrix const &src, Matrix &dst) const =0
 Matrix/Matrix transpose multiplication. More...
 
virtual void rightMultiplyTranspose (Matrix const &src, Matrix &dst) const =0
 Matrix/Matrix transpose multiplication. More...
 
virtual void multiplyRAP (Matrix const &R, Matrix const &P, Matrix &dst) const
 Compute the triple product dst = R * this * P More...
 
virtual void multiplyPtAP (Matrix const &P, Matrix &dst) const
 Compute the triple product dst = P^T * this * P More...
 
virtual void gemv (real64 const alpha, Vector const &x, real64 const beta, Vector &y, bool useTranspose=false) const =0
 Compute gemv y = alpha*A*x + beta*y. More...
 
virtual void scale (real64 const scalingFactor)=0
 Multiply all elements by scalingFactor. More...
 
virtual void leftScale (Vector const &vec)=0
 Pre-multiplies (left) with diagonal matrix consisting of the values in vec. More...
 
virtual void rightScale (Vector const &vec)=0
 Post-multiplies (right) with diagonal matrix consisting of the values in vec. More...
 
virtual void leftRightScale (Vector const &vecLeft, Vector const &vecRight)=0
 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 (Matrix &dst) const =0
 Matrix transposition. More...
 
virtual real64 clearRow (globalIndex const row, bool const keepDiag=false, real64 const diagValue=0.0)=0
 Clear a row, and optionally set diagonal element to diagValue. More...
 
virtual void addEntries (Matrix const &src, real64 const scale=1.0, bool const samePattern=true)=0
 Add entries of another matrix to this. More...
 
virtual void addDiagonal (Vector const &src)=0
 Add entries of a vector to the diagonal of this matrix. More...
 
Accessors Methods
virtual localIndex maxRowLength () const =0
 Returns the number of nonzero entries in the longest row of the matrix. More...
 
virtual localIndex localRowLength (localIndex localRowIndex) const =0
 Get row length via local row index. More...
 
virtual localIndex globalRowLength (globalIndex const globalRowIndex) const =0
 Get row length via global row index. More...
 
virtual void getRowCopy (globalIndex const globalRow, arraySlice1d< globalIndex > const &colIndices, arraySlice1d< real64 > const &values) const =0
 Returns a copy of the data in row globalRow. More...
 
virtual real64 getDiagValue (globalIndex globalRow) const =0
 get diagonal element value on a given row More...
 
virtual void extractDiagonal (Vector &dst) const =0
 Extract diagonal values into a vector. More...
 
virtual globalIndex numGlobalRows () const override=0
 Returns the number of global rows. More...
 
virtual globalIndex numGlobalCols () const override=0
 Returns the number of global columns. More...
 
virtual localIndex numLocalRows () const =0
 Return the local number of columns on each processor. More...
 
virtual localIndex numLocalCols () const =0
 Return the local number of columns on each processor. More...
 
virtual globalIndex ilower () const =0
 Returns the index of the first global row owned by that processor. More...
 
virtual globalIndex iupper () const =0
 Returns index one past the last global row owned by that processor. More...
 
virtual globalIndex jlower () const =0
 Returns the index of the first global col owned by that processor. More...
 
virtual globalIndex jupper () const =0
 Returns index one past the last global col owned by that processor. More...
 
virtual localIndex numLocalNonzeros () const =0
 Returns the number of nonzeros in the local portion of the matrix. More...
 
virtual globalIndex numGlobalNonzeros () const =0
 Returns the total number of nonzeros in the matrix. More...
 
virtual real64 normInf () const =0
 Returns the infinity norm of the matrix. More...
 
virtual real64 norm1 () const =0
 Returns the one norm of the matrix. More...
 
virtual real64 normFrobenius () const =0
 Returns the Frobenius norm of the matrix. More...
 
virtual localIndex getLocalRowID (globalIndex const index) const =0
 Map a global row index to local row index. More...
 
virtual globalIndex getGlobalRowID (localIndex const index) const =0
 Map a local row index to global row index. More...
 
virtual MPI_Comm getComm () const =0
 Get the MPI communicator the matrix was created with. More...
 
I/O Methods
virtual void print (std::ostream &os=std::cout) const =0
 Print the matrix in Trilinos format to a stream. More...
 
virtual void write (string const &filename, LAIOutputFormat const format=LAIOutputFormat::MATRIX_MARKET) const =0
 Write the matrix to filename in a matlab-compatible format. More...
 

Protected Attributes

bool m_closed
 Flag indicating whether the matrix is currently open for adding new entries.
 
bool m_assembled
 Flag indicating whether the matrix (sparsity pattern) has been assembled.
 

Friends

std::ostream & operator<< (std::ostream &os, Matrix const &matrix)
 Stream insertion operator for all matrix types. More...
 

Additional Inherited Members

- Public Member Functions inherited from geosx::LinearOperator< VECTOR >
 LinearOperator ()=default
 Constructor.
 
virtual ~LinearOperator ()=default
 Destructor.
 

Detailed Description

template<typename MATRIX, typename VECTOR>
class geosx::MatrixBase< MATRIX, VECTOR >

Common base template for all matrix wrapper types.

Template Parameters
MATRIXderived matrix type
VECTORcompatible vector type

This class template provides a common interface for all derived matrix wrapper types. Most methods are pure abstract in order to get the compiler to enforce a common interface in all derived classes; the class should be inherited from privately by implementations to avoid the possibility of accidentally invoking virtual function calls. Some basic facilities are provided related to matrix lifecycle. These include status flags and corresponding status query functions.

As an added benefit, the documentation for matrix interface also lives here and does not need to be duplicated across matrix wrappers. Derived classes should still document specific functions in case a particular LA package's behavior deviates from expectations or has unexpected performance impacts. In that case, @copydoc tag can be used to copy over the documentation.

Definition at line 49 of file MatrixBase.hpp.

Member Function Documentation

◆ add() [1/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::add ( globalIndex const  rowIndex,
globalIndex const  colIndex,
real64 const  value 
)
protectedpure virtual

Add to one element.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ add() [2/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::add ( globalIndex const  rowIndex,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  size 
)
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ add() [3/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::add ( globalIndex const  rowIndex,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice1d< real64 const > const &  values 
)
protectedpure virtual

Add elements to one row using array1d.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ add() [4/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::add ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::ROW_MAJOR > const &  values 
)
protectedpure virtual

Add a dense block of values.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ add() [5/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::add ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::COL_MAJOR > const &  values 
)
protectedpure virtual

Add a dense block of values.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ add() [6/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::add ( globalIndex const *  rowIndices,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  numRows,
localIndex const  numCols 
)
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ addDiagonal()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::addDiagonal ( Vector const &  src)
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ addEntries()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::addEntries ( Matrix const &  src,
real64 const  scale = 1.0,
bool const  samePattern = true 
)
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ apply()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::apply ( Vector const &  src,
Vector dst 
) const
overrideprotectedpure virtual

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< VECTOR >.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ applyTranspose()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::applyTranspose ( Vector const &  src,
Vector dst 
) const
protectedpure virtual

Apply transpose of the matrix to a vector.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ assembled()

template<typename MATRIX, typename VECTOR>
bool geosx::MatrixBase< MATRIX, VECTOR >::assembled ( ) const
inlineprotected

Query matrix assembled status.

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

Definition at line 118 of file MatrixBase.hpp.

◆ clearRow()

template<typename MATRIX, typename VECTOR>
virtual real64 geosx::MatrixBase< MATRIX, VECTOR >::clearRow ( globalIndex const  row,
bool const  keepDiag = false,
real64 const  diagValue = 0.0 
)
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ close()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::close ( )
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ closed()

template<typename MATRIX, typename VECTOR>
bool geosx::MatrixBase< MATRIX, VECTOR >::closed ( ) const
inlineprotected

Query matrix closed status.

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

Definition at line 112 of file MatrixBase.hpp.

◆ create()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::create ( CRSMatrixView< real64 const, globalIndex const > const &  localMatrix,
MPI_Comm const &  comm 
)
inlineprotectedvirtual

Create parallel matrix from a local CRS matrix.

Parameters
localMatrixThe input local matrix.
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 225 of file MatrixBase.hpp.

◆ created()

template<typename MATRIX, typename VECTOR>
virtual bool geosx::MatrixBase< MATRIX, VECTOR >::created ( ) const
protectedpure virtual

Query matrix creation status.

Returns
true if matrix has been created

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ createWithGlobalSize() [1/2]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::createWithGlobalSize ( globalIndex const  globalSize,
localIndex const  maxEntriesPerRow,
MPI_Comm const &  comm 
)
inlineprotectedvirtual

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 182 of file MatrixBase.hpp.

◆ createWithGlobalSize() [2/2]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::createWithGlobalSize ( globalIndex const  globalRows,
globalIndex const  globalCols,
localIndex const  maxEntriesPerRow,
MPI_Comm const &  comm 
)
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ createWithLocalSize() [1/2]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::createWithLocalSize ( localIndex const  localSize,
localIndex const  maxEntriesPerRow,
MPI_Comm const &  comm 
)
inlineprotectedvirtual

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 164 of file MatrixBase.hpp.

◆ createWithLocalSize() [2/2]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::createWithLocalSize ( localIndex const  localRows,
localIndex const  localCols,
localIndex const  maxEntriesPerRow,
MPI_Comm const &  comm 
)
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ extractDiagonal()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::extractDiagonal ( Vector dst) const
protectedpure virtual

Extract diagonal values into a vector.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ gemv()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::gemv ( real64 const  alpha,
Vector const &  x,
real64 const  beta,
Vector y,
bool  useTranspose = false 
) const
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ getComm()

template<typename MATRIX, typename VECTOR>
virtual MPI_Comm geosx::MatrixBase< MATRIX, VECTOR >::getComm ( ) const
protectedpure virtual

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)

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ getDiagValue()

template<typename MATRIX, typename VECTOR>
virtual real64 geosx::MatrixBase< MATRIX, VECTOR >::getDiagValue ( globalIndex  globalRow) const
protectedpure virtual

get diagonal element value on a given row

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ getGlobalRowID()

template<typename MATRIX, typename VECTOR>
virtual globalIndex geosx::MatrixBase< MATRIX, VECTOR >::getGlobalRowID ( localIndex const  index) const
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ getLocalRowID()

template<typename MATRIX, typename VECTOR>
virtual localIndex geosx::MatrixBase< MATRIX, VECTOR >::getLocalRowID ( globalIndex const  index) const
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ getRowCopy()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::getRowCopy ( globalIndex const  globalRow,
arraySlice1d< globalIndex > const &  colIndices,
arraySlice1d< real64 > const &  values 
) const
protectedpure virtual

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)

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ globalRowLength()

template<typename MATRIX, typename VECTOR>
virtual localIndex geosx::MatrixBase< MATRIX, VECTOR >::globalRowLength ( globalIndex const  globalRowIndex) const
protectedpure virtual

Get row length via global row index.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ ilower()

template<typename MATRIX, typename VECTOR>
virtual globalIndex geosx::MatrixBase< MATRIX, VECTOR >::ilower ( ) const
protectedpure virtual

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

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ insert() [1/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::insert ( globalIndex const  rowIndex,
globalIndex const  colIndex,
real64 const  value 
)
protectedpure virtual

Insert one element.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ insert() [2/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::insert ( globalIndex const  rowIndex,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  size 
)
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ insert() [3/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::insert ( globalIndex const  rowIndex,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice1d< real64 const > const &  values 
)
protectedpure virtual

Insert elements of one row using array1d.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ insert() [4/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::insert ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::ROW_MAJOR > const &  values 
)
protectedpure virtual

Insert a dense block of values.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ insert() [5/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::insert ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::COL_MAJOR > const &  values 
)
protectedpure virtual

Insert a dense block of values.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ insert() [6/6]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::insert ( globalIndex const *  rowIndices,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  numRows,
localIndex const  numCols 
)
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ insertable()

template<typename MATRIX, typename VECTOR>
bool geosx::MatrixBase< MATRIX, VECTOR >::insertable ( ) const
inlineprotected

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 140 of file MatrixBase.hpp.

◆ iupper()

template<typename MATRIX, typename VECTOR>
virtual globalIndex geosx::MatrixBase< MATRIX, VECTOR >::iupper ( ) const
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ jlower()

template<typename MATRIX, typename VECTOR>
virtual globalIndex geosx::MatrixBase< MATRIX, VECTOR >::jlower ( ) const
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ jupper()

template<typename MATRIX, typename VECTOR>
virtual globalIndex geosx::MatrixBase< MATRIX, VECTOR >::jupper ( ) const
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ leftMultiplyTranspose()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::leftMultiplyTranspose ( Matrix const &  src,
Matrix dst 
) const
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ leftRightScale()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::leftRightScale ( Vector const &  vecLeft,
Vector const &  vecRight 
)
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ leftScale()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::leftScale ( Vector const &  vec)
protectedpure virtual

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

Parameters
vecVector to pre-multiply with.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ localRowLength()

template<typename MATRIX, typename VECTOR>
virtual localIndex geosx::MatrixBase< MATRIX, VECTOR >::localRowLength ( localIndex  localRowIndex) const
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ maxRowLength()

template<typename MATRIX, typename VECTOR>
virtual localIndex geosx::MatrixBase< MATRIX, VECTOR >::maxRowLength ( ) const
protectedpure virtual

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

Returns
the max length of a row

Collective.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ modifiable()

template<typename MATRIX, typename VECTOR>
bool geosx::MatrixBase< MATRIX, VECTOR >::modifiable ( ) const
inlineprotected

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 133 of file MatrixBase.hpp.

◆ multiply()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::multiply ( Matrix const &  src,
Matrix dst 
) const
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ multiplyPtAP()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::multiplyPtAP ( Matrix const &  P,
Matrix dst 
) const
inlineprotectedvirtual

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

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

Reimplemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

Definition at line 629 of file MatrixBase.hpp.

◆ multiplyRAP()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::multiplyRAP ( Matrix const &  R,
Matrix const &  P,
Matrix dst 
) const
inlineprotectedvirtual

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 in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

Definition at line 609 of file MatrixBase.hpp.

◆ norm1()

template<typename MATRIX, typename VECTOR>
virtual real64 geosx::MatrixBase< MATRIX, VECTOR >::norm1 ( ) const
protectedpure virtual

Returns the one norm of the matrix.

Returns
the value of 1-norm

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ normFrobenius()

template<typename MATRIX, typename VECTOR>
virtual real64 geosx::MatrixBase< MATRIX, VECTOR >::normFrobenius ( ) const
protectedpure virtual

Returns the Frobenius norm of the matrix.

Returns
the value of Frobenius norm

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ normInf()

template<typename MATRIX, typename VECTOR>
virtual real64 geosx::MatrixBase< MATRIX, VECTOR >::normInf ( ) const
protectedpure virtual

Returns the infinity norm of the matrix.

Returns
the value of infinity norm

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ numGlobalCols()

template<typename MATRIX, typename VECTOR>
virtual globalIndex geosx::MatrixBase< MATRIX, VECTOR >::numGlobalCols ( ) const
overrideprotectedpure virtual

Returns the number of global columns.

Returns
number of global columns

Implements geosx::LinearOperator< VECTOR >.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ numGlobalNonzeros()

template<typename MATRIX, typename VECTOR>
virtual globalIndex geosx::MatrixBase< MATRIX, VECTOR >::numGlobalNonzeros ( ) const
protectedpure virtual

Returns the total number of nonzeros in the matrix.

Returns
the total number of nonzeros in the matrix

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ numGlobalRows()

template<typename MATRIX, typename VECTOR>
virtual globalIndex geosx::MatrixBase< MATRIX, VECTOR >::numGlobalRows ( ) const
overrideprotectedpure virtual

Returns the number of global rows.

Returns
number of global rows

Implements geosx::LinearOperator< VECTOR >.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ numLocalCols()

template<typename MATRIX, typename VECTOR>
virtual localIndex geosx::MatrixBase< MATRIX, VECTOR >::numLocalCols ( ) const
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ numLocalNonzeros()

template<typename MATRIX, typename VECTOR>
virtual localIndex geosx::MatrixBase< MATRIX, VECTOR >::numLocalNonzeros ( ) const
protectedpure virtual

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

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ numLocalRows()

template<typename MATRIX, typename VECTOR>
virtual localIndex geosx::MatrixBase< MATRIX, VECTOR >::numLocalRows ( ) const
protectedpure virtual

Return the local number of columns on each processor.

Returns
number of local columns

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ open()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::open ( )
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ operator=() [1/2]

template<typename MATRIX, typename VECTOR>
MatrixBase& geosx::MatrixBase< MATRIX, VECTOR >::operator= ( MatrixBase< MATRIX, VECTOR > const &  )
protecteddefault

Copy assignment.

Returns
reference to this object

◆ operator=() [2/2]

template<typename MATRIX, typename VECTOR>
MatrixBase& geosx::MatrixBase< MATRIX, VECTOR >::operator= ( MatrixBase< MATRIX, VECTOR > &&  )
protecteddefault

Move assignment.

Returns
reference to this object

◆ print()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::print ( std::ostream &  os = std::cout) const
protectedpure virtual

Print the matrix in Trilinos format to a stream.

Parameters
osthe output stream

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ ready()

template<typename MATRIX, typename VECTOR>
bool geosx::MatrixBase< MATRIX, VECTOR >::ready ( ) const
inlineprotected

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 125 of file MatrixBase.hpp.

◆ residual()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::residual ( Vector const &  x,
Vector const &  b,
Vector r 
) const
inlineoverrideprotectedvirtual

Compute residual r = Ax - b.

Overrides LinearOperator::residual().

Parameters
xInput solution.
bInput right hand side.
rOutput residual.
Note
x and r cannot alias the same vector.

Reimplemented from geosx::LinearOperator< VECTOR >.

Definition at line 546 of file MatrixBase.hpp.

◆ rightMultiplyTranspose()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::rightMultiplyTranspose ( Matrix const &  src,
Matrix dst 
) const
protectedpure virtual

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.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ rightScale()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::rightScale ( Vector const &  vec)
protectedpure virtual

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

Parameters
vecVector to post-multiply with.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ scale()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::scale ( real64 const  scalingFactor)
protectedpure virtual

Multiply all elements by scalingFactor.

Parameters
scalingFactorScaling factor.

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ set() [1/7]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::set ( real64 const  value)
protectedpure virtual

Set all non-zero elements to a value.

Parameters
valuethe value to set all elements to

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ set() [2/7]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::set ( globalIndex const  rowIndex,
globalIndex const  colIndex,
real64 const  value 
)
protectedpure virtual

Set one element.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ set() [3/7]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::set ( globalIndex const  rowIndex,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  size 
)
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ set() [4/7]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::set ( globalIndex const  rowIndex,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice1d< real64 const > const &  values 
)
protectedpure virtual

Set elements of one row using array1d.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ set() [5/7]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::set ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::ROW_MAJOR > const &  values 
)
protectedpure virtual

Set a dense block of values.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ set() [6/7]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::set ( arraySlice1d< globalIndex const > const &  rowIndices,
arraySlice1d< globalIndex const > const &  colIndices,
arraySlice2d< real64 const, MatrixLayout::COL_MAJOR > const &  values 
)
protectedpure virtual

Set a dense block of values.

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ set() [7/7]

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::set ( globalIndex const *  rowIndices,
globalIndex const *  colIndices,
real64 const *  values,
localIndex const  numRows,
localIndex const  numCols 
)
protectedpure virtual

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

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ transpose()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::transpose ( Matrix dst) const
protectedpure virtual

Matrix transposition.

Compute B = this^T.

Parameters
dstOutput matrix (B).

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

◆ write()

template<typename MATRIX, typename VECTOR>
virtual void geosx::MatrixBase< MATRIX, VECTOR >::write ( string const &  filename,
LAIOutputFormat const  format = LAIOutputFormat::MATRIX_MARKET 
) const
protectedpure virtual

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)

Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.

Friends And Related Function Documentation

◆ operator<<

template<typename MATRIX, typename VECTOR>
std::ostream& operator<< ( std::ostream &  os,
Matrix const &  matrix 
)
friend

Stream insertion operator for all matrix types.

Parameters
osthe output stream
matrixthe matrix to be printed
Returns
reference to the output stream

Definition at line 937 of file MatrixBase.hpp.


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