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>

List of all members.

Classes

struct  TridiagRow_

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.
TridiagonalMatrixoperator= (const TridiagonalMatrix &source)
 Assignment operator from another tridiagonal matrix.
TridiagonalMatrixoperator= (Scalar value)
 Assignment operator from a Scalar.
iterator begin ()
 Iterator for the first row
const_iterator begin () const
 Const iterator for the first row
const_iterator end () const
 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.
TridiagonalMatrixoperator*= (Scalar alpha)
 Multiplication with a Scalar.
TridiagonalMatrixoperator/= (Scalar alpha)
 Division by a Scalar.
TridiagonalMatrixoperator-= (const TridiagonalMatrix &other)
 Subtraction operator.
TridiagonalMatrixoperator+= (const TridiagonalMatrix &other)
 Addition operator.
TridiagonalMatrixaxpy (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=std::cout) 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

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

 A.axpy(alpha, B)

is equivalent to

 A += alpha*C
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.

template<class Scalar >
Scalar Opm::TridiagonalMatrix< Scalar >::frobeniusNormSquared (  )  const [inline]

Calculate the squared frobenius norm.

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

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.

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

 A.mmtv(x, y)

is equivalent to

 y -= A^T*x
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

 A.mmv(x, y)

is equivalent to

 y -= A*x
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

 A.mtv(x, y)

is equivalent to

 y = A^T*x
template<class Scalar >
template<class Vector >
void Opm::TridiagonalMatrix< Scalar >::mv ( const Vector &  source,
Vector &  dest 
) const [inline]

Matrix-vector product.

This means that

 A.mv(x, y)

is equivalent to

 y = A*x
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.

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

 A.umtv(x, y)

is equivalent to

 y += A^T*x
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

 A.umv(x, y)

is equivalent to

 y += A*x
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

 A.umtv(alpha, x, y)

is equivalent to

 y += alpha*A^T*x
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

 A.usmv(x, y)

is equivalent to

 y += alpha*(A*x)

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

Generated on 25 Mar 2018 by  doxygen 1.6.1