1#ifndef STAN_MATH_FWD_FUNCTOR_INTEGRATE_1D_HPP
2#define STAN_MATH_FWD_FUNCTOR_INTEGRATE_1D_HPP
29template <
typename F,
typename T_a,
typename T_b,
typename... Args,
32 const F &f,
const T_a &a,
const T_b &b,
double relative_tolerance,
33 std::ostream *msgs,
const Args &... args) {
41 = [f, msgs, relative_tolerance, a_val, b_val](
const auto &... args_var) {
49 auto val_args = std::make_tuple(
value_of(args)...);
51 ret.d_ += math::forward_as<FvarT>(a).d_
53 [&](
auto &&... tuple_args) {
54 return -f(a_val, 0.0, msgs, tuple_args...);
59 ret.d_ += math::forward_as<FvarT>(b).d_
61 [&](
auto &&... tuple_args) {
62 return f(b_val, 0.0, msgs, tuple_args...);
89template <
typename F,
typename T_a,
typename T_b,
typename T_theta,
92 const F &f,
const T_a &a,
const T_b &b,
const std::vector<T_theta> &theta,
93 const std::vector<double> &x_r,
const std::vector<int> &x_i,
94 std::ostream *msgs,
const double relative_tolerance) {
96 msgs, theta, x_r, x_i);
require_any_t< is_fvar< std::decay_t< Types > >... > require_any_fvar_t
Require any of the types satisfy is_fvar.
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.
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...
auto finite_diff(const F &func, const TArgs &... args)
Construct an fvar<T> where the tangent is calculated by finite-differencing.
constexpr decltype(auto) apply(F &&f, Tuple &&t, PreArgs &&... pre_args)
typename scalar_type< T >::type scalar_type_t
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.
Defines a static member function type which is defined to be false as the primitive scalar types cann...