1#ifndef STAN_MATH_FWD_FUNCTOR_INTEGRATE_1D_GAUSS_KRONROD_HPP
2#define STAN_MATH_FWD_FUNCTOR_INTEGRATE_1D_GAUSS_KRONROD_HPP
35template <
typename F,
typename T_a,
typename T_b,
typename... Args,
38 const F &f,
const T_a &a,
const T_b &b,
double relative_tolerance,
39 double absolute_tolerance,
int max_depth, std::ostream *msgs,
40 const Args &... args) {
47 auto func = [f, msgs, relative_tolerance, absolute_tolerance, max_depth,
48 a_val, b_val](
const auto &... args_var) {
50 absolute_tolerance, max_depth, msgs,
57 ret.d_ += a.d_ * -f(a_val, 0.0, msgs,
value_of(args)...);
60 ret.d_ += b.d_ * f(b_val, 0.0, msgs,
value_of(args)...);
83template <
typename F,
typename T_a,
typename T_b,
typename... Args,
86 const F &f,
const T_a &a,
const T_b &b, std::ostream *msgs,
87 const Args &... args) {
require_any_t< is_fvar< scalar_type_t< std::decay_t< Types > > >... > require_any_st_fvar
Require any of the scalar types satisfy is_fvar.
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
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,...
auto finite_diff(const F &func, const TArgs &... args)
Construct an fvar<T> where the tangent is calculated by finite-differencing.
typename scalar_type< T >::type scalar_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Defines a static member function type which is defined to be false as the primitive scalar types cann...