dune-istl
2.7.0
|
A block-diagonal matrix. More...
#include <dune/istl/bdmatrix.hh>
Public Types | |
using | field_type = typename Imp::BlockTraits< B >::field_type |
export the type representing the field More... | |
typedef B | block_type |
export the type representing the components More... | |
typedef A | allocator_type |
export the allocator type More... | |
typedef A::size_type | size_type |
implement row_type with compressed vector More... | |
enum | BuildStage |
enum | BuildMode |
we support two modes More... | |
typedef Imp::CompressedBlockVectorWindow< B, std::allocator< B > > | row_type |
implement row_type with compressed vector More... | |
typedef ::Dune::CompressionStatistics< size_type > | CompressionStatistics |
The type for the statistics object returned by compress() More... | |
typedef RealRowIterator< row_type > | iterator |
The iterator over the (mutable matrix rows. More... | |
typedef RealRowIterator< row_type > | Iterator |
typedef Iterator | RowIterator |
rename the iterators for easier access More... | |
typedef row_type::Iterator | ColIterator |
Iterator for the entries of each row. More... | |
typedef RealRowIterator< const row_type > | const_iterator |
The const iterator over the matrix rows. More... | |
typedef RealRowIterator< const row_type > | ConstIterator |
typedef ConstIterator | ConstRowIterator |
rename the const row iterator for easier access More... | |
typedef row_type::ConstIterator | ConstColIterator |
Const iterator to the entries of a row. More... | |
Public Member Functions | |
BDMatrix () | |
Default constructor. More... | |
BDMatrix (int size) | |
BDMatrix (std::initializer_list< B > const &list) | |
Construct from a std::initializer_list. More... | |
void | setSize (size_type size) |
Resize the matrix. Invalidates the content! More... | |
BDMatrix & | operator= (const BDMatrix &other) |
assignment More... | |
BDMatrix & | operator= (const field_type &k) |
assignment from scalar More... | |
template<class V > | |
void | solve (V &x, const V &rhs) const |
Solve the system Ax=b in O(n) time. More... | |
void | invert () |
Inverts the matrix. More... | |
row_type & | operator[] (size_type i) |
random access to the rows More... | |
const row_type & | operator[] (size_type i) const |
same for read only access More... | |
Iterator | begin () |
Get iterator to first row. More... | |
ConstIterator | begin () const |
Get const iterator to first row. More... | |
Iterator | end () |
Get iterator to one beyond last row. More... | |
ConstIterator | end () const |
Get const iterator to one beyond last row. More... | |
Iterator | beforeEnd () |
ConstIterator | beforeEnd () const |
Iterator | beforeBegin () |
ConstIterator | beforeBegin () const |
void | setBuildMode (BuildMode bm) |
Sets the build mode of the matrix. More... | |
void | setSize (size_type rows, size_type columns, size_type nnz=0) |
Set the size of the matrix. More... | |
void | setImplicitBuildModeParameters (size_type _avg, double _overflow) |
Set parameters needed for creation in implicit build mode. More... | |
CreateIterator | createbegin () |
get initial create iterator More... | |
CreateIterator | createend () |
get create iterator pointing to one after the last block More... | |
void | setrowsize (size_type i, size_type s) |
Set number of indices in row i to s. More... | |
size_type | getrowsize (size_type i) const |
get current number of indices in row i More... | |
void | incrementrowsize (size_type i, size_type s=1) |
increment size of row i by s (1 by default) More... | |
void | addindex (size_type row, size_type col) |
add index (row,col) to the matrix More... | |
void | setIndices (size_type row, It begin, It end) |
Set all column indices for row from the given iterator range. More... | |
B & | entry (size_type row, size_type col) |
Returns reference to entry (row,col) of the matrix. More... | |
CompressionStatistics | compress () |
Finishes the buildstage in implicit mode. More... | |
BCRSMatrix & | operator*= (const field_type &k) |
vector space multiplication with scalar More... | |
BCRSMatrix & | operator/= (const field_type &k) |
vector space division by scalar More... | |
BCRSMatrix & | operator+= (const BCRSMatrix &b) |
Add the entries of another matrix to this one. More... | |
BCRSMatrix & | operator-= (const BCRSMatrix &b) |
Subtract the entries of another matrix from this one. More... | |
BCRSMatrix & | axpy (field_type alpha, const BCRSMatrix &b) |
Add the scaled entries of another matrix to this one. More... | |
void | mv (const X &x, Y &y) const |
y = A x More... | |
void | umv (const X &x, Y &y) const |
y += A x More... | |
void | mmv (const X &x, Y &y) const |
y -= A x More... | |
void | usmv (F &&alpha, const X &x, Y &y) const |
y += alpha A x More... | |
void | mtv (const X &x, Y &y) const |
y = A^T x More... | |
void | umtv (const X &x, Y &y) const |
y += A^T x More... | |
void | mmtv (const X &x, Y &y) const |
y -= A^T x More... | |
void | usmtv (const field_type &alpha, const X &x, Y &y) const |
y += alpha A^T x More... | |
void | umhv (const X &x, Y &y) const |
y += A^H x More... | |
void | mmhv (const X &x, Y &y) const |
y -= A^H x More... | |
void | usmhv (const field_type &alpha, const X &x, Y &y) const |
y += alpha A^H x More... | |
FieldTraits< field_type >::real_type | frobenius_norm2 () const |
square of frobenius norm, need for block recursion More... | |
FieldTraits< field_type >::real_type | frobenius_norm () const |
frobenius norm: sqrt(sum over squared values of entries) More... | |
FieldTraits< ft >::real_type | infinity_norm () const |
infinity norm (row sum norm, how to generalize for blocks?) More... | |
FieldTraits< ft >::real_type | infinity_norm () const |
infinity norm (row sum norm, how to generalize for blocks?) More... | |
FieldTraits< ft >::real_type | infinity_norm_real () const |
simplified infinity norm (uses Manhattan norm for complex values) More... | |
FieldTraits< ft >::real_type | infinity_norm_real () const |
simplified infinity norm (uses Manhattan norm for complex values) More... | |
size_type | N () const |
number of rows (counted in blocks) More... | |
size_type | M () const |
number of columns (counted in blocks) More... | |
size_type | nonzeroes () const |
number of blocks that are stored (the number of blocks that possibly are nonzero) More... | |
BuildStage | buildStage () const |
The current build stage of the matrix. More... | |
BuildMode | buildMode () const |
The currently selected build mode of the matrix. More... | |
bool | exists (size_type i, size_type j) const |
return true if (i,j) is in pattern More... | |
Static Public Attributes | |
static constexpr unsigned int | blocklevel = Imp::BlockTraits<B>::blockLevel()+1 |
increment block level counter More... | |
Protected Types | |
typedef std::map< std::pair< size_type, size_type >, B > | OverflowType |
Protected Member Functions | |
void | setWindowPointers (ConstRowIterator row) |
void | setColumnPointers (ConstRowIterator row) |
Copy row sizes from iterator range starting at row and set column index pointers for all rows. More... | |
void | setDataPointers () |
Set data pointers for all rows. More... | |
void | copyWindowStructure (const BCRSMatrix &Mat) |
Copy the window structure from another matrix. More... | |
void | deallocate (bool deallocateRows=true) |
deallocate memory of the matrix. More... | |
void | allocate (size_type rows, size_type columns, size_type allocationSize, bool allocateRows, bool allocate_data) |
Allocate memory for the matrix structure. More... | |
void | allocateData () |
void | implicit_allocate (size_type _n, size_type _m) |
organizes allocation implicit mode calculates correct array size to be allocated and sets the the window pointers to their correct positions for insertion. internally uses allocate() for the real allocation. More... | |
Protected Attributes | |
BuildMode | build_mode |
BuildStage | ready |
std::allocator< B > ::template rebind< B >::other | allocator_ |
std::allocator< B > ::template rebind< row_type >::other | rowAllocator_ |
std::allocator< B > ::template rebind< size_type >::other | sizeAllocator_ |
size_type | n |
size_type | m |
size_type | nnz_ |
size_type | allocationSize_ |
row_type * | r |
B * | a |
std::shared_ptr< size_type > | j_ |
size_type | avg |
double | overflowsize |
OverflowType | overflow |
A block-diagonal matrix.
typedef A Dune::BDMatrix< B, A >::allocator_type |
export the allocator type
typedef B Dune::BDMatrix< B, A >::block_type |
export the type representing the components
|
inherited |
Iterator for the entries of each row.
|
inherited |
The type for the statistics object returned by compress()
|
inherited |
The const iterator over the matrix rows.
|
inherited |
Const iterator to the entries of a row.
|
inherited |
|
inherited |
rename the const row iterator for easier access
using Dune::BDMatrix< B, A >::field_type = typename Imp::BlockTraits<B>::field_type |
export the type representing the field
|
inherited |
The iterator over the (mutable matrix rows.
|
inherited |
|
protectedinherited |
|
inherited |
implement row_type with compressed vector
|
inherited |
rename the iterators for easier access
typedef A::size_type Dune::BDMatrix< B, A >::size_type |
implement row_type with compressed vector
The type for the index access and the size
|
inherited |
we support two modes
|
inherited |
|
inline |
Default constructor.
|
inlineexplicit |
|
inline |
Construct from a std::initializer_list.
|
inlineinherited |
add index (row,col) to the matrix
This method can only be used when building the BCRSMatrix in random mode.
addindex adds a new column entry to the row. If this column entry already exists, nothing is done.
Don't call addindex after the setup phase is finished (after endindices is called).
|
inlineprotectedinherited |
Allocate memory for the matrix structure.
Sets the number of rows and columns of the matrix and allocates the memory needed for the storage of the matrix entries.
row | The number of rows the matrix should contain. |
columns | the number of columns the matrix should contain. |
allocationSize | The number of nonzero entries the matrix should hold (if omitted defaults to 0). |
allocateRow | Whether we have to allocate the row pointers, too. (Defaults to true) |
|
inlineprotectedinherited |
|
inlineinherited |
Add the scaled entries of another matrix to this one.
Matrix axpy operation: *this += alpha * b
alpha | Scaling factor. |
b | The matrix to add to this one. Its sparsity pattern has to be subset of the sparsity pattern of this matrix. |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Get iterator to first row.
|
inlineinherited |
Get const iterator to first row.
|
inlineinherited |
The currently selected build mode of the matrix.
|
inlineinherited |
The current build stage of the matrix.
|
inlineinherited |
Finishes the buildstage in implicit mode.
Performs compression of index and data arrays with linear complexity in the number of nonzeroes.
After calling this method, the matrix is in the built state and no more entries can be added.
|
inlineprotectedinherited |
Copy the window structure from another matrix.
|
inlineinherited |
get initial create iterator
|
inlineinherited |
get create iterator pointing to one after the last block
|
inlineprotectedinherited |
deallocate memory of the matrix.
deallocateRows | Whether we have to deallocate the row pointers, too. If false they will not be touched. (Defaults to true). |
|
inlineinherited |
Get iterator to one beyond last row.
|
inlineinherited |
Get const iterator to one beyond last row.
|
inlineinherited |
Returns reference to entry (row,col) of the matrix.
This method can only be used when the matrix is in implicit building mode.
A reference to entry (row, col) of the matrix is returned. If entry (row, col) is accessed for the first time, it is created on the fly.
This method can only be used while building the matrix, after compression operator[] gives a much better performance.
|
inlineinherited |
return true if (i,j) is in pattern
|
inlineinherited |
frobenius norm: sqrt(sum over squared values of entries)
|
inlineinherited |
square of frobenius norm, need for block recursion
|
inlineinherited |
get current number of indices in row i
|
inlineprotectedinherited |
organizes allocation implicit mode calculates correct array size to be allocated and sets the the window pointers to their correct positions for insertion. internally uses allocate() for the real allocation.
|
inlineinherited |
increment size of row i by s (1 by default)
|
inlineinherited |
infinity norm (row sum norm, how to generalize for blocks?)
|
inlineinherited |
infinity norm (row sum norm, how to generalize for blocks?)
|
inlineinherited |
simplified infinity norm (uses Manhattan norm for complex values)
|
inlineinherited |
simplified infinity norm (uses Manhattan norm for complex values)
|
inline |
Inverts the matrix.
|
inlineinherited |
number of columns (counted in blocks)
|
inlineinherited |
y -= A^H x
|
inlineinherited |
y -= A^T x
|
inlineinherited |
y -= A x
|
inlineinherited |
y = A^T x
|
inlineinherited |
y = A x
|
inlineinherited |
number of rows (counted in blocks)
|
inlineinherited |
number of blocks that are stored (the number of blocks that possibly are nonzero)
|
inlineinherited |
vector space multiplication with scalar
|
inlineinherited |
Add the entries of another matrix to this one.
b | The matrix to add to this one. Its sparsity pattern has to be subset of the sparsity pattern of this matrix. |
|
inlineinherited |
Subtract the entries of another matrix from this one.
b | The matrix to subtract from this one. Its sparsity pattern has to be subset of the sparsity pattern of this matrix. |
|
inlineinherited |
vector space division by scalar
|
inline |
assignment
|
inline |
assignment from scalar
|
inlineinherited |
random access to the rows
|
inlineinherited |
same for read only access
|
inlineinherited |
Sets the build mode of the matrix.
bm | The build mode to use. |
|
inlineprotectedinherited |
Copy row sizes from iterator range starting at row and set column index pointers for all rows.
This method does not modify the data pointers, as those are set only after building the pattern (to allow for a delayed allocation).
|
inlineprotectedinherited |
Set data pointers for all rows.
This method assumes that column pointers and row sizes have been correctly set up by a prior call to setColumnPointers().
|
inlineinherited |
Set parameters needed for creation in implicit build mode.
Use this method before setSize() to define storage behaviour of a matrix in implicit build mode
_avg | expected average number of entries per row |
_overflowsize | fraction of _n*_avg which is expected to be needed for elements that exceed _avg entries per row. |
|
inlineinherited |
Set all column indices for row from the given iterator range.
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.
Calling this method overwrites any previously set column indices!
|
inlineinherited |
Set number of indices in row i to s.
The number s may actually be larger than the true number of nonzero entries in row i. In that case, the extra memory goes wasted. You will receive run-time warnings about this, sent to the Dune::dwarn stream.
|
inlineinherited |
Set the size of the matrix.
Sets the number of rows and columns of the matrix and allocates the memory needed for the storage of the matrix entries.
rows | The number of rows the matrix should contain. |
columns | the number of columns the matrix should contain. |
nnz | The number of nonzero entries the matrix should hold (if omitted defaults to 0). Must be omitted in implicit mode. |
|
inline |
Resize the matrix. Invalidates the content!
|
inlineprotectedinherited |
|
inline |
Solve the system Ax=b in O(n) time.
ISTLError | if the matrix is singular |
|
inlineinherited |
y += A^H x
|
inlineinherited |
y += A^T x
|
inlineinherited |
y += A x
|
inlineinherited |
y += alpha A^H x
|
inlineinherited |
y += alpha A^T x
|
inlineinherited |
y += alpha A x
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
staticconstexpr |
increment block level counter
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
mutableprotectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |