A diagonal matrix of static size. More...
#include <dune/common/diagonalmatrix.hh>
Public Types | |
enum | { blocklevel = 1 } |
We are at the leaf of the block recursion. More... | |
enum | { rows = n, cols = n } |
export size More... | |
typedef K | value_type |
export the type representing the field | |
typedef value_type | field_type |
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 DiagonalRowVector< K, n > | row_type |
Each row is implemented by a field vector. | |
typedef row_type | reference |
typedef row_type | row_reference |
typedef DiagonalRowVectorConst < K, n > | const_row_type |
typedef const_row_type | const_reference |
typedef const_row_type | const_row_reference |
typedef ContainerWrapperIterator < const WrapperType, reference, reference > | 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 ContainerWrapperIterator < const WrapperType, const_reference, const_reference > | 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 const_row_type::ConstIterator | ConstColIterator |
rename the iterators for easier access | |
Public Member Functions | |
size_type | size () const |
DiagonalMatrix () | |
Default constructor. | |
DiagonalMatrix (const K &k) | |
Constructor initializing the whole matrix with a scalar. | |
DiagonalMatrix (const FieldVector< K, n > &diag) | |
Constructor initializing the diagonal with a vector. | |
DiagonalMatrix (std::initializer_list< K > const &l) | |
Construct diagonal matrix from an initializer list. | |
DiagonalMatrix & | operator= (const K &k) |
Assignment from a scalar. | |
bool | identical (const DiagonalMatrix< K, n > &other) const |
Check if matrix is the same object as the other matrix. | |
Iterator | begin () |
begin iterator | |
Iterator | end () |
end iterator | |
Iterator | beforeEnd () |
Iterator | beforeBegin () |
ConstIterator | begin () const |
begin iterator | |
ConstIterator | end () const |
end iterator | |
ConstIterator | beforeEnd () const |
ConstIterator | beforeBegin () const |
DiagonalMatrix & | operator+= (const DiagonalMatrix &y) |
vector space addition | |
DiagonalMatrix & | operator-= (const DiagonalMatrix &y) |
vector space subtraction | |
DiagonalMatrix & | operator+= (const K &k) |
vector space multiplication with scalar | |
DiagonalMatrix & | operator-= (const K &k) |
vector space division by scalar | |
DiagonalMatrix & | operator*= (const K &k) |
vector space multiplication with scalar | |
DiagonalMatrix & | operator/= (const K &k) |
vector space division by scalar | |
bool | operator== (const DiagonalMatrix &other) const |
comparison operator | |
bool | operator!= (const DiagonalMatrix &other) const |
incomparison operator | |
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 typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const |
y += alpha A x | |
template<class X , class Y > | |
void | usmtv (const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const |
y += alpha A^T x | |
template<class X , class Y > | |
void | usmhv (const typename FieldTraits< Y >::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) | |
template<class V > | |
void | solve (V &x, const V &b) const |
Solve system A x = b. | |
void | invert () |
Compute inverse. | |
K | determinant () const |
calculates the determinant of this matrix | |
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 | |
reference | operator[] (size_type i) |
Return reference object as row replacement. | |
const_reference | operator[] (size_type i) const |
Return const_reference object as row replacement. | |
const K & | diagonal (size_type i) const |
Get const reference to diagonal entry. | |
K & | diagonal (size_type i) |
Get reference to diagonal entry. | |
const FieldVector< K, n > & | diagonal () const |
Get const reference to diagonal vector. | |
FieldVector< K, n > & | diagonal () |
Get reference to diagonal vector. | |
Friends | |
std::ostream & | operator<< (std::ostream &s, const DiagonalMatrix< K, n > &a) |
Sends the matrix to an output stream. |
A diagonal matrix of static size.
This is meant to be a replacement of FieldMatrix for the case that it is a diagonal matrix.
K | Type used for scalars | |
n | Matrix size |
typedef K Dune::DiagonalMatrix< K, n >::block_type |
export the type representing the components
typedef row_type::Iterator Dune::DiagonalMatrix< K, n >::ColIterator |
rename the iterators for easier access
typedef ConstIterator Dune::DiagonalMatrix< K, n >::const_iterator |
typedef for stl compliant access
typedef const_row_type Dune::DiagonalMatrix< K, n >::const_reference |
typedef const_row_type Dune::DiagonalMatrix< K, n >::const_row_reference |
typedef DiagonalRowVectorConst<K,n> Dune::DiagonalMatrix< K, n >::const_row_type |
typedef const_row_type::ConstIterator Dune::DiagonalMatrix< K, n >::ConstColIterator |
rename the iterators for easier access
typedef ContainerWrapperIterator<const WrapperType, const_reference, const_reference> Dune::DiagonalMatrix< K, n >::ConstIterator |
Iterator class for sequential access.
typedef ConstIterator Dune::DiagonalMatrix< K, n >::ConstRowIterator |
rename the iterators for easier access
typedef value_type Dune::DiagonalMatrix< K, n >::field_type |
typedef Iterator Dune::DiagonalMatrix< K, n >::iterator |
typedef for stl compliant access
typedef ContainerWrapperIterator<const WrapperType, reference, reference> Dune::DiagonalMatrix< K, n >::Iterator |
Iterator class for sequential access.
typedef row_type Dune::DiagonalMatrix< K, n >::reference |
typedef row_type Dune::DiagonalMatrix< K, n >::row_reference |
typedef DiagonalRowVector<K,n> Dune::DiagonalMatrix< K, n >::row_type |
Each row is implemented by a field vector.
typedef Iterator Dune::DiagonalMatrix< K, n >::RowIterator |
rename the iterators for easier access
typedef std::size_t Dune::DiagonalMatrix< K, n >::size_type |
The type used for the index access and size operations.
typedef K Dune::DiagonalMatrix< K, n >::value_type |
export the type representing the field
anonymous enum |
anonymous enum |
Dune::DiagonalMatrix< K, n >::DiagonalMatrix | ( | ) | [inline] |
Default constructor.
Dune::DiagonalMatrix< K, n >::DiagonalMatrix | ( | const K & | k | ) | [inline] |
Constructor initializing the whole matrix with a scalar.
Dune::DiagonalMatrix< K, n >::DiagonalMatrix | ( | const FieldVector< K, n > & | diag | ) | [inline] |
Constructor initializing the diagonal with a vector.
Dune::DiagonalMatrix< K, n >::DiagonalMatrix | ( | std::initializer_list< K > const & | l | ) | [inline] |
Construct diagonal matrix from an initializer list.
The elements of the list are copied into the diagonal elements of the matrix. If the initializer list is shorter than the matrix diagonal (which has n elements), the remaining matrix diagonal elements are left uninitialized. If the initializer list is longer, than only the first n elements will be copied into the matrix diagonal.
ConstIterator Dune::DiagonalMatrix< K, n >::beforeBegin | ( | ) | const [inline] |
Iterator Dune::DiagonalMatrix< K, n >::beforeBegin | ( | ) | [inline] |
ConstIterator Dune::DiagonalMatrix< K, n >::beforeEnd | ( | ) | const [inline] |
Iterator Dune::DiagonalMatrix< K, n >::beforeEnd | ( | ) | [inline] |
ConstIterator Dune::DiagonalMatrix< K, n >::begin | ( | ) | const [inline] |
begin iterator
Iterator Dune::DiagonalMatrix< K, n >::begin | ( | ) | [inline] |
begin iterator
K Dune::DiagonalMatrix< K, n >::determinant | ( | ) | const [inline] |
calculates the determinant of this matrix
FieldVector<K,n>& Dune::DiagonalMatrix< K, n >::diagonal | ( | ) | [inline] |
Get reference to diagonal vector.
const FieldVector<K,n>& Dune::DiagonalMatrix< K, n >::diagonal | ( | ) | const [inline] |
Get const reference to diagonal vector.
K& Dune::DiagonalMatrix< K, n >::diagonal | ( | size_type | i | ) | [inline] |
Get reference to diagonal entry.
const K& Dune::DiagonalMatrix< K, n >::diagonal | ( | size_type | i | ) | const [inline] |
Get const reference to diagonal entry.
ConstIterator Dune::DiagonalMatrix< K, n >::end | ( | ) | const [inline] |
end iterator
Iterator Dune::DiagonalMatrix< K, n >::end | ( | ) | [inline] |
end iterator
bool Dune::DiagonalMatrix< K, n >::exists | ( | size_type | i, | |
size_type | j | |||
) | const [inline] |
return true when (i,j) is in pattern
double Dune::DiagonalMatrix< K, n >::frobenius_norm | ( | ) | const [inline] |
frobenius norm: sqrt(sum over squared values of entries)
double Dune::DiagonalMatrix< K, n >::frobenius_norm2 | ( | ) | const [inline] |
square of frobenius norm, need for block recursion
bool Dune::DiagonalMatrix< K, n >::identical | ( | const DiagonalMatrix< K, n > & | other | ) | const [inline] |
Check if matrix is the same object as the other matrix.
double Dune::DiagonalMatrix< K, n >::infinity_norm | ( | ) | const [inline] |
infinity norm (row sum norm, how to generalize for blocks?)
double Dune::DiagonalMatrix< K, n >::infinity_norm_real | ( | ) | const [inline] |
simplified infinity norm (uses Manhattan norm for complex values)
void Dune::DiagonalMatrix< K, n >::invert | ( | ) | [inline] |
Compute inverse.
size_type Dune::DiagonalMatrix< K, n >::M | ( | ) | const [inline] |
number of blocks in column direction
void Dune::DiagonalMatrix< K, n >::mmhv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y -= A^H x
void Dune::DiagonalMatrix< K, n >::mmtv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y -= A^T x
void Dune::DiagonalMatrix< K, n >::mmv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y -= A x
void Dune::DiagonalMatrix< K, n >::mtv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y = A^T x
void Dune::DiagonalMatrix< K, n >::mv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y = A x
size_type Dune::DiagonalMatrix< K, n >::N | ( | ) | const [inline] |
number of blocks in row direction
bool Dune::DiagonalMatrix< K, n >::operator!= | ( | const DiagonalMatrix< K, n > & | other | ) | const [inline] |
incomparison operator
DiagonalMatrix& Dune::DiagonalMatrix< K, n >::operator*= | ( | const K & | k | ) | [inline] |
vector space multiplication with scalar
DiagonalMatrix& Dune::DiagonalMatrix< K, n >::operator+= | ( | const K & | k | ) | [inline] |
vector space multiplication with scalar
DiagonalMatrix& Dune::DiagonalMatrix< K, n >::operator+= | ( | const DiagonalMatrix< K, n > & | y | ) | [inline] |
vector space addition
DiagonalMatrix& Dune::DiagonalMatrix< K, n >::operator-= | ( | const K & | k | ) | [inline] |
vector space division by scalar
DiagonalMatrix& Dune::DiagonalMatrix< K, n >::operator-= | ( | const DiagonalMatrix< K, n > & | y | ) | [inline] |
vector space subtraction
DiagonalMatrix& Dune::DiagonalMatrix< K, n >::operator/= | ( | const K & | k | ) | [inline] |
vector space division by scalar
DiagonalMatrix& Dune::DiagonalMatrix< K, n >::operator= | ( | const K & | k | ) | [inline] |
Assignment from a scalar.
bool Dune::DiagonalMatrix< K, n >::operator== | ( | const DiagonalMatrix< K, n > & | other | ) | const [inline] |
comparison operator
const_reference Dune::DiagonalMatrix< K, n >::operator[] | ( | size_type | i | ) | const [inline] |
Return const_reference object as row replacement.
reference Dune::DiagonalMatrix< K, n >::operator[] | ( | size_type | i | ) | [inline] |
Return reference object as row replacement.
size_type Dune::DiagonalMatrix< K, n >::size | ( | ) | const [inline] |
void Dune::DiagonalMatrix< K, n >::solve | ( | V & | x, | |
const V & | b | |||
) | const [inline] |
Solve system A x = b.
void Dune::DiagonalMatrix< K, n >::umhv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y += A^H x
void Dune::DiagonalMatrix< K, n >::umtv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y += A^T x
void Dune::DiagonalMatrix< K, n >::umv | ( | const X & | x, | |
Y & | y | |||
) | const [inline] |
y += A x
void Dune::DiagonalMatrix< K, n >::usmhv | ( | const typename FieldTraits< Y >::field_type & | alpha, | |
const X & | x, | |||
Y & | y | |||
) | const [inline] |
y += alpha A^H x
void Dune::DiagonalMatrix< K, n >::usmtv | ( | const typename FieldTraits< Y >::field_type & | alpha, | |
const X & | x, | |||
Y & | y | |||
) | const [inline] |
y += alpha A^T x
void Dune::DiagonalMatrix< K, n >::usmv | ( | const typename FieldTraits< Y >::field_type & | alpha, | |
const X & | x, | |||
Y & | y | |||
) | const [inline] |
y += alpha A x
std::ostream& operator<< | ( | std::ostream & | s, | |
const DiagonalMatrix< K, n > & | a | |||
) | [friend] |
Sends the matrix to an output stream.