Integrate drop-in function-wrapper

template<typename UnaryRealFunction_>
inline integrator::return_type integratecpp::integrate(UnaryRealFunction_ &&fn, const double lower, const double upper, const integrator::config_type config = {})

A drop-in replacement of integratecpp::integrator for numerical integration. Approximates an integral numerically for a functor, lower, and upper bound, using Rdqags if both bounds are are finite and Rdqagi of at least one of the bounds is infinite.

Template Parameters:

UnaryRealFunction_ – A Callable type invocable with const double and returning double.

Parameters:
  • fn – a UnaryRealFunction_ functor compatible with a const double signature.

  • lower – a double for the lower bound.

  • upper – a double for the upper bound.

  • config – an optional const reference to a integratecpp::integrator::config_type configuration parameter.

Throws:
Returns:

a integratecpp::integrator::return_type with the integration results.