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. More...
 
static Matrix fromDense (const Dune::DynamicMatrix< double > &T)
 Create a sparse matrix from a dense matrix. More...
 
static void print (const Matrix &A)
 Print a matrix to stdout. More...
 
static Matrix Axpy (const Matrix &A, const Matrix &B, double alpha)
 axpy like operation - returns A+alpha*B More...
 
static Matrix augment (const Matrix &A, const Matrix &B, size_t r0, size_t c0, bool symmetric)
 Augment a matrix with another. More...
 
static Matrix extractDiagonal (const Matrix &A)
 Extract the diagonal of a matrix into a new matrix. More...
 
static Matrix diagonal (size_t N)
 Returns a diagonal matrix. More...
 
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. More...
 
static void saveAsc (const Matrix &A, const std::string &file)
 Save a matrix as a dense asc file. More...
 

Detailed Description

Helper class with some matrix operations.

Member Function Documentation

static 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
static 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
static Matrix Opm::Elasticity::MatrixOps::diagonal ( size_t  N)
static

Returns a diagonal matrix.

Parameters
[in]NThe dimension of the matrix

Referenced by Opm::Elasticity::if().

static 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]Thematrix to extract from
Returns
The subblock
static Matrix Opm::Elasticity::MatrixOps::extractDiagonal ( const Matrix A)
static

Extract the diagonal of a matrix into a new matrix.

Parameters
[in]Thematrix to extract the diagonal from
Returns
M = diag(A)
static 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

Referenced by Opm::Elasticity::ASMHandler< GridType >::initForAssembly().

static 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

Referenced by Opm::Elasticity::if().

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

Print a matrix to stdout.

Parameters
[in]AThe matrix to print

Referenced by Opm::Elasticity::ASMHandler< GridType >::printOperator().

static 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 file: