dune-common 2.1.1
Public Types | Public Member Functions
Dune::DenseMatrix< MAT > Class Template Reference

A dense n x m matrix. More...

#include <dune/common/densematrix.hh>

Inheritance diagram for Dune::DenseMatrix< MAT >:
Inheritance graph

List of all members.

Public Types

enum  { blocklevel = 1 }
 We are at the leaf of the block recursion. More...
typedef Traits::derived_type derived_type
 type of derived matrix class
typedef Traits::value_type value_type
 export the type representing the field
typedef Traits::value_type field_type
 export the type representing the field
typedef Traits::value_type block_type
 export the type representing the components
typedef Traits::size_type size_type
 The type used for the index access and size operation.
typedef Traits::row_type row_type
 The type used to represent a row (must fulfill the Dune::DenseVector interface)
typedef DenseIterator
< DenseMatrix, row_type
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 DenseIterator< const
DenseMatrix, const row_type
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 row_type::ConstIterator ConstColIterator
 rename the iterators for easier access

Public Member Functions

row_typeoperator[] (size_type i)
 random access
const row_typeoperator[] (size_type i) const
size_type size () const
 size method (number of rows)
Iterator begin ()
 begin iterator
Iterator end ()
 end iterator
Iterator rbegin ()
Iterator beforeEnd ()
Iterator rend ()
Iterator beforeBegin ()
ConstIterator begin () const
 begin iterator
ConstIterator end () const
 end iterator
ConstIterator rbegin () const
ConstIterator beforeEnd () const
ConstIterator rend () const
ConstIterator beforeBegin () const
DenseMatrixoperator= (const field_type &f)
template<typename T >
DenseMatrixoperator= (const T &t)
DenseMatrixoperator+= (const DenseMatrix &y)
 vector space addition
DenseMatrixoperator-= (const DenseMatrix &y)
 vector space subtraction
DenseMatrixoperator*= (const field_type &k)
 vector space multiplication with scalar
DenseMatrixoperator/= (const field_type &k)
 vector space division by scalar
DenseMatrixaxpy (const field_type &k, const DenseMatrix &y)
 vector space axpy operation (*this += k y)
bool operator== (const DenseMatrix &y) const
 Binary matrix comparison.
bool operator!= (const DenseMatrix &y) const
 Binary matrix incomparison.
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 field_type &alpha, const X &x, Y &y) const
 y += alpha A 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 usmhv (const field_type &alpha, const X &x, Y &y) const
 y += alpha A^H x
FieldTraits< value_type >
::real_type 
frobenius_norm () const
 frobenius norm: sqrt(sum over squared values of entries)
FieldTraits< value_type >
::real_type 
frobenius_norm2 () const
 square of frobenius norm, need for block recursion
FieldTraits< value_type >
::real_type 
infinity_norm () const
 infinity norm (row sum norm, how to generalize for blocks?)
FieldTraits< value_type >
::real_type 
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.
field_type determinant () const
 calculates the determinant of this matrix
template<typename M2 >
MAT & leftmultiply (const DenseMatrix< M2 > &M)
 Multiplies M from the left to this matrix.
template<typename M2 >
MAT & rightmultiply (const DenseMatrix< M2 > &M)
 Multiplies M from the right to this matrix.
size_type N () const
 number of rows
size_type M () const
 number of columns
size_type rows () const
 number of rows
size_type cols () const
 number of columns
bool exists (size_type i, size_type j) const
 return true when (i,j) is in pattern

Detailed Description

template<typename MAT>
class Dune::DenseMatrix< MAT >

A dense n x m matrix.

Matrices represent linear maps from a vector space V to a vector space W. This class represents such a linear map by storing a two-dimensional array of numbers of a given field type K. The number of rows and columns is given at compile time.

Template Parameters:
MATtype of the matrix implementation

Member Typedef Documentation

template<typename MAT>
typedef Traits::value_type Dune::DenseMatrix< MAT >::block_type

export the type representing the components

template<typename MAT>
typedef row_type::Iterator Dune::DenseMatrix< MAT >::ColIterator

rename the iterators for easier access

template<typename MAT>
typedef ConstIterator Dune::DenseMatrix< MAT >::const_iterator

