dune-istl 2.12-git
Loading...
Searching...
No Matches
Dune::Experimental::BCRSMatrix< B, I, A > Class Template Reference

Block compressed row storage matrix. More...

#include <dune/istl/experimental/bcrsmatrix.hh>

Inheritance diagram for Dune::Experimental::BCRSMatrix< B, I, A >:
Inheritance graph

Classes

struct  CompressionStatistics
 
class  CreateIterator
 Row-wise build API. More...
 

Public Types

enum  BuildMode : uint_least8_t { row_wise = 0 , random = 1 , implicit = 1 , unknown }
 Available matrix construction modes. More...
 
using allocator_type = A
 Type of the allocator used for memory management.
 
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

 BCRSMatrix (const Matrix< B, SparseIndexRanges< I >, A > &other, const allocator_type &allocator=allocator_type())
 Construct an BCRSMatrix from another Matrix.
 
 BCRSMatrix (Matrix< B, SparseIndexRanges< I >, A > &&other, const allocator_type &allocator=allocator_type())
 Move-construct an BCRSMatrix from another Matrix.
 
 BCRSMatrix (const BCRSMatrix &other, const allocator_type &allocator=allocator_type())
 Copy-construct an BCRSMatrix from another matrix.
 
 BCRSMatrix (BCRSMatrix &&other, const allocator_type &allocator=allocator_type())
 
BCRSMatrix< B, I, A > & operator= (const BCRSMatrix &other)
 Copy-assign an BCRSMatrix from another matrix.
 
BCRSMatrix< B, I, A > & operator= (BCRSMatrix &&other)
 Move-assign matrix storage while respecting allocator propagation rules.
 
 BCRSMatrix (size_type rows, size_type cols, BuildMode bm, const allocator_type &allocator=allocator_type())
 Construct a matrix with a pre-selected build mode and dimensions.
 
 BCRSMatrix (size_type rows, size_type cols, size_type nnz, BuildMode bm, const allocator_type &allocator=allocator_type())
 Construct a matrix with a pre-selected build mode, dimensions, and expected non-zero entries.
 
 BCRSMatrix (size_type rows, size_type cols, size_type avg, double overflowRatio, BuildMode bm, const allocator_type &allocator=allocator_type())
 Construct a matrix with a pre-selected build mode, dimensions, and expected non-zero entries.
 
void swap (BCRSMatrix &other)
 Swap the contents of two matrices, respecting allocator propagation rules.
 
void setBuildMode (BuildMode bm)
 Reset the matrix and select a new build mode.
 
BuildMode buildMode () const
 Return the currently active build mode.
 
void setSize (size_type rows, size_type cols, size_type nnz=0)
 Set the expected matrix dimensions for the currently selected build mode.
 
void setrowsize (size_type row, size_type size)
 Random/implicit build API, mirroring the historic BCRSMatrix interface.
 
void incrementrowsize (size_type row, size_type increment=1)
 Increment the expected number of non-zero entries in a row for random/implicit build.
 
void endrowsizes ()
 Finalize the row-size declaration phase.
 
void addindex (size_type row, size_type col)
 Insert the col index into a sparse row during implicit/random build.
 
void endindices ()
 Finalize the sparsity pattern and make the matrix ready for value access.
 
template<typename It >
void setIndicesNoSort (size_type row, It begin, It end)
 Set all column indices for row from the given iterator range on row-wise build mode.
 
template<typename It >
void setIndices (size_type row, It begin, It end)
 Set all column indices for row from the given iterator range row-wise build mode.
 
CreateIterator createbegin ()
 Begin row-wise construction.
 
SequencedPatternBuilder::EndSentinel createend ()
 End sentinel for row-wise construction.
 
DefaultBlockAssgnment entry (size_type row, size_type col)
 Insert an index in implicit/random build mode.
 
CompressionStatistics compress ()
 Finalize implicit/random build and return compression statistics.
 
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 (BCRSMatrix &lhs, BCRSMatrix &rhs)
 Swap the contents of two matrices, respecting allocator propagation rules.
 

Detailed Description

template<class B, class I = uint_least32_t, class A = std::allocator<B>>
class Dune::Experimental::BCRSMatrix< B, I, A >

Block compressed row storage matrix.

BCRSMatrix is an sparse matrix inheriting from the Matrix class explicitly instantiated with SparseIndexRanges as the pattern type. It is designed to be a modernized, allocator-aware replacement for BCRSMatrix that preserves the familiar matrix interface and build workflow while improving performance and control over construction and ownership.

