GEOS
|
Common base template for all matrix wrapper types. More...
#include <MatrixBase.hpp>
Protected Types | |
using | Base = LinearOperator< VECTOR > |
Alias for base type. | |
using | Matrix = MATRIX |
Type alias for actual derived matrix class. | |
using | Vector = VECTOR |
Type alias for a compatible vector class. | |
Protected Member Functions | |
virtual localIndex | numLocalRows () const=0 |
Get the number of local rows. More... | |
virtual localIndex | numLocalCols () const=0 |
Get the number of local columns. More... | |
virtual globalIndex | numGlobalRows () const=0 |
Get the number of global rows. More... | |
virtual globalIndex | numGlobalCols () const=0 |
Get the number of global columns. More... | |
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... | |
DofManager related methods | |
Some solvers and preconditioners rely on information about degrees-of-freedom of the linear problem represented by a matrix (for example, to decompose the matrix into blocks representing various parts of the physical problem). This lightweight interface allows one to associate a DofManager instance with the matrix, and thus avoid having to pass it to the preconditioner separately. The association is non-owning, the user must ensure the lifetime of DofManager object while any solvers/preconditioners set up with this matrix are in use. | |
void | setDofManager (DofManager const *const dofManager) |
Associate a DofManager with this matrix. More... | |
DofManager const * | dofManager () const |
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, localIndex const numLocalColumns, 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 > 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 > 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 > 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... | |
virtual void | insert (arrayView1d< globalIndex const > const &rowIndices, arrayView1d< globalIndex const > const &colIndices, arrayView1d< real64 const > const &values)=0 |
Insert values stored in 3 linear vectors. More... | |
Linear Algebra Methods | |
virtual void | apply (Vector const &src, Vector &dst) const override=0 |
Apply operator to a vector, dst = this(src) . 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 = b - A * x . 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 | multiplyRARt (Matrix const &R, Matrix &dst) const |
Compute the triple product dst = R * this * R^T 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 | separateComponentFilter (Matrix &dst, integer const dofPerPoint) const =0 |
Apply a separate component approximation (filter) to this matrix. 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 | rescaleRows (arrayView1d< globalIndex const > const &rowIndices, RowSumType const rowSumType)=0 |
Rescales selected rows of matrix using row sum reciprocal as a factor. 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, MatrixPatternOp const op, real64 const scale)=0 |
Add entries of another matrix to this. More... | |
virtual void | addDiagonal (Vector const &src, real64 const scale)=0 |
Add (scaled) entries of a vector to the diagonal of this matrix. More... | |
virtual void | clampEntries (real64 const lo, real64 const hi, bool const excludeDiag)=0 |
Clamp each matrix value between values of lo and hi . More... | |
Accessors Methods | |
virtual localIndex | maxRowLength () const =0 |
Returns the number of nonzero entries in the longest row of the matrix. More... | |
virtual localIndex | rowLength (globalIndex const globalRowIndex) const =0 |
Get row length via global row index. More... | |
virtual void | getRowLengths (arrayView1d< localIndex > const &lengths) const =0 |
Get the row lengths of every local row. 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 void | extractDiagonal (Vector &dst) const =0 |
Extract diagonal values into a vector. More... | |
virtual void | getRowSums (Vector &dst, RowSumType const rowSumType) const =0 |
Populate a vector with row sums of this . 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 real64 | normMax () const =0 |
Returns the max norm of the matrix (the largest absolute element value). More... | |
virtual real64 | normMax (arrayView1d< globalIndex const > const &rowIndices) const =0 |
Returns the max norm of the matrix on a subset of rows. 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... | |
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 = true |
Flag indicating whether the matrix is currently open for adding new entries. | |
bool | m_assembled = false |
Flag indicating whether the matrix (sparsity pattern) has been assembled. | |
DofManager const * | m_dofManager {} |
(optional) DofManager associated with this matrix | |
Friends | |
std::ostream & | operator<< (std::ostream &os, Matrix const &matrix) |
Stream insertion operator for all matrix types. More... | |
Additional Inherited Members | |
Public Types inherited from geos::LinearOperator< VECTOR > | |
using | Vector = VECTOR |
Alias for template parameter. | |
Public Member Functions inherited from geos::LinearOperator< VECTOR > | |
LinearOperator ()=default | |
Constructor. | |
virtual | ~LinearOperator ()=default |
Destructor. | |
virtual globalIndex | numGlobalRows () const =0 |
Get the number of global rows. More... | |
virtual globalIndex | numGlobalCols () const =0 |
Get the number of global columns. More... | |
virtual localIndex | numLocalRows () const =0 |
Get the number of local rows. More... | |
virtual localIndex | numLocalCols () const =0 |
Get the number of local columns. More... | |
virtual MPI_Comm | comm () const =0 |
Get the MPI communicator the matrix was created with. More... | |
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 75 of file MatrixBase.hpp.
|
protectedpure virtual |
Add a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Add to one element.
rowIndex | Global row index |
colIndex | Global column index |
value | Value to add to prescribed location |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Add (scaled) entries of a vector to the diagonal of this matrix.
src | the source vector |
scale | optional scaling factor |
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 geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
|
protectedpure virtual |
Add entries of another matrix to this.
src | the source matrix |
op | handling of nonzero patterns, see MatrixPatternOp |
scale | factor to scale entries of src by |
this
must be a superset of sparsity of src
. this
and src
must have the same parallel row distribution. Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
|
overrideprotectedpure virtual |
Apply operator to a vector, dst = this(src)
.
src | input vector |
dst | output vector |
src
and dst
cannot alias the same vector (some implementations may allow this). Implements geos::LinearOperator< VECTOR >.
Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
|
protectedpure virtual |
Apply transpose of the matrix to a vector.
src | Input vector (x). |
dst | Output vector (b). |
Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
|
inlineprotected |
Query matrix assembled status.
true
if matrix has been opened and closed since creation; false
otherwise Definition at line 108 of file MatrixBase.hpp.
|
protectedpure virtual |
Clamp each matrix value between values of lo
and hi
.
lo | min value |
hi | max value |
excludeDiag | iff true , diagonal values are unchanged |
Effectively sets each matrix value v to min(max(v, lo), hi).
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
inlineprotected |
Query matrix closed status.
true
if matrix has been opened and has not been closed since; false
otherwise Definition at line 102 of file MatrixBase.hpp.
|
inlineprotectedvirtual |
Create parallel matrix from a local CRS matrix.
localMatrix | The input local matrix. |
numLocalColumns | number of local columns (not available from localMatrix in general) |
comm | The MPI communicator to use. |
localMatrix
does not need to retain its values after the call. Reimplemented in geos::HypreMatrix.
Definition at line 248 of file MatrixBase.hpp.
|
protectedpure virtual |
Query matrix creation status.
true
if matrix has been created Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 204 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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 186 of file MatrixBase.hpp.
|
inlineprotected |
Definition at line 165 of file MatrixBase.hpp.
|
protectedpure virtual |
Extract diagonal values into a vector.
dst | the target vector, must have the same row partitioning as this |
Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::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 geos::PetscMatrix, geos::HypreMatrix, and geos::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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::HypreMatrix, geos::EpetraMatrix, and geos::PetscMatrix.
|
protectedpure virtual |
Get the row lengths of every local row.
lengths | an array view to be populated with row lengths |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Populate a vector with row sums of this
.
dst | the target vector, must have the same row partitioning as this |
rowSumType | type of row sum operation to perform |
Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
|
protectedpure virtual |
Returns the index of the first global row owned by that processor.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Insert a dense block of values.
rowIndices | Global row indices |
colIndices | Global col indices |
values | Dense local matrix of values |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Insert values stored in 3 linear vectors.
rowIndices | Array of global row indices |
colIndices | Array of global column indices |
values | Array of values |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Insert one element.
rowIndex | Global row index |
colIndex | Global column index |
value | Value to insert at prescribed location |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 130 of file MatrixBase.hpp.
|
protectedpure virtual |
Returns index one past the last global row owned by that processor.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Returns the index of the first global col owned by that processor.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Returns index one past the last global col owned by that processor.
jlower()
about the meaning of "owned" columns. Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Matrix/Matrix transpose multiplication.
Compute this^T * B = C
.
src | Input matrix (B). |
dst | Output matrix (C). |
dst
doesn't need to be created beforehand. Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::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 geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
|
protectedpure virtual |
Pre-multiplies (left) with diagonal matrix consisting of the values in vec.
vec | Vector to pre-multiply with. |
Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
|
protectedpure virtual |
Returns the number of nonzero entries in the longest row of the matrix.
Collective.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 123 of file MatrixBase.hpp.
|
protectedpure virtual |
Matrix/Matrix multiplication.
Compute this * B = C
.
src | Input matrix (B). |
dst | Output matrix (C). |
dst
doesn't need to be created beforehand. Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::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 geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
Definition at line 625 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 geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
Definition at line 605 of file MatrixBase.hpp.
|
inlineprotectedvirtual |
Compute the triple product dst = R * this * R^T
R | the "restriction" matrix |
dst | the resulting product matrix (will be re-created as needed) |
Definition at line 643 of file MatrixBase.hpp.
|
protectedpure virtual |
Returns the one norm of the matrix.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Returns the Frobenius norm of the matrix.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Returns the infinity norm of the matrix.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Returns the max norm of the matrix (the largest absolute element value).
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Returns the max norm of the matrix on a subset of rows.
rowIndices | global indices of rows to compute norm over |
Implemented in geos::EpetraMatrix, geos::HypreMatrix, and geos::PetscMatrix.
|
protected |
Get the number of global columns.
|
protectedpure virtual |
Returns the total number of nonzeros in the matrix.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protected |
Get the number of global rows.
|
protected |
Get the number of local columns.
|
protectedpure virtual |
Returns the number of nonzeros in the local portion of the matrix.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protected |
Get the number of local rows.
|
protectedpure virtual |
Open matrix for adding new entries.
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Print the matrix in Trilinos format to a stream.
os | the output stream |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 115 of file MatrixBase.hpp.
|
protectedpure virtual |
Rescales selected rows of matrix using row sum reciprocal as a factor.
rowIndices | global indicies of rows to scale (all must be locally owned) |
rowSumType | type of row sums to use as scaling factors |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
inlineoverrideprotectedvirtual |
Compute residual r = b - A * x
.
Overrides LinearOperator::residual().
x | Input solution. |
b | Input right hand side. |
r | Output residual. |
x
and r
cannot alias the same vector, but b
and r
can. Reimplemented from geos::LinearOperator< VECTOR >.
Definition at line 551 of file MatrixBase.hpp.
|
protectedpure virtual |
Matrix/Matrix transpose multiplication.
Compute B * this^T = C
.
src | Input matrix (B). |
dst | Output matrix (C). |
dst
doesn't need to be created beforehand. Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
|
protectedpure virtual |
Post-multiplies (right) with diagonal matrix consisting of the values in vec.
vec | Vector to post-multiply with. |
Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::EpetraMatrix.
|
protectedpure virtual |
Get row length via global row index.
[in] | globalRowIndex | the global row index |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Multiply all elements by scalingFactor.
scalingFactor | Scaling factor. |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Apply a separate component approximation (filter) to this matrix.
dst | the target (filtered) matrix |
dofPerPoint | number of degrees-of-freedom per node |
Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Set one element.
rowIndex | Global row index |
colIndex | Global column index |
value | Value to set at prescribed location |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
protectedpure virtual |
Set all non-zero elements to a value.
value | the value to set all elements to |
Implemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
inlineprotected |
Associate a DofManager with this matrix.
dofManager | the DofManager containing the relevant degrees of freedom |
Definition at line 157 of file MatrixBase.hpp.
|
protectedpure virtual |
Matrix transposition.
Compute B = this^T
.
dst | Output matrix (B). |
Implemented in geos::PetscMatrix, geos::HypreMatrix, and geos::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 geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.
|
friend |
Stream insertion operator for all matrix types.
os | the output stream |
matrix | the matrix to be printed |
Definition at line 950 of file MatrixBase.hpp.