typedef for stl compliant access

template<typename MAT>
typedef row_type::ConstIterator Dune::DenseMatrix< MAT >::ConstColIterator

rename the iterators for easier access

template<typename MAT>
typedef DenseIterator<const DenseMatrix,const row_type> Dune::DenseMatrix< MAT >::ConstIterator

Iterator class for sequential access.

template<typename MAT>
typedef ConstIterator Dune::DenseMatrix< MAT >::ConstRowIterator

rename the iterators for easier access

template<typename MAT>
typedef Traits::derived_type Dune::DenseMatrix< MAT >::derived_type

type of derived matrix class

template<typename MAT>
typedef Traits::value_type Dune::DenseMatrix< MAT >::field_type

export the type representing the field

template<typename MAT>
typedef Iterator Dune::DenseMatrix< MAT >::iterator

typedef for stl compliant access

template<typename MAT>
typedef DenseIterator<DenseMatrix,row_type> Dune::DenseMatrix< MAT >::Iterator

Iterator class for sequential access.

template<typename MAT>
typedef Traits::row_type Dune::DenseMatrix< MAT >::row_type

The type used to represent a row (must fulfill the Dune::DenseVector interface)

Reimplemented in Dune::DynamicMatrix< K >, Dune::FieldMatrix< K, ROWS, COLS >, and Dune::FieldMatrix< T, n, m >.

template<typename MAT>
typedef Iterator Dune::DenseMatrix< MAT >::RowIterator

rename the iterators for easier access

template<typename MAT>
typedef Traits::size_type Dune::DenseMatrix< MAT >::size_type

The type used for the index access and size operation.

Reimplemented in Dune::DynamicMatrix< K >, Dune::FieldMatrix< K, ROWS, COLS >, and Dune::FieldMatrix< T, n, m >.

template<typename MAT>
typedef Traits::value_type Dune::DenseMatrix< MAT >::value_type

export the type representing the field

Reimplemented in Dune::DynamicMatrix< K >.


Member Enumeration Documentation

template<typename MAT>
anonymous enum

We are at the leaf of the block recursion.

Enumerator:
blocklevel 

The number of block levels we contain. This is 1.


Member Function Documentation

template<typename MAT>
DenseMatrix& Dune::DenseMatrix< MAT >::axpy ( const field_type k,
const DenseMatrix< MAT > &  y 
) [inline]

vector space axpy operation (*this += k y)

Referenced by Dune::DenseMatrix< DynamicMatrix< K > >::axpy().

template<typename MAT>
Iterator Dune::DenseMatrix< MAT >::beforeBegin ( ) [inline]
Returns:
an iterator that is positioned before the first entry of the vector.

Referenced by Dune::DenseMatrix< DynamicMatrix< K > >::rbegin(), and Dune::DenseMatrix< DynamicMatrix< K > >::rend().

template<typename MAT>
ConstIterator Dune::DenseMatrix< MAT >::beforeBegin ( ) const [inline]
Returns:
an iterator that is positioned before the first entry of the vector.
template<typename MAT>
Iterator Dune::DenseMatrix< MAT >::beforeEnd ( ) [inline]
Returns:
an iterator that is positioned before the end iterator of the vector, i.e. at the last entry.

Referenced by Dune::DenseMatrix< DynamicMatrix< K > >::rbegin().

template<typename MAT>
ConstIterator Dune::DenseMatrix< MAT >::beforeEnd ( ) const [inline]
Returns:
an iterator that is positioned before the end iterator of the vector. i.e. at the last element
template<typename MAT>
ConstIterator Dune::DenseMatrix< MAT >::begin ( ) const [inline]

begin iterator

template<typename MAT>
Iterator Dune::DenseMatrix< MAT >::begin ( ) [inline]

begin iterator

template<typename MAT>
size_type Dune::DenseMatrix< MAT >::cols ( ) const [inline]
template<typename MAT>
field_type Dune::DenseMatrix< MAT >::determinant ( ) const

calculates the determinant of this matrix

template<typename MAT>
Iterator Dune::DenseMatrix< MAT >::end ( ) [inline]

end iterator

template<typename MAT>
ConstIterator Dune::DenseMatrix< MAT >::end ( ) const [inline]

