1#ifndef STAN_MATH_REV_FUNCTOR_integrate_1d_HPP
2#define STAN_MATH_REV_FUNCTOR_integrate_1d_HPP
34template <
typename F,
typename T_a,
typename T_b,
typename... Args,
37 const F &f,
const T_a &a,
const T_b &b,
double relative_tolerance,
38 std::ostream *msgs,
const Args &... args) {
39 static constexpr const char *function =
"integrate_1d";
43 [&](
auto &&integrand) {
44 return integrate(std::forward<
decltype(integrand)>(integrand),
105template <
typename F,
typename T_a,
typename T_b,
typename T_theta,
106 typename = require_any_var_t<T_a, T_b, T_theta>>
108 const F &f,
const T_a &a,
const T_b &b,
const std::vector<T_theta> &theta,
109 const std::vector<double> &x_r,
const std::vector<int> &x_i,
110 std::ostream *msgs,
const double relative_tolerance = std::sqrt(
EPSILON)) {
112 msgs, theta, x_r, x_i);
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.
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_impl(const F &f, const T_a &a, const T_b &b, double relative_tolerance, std::ostream *msgs, const Args &... args)
Return the integral of f from a to b to the given relative tolerance.
return_type_t< T_a, T_b, T_theta > integrate_1d(const F &f, const T_a &a, const T_b &b, const std::vector< T_theta > &theta, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream *msgs, const double relative_tolerance)
Compute the integral of the single variable function f from a to b to within a specified relative tol...
double integrate(const F &f, double a, double b, double relative_tolerance)
Integrate a single variable function f from a to b to within a specified relative tolerance.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Adapt the non-variadic integrate_1d arguments to the variadic integrate_1d_impl interface.