- Home
- About DUNE
- Download
- Documentation
- Community
- Development
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. | |
RowIterator | begin () |
Get iterator to first row. | |
RowIterator | end () |
Get iterator to one beyond last row. | |
RowIterator | rbegin () |
RowIterator | beforeEnd () |
RowIterator | rend () |
RowIterator | beforeBegin () |
ConstRowIterator | begin () const |
Get const iterator to first row. | |
ConstRowIterator | end () const |
Get const iterator to one beyond last row. | |
ConstRowIterator | rbegin () const |
ConstRowIterator | beforeEnd () const |
ConstRowIterator | rend () const |
ConstRowIterator | beforeBegin () const |
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 X &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 | 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 |
![]() | |
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 | |
Protected Attributes | |
VariableBlockVector< T, A > | data_ |
Abuse VariableBlockVector as an engine for a 2d array ISTL-style. | |
size_type | cols_ |
Number of columns of the matrix. | |
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. |
A generic dynamic dense matrix.
typedef A Dune::Matrix< T, A >::allocator_type |
Export the allocator.
typedef T Dune::Matrix< T, A >::block_type |
Export the type representing the components.
typedef row_type::iterator Dune::Matrix< T, A >::ColIterator |
Iterator for the entries of each row.
typedef row_type::const_iterator Dune::Matrix< T, A >::ConstColIterator |
Const iterator for the entries of each row.
typedef VariableBlockVector<T,A>::ConstIterator Dune::Matrix< T, A >::ConstRowIterator |
Const iterator over the matrix rows.
typedef T::field_type Dune::Matrix< T, A >::field_type |
Export the type representing the underlying field.
typedef VariableBlockVector<T,A>::window_type Dune::Matrix< T, A >::row_type |
The type implementing a matrix row.
typedef VariableBlockVector<T,A>::Iterator Dune::Matrix< T, A >::RowIterator |
Iterator over the matrix rows.
typedef A::size_type Dune::Matrix< T, A >::size_type |
Type for indices and sizes.
anonymous enum |
Dune::Matrix< T, A >::Matrix | ( | ) | [inline] |
Create empty matrix.
Dune::Matrix< T, A >::Matrix | ( | size_type | rows, | |
size_type | cols | |||
) | [inline] |
Create uninitialized matrix of size rows x cols.
RowIterator Dune::Matrix< T, A >::beforeBegin | ( | ) | [inline] |
References Dune::VariableBlockVector< B, A >::beforeBegin(), and Dune::Matrix< T, A >::data_.
Referenced by Dune::Matrix< T, A >::rend().
ConstRowIterator Dune::Matrix< T, A >::beforeBegin | ( | ) | const [inline] |
References Dune::VariableBlockVector< B, A >::beforeBegin(), and Dune::Matrix< T, A >::data_.
ConstRowIterator Dune::Matrix< T, A >::beforeEnd | ( | ) | const [inline] |
References Dune::VariableBlockVector< B, A >::beforeEnd(), and Dune::Matrix< T, A >::data_.
RowIterator Dune::Matrix< T, A >::beforeEnd | ( | ) | [inline] |
References Dune::VariableBlockVector< B, A >::beforeEnd(), and Dune::Matrix< T, A >::data_.
Referenced by Dune::Matrix< T, A >::rbegin().
ConstRowIterator Dune::Matrix< T, A >::begin | ( | ) | const [inline] |
Get const iterator to first row.
References Dune::VariableBlockVector< B, A >::begin(), and Dune::Matrix< T, A >::data_.
RowIterator Dune::Matrix< T, A >::begin | ( | ) | [inline] |
Get iterator to first row.
References Dune::VariableBlockVector< B, A >::begin(), and Dune::Matrix< T, A >::data_.
Referenced by Dune::SuperMatrixInitializer< BCRSMatrix< FieldMatrix< T, n, m >, A > >::addRowNnz(), Dune::SeqOverlappingSchwarzAssembler< SuperLU< T > >::assembleLocalProblems(), Dune::CheckIfDiagonalPresent< Matrix, 0, l >::check(), Dune::CheckIfDiagonalPresent< Matrix, blocklevel, l >::check(), Dune::Matrix< T, A >::mmhv(), Dune::Matrix< T, A >::mmtv(), Dune::Matrix< T, A >::mmv(), Dune::printSparseMatrix(), Dune::DynamicMatrixSubdomainSolver< BCRSMatrix< FieldMatrix< K, n, n >, Al >, X, Y >::setSubMatrix(), Dune::Matrix< T, A >::umhv(), Dune::Matrix< T, A >::umtv(), Dune::Matrix< T, A >::usmhv(), and Dune::Matrix< T, A >::usmtv().
size_type Dune::Matrix< T, A >::coldim | ( | ) | const [inline] |
The number of scalar columns.
References Dune::Matrix< T, A >::data_, Dune::Matrix< T, A >::N(), and Dune::base_array_unmanaged< B, A >::size().
size_type Dune::Matrix< T, A >::coldim | ( | size_type | c | ) | const [inline] |
The number of scalar columns.
References Dune::Matrix< T, A >::data_, Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
ConstRowIterator Dune::Matrix< T, A >::end | ( | ) | const [inline] |
Get const iterator to one beyond last row.
References Dune::Matrix< T, A >::data_, and Dune::VariableBlockVector< B, A >::end().
RowIterator Dune::Matrix< T, A >::end | ( | ) | [inline] |
Get iterator to one beyond last row.
References Dune::Matrix< T, A >::data_, and Dune::VariableBlockVector< B, A >::end().
Referenced by Dune::CheckIfDiagonalPresent< Matrix, 0, l >::check(), Dune::CheckIfDiagonalPresent< Matrix, blocklevel, l >::check(), Dune::Matrix< T, A >::mmhv(), Dune::Matrix< T, A >::mmtv(), Dune::Matrix< T, A >::mmv(), Dune::printSparseMatrix(), Dune::Matrix< T, A >::umhv(), Dune::Matrix< T, A >::umtv(), Dune::Matrix< T, A >::usmhv(), and Dune::Matrix< T, A >::usmtv().
bool Dune::Matrix< T, A >::exists | ( | size_type | i, | |
size_type | j | |||
) | const [inline] |
return true if (i,j) is in pattern
References Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
double Dune::Matrix< T, A >::frobenius_norm | ( | ) | const [inline] |
frobenius norm: sqrt(sum over squared values of entries)
References Dune::Matrix< T, A >::frobenius_norm2().
double Dune::Matrix< T, A >::frobenius_norm2 | ( | ) | const [inline] |
square of frobenius norm, need for block recursion
References Dune::Matrix< T, A >::data_, Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
Referenced by Dune::Matrix< T, A >::frobenius_norm().
double Dune::Matrix< T, A >::infinity_norm | ( | ) | const [inline] |
infinity norm (row sum norm, how to generalize for blocks?)
References Dune::Matrix< T, A >::data_, Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
double Dune::Matrix< T, A >::infinity_norm_real | ( | ) | const [inline] |
simplified infinity norm (uses Manhattan norm for complex values)
References Dune::Matrix< T, A >::data_, Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
size_type Dune::Matrix< T, A >::M | ( | ) | const [inline] |
Return the number of columns.
References Dune::Matrix< T, A >::cols_.
Referenced by Dune::SuperLU< BCRSMatrix< FieldMatrix< T, n, m >, A > >::apply(), Dune::MatrixDimension< Matrix< FieldMatrix< K, n, m >, TA > >::coldim(), Dune::Matrix< T, A >::coldim(), Dune::Matrix< T, A >::exists(), Dune::Matrix< T, A >::frobenius_norm2(), Dune::Matrix< T, A >::infinity_norm(), Dune::Matrix< T, A >::infinity_norm_real(), Dune::Matrix< T, A >::mmhv(), Dune::Matrix< T, A >::mmtv(), Dune::Matrix< T, A >::mmv(), Dune::Matrix< T, A >::mtv(), Dune::Matrix< T, A >::mv(), Dune::Matrix< T, A >::operator+=(), Dune::Matrix< T, A >::operator-=(), Dune::printSparseMatrix(), Dune::Matrix< T, A >::rowdim(), Dune::SuperLU< BCRSMatrix< FieldMatrix< T, n, m >, A > >::setMatrix(), Dune::SuperLU< BCRSMatrix< FieldMatrix< T, n, m >, A > >::setSubMatrix(), Dune::Matrix< T, A >::transpose(), Dune::Matrix< T, A >::transposedMult(), Dune::Matrix< T, A >::umhv(), Dune::Matrix< T, A >::umtv(), Dune::Matrix< T, A >::umv(), Dune::Matrix< T, A >::usmhv(), Dune::Matrix< T, A >::usmtv(), Dune::Matrix< T, A >::usmv(), and Dune::SuperLU< BCRSMatrix< FieldMatrix< T, n, m >, A > >::~SuperLU().
void Dune::Matrix< T, A >::mmhv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y -= A^H x
References Dune::Matrix< T, A >::begin(), Dune::Matrix< T, A >::end(), Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
void Dune::Matrix< T, A >::mmtv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y -= A^T x
References Dune::Matrix< T, A >::begin(), Dune::Matrix< T, A >::end(), Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
void Dune::Matrix< T, A >::mmv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y -= A x
References Dune::Matrix< T, A >::begin(), Dune::Matrix< T, A >::end(), Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
void Dune::Matrix< T, A >::mtv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y = A^T x
References Dune::Matrix< T, A >::M(), Dune::Matrix< T, A >::N(), and Dune::Matrix< T, A >::umtv().
void Dune::Matrix< T, A >::mv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
size_type Dune::Matrix< T, A >::N | ( | ) | const [inline] |
Return the number of rows.
References Dune::Matrix< T, A >::data_, and Dune::VariableBlockVector< B, A >::N().
Referenced by Dune::SuperLU< BCRSMatrix< FieldMatrix< T, n, m >, A > >::apply(), Dune::Matrix< T, A >::coldim(), Dune::copyToSuperMatrix(), Dune::Matrix< T, A >::exists(), Dune::Matrix< T, A >::frobenius_norm2(), Dune::Matrix< T, A >::infinity_norm(), Dune::Matrix< T, A >::infinity_norm_real(), Dune::Matrix< T, A >::mmhv(), Dune::Matrix< T, A >::mmtv(), Dune::Matrix< T, A >::mmv(), Dune::Matrix< T, A >::mtv(), Dune::Matrix< T, A >::mv(), Dune::Matrix< T, A >::operator+=(), Dune::Matrix< T, A >::operator-=(), Dune::Matrix< T, A >::operator[](), Dune::printSparseMatrix(), Dune::MatrixDimension< Matrix< FieldMatrix< K, n, m >, TA > >::rowdim(), Dune::Matrix< T, A >::rowdim(), Dune::SuperLU< BCRSMatrix< FieldMatrix< T, n, m >, A > >::setMatrix(), Dune::SuperLU< BCRSMatrix< FieldMatrix< T, n, m >, A > >::setSubMatrix(), Dune::Matrix< T, A >::transpose(), Dune::Matrix< T, A >::transposedMult(), Dune::Matrix< T, A >::umhv(), Dune::Matrix< T, A >::umtv(), Dune::Matrix< T, A >::umv(), Dune::Matrix< T, A >::usmhv(), Dune::Matrix< T, A >::usmtv(), Dune::Matrix< T, A >::usmv(), and Dune::SuperLU< BCRSMatrix< FieldMatrix< T, n, m >, A > >::~SuperLU().
Matrix<T>& Dune::Matrix< T, A >::operator*= | ( | const field_type & | scalar | ) | [inline] |
Multiplication with a scalar.
References Dune::Matrix< T, A >::data_.
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 >::data_, 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 >::data_, Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
Matrix<T>& Dune::Matrix< T, A >::operator/= | ( | const field_type & | scalar | ) | [inline] |
Multiplication with a scalar.
References Dune::Matrix< T, A >::data_.
Matrix& Dune::Matrix< T, A >::operator= | ( | const field_type & | t | ) | [inline] |
Assignment from scalar.
References Dune::Matrix< T, A >::data_.
const row_type& Dune::Matrix< T, A >::operator[] | ( | size_type | row | ) | const [inline] |
The const index operator.
References Dune::Matrix< T, A >::data_, and Dune::Matrix< T, A >::N().
row_type& Dune::Matrix< T, A >::operator[] | ( | size_type | row | ) | [inline] |
The index operator.
References Dune::Matrix< T, A >::data_, and Dune::Matrix< T, A >::N().
ConstRowIterator Dune::Matrix< T, A >::rbegin | ( | ) | const [inline] |
References Dune::Matrix< T, A >::beforeEnd().
RowIterator Dune::Matrix< T, A >::rbegin | ( | ) | [inline] |
References Dune::Matrix< T, A >::beforeEnd().
ConstRowIterator Dune::Matrix< T, A >::rend | ( | ) | const [inline] |
References Dune::Matrix< T, A >::beforeBegin().
RowIterator Dune::Matrix< T, A >::rend | ( | ) | [inline] |
References Dune::Matrix< T, A >::beforeBegin().
size_type Dune::Matrix< T, A >::rowdim | ( | size_type | r | ) | const [inline] |
The number of scalar rows.
References Dune::Matrix< T, A >::data_, Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
size_type Dune::Matrix< T, A >::rowdim | ( | ) | const [inline] |
The number of scalar rows.
References Dune::Matrix< T, A >::data_, Dune::Matrix< T, A >::M(), and Dune::VariableBlockVector< B, A >::N().
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_, Dune::Matrix< T, A >::data_, and Dune::VariableBlockVector< B, A >::resize().
Matrix Dune::Matrix< T, A >::transpose | ( | ) | const [inline] |
Return the transpose of the matrix.
References Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
Y Dune::Matrix< T, A >::transposedMult | ( | const X & | vec | ) | [inline] |
Multiplication of the transposed matrix times a vector.
References Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
void Dune::Matrix< T, A >::umhv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y += A^H x
References Dune::Matrix< T, A >::begin(), Dune::Matrix< T, A >::end(), Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
void Dune::Matrix< T, A >::umtv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y += A^T x
References Dune::Matrix< T, A >::begin(), Dune::Matrix< T, A >::end(), Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
Referenced by Dune::Matrix< T, A >::mtv().
void Dune::Matrix< T, A >::umv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
void Dune::Matrix< T, A >::usmhv | ( | const field_type & | alpha, | |
const X & | x, | |||
Y & | y | |||
) | const [inline] |
y += alpha A^H x
References Dune::Matrix< T, A >::begin(), Dune::Matrix< T, A >::end(), Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
void Dune::Matrix< T, A >::usmtv | ( | const field_type & | alpha, | |
const X & | x, | |||
Y & | y | |||
) | const [inline] |
y += alpha A^T x
References Dune::Matrix< T, A >::begin(), Dune::Matrix< T, A >::end(), Dune::Matrix< T, A >::M(), and Dune::Matrix< T, A >::N().
void Dune::Matrix< T, A >::usmv | ( | const field_type & | alpha, | |
const X & | x, | |||
Y & | y | |||
) | const [inline] |
Matrix<T> operator* | ( | const Matrix< T > & | m1, | |
const Matrix< T > & | m2 | |||
) | [friend] |
Generic matrix multiplication.
Y operator* | ( | const Matrix< T > & | m, | |
const X & | vec | |||
) | [friend] |
Generic matrix-vector multiplication.
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().
VariableBlockVector<T,A> Dune::Matrix< T, A >::data_ [protected] |
Abuse VariableBlockVector as an engine for a 2d array ISTL-style.
This is almost as good as it can get. Further speedup may be possible by using the fact that all rows have the same length.
Referenced by Dune::Matrix< T, A >::beforeBegin(), Dune::Matrix< T, A >::beforeEnd(), Dune::Matrix< T, A >::begin(), Dune::Matrix< T, A >::coldim(), Dune::Matrix< T, A >::end(), Dune::Matrix< T, A >::frobenius_norm2(), Dune::Matrix< T, A >::infinity_norm(), Dune::Matrix< T, A >::infinity_norm_real(), Dune::Matrix< T, A >::mv(), Dune::Matrix< T, A >::N(), Dune::Matrix< T, A >::operator*=(), Dune::Matrix< T, A >::operator+=(), Dune::Matrix< T, A >::operator-=(), Dune::Matrix< T, A >::operator/=(), Dune::Matrix< T, A >::operator=(), Dune::Matrix< T, A >::operator[](), Dune::Matrix< T, A >::rowdim(), Dune::Matrix< T, A >::setSize(), Dune::Matrix< T, A >::umv(), and Dune::Matrix< T, A >::usmv().
Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].