1 #ifndef PhysicsTools_Utilities_Integral_h 2 #define PhysicsTools_Utilities_Integral_h 10 template<
typename F,
typename X = no_var>
26 return p(max) -
p(min);
32 template<
typename Integrator,
typename F,
typename X = no_var>
35 f_(f), integrator_(integrator) { }
37 return integrator_(f_, min, max);
41 function(
const F &
f) : f_(
f) { }
52 template<
typename Integrator,
typename F>
55 f_(f), integrator_(integrator) { }
57 return integrator_(f_, min, max);
64 template<
typename F,
typename X = no_var>
struct Integral {
68 template<
typename X,
typename F>
73 template<
typename X,
typename F,
typename Integrator>
78 template<
typename F,
typename Integrator>
83 template<
typename X,
typename F>
85 return integral<X>(
f)(min, max);
88 template<
typename X,
typename F,
typename Integrator>
90 return integral<X>(
f, integrator)(min, max);
103 template<
typename F,
typename Integrator>
108 template<
typename F,
typename MIN,
typename MAX,
typename Integrator = no_var,
typename X = no_var>
111 f_(f), min_(min), max_(max), integrator_(integrator) { }
113 return integral<X>(f_, min_(), max_(), integrator_);
122 template<
typename F,
typename MIN,
typename MAX,
typename X>
125 f_(f), min_(min), max_(max) { }
127 return integral<X>(f_, min_(x), max_(x));
135 template<
typename F,
typename MIN,
typename MAX,
typename Integrator>
138 f_(f), min_(min), max_(max), integrator_(integrator) { }
140 return integral_f(f_, min_(x), max_(x), integrator_);
149 template<
typename F,
typename MIN,
typename MAX>
163 #define NUMERICAL_INTEGRAL(X, F, INTEGRATOR) \ 165 template<typename X> struct Integral<F, X> { \ 166 typedef NumericalIntegral<INTEGRATOR, F, X> type; \ 169 struct __useless_ignoreme 171 #define NUMERICAL_FUNCT_INTEGRAL(F, INTEGRATOR) \ 173 template<> struct Integral<F, no_var> { \ 174 typedef NumericalIntegral<INTEGRATOR, F> type; \ 177 struct __useless_ignoreme
DefIntegral(const F &f, const MIN &min, const MAX &max, const Integrator &integrator)
double operator()(double min, double max) const
IntegralStruct(const F &f)
double operator()(double x) const
double operator()(double x) const
double operator()(double min, double max) const
Integral< F >::type integral_f(const F &f, const Integrator &integrator)
DefIntegral(const F &f, const MIN &min, const MAX &max)
NumericalIntegral(const F &f, const Integrator &integrator)
IntegralStruct< F, X > type
Primitive< F, X >::type primitive(const F &f)
DefIntegral(const F &f, const MIN &min, const MAX &max, const Integrator &integrator)
Primitive< F, X >::type p
double operator()(double min, double max) const
static void set(const double &x)
double operator()(double min, double max) const
Integral< F, X >::type integral(const F &f)
IntegralStruct(const F &f)
double operator()(double x) const
DefIntegral(const F &f, const MIN &min, const MAX &max)
NumericalIntegral(const F &f, const Integrator &integrator)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
double operator()(double x) const
double operator()() const