|
dune-istl 2.12-git
|
Non-owning matrix view over external block storage and pattern. More...
#include <dune/istl/experimental/matrixview.hh>

Classes | |
| class | block_const_iter_type |
| Const block iterator adapter. More... | |
| class | ConstIterator |
| Const random-access iterator over matrix rows. More... | |
| class | Iterator |
| Mutable random-access iterator over matrix rows. More... | |
Public Types | |
| 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 | |
| MatrixView (block_iter_type block_iter, pattern_type const *pattern_ptr) noexcept | |
| Construct a view from data iterator and sparsity pattern. | |
| 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. | |
| Iterator | end () |
| Return iterator one past the last row. | |
| ConstIterator | begin () const |
| Return const iterator to the first 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. | |
| template<class OtherB , class OtherI > | |
| MatrixView & | axpy (field_type alpha, const MatrixView< OtherB, OtherI > &b) |
| Compute \(this \leftarrow this + \alpha b\). | |
| template<class X , class Y > | |
| void | mv (const X &x, Y &y) const |
| Compute \(y = Ax\). | |
| template<class X , class Y > | |
| void | umv (const X &x, Y &y) const |
| Compute \(y \mathrel{+}= Ax\). | |
| template<class X , class Y > | |
| void | mmv (const X &x, Y &y) const |
| Compute \(y \mathrel{-}= Ax\). | |
| template<class X , class Y > | |
| void | usmv (const field_type &alpha, const X &x, Y &y) const |
| Compute \(y \mathrel{+}= \alpha Ax\). | |
| template<class X , class Y > | |
| void | mtv (const X &x, Y &y) const |
| Compute \(y = A^T x\). | |
| template<class X , class Y > | |
| void | umtv (const X &x, Y &y) const |
| Compute \(y \mathrel{+}= A^T x\). | |
| template<class X , class Y > | |
| void | mmtv (const X &x, Y &y) const |
| Compute \(y \mathrel{-}= A^T x\). | |
| template<class X , class Y > | |
| void | usmtv (const field_type &alpha, const X &x, Y &y) const |
| Compute \(y \mathrel{+}= \alpha A^T x\). | |
| template<class X , class Y > | |
| void | umhv (const X &x, Y &y) const |
| Compute \(y \mathrel{+}= A^H x\) (Hermitian transpose). | |
| template<class X , class Y > | |
| void | mmhv (const X &x, Y &y) const |
| Compute \(y \mathrel{-}= A^H x\) (Hermitian transpose). | |
| template<class X , class Y > | |
| 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. | |
| template<class OtherB , class OtherI > | |
| MatrixView & | operator+= (const MatrixView< OtherB, OtherI > &b) |
| Add another matrix view to this one. | |
| template<class OtherB , class OtherI > | |
| MatrixView & | operator-= (const MatrixView< OtherB, OtherI > &b) |
| Subtract another matrix view from this one. | |
| MatrixView & | operator= (const field_type &k) |
Assign all stored blocks to scalar k. | |
| const pattern_type & | pattern () const |
| template<class OtherB , class OtherI > | |
| MatrixView< B, I > & | operator+= (const MatrixView< OtherB, OtherI > &b) |
| template<class OtherB , class OtherI > | |
| MatrixView< B, I > & | operator-= (const MatrixView< OtherB, OtherI > &b) |
| template<class OtherB , class OtherI > | |
| MatrixView< B, I > & | axpy (field_type alpha, const MatrixView< OtherB, OtherI > &b) |
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. | |
Detailed Description
class Dune::Experimental::MatrixView< B, P >
Non-owning matrix view over external block storage and pattern.
MatrixView binds two external objects:
- a random-access iterator to block values,
- a pattern that defines row offsets and column indices.
The block iterator is expected to point to at least pattern().count() blocks, which are interpreted in row-major order consistent with index ranges of pattern_type. That is, entries of row \(i\) start at an offset given by pattern().offset(i) and follow the column indices in pattern()[i].
The view does not own memory. The caller must ensure that both the data range and the pattern outlive the view. The pattern is treated as read-only for the lifetime of the view.
A pattern is a sized range of BorrowedOrderedIndexRange with three extra methods:
offset(i)counts the total number of entries in rows \(0\) to \(i-1\).count()counts the total number of entries in the matrix.range()returns the logical range of row indices.
- Template Parameters
-
B Random-access iterator type for matrix blocks. P Pattern type with row ranges and offsets.
Member Typedef Documentation
◆ block_iter_type
| using Dune::Experimental::MatrixView< B, P >::block_iter_type = B |
The iterator type used to access the blocks of the matrix.
◆ block_type
| using Dune::Experimental::MatrixView< B, P >::block_type = std::iter_value_t<block_iter_type> |
The type of blocks in the matrix.
◆ ColIterator
| using Dune::Experimental::MatrixView< B, P >::ColIterator = typename row_type::iterator |
The type of mutable row iterators over the column blocks.
◆ const_iterator
| using Dune::Experimental::MatrixView< B, P >::const_iterator = ConstIterator |
The type of const matrix iterators over the rows.
◆ const_row_type
| using Dune::Experimental::MatrixView< B, P >::const_row_type = VectorView<block_const_iter_type, row_index_range_type> |
The type representing a const matrix row.
◆ ConstColIterator
| using Dune::Experimental::MatrixView< B, P >::ConstColIterator = typename const_row_type::const_iterator |
The type of const row iterators over the column blocks.
◆ ConstRowIterator
| using Dune::Experimental::MatrixView< B, P >::ConstRowIterator = ConstIterator |
The type of const matrix iterators over the rows.
◆ field_type
| using Dune::Experimental::MatrixView< B, P >::field_type = typename FieldTraits<block_type>::field_type |
The type of the field.
◆ iterator
| using Dune::Experimental::MatrixView< B, P >::iterator = Iterator |
The type of mutable matrix iterators over the rows.
◆ pattern_type
| using Dune::Experimental::MatrixView< B, P >::pattern_type = P |
The type used for the sparsity pattern.
◆ row_index_range_type
| using Dune::Experimental::MatrixView< B, P >::row_index_range_type = std::ranges::range_value_t<pattern_type> |
The type used for the index set of rows.
◆ row_type
| using Dune::Experimental::MatrixView< B, P >::row_type = VectorView<block_iter_type, row_index_range_type> |
The type representing a mutable matrix row.
◆ RowIterator
| using Dune::Experimental::MatrixView< B, P >::RowIterator = Iterator |
The type of mutable matrix iterators over the rows.
◆ size_type
| using Dune::Experimental::MatrixView< B, P >::size_type = std::ranges::range_size_t<pattern_type> |
The type used to count elements in the row and column index sets.
◆ value_type
| using Dune::Experimental::MatrixView< B, P >::value_type = block_type |
The type of blocks in the matrix.
Constructor & Destructor Documentation
◆ MatrixView()
|
inlinenoexcept |
Construct a view from data iterator and sparsity pattern.
- Parameters
-
data Iterator to the first stored block. pattern_ptr Pointer to the external sparsity pattern.
Member Function Documentation
◆ axpy() [1/2]
| MatrixView & Dune::Experimental::MatrixView< B, P >::axpy | ( | field_type | alpha, |
| const MatrixView< OtherB, OtherI > & | b | ||
| ) |
Compute \(this \leftarrow this + \alpha b\).
◆ axpy() [2/2]
| MatrixView< B, I > & Dune::Experimental::MatrixView< B, P >::axpy | ( | field_type | alpha, |
| const MatrixView< OtherB, OtherI > & | b | ||
| ) |
◆ begin() [1/2]
|
inline |
Return iterator to the first row.
◆ begin() [2/2]
|
inline |
Return const iterator to the first row.
◆ blockIter() [1/2]
|
inlineprotected |
Return the underlying block iterator.
◆ blockIter() [2/2]
|
inlineprotected |
Return the underlying block iterator as a const iterator.
◆ cbegin()
|
inline |
Return const iterator to the first row.
◆ cend()
|
inline |
Return const iterator one past the last row.
◆ end() [1/2]
|
inline |
Return iterator one past the last row.
◆ end() [2/2]
|
inline |
Return const iterator one past the last row.
◆ exists()
|
inline |
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()
| auto Dune::Experimental::MatrixView< B, I >::frobenius_norm | ( | ) | const |
Return the Frobenius norm \(\|A\|_F\).
◆ frobenius_norm2()
| auto Dune::Experimental::MatrixView< B, I >::frobenius_norm2 | ( | ) | const |
Return \(\|A\|_F^2\) (sum of squared block Frobenius norms).
◆ infinity_norm()
| auto Dune::Experimental::MatrixView< B, I >::infinity_norm | ( | ) | const |
Return the block-aware infinity norm.
◆ infinity_norm_real()
| auto Dune::Experimental::MatrixView< B, I >::infinity_norm_real | ( | ) | const |
Return simplified infinity norm (Manhattan norm for complex values).
infinity norm (maximum of absolute values of entries)
◆ M()
|
inline |
Number of block columns.
◆ mmhv()
| void Dune::Experimental::MatrixView< B, I >::mmhv | ( | const X & | x, |
| Y & | y | ||
| ) | const |
Compute \(y \mathrel{-}= A^H x\) (Hermitian transpose).
◆ mmtv()
| void Dune::Experimental::MatrixView< B, I >::mmtv | ( | const X & | x, |
| Y & | y | ||
| ) | const |
Compute \(y \mathrel{-}= A^T x\).
◆ mmv()
| void Dune::Experimental::MatrixView< B, I >::mmv | ( | const X & | x, |
| Y & | y | ||
| ) | const |
Compute \(y \mathrel{-}= Ax\).
◆ mtv()
| void Dune::Experimental::MatrixView< B, I >::mtv | ( | const X & | x, |
| Y & | y | ||
| ) | const |
Compute \(y = A^T x\).
◆ mv()
| void Dune::Experimental::MatrixView< B, I >::mv | ( | const X & | x, |
| Y & | y | ||
| ) | const |
Compute \(y = Ax\).
◆ N()
|
inline |
Number of block rows.
◆ nonzeroes()
|
inline |
Number of stored block entries.
This is the number of structurally present entries, i.e., entries that may be nonzero.
◆ operator*=()
| MatrixView< B, I > & Dune::Experimental::MatrixView< B, I >::operator*= | ( | const field_type & | k | ) |
Scale all stored blocks by k.
◆ operator+=() [1/2]
| MatrixView & Dune::Experimental::MatrixView< B, P >::operator+= | ( | const MatrixView< OtherB, OtherI > & | b | ) |
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]
| MatrixView< B, I > & Dune::Experimental::MatrixView< B, P >::operator+= | ( | const MatrixView< OtherB, OtherI > & | b | ) |
◆ operator-=() [1/2]
| MatrixView & Dune::Experimental::MatrixView< B, P >::operator-= | ( | const MatrixView< OtherB, OtherI > & | b | ) |
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]
| MatrixView< B, I > & Dune::Experimental::MatrixView< B, P >::operator-= | ( | const MatrixView< OtherB, OtherI > & | b | ) |
◆ operator/=()
| MatrixView< B, I > & Dune::Experimental::MatrixView< B, I >::operator/= | ( | const field_type & | k | ) |
Divide all stored blocks by k.
◆ operator=()
| MatrixView< B, I > & Dune::Experimental::MatrixView< B, I >::operator= | ( | const field_type & | k | ) |
Assign all stored blocks to scalar k.
◆ operator[]() [1/2]
|
inline |
Return a mutable view of row i.
◆ operator[]() [2/2]
|
inline |
Return a const view of row i.
◆ pattern()
|
inline |
◆ patternPtr()
|
inlineprotected |
Return the underlying pattern pointer.
◆ resetView()
|
inlineprotected |
Reset the view to point to block_iter and pattern_ptr.
◆ umhv()
| void Dune::Experimental::MatrixView< B, I >::umhv | ( | const X & | x, |
| Y & | y | ||
| ) | const |
Compute \(y \mathrel{+}= A^H x\) (Hermitian transpose).
◆ umtv()
| void Dune::Experimental::MatrixView< B, I >::umtv | ( | const X & | x, |
| Y & | y | ||
| ) | const |
Compute \(y \mathrel{+}= A^T x\).
◆ umv()
| void Dune::Experimental::MatrixView< B, I >::umv | ( | const X & | x, |
| Y & | y | ||
| ) | const |
Compute \(y \mathrel{+}= Ax\).
◆ usmhv()
| void Dune::Experimental::MatrixView< B, I >::usmhv | ( | const field_type & | alpha, |
| const X & | x, | ||
| Y & | y | ||
| ) | const |
Compute \(y \mathrel{+}= \alpha A^H x\) (Hermitian transpose).
◆ usmtv()
| void Dune::Experimental::MatrixView< B, I >::usmtv | ( | const field_type & | alpha, |
| const X & | x, | ||
| Y & | y | ||
| ) | const |
Compute \(y \mathrel{+}= \alpha A^T x\).
◆ usmv()
| void Dune::Experimental::MatrixView< B, I >::usmv | ( | const field_type & | alpha, |
| const X & | x, | ||
| Y & | y | ||
| ) | const |
Compute \(y \mathrel{+}= \alpha Ax\).
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