Spike
Loading...
Searching...
No Matches
Integrations.h
Go to the documentation of this file.
1
6#ifndef SPIKE_INTEGRATIONS_H
7#define SPIKE_INTEGRATIONS_H
8
9#include <cmath>
10#include <functional>
11#include <gsl/gsl_math.h>
12#include <iostream>
13
14template <typename F> class gsl_function_pp : public gsl_function {
15public:
16 explicit gsl_function_pp(const F &func) : gsl_function_struct(), _func(func) {
17 function = &gsl_function_pp::invoke;
18 params = this;
19 }
20
21private:
22 const F &_func;
23 static double invoke(double x, void *params) {
24 return static_cast<gsl_function_pp *>(params)->_func(x);
25 }
26};
27
28// wrapper functions for integration routines of the gsl
29double cquad(const std::function<double(double)> &f, double a, double b,
30 double relerr, double epsabs);
31double qags(const std::function<double(double)> &f, double a, double b,
32 double relerr, double epsabs);
33double qagil(const std::function<double(double)> &f, double a, double relerr,
34 double epsabs);
35
36double heaviside(double x);
37
38
39#endif // SPIKE_INTEGRATIONS_H
Definition Integrations.h:14