1#ifndef DUNE_FEM_BASEFUNCTIONSET_FUNCTOR_HH
2#define DUNE_FEM_BASEFUNCTIONSET_FUNCTOR_HH
4#include <dune/common/fmatrix.hh>
5#include <dune/common/fvector.hh>
20 inline void axpy (
const T &a,
const T &x, T &y );
22 template<
class K,
int SIZE >
23 inline void axpy (
const typename FieldTraits< K >::field_type &a,
24 const FieldVector< K, SIZE > &x,
25 FieldVector< K, SIZE > &y );
27 template<
class K,
int ROWS,
int COLS >
28 inline void axpy (
const typename FieldTraits< K >::field_type &a,
29 const FieldMatrix< K, ROWS, COLS > &x,
30 FieldMatrix< K, ROWS, COLS > &y );
38 inline void axpy (
const T &a,
const T &x, T &y )
43 template<
class K,
int SIZE >
44 inline void axpy (
const typename FieldTraits< K >::field_type &a,
45 const FieldVector< K, SIZE > &x,
46 FieldVector< K, SIZE > &y )
48 for(
int i = 0; i < SIZE; ++i )
49 axpy( a, x[ i ], y[ i ] );
52 template<
class K,
int ROWS,
int COLS >
53 inline void axpy (
const typename FieldTraits< K >::field_type &a,
54 const FieldMatrix< K, ROWS, COLS > &x,
55 FieldMatrix< K, ROWS, COLS > &y )
65 inline double scalarProduct (
const double &a,
const double &b ) {
return a * b; }
73 template<
class K,
int ROWS,
int COLS >
74 inline K
scalarProduct (
const FieldMatrix< K, ROWS, COLS > &a,
const FieldMatrix< K, ROWS, COLS > &b )
77 for(
int r = 0; r < ROWS; ++r )
82 template<
class K,
int ROWS,
int COLS,
int R >
83 inline K
scalarProduct (
const FieldVector< FieldMatrix< K, ROWS, COLS >, R> &a,
const FieldVector< FieldMatrix< K, ROWS, COLS >, R> &b )
86 for (
int i=0; i<R; ++i)
87 for(
int r = 0; r < ROWS; ++r )
88 s += a[ i ][ r ] * b[ i ][ r ];
92 template<
class K,
int ROWS,
int COLS,
int R >
96 for (
int i=0; i<R; ++i)
97 for(
int r = 0; r < ROWS; ++r )
98 s += a[ i ][ r ] * b[ i ][ r ];
106 template<
class Vector,
class Value >
117 axpy( vector_[ i ], v, value_ );
121 const Vector &vector_;
130 template<
class Value,
class Vector >
Definition: bindguard.hh:11
double scalarProduct(const double &a, const double &b)
Definition: space/basisfunctionset/functor.hh:65
void axpy(const T &a, const T &x, T &y)
Definition: space/basisfunctionset/functor.hh:38
Definition: explicitfieldvector.hh:75
Definition: space/basisfunctionset/functor.hh:108
AxpyFunctor(const Vector &vector, Value &value)
Definition: space/basisfunctionset/functor.hh:109
void operator()(const std::size_t i, const V &v)
Definition: space/basisfunctionset/functor.hh:115
Definition: space/basisfunctionset/functor.hh:132
FunctionalAxpyFunctor(const Value &value, Vector &vector)
Definition: space/basisfunctionset/functor.hh:133
void operator()(const std::size_t i, const V &v)
Definition: space/basisfunctionset/functor.hh:139