1#ifndef STAN_MATH_REV_FUNCTOR_INTEGRATE_1D_GAUSS_KRONROD_HPP
2#define STAN_MATH_REV_FUNCTOR_INTEGRATE_1D_GAUSS_KRONROD_HPP
38template <
typename F,
typename T_a,
typename T_b,
typename... Args,
41 const F &f,
const T_a &a,
const T_b &b,
double relative_tolerance,
42 double absolute_tolerance,
int max_depth, std::ostream *msgs,
43 const Args &... args) {
44 static constexpr const char *function =
"integrate_1d_gauss_kronrod";
50 [&](
auto &&integrand) {
51 return integrate_gk(std::forward<
decltype(integrand)>(integrand),
53 absolute_tolerance, max_depth);
92template <
typename F,
typename T_a,
typename T_b,
typename... Args,
95 const F &f,
const T_a &a,
const T_b &b, std::ostream *msgs,
96 const Args &... args) {
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
require_any_t< is_var< scalar_type_t< std::decay_t< Types > > >... > require_any_st_var
Require any of the scalar types satisfy is_var.
return_type_t< T_a, T_b, Args... > integrate_1d_adjoint(const char *function, const F &f, const T_a &a, const T_b &b, Integrator &&integrator, std::ostream *msgs, const Args &... args)
Build the reverse-mode result of a one-dimensional adaptive quadrature.
void check_less_or_equal(const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
Throw an exception if y is not less than high.
void check_nonnegative(const char *function, const char *name, const T_y &y)
Check if y is non-negative.
static constexpr double EPSILON
Smallest positive value.
return_type_t< T_a, T_b, Args... > integrate_1d_gauss_kronrod_tol(const F &f, const T_a &a, const T_b &b, double relative_tolerance, double absolute_tolerance, int max_depth, std::ostream *msgs, const Args &... args)
Return the integral of f from a to b using adaptive Gauss-Kronrod (G21,K21) quadrature,...
constexpr int INTEGRATE_1D_GAUSS_KRONROD_MAX_DEPTH
Default recursive bisection depth used by integrate_1d_gauss_kronrod when the user does not pass one ...
T value_of(const fvar< T > &v)
Return the value of the specified variable.
return_type_t< T_a, T_b, Args... > integrate_1d_gauss_kronrod(const F &f, const T_a &a, const T_b &b, std::ostream *msgs, const Args &... args)
Return the integral of f from a to b using adaptive Gauss-Kronrod (G21,K21) quadrature,...
double integrate_gk(const F &f, double a, double b, double relative_tolerance, double absolute_tolerance, int max_depth)
Integrate a single variable function f from a to b using Boost's adaptive Gauss-Kronrod (G21,...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...