Go to the documentation of this file.
3 #ifndef DUNE_ISTL_BDMATRIX_HH
4 #define DUNE_ISTL_BDMATRIX_HH
8 #include <dune/common/rangeutilities.hh>
9 #include <dune/common/scalarmatrixview.hh>
28 template <
class B,
class A=std::allocator<B> >
36 using field_type =
typename Imp::BlockTraits<B>::field_type;
51 static constexpr
unsigned int blocklevel = Imp::BlockTraits<B>::blockLevel()+1;
59 for (
int i=0; i<size; i++)
64 for (
int i=0; i<size; i++)
72 BDMatrix (std::initializer_list<B>
const &list)
76 for (
auto it = list.begin(); it != list.end(); ++it, ++i)
87 for (
auto i : range(size))
92 for (
auto i : range(size))
116 void solve (V& x,
const V& rhs)
const {
119 auto&& xv = Impl::asVector(x[i]);
120 auto&& rhsv = Impl::asVector(rhs[i]);
121 Impl::asMatrix((*
this)[i][i]).solve(xv,rhsv);
128 Impl::asMatrix((*
this)[i][i]).
invert();
142 void endrowsizes () {}
144 void endindices () {}
void endindices()
indicate that all indices are defined, check consistency
Definition: bcrsmatrix.hh:1206
Col col
Definition: matrixmatrix.hh:349
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition: bcrsmatrix.hh:819
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition: bdmatrix.hh:36
BDMatrix & operator=(const BDMatrix &other)
assignment
Definition: bdmatrix.hh:99
void invert()
Inverts the matrix.
Definition: bdmatrix.hh:126
void solve(V &x, const V &rhs) const
Solve the system Ax=b in O(n) time.
Definition: bdmatrix.hh:116
BDMatrix(std::initializer_list< B > const &list)
Construct from a std::initializer_list.
Definition: bdmatrix.hh:72
B block_type
export the type representing the components
Definition: bdmatrix.hh:39
void addindex(size_type row, size_type col)
add index (row,col) to the matrix
Definition: bcrsmatrix.hh:1149
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition: bcrsmatrix.hh:869
void setrowsize(size_type i, size_type s)
Set number of indices in row i to s.
Definition: bcrsmatrix.hh:1075
BDMatrix()
Default constructor.
Definition: bdmatrix.hh:54
@ random
Build entries randomly.
Definition: bcrsmatrix.hh:488
Implementation of the BCRSMatrix class.
A sparse block matrix with compressed row storage.
Definition: bcrsmatrix.hh:424
A::size_type size_type
implement row_type with compressed vector
Definition: bdmatrix.hh:48
A block-diagonal matrix.
Definition: bdmatrix.hh:29
size_type N() const
number of rows (counted in blocks)
Definition: bcrsmatrix.hh:1930
Definition: allocator.hh:7
void endrowsizes()
indicate that size of all rows is defined
Definition: bcrsmatrix.hh:1107
BDMatrix(int size)
Definition: bdmatrix.hh:56
static constexpr unsigned int blocklevel
increment block level counter
Definition: bdmatrix.hh:51
A allocator_type
export the allocator type
Definition: bdmatrix.hh:42
void setSize(size_type size)
Resize the matrix. Invalidates the content!
Definition: bdmatrix.hh:81