|
dune-istl 2.12-git
|
Owning matrix container built on top of MatrixView. More...
#include <dune/istl/experimental/matrix.hh>

Public Types | |
| using | allocator_type = A |
| Allocator type used by this container. | |
| using | block_iter_type = B |
| The iterator type used to access the blocks of the matrix. | |
| using | pattern_type = P |
| The type used for the sparsity pattern. | |
| using | row_index_range_type = std::ranges::range_value_t< pattern_type > |
| The type used for the index set of rows. | |
| using | block_type = std::iter_value_t< block_iter_type > |
| The type of blocks in the matrix. | |
| using | value_type = block_type |
| The type of blocks in the matrix. | |
| using | size_type = std::ranges::range_size_t< pattern_type > |
| The type used to count elements in the row and column index sets. | |
| using | field_type = typename FieldTraits< block_type >::field_type |
| The type of the field. | |
| using | row_type = VectorView< block_iter_type, row_index_range_type > |
| The type representing a mutable matrix row. | |
| using | const_row_type = VectorView< block_const_iter_type, row_index_range_type > |
| The type representing a const matrix row. | |
| using | iterator = Iterator |
| The type of mutable matrix iterators over the rows. | |
| using | const_iterator = ConstIterator |
| The type of const matrix iterators over the rows. | |
| using | RowIterator = Iterator |
| The type of mutable matrix iterators over the rows. | |
| using | ConstRowIterator = ConstIterator |
| The type of const matrix iterators over the rows. | |
| using | ColIterator = typename row_type::iterator |
| The type of mutable row iterators over the column blocks. | |
| using | ConstColIterator = typename const_row_type::const_iterator |
| The type of const row iterators over the column blocks. | |
Public Member Functions | |
| Matrix (const allocator_type &allocator=allocator_type()) | |
Construct an empty matrix with allocator allocator. | |
| Matrix (std::shared_ptr< const pattern_type > pattern, const allocator_type &allocator=allocator_type()) | |
| Construct from a shared pattern. | |
| Matrix (pattern_type &&pattern, const allocator_type &allocator=allocator_type()) | |
| Construct from an rvalue pattern. | |
| Matrix (const Matrix &other) | |
| Copy constructor. | |
| Matrix (const Matrix &other, const allocator_type &allocator) | |
| Copy constructor. | |
| Matrix & | operator= (const Matrix &other) |
| Copy assignment. | |
| Matrix (Matrix &&other) | |
| Move constructor. | |
| Matrix & | operator= (Matrix &&other) |
| Move assignment. | |
| Matrix (Matrix &&other, const allocator_type &allocator) | |
| Move construct with explicit allocator. | |
| ~Matrix () | |
| Destructor releases owned block storage. | |
| allocator_type | get_allocator () const |
| Return the allocator currently associated with this matrix. | |
| void | swap (Matrix &other) |
Swap contents of this matrix with other, honoring allocator swap propagation traits. | |
| std::shared_ptr< const pattern_type > | patternStorage () const |
| Get shared storage of the pattern. | |
| template<class Alloc , class ConstructFn > | |
| auto | allocateData (const Alloc &alloc, size_type count, ConstructFn &&construct_fn) -> block_iter_type |
| template<class Alloc , class ConstructFn , class RestoreFn > | |
| auto | allocateData (const Alloc &alloc, size_type count, ConstructFn &&construct_fn, RestoreFn &&restore_fn) -> block_iter_type |
| row_type | operator[] (size_type i) |
Return a mutable view of row i. | |
| const_row_type | operator[] (size_type i) const |
Return a const view of row i. | |
| Iterator | begin () |
| Return iterator to the first row. | |
| ConstIterator | begin () const |
| Return const iterator to the first row. | |
| Iterator | end () |
| Return iterator one past the last row. | |
| ConstIterator | end () const |
| Return const iterator one past the last row. | |
| ConstIterator | cbegin () const |
| Return const iterator to the first row. | |
| ConstIterator | cend () const |
| Return const iterator one past the last row. | |
| MatrixView & | axpy (field_type alpha, const MatrixView< OtherB, OtherI > &b) |
| Compute \(this \leftarrow this + \alpha b\). | |
| MatrixView< B, I > & | axpy (field_type alpha, const MatrixView< OtherB, OtherI > &b) |
| void | mv (const X &x, Y &y) const |
| Compute \(y = Ax\). | |
| void | umv (const X &x, Y &y) const |
| Compute \(y \mathrel{+}= Ax\). | |
| void | mmv (const X &x, Y &y) const |
| Compute \(y \mathrel{-}= Ax\). | |
| void | usmv (const field_type &alpha, const X &x, Y &y) const |
| Compute \(y \mathrel{+}= \alpha Ax\). | |
| void | mtv (const X &x, Y &y) const |
| Compute \(y = A^T x\). | |
| void | umtv (const X &x, Y &y) const |
| Compute \(y \mathrel{+}= A^T x\). | |
| void | mmtv (const X &x, Y &y) const |
| Compute \(y \mathrel{-}= A^T x\). | |
| void | usmtv (const field_type &alpha, const X &x, Y &y) const |
| Compute \(y \mathrel{+}= \alpha A^T x\). | |
| void | umhv (const X &x, Y &y) const |
| Compute \(y \mathrel{+}= A^H x\) (Hermitian transpose). | |
| void | mmhv (const X &x, Y &y) const |
| Compute \(y \mathrel{-}= A^H x\) (Hermitian transpose). | |
| void | usmhv (const field_type &alpha, const X &x, Y &y) const |
| Compute \(y \mathrel{+}= \alpha A^H x\) (Hermitian transpose). | |
| FieldTraits< field_type >::real_type | frobenius_norm2 () const |
| Return \(\|A\|_F^2\) (sum of squared block Frobenius norms). | |
| FieldTraits< field_type >::real_type | frobenius_norm () const |
| Return the Frobenius norm \(\|A\|_F\). | |
| FieldTraits< field_type >::real_type | infinity_norm () const |
| Return the block-aware infinity norm. | |
| FieldTraits< field_type >::real_type | infinity_norm_real () const |
| Return simplified infinity norm (Manhattan norm for complex values). | |
| bool | exists (size_type i, size_type j) const DUNE_ISTL_WITH_CHECKING_NOEXCEPT |
| Test whether position \((i,j)\) is present in the sparsity pattern. | |
| size_type | N () const |
| Number of block rows. | |
| size_type | M () const |
| Number of block columns. | |
| size_type | nonzeroes () const |
| Number of stored block entries. | |
| MatrixView & | operator*= (const field_type &k) |
Scale all stored blocks by k. | |
| MatrixView & | operator/= (const field_type &k) |
Divide all stored blocks by k. | |
| MatrixView & | operator+= (const MatrixView< OtherB, OtherI > &b) |
| Add another matrix view to this one. | |
| MatrixView< B, I > & | operator+= (const MatrixView< OtherB, OtherI > &b) |
| MatrixView & | operator-= (const MatrixView< OtherB, OtherI > &b) |
| Subtract another matrix view from this one. | |
| MatrixView< B, I > & | operator-= (const MatrixView< OtherB, OtherI > &b) |
| const pattern_type & | pattern () const |
Protected Member Functions | |
| void | resetView (block_iter_type block_iter, pattern_type const *pattern_ptr) |
Reset the view to point to block_iter and pattern_ptr. | |
| block_iter_type | blockIter () |
| Return the underlying block iterator. | |
| block_const_iter_type | blockIter () const |
| Return the underlying block iterator as a const iterator. | |
| pattern_type const * | patternPtr () const |
| Return the underlying pattern pointer. | |
Friends | |
| void | swap (Matrix &lhs, Matrix &rhs) |
Swap contents of lhs and rhs, honoring allocator swap propagation traits. | |
Detailed Description
class Dune::Experimental::Matrix< B, P, A >
Owning matrix container built on top of MatrixView.
Matrix stores block values and owns a pattern while exposing the matrix interface from MatrixView.
In contrast to MatrixView, this class owns both resources:
- block storage for all structurally present entries,
- a shared pointer to the immutable sparsity pattern.
- Template Parameters
-
B Block value type. P Pattern type (See MatrixView). A Allocator type used for block and pattern storage.
Member Typedef Documentation
◆ allocator_type
| using Dune::Experimental::Matrix< B, P, A >::allocator_type = A |
Allocator type used by this container.
◆ block_iter_type
|
inherited |
The iterator type used to access the blocks of the matrix.
◆ block_type
|
inherited |
The type of blocks in the matrix.
◆ ColIterator
|
inherited |
The type of mutable row iterators over the column blocks.
◆ const_iterator
|
inherited |
The type of const matrix iterators over the rows.
◆ const_row_type
|
inherited |
The type representing a const matrix row.
◆ ConstColIterator
|
inherited |
The type of const row iterators over the column blocks.
◆ ConstRowIterator
|
inherited |
The type of const matrix iterators over the rows.
◆ field_type
|
inherited |
The type of the field.
◆ iterator
|
inherited |
The type of mutable matrix iterators over the rows.
◆ pattern_type
|
inherited |
The type used for the sparsity pattern.
◆ row_index_range_type
|
inherited |
The type used for the index set of rows.
◆ row_type
|
inherited |
The type representing a mutable matrix row.
◆ RowIterator
|
inherited |
The type of mutable matrix iterators over the rows.
◆ size_type
|
inherited |
The type used to count elements in the row and column index sets.
◆ value_type
|
inherited |
The type of blocks in the matrix.
Constructor & Destructor Documentation
◆ Matrix() [1/7]
| Dune::Experimental::Matrix< B, P, A >::Matrix | ( | const allocator_type & | allocator = allocator_type() | ) |
Construct an empty matrix with allocator allocator.
The resulting matrix has no pattern and no allocated block storage.
◆ Matrix() [2/7]
| Dune::Experimental::Matrix< B, P, A >::Matrix | ( | std::shared_ptr< const pattern_type > | pattern, |
| const allocator_type & | allocator = allocator_type() |
||
| ) |
Construct from a shared pattern.
If pattern is non-null, block storage is allocated and value-initialized for pattern->count() entries.
◆ Matrix() [3/7]
| Dune::Experimental::Matrix< B, P, A >::Matrix | ( | pattern_type && | pattern, |
| const allocator_type & | allocator = allocator_type() |
||
| ) |
Construct from an rvalue pattern.
The pattern is moved into shared owned storage and corresponding block storage is allocated and value-initialized.
◆ Matrix() [4/7]
| Dune::Experimental::Matrix< B, P, A >::Matrix | ( | const Matrix< B, P, A > & | other | ) |
Copy constructor.
Shares the sparsity pattern and deep-copies block values.
◆ Matrix() [5/7]
| Dune::Experimental::Matrix< B, P, A >::Matrix | ( | const Matrix< B, P, A > & | other, |
| const allocator_type & | allocator | ||
| ) |
Copy constructor.
Shares the pattern and deep-copies block values.
◆ Matrix() [6/7]
| Dune::Experimental::Matrix< B, P, A >::Matrix | ( | Matrix< B, P, A > && | other | ) |
Move constructor.
Transfers owned resources from other.
◆ Matrix() [7/7]
| Dune::Experimental::Matrix< B, P, A >::Matrix | ( | Matrix< B, P, A > && | other, |
| const allocator_type & | allocator | ||
| ) |
Move construct with explicit allocator.
If allocators compare equal, resources are stolen. Otherwise, pattern is shared and block values are moved into newly allocated storage.
◆ ~Matrix()
| Dune::Experimental::Matrix< B, P, A >::~Matrix | ( | ) |
Destructor releases owned block storage.
Member Function Documentation
◆ allocateData() [1/2]
| auto Dune::Experimental::Matrix< B, P, A >::allocateData | ( | const Alloc & | alloc, |
| size_type | count, | ||
| ConstructFn && | construct_fn | ||
| ) | -> block_iter_type |
◆ allocateData() [2/2]
| auto Dune::Experimental::Matrix< B, P, A >::allocateData | ( | const Alloc & | alloc, |
| size_type | count, | ||
| ConstructFn && | construct_fn, | ||
| RestoreFn && | restore_fn | ||
| ) | -> block_iter_type |
◆ axpy() [1/2]
|
inherited |
Compute \(this \leftarrow this + \alpha b\).
◆ axpy() [2/2]
|
inherited |
◆ begin() [1/2]
|
inlineinherited |
Return iterator to the first row.
◆ begin() [2/2]
|
inlineinherited |
Return const iterator to the first row.
◆ blockIter() [1/2]
|
inlineprotectedinherited |
Return the underlying block iterator.
◆ blockIter() [2/2]
|
inlineprotectedinherited |
Return the underlying block iterator as a const iterator.
◆ cbegin()
|
inlineinherited |
Return const iterator to the first row.
◆ cend()
|
inlineinherited |
Return const iterator one past the last row.
◆ end() [1/2]
|
inlineinherited |
Return iterator one past the last row.
◆ end() [2/2]
|
inlineinherited |
Return const iterator one past the last row.
◆ exists()
|
inlineinherited |
Test whether position \((i,j)\) is present in the sparsity pattern.
This checks structural existence only. It does not inspect value magnitude.
- Exceptions
-
BCRSMatrixError if \(i\) or \(j\) is out of range if DUNE_ISTL_WITH_CHECKING is defined.
◆ frobenius_norm()
|
inherited |
Return the Frobenius norm \(\|A\|_F\).
◆ frobenius_norm2()
|
inherited |
Return \(\|A\|_F^2\) (sum of squared block Frobenius norms).
◆ get_allocator()
| auto Dune::Experimental::Matrix< B, P, A >::get_allocator | ( | ) | const |
Return the allocator currently associated with this matrix.
◆ infinity_norm()
|
inherited |
Return the block-aware infinity norm.
◆ infinity_norm_real()
|
inherited |
Return simplified infinity norm (Manhattan norm for complex values).
infinity norm (maximum of absolute values of entries)
◆ M()
|
inlineinherited |
Number of block columns.
◆ mmhv()
|
inherited |
Compute \(y \mathrel{-}= A^H x\) (Hermitian transpose).
◆ mmtv()
|
inherited |
Compute \(y \mathrel{-}= A^T x\).
◆ mmv()
|
inherited |
Compute \(y \mathrel{-}= Ax\).
◆ mtv()
|
inherited |
Compute \(y = A^T x\).
◆ mv()
|
inherited |
Compute \(y = Ax\).
◆ N()
|
inlineinherited |
Number of block rows.
◆ nonzeroes()
|
inlineinherited |
Number of stored block entries.
This is the number of structurally present entries, i.e., entries that may be nonzero.
◆ operator*=()
|
inherited |
Scale all stored blocks by k.
◆ operator+=() [1/2]
|
inherited |
Add another matrix view to this one.
- Parameters
-
b The matrix to add to this one. Its sparsity pattern has to be subset of the sparsity pattern of this matrix.
◆ operator+=() [2/2]
|
inherited |
◆ operator-=() [1/2]
|
inherited |
Subtract another matrix view from this one.
- Parameters
-
b The matrix to subtract from this one. Its sparsity pattern has to be subset of the sparsity pattern of this matrix.
◆ operator-=() [2/2]
|
inherited |
◆ operator/=()
|
inherited |
Divide all stored blocks by k.
◆ operator=() [1/2]
| Matrix< B, P, A > & Dune::Experimental::Matrix< B, P, A >::operator= | ( | const Matrix< B, P, A > & | other | ) |
Copy assignment.
Provides strong exception safety for block storage replacement.
◆ operator=() [2/2]
| Matrix< B, P, A > & Dune::Experimental::Matrix< B, P, A >::operator= | ( | Matrix< B, P, A > && | other | ) |
Move assignment.
Transfers owned resources from other according to allocator propagation rules.
◆ operator[]() [1/2]
|
inlineinherited |
Return a mutable view of row i.
◆ operator[]() [2/2]
|
inlineinherited |
Return a const view of row i.
◆ pattern()
|
inlineinherited |
◆ patternPtr()
|
inlineprotectedinherited |
Return the underlying pattern pointer.
◆ patternStorage()
|
inline |
Get shared storage of the pattern.
◆ resetView()
|
inlineprotectedinherited |
Reset the view to point to block_iter and pattern_ptr.
◆ swap()
| void Dune::Experimental::Matrix< B, P, A >::swap | ( | Matrix< B, P, A > & | other | ) |
Swap contents of this matrix with other, honoring allocator swap propagation traits.
◆ umhv()
|
inherited |
Compute \(y \mathrel{+}= A^H x\) (Hermitian transpose).
◆ umtv()
|
inherited |
Compute \(y \mathrel{+}= A^T x\).
◆ umv()
|
inherited |
Compute \(y \mathrel{+}= Ax\).
◆ usmhv()
|
inherited |
Compute \(y \mathrel{+}= \alpha A^H x\) (Hermitian transpose).
◆ usmtv()
|
inherited |
Compute \(y \mathrel{+}= \alpha A^T x\).
◆ usmv()
|
inherited |
Compute \(y \mathrel{+}= \alpha Ax\).
Friends And Related Symbol Documentation
◆ swap
|
friend |
Swap contents of lhs and rhs, honoring allocator swap propagation traits.
The documentation for this class was generated from the following file:
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8