opm-upscaling
Loading...
Searching...
No Matches
Opm::Elasticity::MatrixOps Class Reference

Helper class with some matrix operations. More...

#include <matrixops.hpp>

Static Public Member Functions

static void fromAdjacency (Matrix &A, const AdjacencyPattern &adj, int rows, int cols)
 Create a sparse matrix from a given adjacency pattern.
static Matrix fromDense (const Dune::DynamicMatrix< double > &T)
 Create a sparse matrix from a dense matrix.
static void print (const Matrix &A)
 Print a matrix to stdout.
static Matrix Axpy (const Matrix &A, const Matrix &B, double alpha)
 axpy like operation - returns A+alpha*B
static Matrix augment (const Matrix &A, const Matrix &B, size_t r0, size_t c0, bool symmetric)
 Augment a matrix with another.
static Matrix extractDiagonal (const Matrix &A)
 Extract the diagonal of a matrix into a new matrix.
static Matrix diagonal (size_t N)
 Returns a diagonal matrix.
static Matrix extractBlock (const Matrix &A, size_t r0, size_t N, size_t c0, size_t M)
 Extract a subblock of a matrix into a new matrix.
static void saveAsc (const Matrix &A, const std::string &file)
 Save a matrix as a dense asc file.

Detailed Description

Helper class with some matrix operations.

Member Function Documentation

◆ augment()

Matrix Opm::Elasticity::MatrixOps::augment ( const Matrix & A,
const Matrix & B,
size_t r0,
size_t c0,
bool symmetric )
static

Augment a matrix with another.

Parameters
[in]AThe matrix to be augmented
[in]BThe matrix to augment with
[in]r0The starting row of the augment matrix
[in]c0The starting column of the augment matrix
[in]symmetricIf true, augment symmetrically

◆ Axpy()

Matrix Opm::Elasticity::MatrixOps::Axpy ( const Matrix & A,
const Matrix & B,
double alpha )
static

axpy like operation - returns A+alpha*B

Parameters
[in]AThe matrix to subtract from
[in]BThe matrix to subtract
[in]alphaThe constant in front of B
Returns
A+alpha*B

◆ diagonal()

Matrix Opm::Elasticity::MatrixOps::diagonal ( size_t N)
static

Returns a diagonal matrix.

Parameters
[in]NThe dimension of the matrix

◆ extractBlock()

Matrix Opm::Elasticity::MatrixOps::extractBlock ( const Matrix & A,
size_t r0,
size_t N,
size_t c0,
size_t M )
static

Extract a subblock of a matrix into a new matrix.

Parameters
[in]AThe matrix to extract from
[in]r0First row index for block
[in]NNumber of rows in block
[in]c0First column index for block
[in]MNumber of colums in block
Returns
The subblock

◆ extractDiagonal()

Matrix Opm::Elasticity::MatrixOps::extractDiagonal ( const Matrix & A)
static

Extract the diagonal of a matrix into a new matrix.

Parameters
[in]AThe matrix to extract the diagonal from
Returns
M = diag(A)

◆ fromAdjacency()

void Opm::Elasticity::MatrixOps::fromAdjacency ( Matrix & A,
const AdjacencyPattern & adj,
int rows,
int cols )
static

Create a sparse matrix from a given adjacency pattern.

Parameters
[in]adjThe adjacency pattern
[in]rowsThe number of rows in the matrix
[in]colsThe number of columns in the matrix
[out]AThe created matrix

◆ fromDense()

Matrix Opm::Elasticity::MatrixOps::fromDense ( const Dune::DynamicMatrix< double > & T)
static

Create a sparse matrix from a dense matrix.

Parameters
[in]TThe dense matrix
Returns
The sparse matrix

◆ print()

void Opm::Elasticity::MatrixOps::print ( const Matrix & A)
static

Print a matrix to stdout.

Parameters
[in]AThe matrix to print

◆ saveAsc()

void Opm::Elasticity::MatrixOps::saveAsc ( const Matrix & A,
const std::string & file )
static

Save a matrix as a dense asc file.

Parameters
[in]AThe matrix to save
[in]fileFile name

This is only useful for debugging as the files grow very big


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