Loading...
Searching...
No Matches
Dune::DiagonalMatrix< K, n > Class Template Reference
Common » Dense Matrix and Vector Template Library

A diagonal matrix of static size. More...

`#include <dune/common/diagonalmatrix.hh>`

## Public Types

typedef K | value_type
| export the type representing the field
typedef value_type | field_type
typedef K | block_type
| export the type representing the components
typedef std::size_t | size_type
| The type used for the index access and size operations.
typedef DiagonalRowVector< K, n > | row_type
| Each row is implemented by a field vector.
typedef row_type | reference
typedef row_type | row_reference
typedef DiagonalRowVectorConst< K, n > | const_row_type
typedef const_row_type | const_reference
typedef const_row_type | const_row_reference
typedef ContainerWrapperIterator< const WrapperType, reference, reference > | Iterator
| Iterator class for sequential access.
typedef Iterator | iterator
| typedef for stl compliant access
typedef Iterator | RowIterator
| rename the iterators for easier access
typedef row_type::Iterator | ColIterator
| rename the iterators for easier access
typedef ContainerWrapperIterator< const WrapperType, const_reference, const_reference > | ConstIterator
| Iterator class for sequential access.
typedef ConstIterator | const_iterator
| typedef for stl compliant access
typedef ConstIterator | ConstRowIterator
| rename the iterators for easier access
typedef const_row_type::ConstIterator | ConstColIterator
| rename the iterators for easier access

## Public Member Functions

constexpr | DiagonalMatrix ()=default
| Default constructor.
| DiagonalMatrix (const K &k)
| Constructor initializing the whole matrix with a scalar.
| DiagonalMatrix (const FieldVector< K, n > &diag)
| Constructor initializing the diagonal with a vector.
| DiagonalMatrix (std::initializer_list< K > const &l)
| Construct diagonal matrix from an initializer list.
template<class OtherK>
| DiagonalMatrix (const DiagonalMatrix< OtherK, n > &other)
| Converting constructor.
DiagonalMatrix & | operator= (const K &k)
| Assignment from a scalar.
template<class OtherK>
DiagonalMatrix & | operator= (const DiagonalMatrix< OtherK, n > &other)
| Converting assignment operator.
bool | identical (const DiagonalMatrix< K, n > &other) const
| Check if matrix is the same object as the other matrix.
DiagonalMatrix< K, n > | transposed () const
| Return transposed of the matrix as DiagonalMatrix.
Iterator | begin ()
| begin iterator
Iterator | end ()
| end iterator
Iterator | beforeEnd ()
Iterator | beforeBegin ()
ConstIterator | begin () const
| begin iterator
ConstIterator | end () const
| end iterator
ConstIterator | beforeEnd () const
ConstIterator | beforeBegin () const
DiagonalMatrix & | operator+= (const DiagonalMatrix &y)
| vector space addition
DiagonalMatrix & | operator-= (const DiagonalMatrix &y)
| vector space subtraction
DiagonalMatrix & | operator+= (const K &k)
| vector space multiplication with scalar
DiagonalMatrix & | operator-= (const K &k)
| vector space division by scalar
DiagonalMatrix & | operator*= (const K &k)
| vector space multiplication with scalar
DiagonalMatrix & | operator/= (const K &k)
| vector space division by scalar
bool | operator== (const DiagonalMatrix &other) const
| comparison operator
bool | operator!= (const DiagonalMatrix &other) const
| incomparison operator
template<class X, class Y>
void | mv (const X &x, Y &y) const
| y = A x
template<class X, class Y>
void | mtv (const X &x, Y &y) const
| y = A^T x
template<class X, class Y>
void | umv (const X &x, Y &y) const
| y += A x
template<class X, class Y>
void | umtv (const X &x, Y &y) const
| y += A^T x
template<class X, class Y>
void | umhv (const X &x, Y &y) const
| y += A^H x
template<class X, class Y>
void | mmv (const X &x, Y &y) const
| y -= A x
template<class X, class Y>
void | mmtv (const X &x, Y &y) const
| y -= A^T x
template<class X, class Y>
void | mmhv (const X &x, Y &y) const
| y -= A^H x
template<class X, class Y>
void | usmv (const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
| y += alpha A x
template<class X, class Y>
void | usmtv (const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
| y += alpha A^T x
template<class X, class Y>
void | usmhv (const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
| y += alpha A^H x
double | frobenius_norm () const
| frobenius norm: sqrt(sum over squared values of entries)
double | frobenius_norm2 () const
| square of frobenius norm, need for block recursion
double | infinity_norm () const
| infinity norm (row sum norm, how to generalize for blocks?)
double | infinity_norm_real () const
| simplified infinity norm (uses Manhattan norm for complex values)
template<class V>
void | solve (V &x, const V &b) const
| Solve system A x = b.
void | invert ()
| Compute inverse.
K | determinant () const
| calculates the determinant of this matrix
bool | exists (size_type i, size_type j) const
| return true when (i,j) is in pattern
reference | operator[] (size_type i)
| Return reference object as row replacement.
const_reference | operator[] (size_type i) const
| Return const_reference object as row replacement.
const K & | diagonal (size_type i) const
| Get const reference to diagonal entry.
K & | diagonal (size_type i)
| Get reference to diagonal entry.
const FieldVector< K, n > & | diagonal () const
| Get const reference to diagonal vector.
FieldVector< K, n > & | diagonal ()
| Get reference to diagonal vector.

## Static Public Member Functions

static constexpr size_type | size ()
static constexpr size_type | N ()
| number of blocks in row direction
static constexpr size_type | M ()
| number of blocks in column direction

## Static Public Attributes

static constexpr int | blocklevel = 1
| The number of block levels we contain. This is the leaf, that is, 1.
static constexpr int | rows = n
| The number of rows.
static constexpr int | cols = n
| The number of columns.

## Friends

template<class, int>
class | DiagonalMatrix
template<class OtherScalar>
auto | operator* (const DiagonalMatrix &matrixA, const DiagonalMatrix< OtherScalar, n > &matrixB)
| Matrix-matrix multiplication.
template<class OtherMatrix, std::enable_if_t<(Impl::IsDenseMatrix< OtherMatrix >::value), int > = 0, std::enable_if_t<(not Impl::IsFieldMatrix< OtherMatrix >::value), int > = 0>
auto | operator* (const DiagonalMatrix &matrixA, const OtherMatrix &matrixB)
| Multiply a diagonal matrix with a dense matrix.
std::ostream & | operator<< (std::ostream &s, const DiagonalMatrix< K, n > &a)
| Sends the matrix to an output stream.

## Detailed Description

template<class K, int n>
class Dune::DiagonalMatrix< K, n >

A diagonal matrix of static size.

This is meant to be a replacement of FieldMatrix for the case that it is a diagonal matrix.

Template Parameters

  K | Type used for scalars
  n | Matrix size

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

- diagonalmatrix.hh