What stays familiar compared to BCRSMatrix
  • Constructors with same syntax and similar semantics.
  • Row-wise and random/implicit build modes.
  • Matrix/vector vector operations are compatible with existing DUNE algorithms and tests.
What is different from BCRSMatrix
  • There is an extra template parameter for the index type used to store the column indices whose default type is uint_least32_t which saves around 25% of memory.
  • The matrix is an allocator aware container, usable with statefull allocators.
  • The matrix is now movable without copying internal data.
  • There is no build stage related structures or methods.
  • The rows are now proxy objects created on demand which means that mutable references to rows objects are not possible anymore.
  • Mutable and constant row iterators are now different.
  • The pattern is internally built with with the SparseIndexRanges builders. While it offers the same syntax, there are a few differences to be aware of:
    • The build mode switches to unknown after the pattern construction is finalized. Thus, if the user needs to fill the matrix in multiple stages, they need to select the build mode again.
    • Pattern is entirely decoupled from the matrix, allowing to share the pattern on other types, e.g., for a matrix in lower precision.
    • The entire pattern, including sizes and row pointers, is shared when copying the matrix.
    • Implicit and row-wise build modes are essentially the same under the hood.
    • All build modes grow the pattern dynamically and are compressed once finalized.
    • The implicit build mode does not support storing blocks during the pattern construction. In order to support the same syntax as the BCRSMatrix implicit build mode, the entry(i, j) method that only accepts assignment of values that equal to default constructed blocks.
    • The setSize() method should be used after selecting the build mode and before the pattern construction is finalized.
    • The N() and M() methods are not available during the pattern construction.
    • The type of the createend() iterator is a sentinel comparable with the corresponding createbegin() iterator, but their type is not the same.
Build modes
Todo:
Implement setIndicesNoSort and setIndicesSorted methods for row-wise build mode.

Member Typedef Documentation

◆ allocator_type

template<class B , class I = uint_least32_t, class A = std::allocator<B>>
using Dune::Experimental::BCRSMatrix< B, I, A >::allocator_type = A

Type of the allocator used for memory management.

◆ block_iter_type

using Dune::Experimental::MatrixView< B, P >::block_iter_type = B
inherited

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>
inherited

The type of blocks in the matrix.

◆ ColIterator

using Dune::Experimental::MatrixView< B, P >::ColIterator = typename row_type::iterator
inherited

The type of mutable row iterators over the column blocks.

◆ const_iterator

using Dune::Experimental::MatrixView< B, P >::const_iterator = ConstIterator
inherited

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>
inherited

The type representing a const matrix row.

◆ ConstColIterator

using Dune::Experimental::MatrixView< B, P >::ConstColIterator = typename const_row_type::const_iterator
inherited

The type of const row iterators over the column blocks.

◆ ConstRowIterator

using Dune::Experimental::MatrixView< B, P >::ConstRowIterator = ConstIterator
inherited

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
inherited

The type of the field.

◆ iterator

using Dune::Experimental::MatrixView< B, P >::iterator = Iterator
inherited

The type of mutable matrix iterators over the rows.

◆ pattern_type

using Dune::Experimental::MatrixView< B, P >::pattern_type = P
inherited

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>
inherited

The type used for the index set of rows.

◆ row_type

The type representing a mutable matrix row.

◆ RowIterator

using Dune::Experimental::MatrixView< B, P >::RowIterator = Iterator
inherited

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>
inherited

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
inherited

The type of blocks in the matrix.

Member Enumeration Documentation

◆ BuildMode

template<class B , class I = uint_least32_t, class A = std::allocator<B>>
enum Dune::Experimental::BCRSMatrix::BuildMode : uint_least8_t

Available matrix construction modes.

The values mirror the traditional BCRSMatrix build flow, but the semantics are implemented on top of SparseIndexRanges.

Enumerator
row_wise 

Fill index sets sequentially, one row after another.

It is a good fit when rows are naturally produced in order.

Rows are initialized and then filled via createbegin and createend. The iterator returned by createbegin represents the current row and could be filled with column indices with the insert method. The iterator is incrementable to the next row until all rows are traversed, at which point comparing with the createend iterator returns true and the pattern is finalized.

random 

Build entries in arbitrary order.

In this mode, indices can be inserted in any order via the addindex or entry methods. If rows sizes are known previous to adding indices, it can be hited to the builders with the setrowsize and incrementrowsize methods. Pattern creation is finalized by calling either one of endindices or compress.

implicit 

Build entries in arbitrary order.

Same as random build mode. This is kept for legacy reasons.

unknown 

No build mode selected, or matrix construction has finished.

Constructor & Destructor Documentation

◆ BCRSMatrix() [1/7]

template<class B , class I = uint_least32_t, class A = std::allocator<B>>
Dune::Experimental::BCRSMatrix< B, I, A >::BCRSMatrix ( const Matrix< B, SparseIndexRanges< I >, A > &  other,
const allocator_type &  allocator = allocator_type() 
)
inline

Construct an BCRSMatrix from another Matrix.

◆ BCRSMatrix() [2/7]

template<class B , class I = uint_least32_t, class A = std::allocator<B>>
Dune::Experimental::BCRSMatrix< B, I, A >::BCRSMatrix ( Matrix< B, SparseIndexRanges< I >, A > &&  other,
const allocator_type &  allocator = allocator_type() 
)
inline

Move-construct an BCRSMatrix from another Matrix.

◆ BCRSMatrix() [3/7]

template<class B , class I , class A >
Dune::Experimental::BCRSMatrix< B, I, A >::BCRSMatrix ( const BCRSMatrix< B, I, A > &  other,
const allocator_type &  allocator = allocator_type() 
)

Copy-construct an BCRSMatrix from another matrix.

Warning
Internal pattern builders are not copied, so the resulting matrix is not in a build stage even if the source matrix is.
Parameters
otherThe matrix to copy from.
allocatorThe allocator to use for memory management.

◆ BCRSMatrix() [4/7]

template<class B , class I , class A >
Dune::Experimental::BCRSMatrix< B, I, A >::BCRSMatrix ( BCRSMatrix< B, I, A > &&  other,
const allocator_type &  allocator = allocator_type() 
)

Move-construct a matrix, optionally rebinding it to a different allocator. If allocators differ, block values may be moved into fresh storage.

◆ BCRSMatrix() [5/7]

template<class B , class I , class A >
Dune::Experimental::BCRSMatrix< B, I, A >::BCRSMatrix ( size_type  rows,
size_type  cols,
BuildMode  bm,
const allocator_type &  allocator = allocator_type() 
)

Construct a matrix with a pre-selected build mode and dimensions.

Parameters
rowsNumber of rows in the matrix.
colsNumber of columns in the matrix.
bmBuild mode of the pattern.

◆ BCRSMatrix() [6/7]

template<class B , class I , class A >
Dune::Experimental::BCRSMatrix< B, I, A >::BCRSMatrix ( size_type  rows,
size_type  cols,
size_type  nnz,
BuildMode  bm,
const allocator_type &  allocator = allocator_type() 
)

Construct a matrix with a pre-selected build mode, dimensions, and expected non-zero entries.

Parameters
rowsNumber of rows in the matrix.
colsNumber of columns in the matrix.
nnzExpected number of non-zero entries in the matrix.
bmBuild mode of the pattern.

◆ BCRSMatrix() [7/7]

template<class B , class I , class A >
Dune::Experimental::BCRSMatrix< B, I, A >::BCRSMatrix ( size_type  rows,
size_type  cols,
size_type  avg,
double  overflowRatio,
BuildMode  bm,
const allocator_type &  allocator = allocator_type() 
)

Construct a matrix with a pre-selected build mode, dimensions, and expected non-zero entries.

Parameters
rowsNumber of rows in the matrix.
colsNumber of columns in the matrix.
avgExpected average number of non-zero entries per row.
overflowRatioExpected ratio of overflow entries to total entries during construction.
bmBuild mode of the pattern.

Member Function Documentation

◆ addindex()

template<class B , class I , class A >
void Dune::Experimental::BCRSMatrix< B, I, A >::addindex ( size_type  row,
size_type  col 
)

Insert the col index into a sparse row during implicit/random build.

◆ allocateData() [1/2]

template<class B , class P , class A = std::allocator<B>>
template<class Alloc , class ConstructFn >
auto Dune::Experimental::Matrix< B, P, A >::allocateData ( const Alloc &  alloc,
size_type  count,
ConstructFn &&  construct_fn 
) -> block_iter_type
inherited

◆ allocateData() [2/2]

template<class B , class P , class A = std::allocator<B>>
template<class Alloc , class ConstructFn , class RestoreFn >
auto Dune::Experimental::Matrix< B, P, A >::allocateData ( const Alloc &  alloc,
size_type  count,
ConstructFn &&  construct_fn,
RestoreFn &&  restore_fn 
) -> block_iter_type
inherited

◆ axpy() [1/2]

MatrixView & Dune::Experimental::MatrixView< B, P >::axpy ( field_type  alpha,
const MatrixView< OtherB, OtherI > &  b 
)
inherited

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 
)
inherited

◆ begin() [1/2]

Iterator Dune::Experimental::MatrixView< B, P >::begin ( )
inlineinherited

Return iterator to the first row.

◆ begin() [2/2]

ConstIterator Dune::Experimental::MatrixView< B, P >::begin ( ) const
inlineinherited

Return const iterator to the first row.

◆ blockIter() [1/2]

block_iter_type Dune::Experimental::MatrixView< B, P >::blockIter ( )
inlineprotectedinherited

Return the underlying block iterator.

◆ blockIter() [2/2]

block_const_iter_type Dune::Experimental::MatrixView< B, P >::blockIter ( ) const
inlineprotectedinherited

Return the underlying block iterator as a const iterator.

◆ buildMode()

template<class B , class I , class A >
auto Dune::Experimental::BCRSMatrix< B, I, A >::buildMode ( ) const

Return the currently active build mode.

◆ cbegin()

ConstIterator Dune::Experimental::MatrixView< B, P >::cbegin ( ) const
inlineinherited

Return const iterator to the first row.

◆ cend()

ConstIterator Dune::Experimental::MatrixView< B, P >::cend ( ) const
inlineinherited

Return const iterator one past the last row.

◆ compress()

template<class B , class I , class A >
auto Dune::Experimental::BCRSMatrix< B, I, A >::compress ( )

Finalize implicit/random build and return compression statistics.

◆ createbegin()

template<class B , class I , class A >
auto Dune::Experimental::BCRSMatrix< B, I, A >::createbegin ( )

Begin row-wise construction.

◆ createend()

template<class B , class I , class A >
auto Dune::Experimental::BCRSMatrix< B, I, A >::createend ( )

End sentinel for row-wise construction.

◆ end() [1/2]

Iterator Dune::Experimental::MatrixView< B, P >::end ( )
inlineinherited

Return iterator one past the last row.

◆ end() [2/2]

ConstIterator Dune::Experimental::MatrixView< B, P >::end ( ) const
inlineinherited

Return const iterator one past the last row.

◆ endindices()

template<class B , class I , class A >
void Dune::Experimental::BCRSMatrix< B, I, A >::endindices ( )

Finalize the sparsity pattern and make the matrix ready for value access.

◆ endrowsizes()

template<class B , class I = uint_least32_t, class A = std::allocator<B>>
void Dune::Experimental::BCRSMatrix< B, I, A >::endrowsizes ( )
inline

Finalize the row-size declaration phase.

◆ entry()

template<class B , class I , class A >
auto Dune::Experimental::BCRSMatrix< B, I, A >::entry ( size_type  row,
size_type  col 
)

Insert an index in implicit/random build mode.

Warning
The object returned by this method allows assignment of block values due to legacy reasons, but it does not actually store any values. Only default constructed block values or field values are allowed to be assigned to it, otherwise, the assignment throws a RangeError exception.
Parameters
rowThe zero-based index of the sparse row to insert the index into.
colThe column index to insert into the row.
Returns
A proxy object that allows a (default constructed) assignment of a block value.

◆ exists()

bool Dune::Experimental::MatrixView< B, P >::exists ( size_type  i,
size_type  j 
) const
inlineinherited

Test whether position \((i,j)\) is present in the sparsity pattern.

This checks structural existence only. It does not inspect value magnitude.