end iterator

template<typename MAT>
bool Dune::DenseMatrix< MAT >::exists ( size_type  i,
size_type  j 
) const [inline]

return true when (i,j) is in pattern

template<typename MAT>
FieldTraits<value_type>::real_type Dune::DenseMatrix< MAT >::frobenius_norm ( ) const [inline]

frobenius norm: sqrt(sum over squared values of entries)

template<typename MAT>
FieldTraits<value_type>::real_type Dune::DenseMatrix< MAT >::frobenius_norm2 ( ) const [inline]

square of frobenius norm, need for block recursion

template<typename MAT>
FieldTraits<value_type>::real_type Dune::DenseMatrix< MAT >::infinity_norm ( ) const [inline]

infinity norm (row sum norm, how to generalize for blocks?)

template<typename MAT>
FieldTraits<value_type>::real_type Dune::DenseMatrix< MAT >::infinity_norm_real ( ) const [inline]

simplified infinity norm (uses Manhattan norm for complex values)

template<typename MAT>
void Dune::DenseMatrix< MAT >::invert ( )

Compute inverse.

Exceptions:
FMatrixErrorif the matrix is singular
template<typename MAT>
template<typename M2 >
MAT& Dune::DenseMatrix< MAT >::leftmultiply ( const DenseMatrix< M2 > &  M) [inline]

Multiplies M from the left to this matrix.

template<typename MAT>
size_type Dune::DenseMatrix< MAT >::M ( ) const [inline]
template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::mmhv ( const X &  x,
Y &  y 
) const [inline]

y -= A^H x

template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::mmtv ( const X &  x,
Y &  y 
) const [inline]

y -= A^T x

template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::mmv ( const X &  x,
Y &  y 
) const [inline]

y -= A x

template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::mtv ( const X &  x,
Y &  y 
) const [inline]

y = A^T x

template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::mv ( const X &  x,
Y &  y 
) const [inline]

y = A x

template<typename MAT>
size_type Dune::DenseMatrix< MAT >::N ( ) const [inline]
template<typename MAT>
bool Dune::DenseMatrix< MAT >::operator!= ( const DenseMatrix< MAT > &  y) const [inline]

Binary matrix incomparison.

template<typename MAT>
DenseMatrix& Dune::DenseMatrix< MAT >::operator*= ( const field_type k) [inline]

vector space multiplication with scalar

template<typename MAT>
DenseMatrix& Dune::DenseMatrix< MAT >::operator+= ( const DenseMatrix< MAT > &  y) [inline]

vector space addition

template<typename MAT>
DenseMatrix& Dune::DenseMatrix< MAT >::operator-= ( const DenseMatrix< MAT > &  y) [inline]

vector space subtraction

template<typename MAT>
DenseMatrix& Dune::DenseMatrix< MAT >::operator/= ( const field_type k) [inline]

vector space division by scalar

template<typename MAT>
DenseMatrix& Dune::DenseMatrix< MAT >::operator= ( const field_type f) [inline]
template<typename MAT>
template<typename T >
DenseMatrix& Dune::DenseMatrix< MAT >::operator= ( const T &  t) [inline]
template<typename MAT>
bool Dune::DenseMatrix< MAT >::operator== ( const DenseMatrix< MAT > &  y) const [inline]

Binary matrix comparison.

Referenced by Dune::DenseMatrix< DynamicMatrix< K > >::operator!=().

template<typename MAT>
const row_type& Dune::DenseMatrix< MAT >::operator[] ( size_type  i) const [inline]
template<typename MAT>
row_type& Dune::DenseMatrix< MAT >::operator[] ( size_type  i) [inline]

random access

template<typename MAT>
ConstIterator Dune::DenseMatrix< MAT >::rbegin ( ) const [inline]
Deprecated:
This method was renamed to make it distinct from the STL version which returns a reverse iterator. Use the new method beforeEnd instead.
Deprecated:
template<typename MAT>
Iterator Dune::DenseMatrix< MAT >::rbegin ( ) [inline]
Deprecated:
This method was renamed to make it distinct from the STL version which returns a reverse iterator. Use the new method beforeEnd instead.
Deprecated:
template<typename MAT>
Iterator Dune::DenseMatrix< MAT >::rend ( ) [inline]
Deprecated:
This method was renamed to make it distinct from the STL version which returns a reverse iterator. Use the new method beforeBegin instead.
Deprecated:
template<typename MAT>
ConstIterator Dune::DenseMatrix< MAT >::rend ( ) const [inline]
Deprecated:
This method was renamed to make it distinct from the STL version which returns a reverse iterator. Use the new method beforeBegin instead.
Deprecated:
template<typename MAT>
template<typename M2 >
MAT& Dune::DenseMatrix< MAT >::rightmultiply ( const DenseMatrix< M2 > &  M) [inline]

Multiplies M from the right to this matrix.

template<typename MAT>
size_type Dune::DenseMatrix< MAT >::rows ( ) const [inline]

number of rows

Referenced by Dune::DenseMatrix< DynamicMatrix< K > >::axpy(), Dune::DenseMatrix< DynamicMatrix< K > >::beforeEnd(), Dune::DenseMatrix< DynamicMatrix< K > >::end(), Dune::DenseMatrix< DynamicMatrix< K > >::exists(), Dune::DenseMatrix< DynamicMatrix< K > >::frobenius_norm(), Dune::DenseMatrix< DynamicMatrix< K > >::frobenius_norm2(), Dune::DenseMatrix< DynamicMatrix< K > >::infinity_norm(), Dune::DenseMatrix< DynamicMatrix< K > >::infinity_norm_real(), Dune::DenseMatrix< DynamicMatrix< K > >::leftmultiply(), Dune::DenseMatrix< DynamicMatrix< K > >::mmhv(), Dune::DenseMatrix< DynamicMatrix< K > >::mmtv(), Dune::DenseMatrix< DynamicMatrix< K > >::mmv(), Dune::DenseMatrix< DynamicMatrix< K > >::mtv(), Dune::DenseMatrixHelp::multAssign(), Dune::DenseMatrix< DynamicMatrix< K > >::mv(), Dune::DenseMatrix< DynamicMatrix< K > >::N(), Dune::DenseMatrix< DynamicMatrix< K > >::operator*=(), Dune::DenseMatrix< DynamicMatrix< K > >::operator+=(), Dune::DenseMatrix< DynamicMatrix< K > >::operator-=(), Dune::DenseMatrix< DynamicMatrix< K > >::operator/=(), Dune::DenseMatrix< DynamicMatrix< K > >::operator=(), Dune::DenseMatrix< DynamicMatrix< K > >::operator==(), Dune::DenseMatrix< DynamicMatrix< K > >::rightmultiply(), Dune::DenseMatrix< DynamicMatrix< K > >::size(), Dune::DenseMatrix< DynamicMatrix< K > >::umhv(), Dune::DenseMatrix< DynamicMatrix< K > >::umtv(), Dune::DenseMatrix< DynamicMatrix< K > >::umv(), Dune::DenseMatrix< DynamicMatrix< K > >::usmhv(), Dune::DenseMatrix< DynamicMatrix< K > >::usmtv(), and Dune::DenseMatrix< DynamicMatrix< K > >::usmv().

template<typename MAT>
size_type Dune::DenseMatrix< MAT >::size ( ) const [inline]

size method (number of rows)

template<typename MAT>
template<class V >
void Dune::DenseMatrix< MAT >::solve ( V &  x,
const V &  b 
) const

Solve system A x = b.

Exceptions:
FMatrixErrorif the matrix is singular
template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::umhv ( const X &  x,
Y &  y 
) const [inline]

y += A^H x

template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::umtv ( const X &  x,
Y &  y 
) const [inline]

y += A^T x

template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::umv ( const X &  x,
Y &  y 
) const [inline]

y += A x

template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::usmhv ( const field_type alpha,
const X &  x,
Y &  y 
) const [inline]

y += alpha A^H x

template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::usmtv ( const field_type alpha,
const X &  x,
Y &  y 
) const [inline]

y += alpha A^T x

template<typename MAT>
template<class X , class Y >
void Dune::DenseMatrix< MAT >::usmv ( const field_type alpha,
const X &  x,
Y &  y 
) const [inline]

y += alpha A x


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