...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template<class Real> class sinh_sinh { public: sinh_sinh(size_t max_refinements = 9); template<class F> auto integrate(const F f, Real tol = sqrt(std::numeric_limits<Real>::epsilon()), Real* error = nullptr, Real* L1 = nullptr, size_t* levels = nullptr)->decltype(std::declval<F>()(std::declval<Real>())) const;; };
The sinh-sinh quadrature allows computation over the entire real line, and is called as follows:
sinh_sinh<double> integrator; auto f = [](double x) { return exp(-x*x); }; double error; double L1; double Q = integrator.integrate(f, &error, &L1);
Note that the limits of integration are understood to be (-∞, ∞). Complex valued integrands are supported.