Dune::FieldMatrix< K, ROWS, COLS > Class Template Reference
[Dense Matrix and Vector Template Library]

A dense n x m matrix. More...

#include <dune/common/fmatrix.hh>

Inheritance diagram for Dune::FieldMatrix< K, ROWS, COLS >:
Inheritance graph

List of all members.

Public Types

enum  { blocklevel = 1 }
 

We are at the leaf of the block recursion.

More...
enum  { rows = ROWS, cols = COLS }
 

export size

More...
typedef K field_type
 export the type representing the field
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 FieldVector< K, cols > row_type
 Each row is implemented by a field vector.
typedef FieldIterator
< FieldMatrix< K, rows, cols >
, 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 FieldIterator< const
FieldMatrix< K, rows, cols >
, 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

 FieldMatrix ()
 Default constructor.
 FieldMatrix (const K &k)
 Constructor initializing the whole matrix with a scalar.
template<typename T >
 FieldMatrix (const T &t)
row_typeoperator[] (size_type i)
 random access to the rows
const row_typeoperator[] (size_type i) const
 same for read only access
Iterator begin ()
 begin iterator
Iterator end ()
 end iterator
Iterator rbegin ()
 begin iterator
Iterator rend ()
 end iterator
ConstIterator begin () const
 begin iterator
ConstIterator end () const
 end iterator
ConstIterator rbegin () const
 begin iterator
ConstIterator rend () const
 end iterator
FieldMatrixoperator= (const K &k)
template<typename T >
FieldMatrixoperator= (const T &t)
FieldMatrixoperator+= (const FieldMatrix &y)
 vector space addition
FieldMatrixoperator-= (const FieldMatrix &y)
 vector space subtraction
FieldMatrixoperator*= (const K &k)
 vector space multiplication with scalar
FieldMatrixoperator/= (const K &k)
 vector space division by scalar
FieldMatrixaxpy (const K &k, const FieldMatrix &y)
 vector space axpy operation (*this += k y)
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 K &alpha, const X &x, Y &y) const
 y += alpha A x
template<class X , class Y >
void usmtv (const K &alpha, const X &x, Y &y) const
 y += alpha A^T x
template<class X , class Y >
void usmhv (const K &alpha, const X &x, Y &y) const
 y += alpha A^H x
FieldTraits< K >::real_type frobenius_norm () const
 frobenius norm: sqrt(sum over squared values of entries)
FieldTraits< K >::real_type frobenius_norm2 () const
 square of frobenius norm, need for block recursion
FieldTraits< K >::real_type infinity_norm () const
 infinity norm (row sum norm, how to generalize for blocks?)
FieldTraits< K >::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.
determinant () const
 calculates the determinant of this matrix
FieldMatrixleftmultiply (const FieldMatrix< K, rows, rows > &M)
 Multiplies M from the left to this matrix.
template<int l>
FieldMatrix< K, l, cols > leftmultiplyany (const FieldMatrix< K, l, rows > &M) const
 Multiplies M from the left to this matrix, this matrix is not modified.
FieldMatrixrightmultiply (const FieldMatrix< K, cols, cols > &M)
 Multiplies M from the right to this matrix.
template<int l>
FieldMatrix< K, rows, l > rightmultiplyany (const FieldMatrix< K, cols, l > &M) const
 Multiplies M from the right to this matrix, this matrix is not modified.
size_type N () const
 number of blocks in row direction
size_type M () const
 number of blocks in column direction
bool exists (size_type i, size_type j) const
 return true when (i,j) is in pattern

Friends

std::ostream & operator<< (std::ostream &s, const FieldMatrix< K, rows, cols > &a)
 Sends the matrix to an output stream.

Detailed Description

template<class K, int ROWS, int COLS>
class Dune::FieldMatrix< K, ROWS, COLS >

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.


Member Typedef Documentation

template<class K, int ROWS, int COLS>
typedef K Dune::FieldMatrix< K, ROWS, COLS >::block_type

export the type representing the components

template<class K, int ROWS, int COLS>
typedef row_type::Iterator Dune::FieldMatrix< K, ROWS, COLS >::ColIterator

rename the iterators for easier access

template<class K, int ROWS, int COLS>
typedef ConstIterator Dune::FieldMatrix< K, ROWS, COLS >::const_iterator

typedef for stl compliant access

template<class K, int ROWS, int COLS>
typedef row_type::ConstIterator Dune::FieldMatrix< K, ROWS, COLS >::ConstColIterator

rename the iterators for easier access

template<class K, int ROWS, int COLS>
typedef FieldIterator<const FieldMatrix<K,rows,cols>,const row_type> Dune::FieldMatrix< K, ROWS, COLS >::ConstIterator

Iterator class for sequential access.

template<class K, int ROWS, int COLS>
typedef ConstIterator Dune::FieldMatrix< K, ROWS, COLS >::ConstRowIterator

rename the iterators for easier access

template<class K, int ROWS, int COLS>
typedef K Dune::FieldMatrix< K, ROWS, COLS >::field_type

export the type representing the field

template<class K, int ROWS, int COLS>
typedef Iterator Dune::FieldMatrix< K, ROWS, COLS >::iterator

typedef for stl compliant access

template<class K, int ROWS, int COLS>
typedef FieldIterator<FieldMatrix<K,rows,cols>,row_type> Dune::FieldMatrix< K, ROWS, COLS >::Iterator

Iterator class for sequential access.

template<class K, int ROWS, int COLS>
typedef FieldVector<K,cols> Dune::FieldMatrix< K, ROWS, COLS >::row_type

Each row is implemented by a field vector.

template<class K, int ROWS, int COLS>
typedef Iterator Dune::FieldMatrix< K, ROWS, COLS >::RowIterator

rename the iterators for easier access

template<class K, int ROWS, int COLS>
typedef std::size_t Dune::FieldMatrix< K, ROWS, COLS >::size_type

The type used for the index access and size operations.


Member Enumeration Documentation

template<class K, int ROWS, int COLS>
anonymous enum

We are at the leaf of the block recursion.

Enumerator:
blocklevel 

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

template<class K, int ROWS, int COLS>
anonymous enum

export size

Enumerator:
rows 

The number of rows.

cols 

The number of columns.


Constructor & Destructor Documentation

template<class K, int ROWS, int COLS>
Dune::FieldMatrix< K, ROWS, COLS >::FieldMatrix (  )  [inline]

Default constructor.

template<class K, int ROWS, int COLS>
Dune::FieldMatrix< K, ROWS, COLS >::FieldMatrix ( const K &  k  )  [inline, explicit]

Constructor initializing the whole matrix with a scalar.

template<class K, int ROWS, int COLS>
template<typename T >
Dune::FieldMatrix< K, ROWS, COLS >::FieldMatrix ( const T &  t  )  [inline, explicit]

Member Function Documentation

template<class K, int ROWS, int COLS>
FieldMatrix& Dune::FieldMatrix< K, ROWS, COLS >::axpy ( const K &  k,
const FieldMatrix< K, ROWS, COLS > &  y 
) [inline]

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

Referenced by Dune::FieldMatrix< T, n, m >::axpy().

template<class K, int ROWS, int COLS>
ConstIterator Dune::FieldMatrix< K, ROWS, COLS >::begin (  )  const [inline]

begin iterator

template<class K, int ROWS, int COLS>
Iterator Dune::FieldMatrix< K, ROWS, COLS >::begin (  )  [inline]

begin iterator

template<class K, int ROWS, int COLS>
K Dune::FieldMatrix< K, ROWS, COLS >::determinant (  )  const

calculates the determinant of this matrix

template<class K, int ROWS, int COLS>
ConstIterator Dune::FieldMatrix< K, ROWS, COLS >::end (  )  const [inline]

end iterator

template<class K, int ROWS, int COLS>
Iterator Dune::FieldMatrix< K, ROWS, COLS >::end (  )  [inline]

end iterator

template<class K, int ROWS, int COLS>
bool Dune::FieldMatrix< K, ROWS, COLS >::exists ( size_type  i,
size_type  j 
) const [inline]

return true when (i,j) is in pattern

template<class K, int ROWS, int COLS>
FieldTraits<K>::real_type Dune::FieldMatrix< K, ROWS, COLS >::frobenius_norm (  )  const [inline]

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

template<class K, int ROWS, int COLS>
FieldTraits<K>::real_type Dune::FieldMatrix< K, ROWS, COLS >::frobenius_norm2 (  )  const [inline]

square of frobenius norm, need for block recursion

template<class K, int ROWS, int COLS>
FieldTraits<K>::real_type Dune::FieldMatrix< K, ROWS, COLS >::infinity_norm (  )  const [inline]

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

template<class K, int ROWS, int COLS>
FieldTraits<K>::real_type Dune::FieldMatrix< K, ROWS, COLS >::infinity_norm_real (  )  const [inline]

simplified infinity norm (uses Manhattan norm for complex values)

template<class K, int ROWS, int COLS>
void Dune::FieldMatrix< K, ROWS, COLS >::invert (  ) 

Compute inverse.

Exceptions:
FMatrixError if the matrix is singular
template<class K, int ROWS, int COLS>
FieldMatrix& Dune::FieldMatrix< K, ROWS, COLS >::leftmultiply ( const FieldMatrix< K, rows, rows > &  M  )  [inline]

Multiplies M from the left to this matrix.

template<class K, int ROWS, int COLS>
template<int l>
FieldMatrix<K,l,cols> Dune::FieldMatrix< K, ROWS, COLS >::leftmultiplyany ( const FieldMatrix< K, l, rows > &  M  )  const [inline]

Multiplies M from the left to this matrix, this matrix is not modified.

template<class K, int ROWS, int COLS>
size_type Dune::FieldMatrix< K, ROWS, COLS >::M (  )  const [inline]
template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::mmhv ( const X &  x,
Y &  y 
) const [inline]

y -= A^H x

template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::mmtv ( const X &  x,
Y &  y 
) const [inline]

y -= A^T x

template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::mmv ( const X &  x,
Y &  y 
) const [inline]

y -= A x

template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::mtv ( const X &  x,
Y &  y 
) const [inline]

y = A^T x

template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::mv ( const X &  x,
Y &  y 
) const [inline]

y = A x

template<class K, int ROWS, int COLS>
size_type Dune::FieldMatrix< K, ROWS, COLS >::N (  )  const [inline]
template<class K, int ROWS, int COLS>
FieldMatrix& Dune::FieldMatrix< K, ROWS, COLS >::operator*= ( const K &  k  )  [inline]

vector space multiplication with scalar

template<class K, int ROWS, int COLS>
FieldMatrix& Dune::FieldMatrix< K, ROWS, COLS >::operator+= ( const FieldMatrix< K, ROWS, COLS > &  y  )  [inline]

vector space addition

template<class K, int ROWS, int COLS>
FieldMatrix& Dune::FieldMatrix< K, ROWS, COLS >::operator-= ( const FieldMatrix< K, ROWS, COLS > &  y  )  [inline]

vector space subtraction

template<class K, int ROWS, int COLS>
FieldMatrix& Dune::FieldMatrix< K, ROWS, COLS >::operator/= ( const K &  k  )  [inline]

vector space division by scalar

template<class K, int ROWS, int COLS>
template<typename T >
FieldMatrix& Dune::FieldMatrix< K, ROWS, COLS >::operator= ( const T &  t  )  [inline]
template<class K, int ROWS, int COLS>
FieldMatrix& Dune::FieldMatrix< K, ROWS, COLS >::operator= ( const K &  k  )  [inline]
template<class K, int ROWS, int COLS>
const row_type& Dune::FieldMatrix< K, ROWS, COLS >::operator[] ( size_type  i  )  const [inline]

same for read only access

template<class K, int ROWS, int COLS>
row_type& Dune::FieldMatrix< K, ROWS, COLS >::operator[] ( size_type  i  )  [inline]

random access to the rows

template<class K, int ROWS, int COLS>
ConstIterator Dune::FieldMatrix< K, ROWS, COLS >::rbegin (  )  const [inline]

begin iterator

template<class K, int ROWS, int COLS>
Iterator Dune::FieldMatrix< K, ROWS, COLS >::rbegin (  )  [inline]

begin iterator

template<class K, int ROWS, int COLS>
ConstIterator Dune::FieldMatrix< K, ROWS, COLS >::rend (  )  const [inline]

end iterator

template<class K, int ROWS, int COLS>
Iterator Dune::FieldMatrix< K, ROWS, COLS >::rend (  )  [inline]

end iterator

template<class K, int ROWS, int COLS>
FieldMatrix& Dune::FieldMatrix< K, ROWS, COLS >::rightmultiply ( const FieldMatrix< K, cols, cols > &  M  )  [inline]

Multiplies M from the right to this matrix.

template<class K, int ROWS, int COLS>
template<int l>
FieldMatrix<K,rows,l> Dune::FieldMatrix< K, ROWS, COLS >::rightmultiplyany ( const FieldMatrix< K, cols, l > &  M  )  const [inline]

Multiplies M from the right to this matrix, this matrix is not modified.

template<class K, int ROWS, int COLS>
template<class V >
void Dune::FieldMatrix< K, ROWS, COLS >::solve ( V &  x,
const V &  b 
) const [inline]

Solve system A x = b.

Exceptions:
FMatrixError if the matrix is singular
template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::umhv ( const X &  x,
Y &  y 
) const [inline]

y += A^H x

template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::umtv ( const X &  x,
Y &  y 
) const [inline]

y += A^T x

template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::umv ( const X &  x,
Y &  y 
) const [inline]

y += A x

template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::usmhv ( const K &  alpha,
const X &  x,
Y &  y 
) const [inline]

y += alpha A^H x

template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::usmtv ( const K &  alpha,
const X &  x,
Y &  y 
) const [inline]

y += alpha A^T x

template<class K, int ROWS, int COLS>
template<class X , class Y >
void Dune::FieldMatrix< K, ROWS, COLS >::usmv ( const K &  alpha,
const X &  x,
Y &  y 
) const [inline]

y += alpha A x


Friends And Related Function Documentation

template<class K, int ROWS, int COLS>
std::ostream& operator<< ( std::ostream &  s,
const FieldMatrix< K, rows, cols > &  a 
) [friend]

Sends the matrix to an output stream.


The documentation for this class was generated from the following file:
Generated on Mon Apr 26 10:45:23 2010 for dune-common by  doxygen 1.6.3