5#ifndef DUNE_ISTL_BDMATRIX_HH
6#define DUNE_ISTL_BDMATRIX_HH
10#include <dune/common/rangeutilities.hh>
11#include <dune/common/scalarmatrixview.hh>
31 template <
class B,
class A=std::allocator<B> >
39 using field_type =
typename Imp::BlockTraits<B>::field_type;
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 () {}
147 template<
typename B,
typename A>
151 using real_type =
typename FieldTraits<field_type>::real_type;
Helper functions for determining the vector/matrix block level.
Implementation of the BCRSMatrix class.
Col col
Definition matrixmatrix.hh:351
Definition allocator.hh:11
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
void endrowsizes()
indicate that size of all rows is defined
Definition bcrsmatrix.hh:1146
@ random
Build entries randomly.
Definition bcrsmatrix.hh:526
void endindices()
indicate that all indices are defined, check consistency
Definition bcrsmatrix.hh:1269
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:2001
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:858
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition bcrsmatrix.hh:908
A block-diagonal matrix.
Definition bdmatrix.hh:33
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bdmatrix.hh:39
A::size_type size_type
implement row_type with compressed vector
Definition bdmatrix.hh:51
BDMatrix()
Default constructor.
Definition bdmatrix.hh:54
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:42
void solve(V &x, const V &rhs) const
Solve the system Ax=b in O(n) time.
Definition bdmatrix.hh:116
A allocator_type
export the allocator type
Definition bdmatrix.hh:45
BDMatrix(int size)
Definition bdmatrix.hh:56
BDMatrix & operator=(const BDMatrix &other)
assignment
Definition bdmatrix.hh:99
void setSize(size_type size)
Resize the matrix. Invalidates the content!
Definition bdmatrix.hh:81
void invert()
Inverts the matrix.
Definition bdmatrix.hh:126
typename BDMatrix< B, A >::field_type field_type
Definition bdmatrix.hh:150
typename FieldTraits< field_type >::real_type real_type
Definition bdmatrix.hh:151