Dune Core Modules (2.4.2)

A generic dynamic dense matrix. More...

#include <dune/istl/matrix.hh>

Public Types

enum  { blocklevel = T::blocklevel+1 }
 
typedef T::field_type field_type
 Export the type representing the underlying field.
 
typedef T block_type
 Export the type representing the components.
 
typedef A allocator_type
 Export the allocator.
 
typedef VariableBlockVector< T, A >::window_type row_type
 The type implementing a matrix row.
 
typedef A::size_type size_type
 Type for indices and sizes.
 
typedef VariableBlockVector< T, A >::Iterator RowIterator
 Iterator over the matrix rows.
 
typedef row_type::iterator ColIterator
 Iterator for the entries of each row.
 
typedef VariableBlockVector< T, A >::ConstIterator ConstRowIterator
 Const iterator over the matrix rows.
 
typedef row_type::const_iterator ConstColIterator
 Const iterator for the entries of each row.
 

Public Member Functions

 Matrix ()
 Create empty matrix.
 
 Matrix (size_type rows, size_type cols)
 Create uninitialized matrix of size rows x cols.
 
void setSize (size_type rows, size_type cols)
 Change the matrix size. More...
 
RowIterator begin ()
 Get iterator to first row.
 
RowIterator end ()
 Get iterator to one beyond last row.
 
RowIterator beforeEnd ()
 
RowIterator beforeBegin ()
 
ConstRowIterator begin () const
 Get const iterator to first row.
 
ConstRowIterator end () const
 Get const iterator to one beyond last row.
 
ConstRowIterator beforeEnd () const
 
ConstRowIterator beforeBegin () const
 
Matrixoperator= (const field_type &t)
 Assignment from scalar.
 
row_typeoperator[] (size_type row)
 The index operator.
 
const row_typeoperator[] (size_type row) const
 The const index operator.
 
size_type N () const
 Return the number of rows.
 
size_type M () const
 Return the number of columns.
 
size_type rowdim () const
 The number of scalar rows.
 
size_type coldim () const
 The number of scalar columns.
 
size_type rowdim (size_type r) const
 The number of scalar rows.
 
size_type coldim (size_type c) const
 The number of scalar columns.
 
Matrix< T > & operator*= (const field_type &scalar)
 Multiplication with a scalar.
 
Matrix< T > & operator/= (const field_type &scalar)
 Multiplication with a scalar.
 
Matrixoperator+= (const Matrix &b)
 Add the entries of another matrix to this one. More...
 
Matrixoperator-= (const Matrix &b)
 Subtract the entries of another matrix from this one. More...
 
Matrix transpose () const
 Return the transpose of the matrix.
 
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 mmv (const X &x, Y &y) const
 y -= A x
 
template<class X , class Y >
void usmv (const field_type &alpha, const X &x, Y &y) const
 \( y += \alpha 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 mmtv (const X &x, Y &y) const
 y -= A^T x
 
template<class X , class Y >
void usmtv (const field_type &alpha, const X &x, Y &y) const
 y += alpha 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 mmhv (const X &x, Y &y) const
 y -= A^H x
 
template<class X , class Y >
void usmhv (const field_type &alpha, const X &x, Y &y) const
 y += alpha A^H x
 
FieldTraits< field_type >::real_type frobenius_norm () const
 frobenius norm: sqrt(sum over squared values of entries)
 
FieldTraits< field_type >::real_type frobenius_norm2 () const
 square of frobenius norm, need for block recursion
 
FieldTraits< field_type >::real_type infinity_norm () const
 infinity norm (row sum norm, how to generalize for blocks?)
 
FieldTraits< field_type >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values)
 
bool exists (size_type i, size_type j) const
 return true if (i,j) is in pattern
 

Protected Attributes

VariableBlockVector< T, A > data_
 Abuse VariableBlockVector as an engine for a 2d array ISTL-style. More...
 
size_type cols_
 Number of columns of the matrix. More...
 

Detailed Description

template<class T, class A = std::allocator<T>>
class Dune::Matrix< T, A >

A generic dynamic dense matrix.

Member Enumeration Documentation

◆ anonymous enum

template<class T , class A = std::allocator<T>>
anonymous enum
Enumerator
blocklevel 

The number of nesting levels the matrix contains.

Member Function Documentation

◆ beforeBegin() [1/2]

template<class T , class A = std::allocator<T>>
RowIterator Dune::Matrix< T, A >::beforeBegin ( )
inline
Returns
an iterator that is positioned before the first row of the matrix.

References Dune::Matrix< T, A >::data_.

◆ beforeBegin() [2/2]

template<class T , class A = std::allocator<T>>
ConstRowIterator Dune::Matrix< T, A >::beforeBegin ( ) const
inline
Returns
an iterator that is positioned before the first row if the matrix.

References Dune::Matrix< T, A >::data_.

◆ beforeEnd() [1/2]

template<class T , class A = std::allocator<T>>
RowIterator Dune::Matrix< T, A >::beforeEnd ( )
inline
Returns
an iterator that is positioned before the end iterator of the rows, i.e. at the last row.

References Dune::Matrix< T, A >::data_.

◆ beforeEnd() [2/2]

template<class T , class A = std::allocator<T>>
ConstRowIterator Dune::Matrix< T, A >::beforeEnd ( ) const
inline
Returns
an iterator that is positioned before the end iterator of the rows. i.e. at the last row.

References Dune::Matrix< T, A >::data_.

◆ operator+=()

template<class T , class A = std::allocator<T>>
Matrix& Dune::Matrix< T, A >::operator+= ( const Matrix< T, A > &  b)
inline

Add the entries of another matrix to this one.

Parameters
bThe matrix to add to this one. Its size has to be the same as the size of this matrix.

References Dune::Matrix< T, A >::data_, DUNE_THROW, Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().

◆ operator-=()

template<class T , class A = std::allocator<T>>
Matrix& Dune::Matrix< T, A >::operator-= ( const Matrix< T, A > &  b)
inline

Subtract the entries of another matrix from this one.

Parameters
bThe matrix to add to this one. Its size has to be the same as the size of this matrix.

References Dune::Matrix< T, A >::data_, DUNE_THROW, Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().

◆ setSize()

template<class T , class A = std::allocator<T>>
void Dune::Matrix< T, A >::setSize ( size_type  rows,
size_type  cols 
)
inline

Change the matrix size.

The way the data is handled is unpredictable.

References Dune::Matrix< T, A >::cols_, and Dune::Matrix< T, A >::data_.

Member Data Documentation

◆ cols_

template<class T , class A = std::allocator<T>>
size_type Dune::Matrix< T, A >::cols_
protected

Number of columns of the matrix.

In general you can extract the same information from the data_ member. However if you want to be able to properly handle 0xn matrices then you need a separate member.

Referenced by Dune::Matrix< T, A >::M(), Dune::Matrix< T, A >::mv(), Dune::Matrix< T, A >::setSize(), Dune::Matrix< T, A >::umv(), and Dune::Matrix< T, A >::usmv().

◆ data_


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Feb 21, 23:30, 2024)