4 #ifndef DUNE_PDELAB_GRIDOPERATOR_COMMON_DIAGONALLOCALMATRIX_HH
5 #define DUNE_PDELAB_GRIDOPERATOR_COMMON_DIAGONALLOCALMATRIX_HH
18 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);
157 void assign (size_type r, size_type c,
const T& t)
160 _container.assign(r,t);
172 template<
typename LFSU,
typename LFSV>
173 T&
operator() (
const LFSV& lfsv, size_type i,
const LFSU& lfsu, size_type j)
175 return getEntry(lfsv.localIndex(i),lfsu.localIndex(j));
185 template<
typename LFSU,
typename LFSV>
186 const T&
operator() (
const LFSV& lfsv, size_type i,
const LFSU& lfsu, size_type j)
const
188 return getEntry(lfsv.localIndex(i),lfsu.localIndex(j));
194 std::transform(_container.begin(),_container.end(),_container.begin(),std::bind1st(std::multiplies<T>(),x));
211 template<
class X,
class R>
212 void umv (
const X& x, R& y)
const
214 for (size_type i=0; i<_rows; ++i)
216 for (size_type j=0; j<_cols; j++)
222 template<
class X,
class R>
223 void usmv (
const value_type& alpha,
const X& x, R& y)
const
225 for (size_type i=0; i<_rows; ++i)
227 for (size_type j=0; j<_cols; j++)
251 const BaseContainer&
base()
const
268 return _container[i];
280 const value_type&
getEntry(size_type i, size_type j)
const
283 return _container[i];
288 std::vector<T> _container;
289 size_type _rows, _cols;
299 #endif // DUNE_PDELAB_GRIDOPERATOR_COMMON_DIAGONALLOCALMATRIX_HH
BaseContainer::const_reference const_reference
The const reference type of this container.
Definition: diagonallocalmatrix.hh:48
DiagonalLocalMatrix * _m
Definition: diagonallocalmatrix.hh:104
WeightedMatrixAccumulationView< DiagonalLocalMatrix > WeightedAccumulationView
An accumulate-only view of this container that automatically applies a weight to all contributions...
Definition: diagonallocalmatrix.hh:58
iterator end()
Definition: diagonallocalmatrix.hh:114
size_type ncols() const
Returns the number of columns.
Definition: diagonallocalmatrix.hh:205
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:280
void resize(size_type r, size_type c)
Resize the matrix.
Definition: diagonallocalmatrix.hh:141
A dense matrix for storing data associated with the degrees of freedom of a pair of LocalFunctionSpac...
Definition: diagonallocalmatrix.hh:28
DiagonalLocalMatrix & operator=(const T &t)
Assign t to all entries of the matrix.
Definition: diagonallocalmatrix.hh:150
DiagonalLocalMatrix & operator*=(const T &x)
Multiplies all entries of the matrix with x.
Definition: diagonallocalmatrix.hh:192
std::vector< T > BaseContainer
The type of the underlying storage container.
Definition: diagonallocalmatrix.hh:36
size_type nrows() const
Returns the number of rows.
Definition: diagonallocalmatrix.hh:199
BaseContainer::size_type size_type
The size type of this container.
Definition: diagonallocalmatrix.hh:42
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
iterator(DiagonalLocalMatrix &m, size_type i)
Definition: diagonallocalmatrix.hh:69
size_type _i
Definition: diagonallocalmatrix.hh:105
size_type row() const
Definition: diagonallocalmatrix.hh:94
Definition: diagonallocalmatrix.hh:60
void increment()
Definition: diagonallocalmatrix.hh:84
C & accessBaseContainer(C &c)
Definition: localvector.hh:296
void decrement()
Definition: diagonallocalmatrix.hh:89
An accumulate-only view on a local matrix that automatically takes into account an accumulation weigh...
Definition: localmatrix.hh:21
void assign(size_type r, size_type c, const T &t)
Resize the matrix and assign t to all entries.
Definition: diagonallocalmatrix.hh:157
void usmv(const value_type &alpha, const X &x, R &y) const
y += alpha A x
Definition: diagonallocalmatrix.hh:223
W weight_type
The weight type of this container.
Definition: diagonallocalmatrix.hh:55
const BaseContainer & base() const
Returns the underlying storage container (const version).
Definition: diagonallocalmatrix.hh:251
DiagonalLocalMatrix(size_type r, size_type c)
Construct a LocalMatrix with r rows and c columns.
Definition: diagonallocalmatrix.hh:123
Definition: adaptivity.hh:27
bool equals(const iterator &other) const
Definition: diagonallocalmatrix.hh:74
BaseContainer & base()
Returns the underlying storage container.
Definition: diagonallocalmatrix.hh:242
iterator()
Definition: diagonallocalmatrix.hh:64
iterator begin()
Definition: diagonallocalmatrix.hh:109
BaseContainer::value_type value_type
The value type of this container.
Definition: diagonallocalmatrix.hh:39
WeightedAccumulationView weightedAccumulationView(weight_type weight)
Returns a weighted accumulate-only view of this matrix with the given weight.
Definition: diagonallocalmatrix.hh:233
void umv(const X &x, R &y) const
y += A x
Definition: diagonallocalmatrix.hh:212
value_type & getEntry(size_type i, size_type j)
Direct (unmapped) access to the (i,j)-th entry of the matrix.
Definition: diagonallocalmatrix.hh:265
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 col() const
Definition: diagonallocalmatrix.hh:99
value_type & dereference() const
Definition: diagonallocalmatrix.hh:79
BaseContainer::reference reference
The reference type of this container.
Definition: diagonallocalmatrix.hh:45
DiagonalLocalMatrix()
Default constructor.
Definition: diagonallocalmatrix.hh:120