Exceptions
BCRSMatrixErrorif \(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
inherited

Return the Frobenius norm \(\|A\|_F\).

◆ frobenius_norm2()

auto Dune::Experimental::MatrixView< B, I >::frobenius_norm2 ( ) const
inherited

Return \(\|A\|_F^2\) (sum of squared block Frobenius norms).

◆ get_allocator()

template<class B , class P , class A >
auto Dune::Experimental::Matrix< B, P, A >::get_allocator ( ) const
inherited

Return the allocator currently associated with this matrix.

◆ incrementrowsize()

template<class B , class I , class A >
void Dune::Experimental::BCRSMatrix< B, I, A >::incrementrowsize ( size_type  row,
size_type  increment = 1 
)

Increment the expected number of non-zero entries in a row for random/implicit build.

Warning
Use this before inserting indices to the pattern.
Parameters
rowThe zero-based index of the row to increment the size for.
incrementThe amount to increment the expected number of non-zero entries in the row by (default is 1).

◆ infinity_norm()

auto Dune::Experimental::MatrixView< B, I >::infinity_norm ( ) const
inherited

Return the block-aware infinity norm.

◆ infinity_norm_real()

auto Dune::Experimental::MatrixView< B, I >::infinity_norm_real ( ) const
inherited

Return simplified infinity norm (Manhattan norm for complex values).

infinity norm (maximum of absolute values of entries)

◆ M()

size_type Dune::Experimental::MatrixView< B, P >::M ( ) const
inlineinherited

Number of block columns.

◆ mmhv()

void Dune::Experimental::MatrixView< B, I >::mmhv ( const X &  x,
Y &  y 
) const
inherited

Compute \(y \mathrel{-}= A^H x\) (Hermitian transpose).

◆ mmtv()

void Dune::Experimental::MatrixView< B, I >::mmtv ( const X &  x,
Y &  y 
) const
inherited

Compute \(y \mathrel{-}= A^T x\).

◆ mmv()

void Dune::Experimental::MatrixView< B, I >::mmv ( const X &  x,
Y &  y 
) const
inherited

Compute \(y \mathrel{-}= Ax\).

◆ mtv()

void Dune::Experimental::MatrixView< B, I >::mtv ( const X &  x,
Y &  y 
) const
inherited

Compute \(y = A^T x\).

◆ mv()

void Dune::Experimental::MatrixView< B, I >::mv ( const X &  x,
Y &  y 
) const
inherited

Compute \(y = Ax\).

◆ N()

size_type Dune::Experimental::MatrixView< B, P >::N ( ) const
inlineinherited

Number of block rows.

◆ nonzeroes()

size_type Dune::Experimental::MatrixView< B, P >::nonzeroes ( ) const
inlineinherited

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)
inherited

Scale all stored blocks by k.

◆ operator+=() [1/2]

MatrixView & Dune::Experimental::MatrixView< B, P >::operator+= ( const MatrixView< OtherB, OtherI > &  b)
inherited

Add another matrix view to this one.

Parameters
bThe 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)
inherited

◆ operator-=() [1/2]

MatrixView & Dune::Experimental::MatrixView< B, P >::operator-= ( const MatrixView< OtherB, OtherI > &  b)
inherited

Subtract another matrix view from this one.

Parameters
bThe 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)
inherited

◆ operator/=()

MatrixView< B, I > & Dune::Experimental::MatrixView< B, I >::operator/= ( const field_type &  k)
inherited

Divide all stored blocks by k.

◆ operator=() [1/2]

template<class B , class I , class A >
BCRSMatrix< B, I, A > & Dune::Experimental::BCRSMatrix< B, I, A >::operator= ( BCRSMatrix< B, I, A > &&  other)

Move-assign matrix storage while respecting allocator propagation rules.

◆ operator=() [2/2]

template<class B , class I , class A >
BCRSMatrix< B, I, A > & Dune::Experimental::BCRSMatrix< B, I, A >::operator= ( const BCRSMatrix< B, I, A > &  other)

Copy-assign an BCRSMatrix from another matrix.

Warning
Internal pattern builders are not copied, so the resulting matrix is not in a build stage even if the source matrix is.
Parameters
otherThe matrix to copy from.
allocatorThe allocator to use for memory management.

◆ operator[]() [1/2]

row_type Dune::Experimental::MatrixView< B, P >::operator[] ( size_type  i)
inlineinherited

Return a mutable view of row i.

◆ operator[]() [2/2]

const_row_type Dune::Experimental::MatrixView< B, P >::operator[] ( size_type  i) const
inlineinherited

Return a const view of row i.

◆ pattern()

const pattern_type & Dune::Experimental::MatrixView< B, P >::pattern ( ) const
inlineinherited

◆ patternPtr()

pattern_type const * Dune::Experimental::MatrixView< B, P >::patternPtr ( ) const
inlineprotectedinherited

Return the underlying pattern pointer.

