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] | A | The matrix to be augmented
  [in] | B | The matrix to augment with
  [in] | r0 | The starting row of the augment matrix
  [in] | c0 | The starting column of the augment matrix
  [in] | symmetric | If 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] | A | The matrix to subtract from
  [in] | B | The matrix to subtract
  [in] | alpha | The 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] | N | The 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] | A | The matrix to extract from
  [in] | r0 | First row index for block
  [in] | N | Number of rows in block
  [in] | c0 | First column index for block
  [in] | M | Number 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] | A | The 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] | adj | The adjacency pattern
  [in] | rows | The number of rows in the matrix
  [in] | cols | The number of columns in the matrix
  [out] | A | The created matrix

## fromDense()

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

static

Create a sparse matrix from a dense matrix.

Parameters

  [in] | T | The dense matrix

Returns
  The sparse matrix

## print()

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

static

Print a matrix to stdout.

Parameters

  [in] | A | The 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] | A | The matrix to save
  [in] | file | File name

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

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

- opm/elasticity/matrixops.hpp
- opm/elasticity/matrixops.cpp