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... | |
Helper class with some matrix operations.
|
static |
Augment a matrix with another.
[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 like operation - returns A+alpha*B
[in] | A | The matrix to subtract from |
[in] | B | The matrix to subtract |
[in] | alpha | The constant in front of B |
|
static |
Returns a diagonal matrix.
[in] | N | The dimension of the matrix |
|
static |
Extract a subblock of a matrix into a new matrix.
[in] | The | matrix to extract from |
Extract the diagonal of a matrix into a new matrix.
[in] | The | matrix to extract the diagonal from |
|
static |
Create a sparse matrix from a given adjacency pattern.
[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 |
|
static |
Create a sparse matrix from a dense matrix.
[in] | T | The dense matrix |
|
static |
Print a matrix to stdout.
[in] | A | The matrix to print |
|
static |
Save a matrix as a dense asc file.
[in] | A | The matrix to save |
[in] | file | File name |
This is only useful for debugging as the files grow very big