4#ifndef DUNE_PDELAB_GRIDOPERATOR_COMMON_DIAGONALLOCALMATRIX_HH
5#define DUNE_PDELAB_GRIDOPERATOR_COMMON_DIAGONALLOCALMATRIX_HH
19 template<
typename T,
typename W = T>
42 typedef typename BaseContainer::size_type
size_type;
45 typedef typename BaseContainer::reference
reference;
61 :
public Dune::BidirectionalIteratorFacade<iterator,value_type>
76 return _m == other.
_m &&
_i == other.
_i;
144 _container.resize(r);
152 std::fill(_container.begin(),_container.end(),t);
160 _container.assign(r,t);
172 template<
typename LFSU,
typename LFSV>
175 return getEntry(lfsv.localIndex(i),lfsu.localIndex(j));
185 template<
typename LFSU,
typename LFSV>
188 return getEntry(lfsv.localIndex(i),lfsu.localIndex(j));
194 using namespace std::placeholders;
199 std::bind(std::multiplies<T>(),x,_1)
217 template<
class X,
class R>
218 void umv (
const X& x, R& y)
const
228 template<
class X,
class R>
274 return _container[i];
289 return _container[i];
294 std::vector<T> _container;
C & accessBaseContainer(C &c)
Definition localvector.hh:368
For backward compatibility – Do not use this!
Definition adaptivity.hh:28
A dense matrix for storing data associated with the degrees of freedom of a pair of LocalFunctionSpac...
Definition diagonallocalmatrix.hh:29
BaseContainer::const_reference const_reference
The const reference type of this container.
Definition diagonallocalmatrix.hh:48
const value_type & getEntry(size_type i, size_type j) const
Direct (unmapped) access to the (i,j)-th entry of the matrix (const version).
Definition diagonallocalmatrix.hh:286
const BaseContainer & base() const
Returns the underlying storage container (const version).
Definition diagonallocalmatrix.hh:257
BaseContainer::value_type value_type
The value type of this container.
Definition diagonallocalmatrix.hh:39
BaseContainer::size_type size_type
The size type of this container.
Definition diagonallocalmatrix.hh:42
void assign(size_type r, size_type c, const T &t)
Resize the matrix and assign t to all entries.
Definition diagonallocalmatrix.hh:157
DiagonalLocalMatrix & operator*=(const T &x)
Multiplies all entries of the matrix with x.
Definition diagonallocalmatrix.hh:192
void umv(const X &x, R &y) const
y += A x
Definition diagonallocalmatrix.hh:218
iterator begin()
Definition diagonallocalmatrix.hh:109
W weight_type
The weight type of this container.
Definition diagonallocalmatrix.hh:55
BaseContainer::reference reference
The reference type of this container.
Definition diagonallocalmatrix.hh:45
T & operator()(const LFSV &lfsv, size_type i, const LFSU &lfsu, size_type j)
Access the value associated with the i-th DOF of lfsv and the j-th DOF of lfsu.
Definition diagonallocalmatrix.hh:173
WeightedAccumulationView weightedAccumulationView(weight_type weight)
Returns a weighted accumulate-only view of this matrix with the given weight.
Definition diagonallocalmatrix.hh:239
BaseContainer & base()
Returns the underlying storage container.
Definition diagonallocalmatrix.hh:248
value_type & getEntry(size_type i, size_type j)
Direct (unmapped) access to the (i,j)-th entry of the matrix.
Definition diagonallocalmatrix.hh:271
std::vector< T > BaseContainer
The type of the underlying storage container.
Definition diagonallocalmatrix.hh:36
void usmv(const value_type &alpha, const X &x, R &y) const
y += alpha A x
Definition diagonallocalmatrix.hh:229
void resize(size_type r, size_type c)
Resize the matrix.
Definition diagonallocalmatrix.hh:141
DiagonalLocalMatrix(size_type r, size_type c, const T &t)
Construct a LocalMatrix with r rows and c columns and initialize its entries with t.
Definition diagonallocalmatrix.hh:132
size_type ncols() const
Returns the number of columns.
Definition diagonallocalmatrix.hh:211
DiagonalLocalMatrix(size_type r, size_type c)
Construct a LocalMatrix with r rows and c columns.
Definition diagonallocalmatrix.hh:123
size_type nrows() const
Returns the number of rows.
Definition diagonallocalmatrix.hh:205
DiagonalLocalMatrix & operator=(const T &t)
Assign t to all entries of the matrix.
Definition diagonallocalmatrix.hh:150
iterator end()
Definition diagonallocalmatrix.hh:114
DiagonalLocalMatrix()
Default constructor.
Definition diagonallocalmatrix.hh:120
WeightedMatrixAccumulationView< DiagonalLocalMatrix > WeightedAccumulationView
An accumulate-only view of this container that automatically applies a weight to all contributions.
Definition diagonallocalmatrix.hh:58
Definition diagonallocalmatrix.hh:62
size_type _i
Definition diagonallocalmatrix.hh:105
size_type col() const
Definition diagonallocalmatrix.hh:99
void decrement()
Definition diagonallocalmatrix.hh:89
value_type & dereference() const
Definition diagonallocalmatrix.hh:79
void increment()
Definition diagonallocalmatrix.hh:84
iterator()
Definition diagonallocalmatrix.hh:64
iterator(DiagonalLocalMatrix &m, size_type i)
Definition diagonallocalmatrix.hh:69
bool equals(const iterator &other) const
Definition diagonallocalmatrix.hh:74
DiagonalLocalMatrix * _m
Definition diagonallocalmatrix.hh:104
size_type row() const
Definition diagonallocalmatrix.hh:94
An accumulate-only view on a local matrix that automatically takes into account an accumulation weigh...
Definition localmatrix.hh:22