GEOSX
|
Common base template for all matrix wrapper types. More...
#include <MatrixBase.hpp>
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. | |
MatrixBase & | operator= (MatrixBase const &)=default |
Copy assignment. More... | |
MatrixBase & | operator= (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 | |
| |
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. | |
Common base template for all matrix wrapper types.
MATRIX | derived matrix type |
VECTOR | compatible 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.
|
protectedpure virtual |
Add to one element.
rowIndex | Global row index |
colIndex | Global column index |
value | Value to add to prescribed location |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Add elements to one row using c-style arrays.
rowIndex | Global row index |
colIndices | Global column indices |
values | Values to add to prescribed locations |
size | Number of elements |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Add elements to one row using array1d.
rowIndex | Global row index |
colIndices | Global column indices |
values | Values to add to prescribed locations |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Add a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Add a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Add a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
numRows | Number of row indices |
numCols | Number of column indices |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Add entries of a vector to the diagonal of this matrix.
src | the source vector |
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.
|
protectedpure virtual |
Add entries of another matrix to this.
src | the source matrix |
scale | factor to scale entries of src by |
samePattern | whether to keep the original pattern or to extend it |
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.
|
overrideprotectedpure virtual |
Apply operator to a vector.
src | Input vector (x). |
dst | Output vector (b). |
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.
|
protectedpure virtual |
Apply transpose of the matrix to a vector.
src | Input vector (x). |
dst | Output vector (b). |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
inlineprotected |
Query matrix assembled status.
true
if matrix has been opened and closed since creation; false
otherwise Definition at line 118 of file MatrixBase.hpp.
|
protectedpure virtual |
Clear a row, and optionally set diagonal element to diagValue
.
row | globalIndex of the row to be cleared. |
diagValue | (Optional) set diagonal element to desired value. |
keepDiag | if true , diagValue is ignored and original diagonal is preserved |
diagValue
and keepDiag
are ignored if the matrix is not square Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
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.
|
inlineprotected |
Query matrix closed status.
true
if matrix has been opened and has not been closed since; false
otherwise Definition at line 112 of file MatrixBase.hpp.
|
inlineprotectedvirtual |
Create parallel matrix from a local CRS matrix.
localMatrix | The input local matrix. |
comm | The MPI communicator to use. |
localMatrix
does not need to retain its values after the call. Definition at line 225 of file MatrixBase.hpp.
|
protectedpure virtual |
Query matrix creation status.
true
if matrix has been created Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
inlineprotectedvirtual |
Create a square matrix from global number of rows.
Create a square matrix with an (approximately) even partitioning of rows.
globalSize | Global dimensions for a square matrix. |
maxEntriesPerRow | Maximum number of non-zero entries per row. |
comm | MPI communicator. |
Definition at line 182 of file MatrixBase.hpp.
|
protectedpure virtual |
Create a rectangular matrix from number of rows/columns.
comm | MPI communicator. |
globalRows | Global number of rows. |
globalCols | Global number of columns. |
maxEntriesPerRow | Maximum number of entries per row (hint). |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
inlineprotectedvirtual |
Create a square matrix from local number of rows.
localSize | local number of rows for square matrix. |
maxEntriesPerRow | Maximum number of non-zero entries per row. |
comm | MPI communicator. |
Definition at line 164 of file MatrixBase.hpp.
|
protectedpure virtual |
Create a rectangular matrix from number of rows/columns.
comm | MPI communicator. |
localRows | Local number of rows. |
localCols | Local number of columns. |
maxEntriesPerRow | Maximum number of entries per row (hint). |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Extract diagonal values into a vector.
dst | the target vector, must have the same row partitioning as this |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Compute gemv y = alpha*A*x + beta*y
.
alpha | Scalar factor for added matvec product. |
x | Input vector. |
beta | Scalar factor for right hand side. |
y | Output vector. |
useTranspose | Boolean, set to true to use A^T . |
x
and y
cannot alias the same vector. Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Get the MPI communicator the matrix was created with.
create
...()Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
get diagonal element value on a given row
globalRow | global row index |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Map a local row index to global row index.
index | the local row index (between 0 and number of local rows) |
index
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Map a global row index to local row index.
index | the global row index |
index
, or -1 if not a local row Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Returns a copy of the data in row globalRow
.
[in] | globalRow | the index of global row to extract |
[out] | colIndices | the output array of global column indices (must have a large enough size) |
[out] | values | the output array of values (must have a large enough size) |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Get row length via global row index.
[in] | globalRowIndex | the global row index |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Returns the index of the first global row owned by that processor.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Insert one element.
rowIndex | Global row index |
colIndex | Global column index |
value | Value to insert at prescribed location |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Insert elements to one row using c-style arrays.
rowIndex | Global row index |
colIndices | Global column indices |
values | Values to add to prescribed locations |
size | Number of elements |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Insert elements of one row using array1d.
rowIndex | Global row index |
colIndices | Global column indices |
values | Values to add to prescribed locations |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Insert a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Insert a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Insert dense matrix.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
numRows | Number of row indices |
numCols | Number of column indices |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
inlineprotected |
Query matrix status.
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.
|
protectedpure virtual |
Returns index one past the last global row owned by that processor.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Returns the index of the first global col owned by that processor.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Returns index one past the last global col owned by that processor.
jlower()
about the meaning of "owned" columns. Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Matrix/Matrix transpose multiplication.
Compute this^T * B = C
.
src | Input matrix (B). |
dst | Output 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.
|
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.
vecLeft | vec to pre-multiply with. |
vecRight | vec to post-multiply with. |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Pre-multiplies (left) with diagonal matrix consisting of the values in vec.
vec | Vector to pre-multiply with. |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Get row length via local row index.
[in] | localRowIndex | the local row index |
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.
|
protectedpure virtual |
Returns the number of nonzero entries in the longest row of the matrix.
Collective.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
inlineprotected |
Query matrix status.
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.
|
protectedpure virtual |
Matrix/Matrix multiplication.
Compute this * B = C
.
src | Input matrix (B). |
dst | Output 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.
|
inlineprotectedvirtual |
Compute the triple product dst = P^T * this * P
P | the "prolongation" matrix |
dst | the 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.
|
inlineprotectedvirtual |
Compute the triple product dst = R * this * P
R | the "restriction" matrix |
P | the "prolongation" matrix |
dst | the 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.
|
protectedpure virtual |
Returns the one norm of the matrix.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Returns the Frobenius norm of the matrix.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Returns the infinity norm of the matrix.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
overrideprotectedpure virtual |
Returns the number of global columns.
Implements geosx::LinearOperator< VECTOR >.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Returns the total number of nonzeros in the matrix.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
overrideprotectedpure virtual |
Returns the number of global rows.
Implements geosx::LinearOperator< VECTOR >.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Return the local number of columns on each processor.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Returns the number of nonzeros in the local portion of the matrix.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Return the local number of columns on each processor.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Open matrix for adding new entries.
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protecteddefault |
Copy assignment.
|
protecteddefault |
Move assignment.
|
protectedpure virtual |
Print the matrix in Trilinos format to a stream.
os | the output stream |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
inlineprotected |
Query matrix ready status.
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.
|
inlineoverrideprotectedvirtual |
Compute residual r = Ax - b
.
Overrides LinearOperator::residual().
x | Input solution. |
b | Input right hand side. |
r | Output residual. |
x
and r
cannot alias the same vector. Reimplemented from geosx::LinearOperator< VECTOR >.
Definition at line 546 of file MatrixBase.hpp.
|
protectedpure virtual |
Matrix/Matrix transpose multiplication.
Compute B * this^T = C
.
src | Input matrix (B). |
dst | Output 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.
|
protectedpure virtual |
Post-multiplies (right) with diagonal matrix consisting of the values in vec.
vec | Vector to post-multiply with. |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Multiply all elements by scalingFactor.
scalingFactor | Scaling factor. |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Set all non-zero elements to a value.
value | the value to set all elements to |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Set one element.
rowIndex | Global row index |
colIndex | Global column index |
value | Value to set at prescribed location |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Set elements to one row using c-style arrays.
rowIndex | Global row index |
colIndices | Global column indices |
values | Values to add to prescribed locations |
size | Number of elements |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Set elements of one row using array1d.
rowIndex | Global row index |
colIndices | Global column indices |
values | Values to add to prescribed locations |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Set a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Set a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Set a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
numRows | Number of row indices |
numCols | Number of column indices |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Matrix transposition.
Compute B = this^T
.
dst | Output matrix (B). |
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
protectedpure virtual |
Write the matrix to filename in a matlab-compatible format.
filename | name of the output file |
format | output format |
Within octave / matlab:
load filename M = spconvert(filename_root)
Implemented in geosx::HypreMatrix, geosx::PetscMatrix, and geosx::EpetraMatrix.
|
friend |
Stream insertion operator for all matrix types.
os | the output stream |
matrix | the matrix to be printed |
Definition at line 937 of file MatrixBase.hpp.