◆ patternStorage()

template<class B , class P , class A = std::allocator<B>>
std::shared_ptr< const pattern_type > Dune::Experimental::Matrix< B, P, A >::patternStorage ( ) const
inlineinherited

Get shared storage of the pattern.

◆ resetView()

void Dune::Experimental::MatrixView< B, P >::resetView ( block_iter_type  block_iter,
pattern_type const *  pattern_ptr 
)
inlineprotectedinherited

Reset the view to point to block_iter and pattern_ptr.

◆ setBuildMode()

template<class B , class I , class A >
void Dune::Experimental::BCRSMatrix< B, I, A >::setBuildMode ( BuildMode  bm)

Reset the matrix and select a new build mode.

Warning
This clears the current matrix storage.
Parameters
bmThe new build mode.

◆ setIndices()

template<class B , class I = uint_least32_t, class A = std::allocator<B>>
template<typename It >
void Dune::Experimental::BCRSMatrix< B, I, A >::setIndices ( size_type  row,
It  begin,
It  end 
)
inline

Set all column indices for row from the given iterator range row-wise build mode.

The iterator range has to be of the same length as the previously set row size. The entries in the iterator range do not have to be in any particular order, but must not contain duplicate values. This method will insert the indices and sort them afterwards.

Warning
Calling this method overwrites any previously set column indices!

◆ setIndicesNoSort()

template<class B , class I = uint_least32_t, class A = std::allocator<B>>
template<typename It >
void Dune::Experimental::BCRSMatrix< B, I, A >::setIndicesNoSort ( size_type  row,
It  begin,
It  end 
)
inline

Set all column indices for row from the given iterator range on row-wise build mode.

The iterator range has to be of the same length as the previously set row size. The entries in the iterator range must be sorted and must not contain duplicate values. This method will insert the indices in the given order.

Warning
Calling this method overwrites any previously set column indices!

◆ setrowsize()

template<class B , class I , class A >
void Dune::Experimental::BCRSMatrix< B, I, A >::setrowsize ( size_type  row,
size_type  size 
)

Random/implicit build API, mirroring the historic BCRSMatrix interface.

Set the expected number of non-zero entries in a row for random/implicit build.

Warning
Use this before inserting indices to the pattern.
Parameters
rowThe zero-based index of the row to set the size for.
sizeThe expected number of non-zero entries in the row.

◆ setSize()

template<class B , class I , class A >
void Dune::Experimental::BCRSMatrix< B, I, A >::setSize ( size_type  rows,
size_type  cols,
size_type  nnz = 0 
)

Set the expected matrix dimensions for the currently selected build mode.

◆ swap() [1/2]

template<class B , class I = uint_least32_t, class A = std::allocator<B>>
void Dune::Experimental::BCRSMatrix< B, I, A >::swap ( BCRSMatrix< B, I, A > &  other)
inline

Swap the contents of two matrices, respecting allocator propagation rules.

◆ swap() [2/2]

template<class B , class P , class A >
void Dune::Experimental::Matrix< B, P, A >::swap ( Matrix< B, P, A > &  other)
inherited

Swap contents of this matrix with other, honoring allocator swap propagation traits.

◆ umhv()

void Dune::Experimental::MatrixView< B, I >::umhv ( const X &  x,
Y &  y 
) const
inherited

Compute \(y \mathrel{+}= A^H x\) (Hermitian transpose).

◆ umtv()

void Dune::Experimental::MatrixView< B, I >::umtv ( const X &  x,
Y &  y 
) const
inherited

Compute \(y \mathrel{+}= A^T x\).

◆ umv()

void Dune::Experimental::MatrixView< B, I >::umv ( const X &  x,
Y &  y 
) const
inherited

Compute \(y \mathrel{+}= Ax\).

◆ usmhv()

void Dune::Experimental::MatrixView< B, I >::usmhv ( const field_type &  alpha,
const X &  x,
Y &  y 
) const
inherited

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
inherited

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
inherited

Compute \(y \mathrel{+}= \alpha Ax\).

Friends And Related Symbol Documentation

◆ swap

template<class B , class I = uint_least32_t, class A = std::allocator<B>>
void swap ( BCRSMatrix< B, I, A > &  lhs,
BCRSMatrix< B, I, A > &  rhs 
)
friend

Swap the contents of two matrices, respecting allocator propagation rules.


The documentation for this class was generated from the following file: