1#ifndef STAN_MATH_FWD_FUNCTOR_INTEGRATE_1D_DOUBLE_EXPONENTIAL_HPP
2#define STAN_MATH_FWD_FUNCTOR_INTEGRATE_1D_DOUBLE_EXPONENTIAL_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_refinements, std::ostream *msgs,
40 const Args &... args) {
45 auto func = [f, msgs, relative_tolerance, absolute_tolerance, max_refinements,
46 a_val, b_val](
const auto &... args_var) {
48 f, a_val, b_val, relative_tolerance, absolute_tolerance,
49 max_refinements, msgs, args_var...);
54 ret.d_ += a.d_ * -f(a_val, 0.0, msgs,
value_of(args)...);
57 ret.d_ += b.d_ * f(b_val, 0.0, msgs,
value_of(args)...);
84template <
typename F,
typename T_a,
typename T_b,
typename... Args,
87 const F &f,
const T_a &a,
const T_b &b,
double relative_tolerance,
88 double absolute_tolerance,
int max_refinements, std::ostream *msgs,
89 const Args &... args) {
91 f, a, b, std::sqrt(
EPSILON), 0.0,
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.
return_type_t< T_a, T_b, Args... > integrate_1d_double_exponential_impl(const F &f, const T_a &a, const T_b &b, double relative_tolerance, double absolute_tolerance, int max_refinements, std::ostream *msgs, const Args &... args)
Compute the integral of the single variable function f from a to b using adaptive double-exponential ...
static constexpr double EPSILON
Smallest positive value.
T value_of(const fvar< T > &v)
Return the value of the specified variable.
return_type_t< T_a, T_b, Args... > integrate_1d_double_exponential_tol(const F &f, const T_a &a, const T_b &b, double relative_tolerance, double absolute_tolerance, int max_refinements, std::ostream *msgs, const Args &... args)
Return the integral of f from a to b using adaptive double-exponential quadrature,...
constexpr int INTEGRATE_1D_DOUBLE_EXPONENTIAL_MAX_REFINEMENTS
Default maximum refinement count used by integrate_1d_double_exponential when the user does not pass ...
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...