17 RealIntegrator::RealIntegrator()
18 : m_gsl_f{m_Cfunction, nullptr}, m_workspace{gsl_integration_workspace_alloc(200)}
22 RealIntegrator::~RealIntegrator()
24 gsl_integration_workspace_free(m_workspace);
27 double RealIntegrator::integrate(
const std::function<
double(
double)>& f,
double lmin,
double lmax)
29 m_gsl_f.params = (
void*)&f;
31 gsl_integration_qag(&m_gsl_f, lmin, lmax, 1e-9, 1e-7, 200, 3, m_workspace, &result, &error);
36 complex_t ComplexIntegrator::integrate(
const std::function<complex_t(
double)>& f,
double lmin,
39 return {realPart.integrate([f](
double x) {
return f(x).real(); }, lmin, lmax),
40 imagPart.integrate([f](
double x) {
return f(x).imag(); }, lmin, lmax)};
Defines classes RealIntegrator, ComplexIntegrator.