Loading...
Searching...
No Matches
Opm::TridiagonalMatrix< Scalar > Class Template Reference

Provides a tridiagonal matrix that also supports non-zero entries in the upper right and lower left. More...

`#include <TridiagonalMatrix.hpp>`

## Public Types

typedef Scalar | FieldType
typedef TridiagRow_ | RowType
typedef size_t | SizeType
typedef TridiagRow_ | iterator
typedef TridiagRow_ | const_iterator

## Public Member Functions

| TridiagonalMatrix (size_t numRows=0)
| TridiagonalMatrix (size_t numRows, Scalar value)
| TridiagonalMatrix (const TridiagonalMatrix &source)
| Copy constructor.
size_t | size () const
| Return the number of rows/columns of the matrix.
size_t | rows () const
| Return the number of rows of the matrix.
size_t | cols () const
| Return the number of columns of the matrix.
void | resize (size_t n)
| Change the number of rows of the matrix.
Scalar & | at (size_t rowIdx, size_t colIdx)
| Access an entry.
Scalar | at (size_t rowIdx, size_t colIdx) const
| Access an entry.
TridiagonalMatrix & | operator= (const TridiagonalMatrix &source)
| Assignment operator from another tridiagonal matrix.
TridiagonalMatrix & | operator= (Scalar value)
| Assignment operator from a Scalar.
iterator | begin ()
| \begin Iterator for the first row
const_iterator | begin () const
| \begin Const iterator for the first row
const_iterator | end () const
| \begin Const iterator for the next-to-last row
TridiagRow_ | operator[] (size_t rowIdx)
| Row access operator.
const TridiagRow_ | operator[] (size_t rowIdx) const
| Row access operator.
TridiagonalMatrix & | operator*= (Scalar alpha)
| Multiplication with a Scalar.
TridiagonalMatrix & | operator/= (Scalar alpha)
| Division by a Scalar.
TridiagonalMatrix & | operator-= (const TridiagonalMatrix &other)
| Subtraction operator.
TridiagonalMatrix & | operator+= (const TridiagonalMatrix &other)
| Addition operator.
TridiagonalMatrix & | axpy (Scalar alpha, const TridiagonalMatrix &other)
| Multiply and add the matrix entries of another tridiagonal matrix.
template<class Vector>
void | mv (const Vector &source, Vector &dest) const
| Matrix-vector product.
template<class Vector>
void | umv (const Vector &source, Vector &dest) const
| Additive matrix-vector product.
template<class Vector>
void | mmv (const Vector &source, Vector &dest) const
| Subtractive matrix-vector product.
template<class Vector>
void | usmv (Scalar alpha, const Vector &source, Vector &dest) const
| Scaled additive matrix-vector product.
template<class Vector>
void | mtv (const Vector &source, Vector &dest) const
| Transposed matrix-vector product.
template<class Vector>
void | umtv (const Vector &source, Vector &dest) const
| Transposed additive matrix-vector product.
template<class Vector>
void | mmtv (const Vector &source, Vector &dest) const
| Transposed subtractive matrix-vector product.
template<class Vector>
void | usmtv (Scalar alpha, const Vector &source, Vector &dest) const
| Transposed scaled additive matrix-vector product.
Scalar | frobeniusNorm () const
| Calculate the frobenius norm.
Scalar | frobeniusNormSquared () const
| Calculate the squared frobenius norm.
Scalar | infinityNorm () const
| Calculate the infinity norm.
template<class XVector, class BVector>
void | solve (XVector &x, const BVector &b) const
| Calculate the solution for a linear system of equations.
void | print (std::ostream &os) const
| Print the matrix to a given output stream.

## Detailed Description

template<class Scalar>
class Opm::TridiagonalMatrix< Scalar >

Provides a tridiagonal matrix that also supports non-zero entries in the upper right and lower left.

The entries in the lower left and upper right are supported to make implementing periodic systems easy.

The API of this class is designed to be close to the one used by the DUNE matrix classes.

## Member Function Documentation

## axpy()

template<class Scalar>

TridiagonalMatrix & Opm::TridiagonalMatrix< Scalar >::axpy | ( | Scalar | alpha,
|  | const TridiagonalMatrix< Scalar > & | other )

inline

Multiply and add the matrix entries of another tridiagonal matrix.

This means that

is equivalent to

## frobeniusNorm()

template<class Scalar>

Scalar Opm::TridiagonalMatrix< Scalar >::frobeniusNorm | ( |  | ) | const

inline

Calculate the frobenius norm.

i.e., the square root of the sum of all squared entries. This corresponds to the euclidean norm for vectors.

## frobeniusNormSquared()

template<class Scalar>

Scalar Opm::TridiagonalMatrix< Scalar >::frobeniusNormSquared | ( |  | ) | const

inline

Calculate the squared frobenius norm.

i.e., the sum of all squared entries.

## infinityNorm()

template<class Scalar>

Scalar Opm::TridiagonalMatrix< Scalar >::infinityNorm | ( |  | ) | const

inline

Calculate the infinity norm.

i.e., the maximum of the sum of the absolute values of all rows.

## mmtv()

template<class Scalar>
template<class Vector>

void Opm::TridiagonalMatrix< Scalar >::mmtv | ( | const Vector & | source,
|  | Vector & | dest ) const

inline

Transposed subtractive matrix-vector product.

This means that

is equivalent to

## mmv()

template<class Scalar>
template<class Vector>

void Opm::TridiagonalMatrix< Scalar >::mmv | ( | const Vector & | source,
|  | Vector & | dest ) const

inline

Subtractive matrix-vector product.

This means that

is equivalent to

## mtv()

template<class Scalar>
template<class Vector>

void Opm::TridiagonalMatrix< Scalar >::mtv | ( | const Vector & | source,
|  | Vector & | dest ) const

inline

Transposed matrix-vector product.

This means that

is equivalent to

## mv()

template<class Scalar>
template<class Vector>

void Opm::TridiagonalMatrix< Scalar >::mv | ( | const Vector & | source,
|  | Vector & | dest ) const

inline

Matrix-vector product.

This means that

is equivalent to

## solve()

template<class Scalar>
template<class XVector, class BVector>

void Opm::TridiagonalMatrix< Scalar >::solve | ( | XVector & | x,
|  | const BVector & | b ) const

inline

Calculate the solution for a linear system of equations.

i.e., calculate x, so that it solves Ax = b, where A is a tridiagonal matrix.

## umtv()

template<class Scalar>
template<class Vector>

void Opm::TridiagonalMatrix< Scalar >::umtv | ( | const Vector & | source,
|  | Vector & | dest ) const

inline

Transposed additive matrix-vector product.

This means that

is equivalent to

## umv()

template<class Scalar>
template<class Vector>

void Opm::TridiagonalMatrix< Scalar >::umv | ( | const Vector & | source,
|  | Vector & | dest ) const

inline

Additive matrix-vector product.

This means that

is equivalent to

## usmtv()

template<class Scalar>
template<class Vector>

void Opm::TridiagonalMatrix< Scalar >::usmtv | ( | Scalar | alpha,
|  | const Vector & | source,
|  | Vector & | dest ) const

inline

Transposed scaled additive matrix-vector product.

This means that

is equivalent to

## usmv()

template<class Scalar>
template<class Vector>

void Opm::TridiagonalMatrix< Scalar >::usmv | ( | Scalar | alpha,
|  | const Vector & | source,
|  | Vector & | dest ) const

inline

Scaled additive matrix-vector product.

This means that

is equivalent to

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

- opm/material/common/TridiagonalMatrix.hpp
- opm/material/common/TridiagonalMatrix.cpp