#include <matrix.hh>
This matrix is currently implemented as a BlockVector of BlockVectors. That makes the code fairly simple, as we get all iterators for free. However, it is not the best way as far as efficiency is concerned.
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 BlockVector< T > | row_type |
The type implementing a matrix row. | |
typedef A::size_type | size_type |
Type for indices and sizes. | |
typedef BlockVector< row_type > ::iterator | RowIterator |
Iterator over the matrix rows. | |
typedef row_type::iterator | ColIterator |
Iterator for the entries of each row. | |
typedef BlockVector< row_type > ::const_iterator | 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. | |
RowIterator | begin () |
Get iterator to first row. | |
RowIterator | end () |
Get iterator to one beyond last row. | |
RowIterator | rbegin () |
Get iterator to last row. | |
RowIterator | rend () |
Get iterator to one before first row. | |
ConstRowIterator | begin () const |
Get const iterator to first row. | |
ConstRowIterator | end () const |
Get const iterator to one beyond last row. | |
ConstRowIterator | rbegin () const |
Get const iterator to last row. | |
ConstRowIterator | rend () const |
Get const iterator to one before first row. | |
Matrix & | operator= (const field_type &t) |
Assignment from scalar. | |
row_type & | operator[] (size_type row) |
The index operator. | |
const row_type & | operator[] (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. | |
Matrix & | operator+= (const Matrix &b) |
Add the entries of another matrix to this one. | |
Matrix & | operator-= (const Matrix &b) |
Subtract the entries of another matrix from this one. | |
Matrix | transpose () const |
Return the transpose of the matrix. | |
template<class X, class Y> | |
Y | transposedMult (const Y &vec) |
Multiplication of the transposed matrix times a vector. | |
template<class X, class Y> | |
void | mv (const X &x, Y &y) const |
y = A 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 |
![]() | |
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 | |
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) | |
bool | exists (size_type i, size_type j) const |
return true if (i,j) is in pattern | |
Friends | |
Matrix< T > | operator* (const Matrix< T > &m1, const Matrix< T > &m2) |
Generic matrix multiplication. | |
template<class X, class Y> | |
Y | operator* (const Matrix< T > &m, const X &vec) |
Generic matrix-vector multiplication. |
anonymous enum |
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.
Matrix& Dune::Matrix< T, A >::operator+= | ( | const Matrix< T, A > & | b | ) | [inline] |
Add the entries of another matrix to this one.
b | The matrix to add to this one. Its size has to be the same as the size of this matrix. |
References Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
Matrix& Dune::Matrix< T, A >::operator-= | ( | const Matrix< T, A > & | b | ) | [inline] |
Subtract the entries of another matrix from this one.
b | The matrix to add to this one. Its size has to be the same as the size of this matrix. |
References Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().