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::integratorfor numerical integration. Approximates an integral numerically for a functor, lower, and upper bound, usingRdqagsif both bounds are are finite andRdqagiof at least one of the bounds is infinite.- Template Parameters:
UnaryRealFunction_ – A
Callabletype invocable withconst doubleand returningdouble.- Parameters:
fn – a
UnaryRealFunction_functor compatible with aconst doublesignature.lower – a
doublefor the lower bound.upper – a
doublefor the upper bound.config – an optional
constreference to aintegratecpp::integrator::config_typeconfiguration parameter.
- Throws:
throws – integratecpp::invalid_input_error if configuration parameters’ preconditions are not fulfilled.
throws – integratecpp::max_subdivision_error if the maximal number of subdivisions is reached without fulfilling required error conditions.
throws – integratecpp::roundoff_error if a roundoff error is detected which prevents the requested accuracy from being achieved.
throws – integratecpp::bad_integrand_error if extremely bad integrand behaviour is detected during integration.
throws – integratecpp::extrapolation_roundoff_error if a roundoff error is detected in the extrapolation table.
throws – integratecpp::divergence_error if the integral is deemed divergence (or slowly convergent).
throws – integratecpp::integration_runtime_error if the
Callablereturns infinite values.rethrows – caught exceptions that occur during the evaluation of the
Callable.
- Returns:
a
integratecpp::integrator::return_typewith the integration results.