1#ifndef STAN_MATH_PRIM_FUNCTOR_ODE_RK45_HPP
2#define STAN_MATH_PRIM_FUNCTOR_ODE_RK45_HPP
53template <
typename F,
typename T_y0,
typename T_t0,
typename T_ts,
54 typename... Args, require_eigen_vector_t<T_y0>* =
nullptr>
58 T_t0 t0,
const std::vector<T_ts>& ts,
59 double relative_tolerance,
double absolute_tolerance,
60 long int max_num_steps,
61 std::ostream* msgs,
const Args&... args) {
62 const auto& args_ref_tuple = std::make_tuple(
to_ref(args)...);
64 [&](
const auto&... args_refs) {
67 integrator(function_name, f, y0_arg, t0, ts, relative_tolerance,
68 absolute_tolerance, max_num_steps, msgs, args_refs...);
111template <
typename F,
typename T_y0,
typename T_t0,
typename T_ts,
116 const std::vector<T_ts>& ts,
double relative_tolerance,
117 double absolute_tolerance,
118 long int max_num_steps,
119 std::ostream* msgs,
const Args&... args) {
121 relative_tolerance, absolute_tolerance,
122 max_num_steps, msgs, args...);
158template <
typename F,
typename T_y0,
typename T_t0,
typename T_ts,
162ode_rk45(
const F& f,
const T_y0& y0, T_t0 t0,
const std::vector<T_ts>& ts,
163 std::ostream* msgs,
const Args&... args) {
164 double relative_tolerance = 1
e-6;
165 double absolute_tolerance = 1
e-6;
166 long int max_num_steps = 1e6;
169 absolute_tolerance, max_num_steps, msgs, args...);
Integrator interface for ARKODE's ERKStep explicit adaptive Runge-Kutta solver, using one of ERKStep'...
require_t< is_eigen_vector< std::decay_t< T > > > require_eigen_vector_t
Require type satisfies is_eigen_vector.
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > ode_rk45_tol_impl(const char *function_name, const F &f, const T_y0 &y0_arg, T_t0 t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const Args &... args)
Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1,...
static constexpr double e()
Return the base of the natural logarithm.
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > ode_rk45(const F &f, const T_y0 &y0, T_t0 t0, const std::vector< T_ts > &ts, std::ostream *msgs, const Args &... args)
Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1,...
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > ode_rk45_tol(const F &f, const T_y0 &y0_arg, T_t0 t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const Args &... args)
Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1,...
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
constexpr decltype(auto) apply(F &&f, Tuple &&t, PreArgs &&... pre_args)
typename ref_type_if< true, T >::type ref_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...