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;
Implementation of the BCRSMatrix class.
Helper functions for determining the vector/matrix block level.
*The type for the index access and the size typedef A::size_type size_type
Definition bcrsmatrix.hh:497
@ random
Build entries randomly.
Definition bcrsmatrix.hh:526
Definition allocator.hh:11
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
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
Definition matrixutils.hh:24