Dune::Matrix< T, A > Class Template Reference
[Sparse Matrix and Vector classes]
#include <matrix.hh>
Detailed Description
template<class T, class A = ISTLAllocator>
class Dune::Matrix< T, A >
A generic dynamic matrix.
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 (int rows, int cols) | |
Create uninitialized matrix of size rows x cols. | |
void | setSize (int rows, int 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[] (int row) |
The index operator. | |
const row_type & | operator[] (int 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. |
Member Enumeration Documentation
template<class T, class A = ISTLAllocator>
anonymous enum |
Member Function Documentation
template<class T, class A = ISTLAllocator>
void Dune::Matrix< T, A >::setSize | ( | int | rows, | |
int | cols | |||
) | [inline] |
Change the matrix size.
The way the data is handled is unpredictable.
template<class T, class A = ISTLAllocator>
Matrix& Dune::Matrix< T, A >::operator+= | ( | const Matrix< T, A > & | b | ) | [inline] |
Add the entries of another matrix to this one.
- Parameters:
-
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().
template<class T, class A = ISTLAllocator>
Matrix& Dune::Matrix< T, A >::operator-= | ( | const Matrix< T, A > & | b | ) | [inline] |
Subtract the entries of another matrix from this one.
- Parameters:
-
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().
The documentation for this class was generated from the following file: