Automatic Differentiation
 
Loading...
Searching...
No Matches
integrate_ode_rk45.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUNCTOR_INTEGRATE_ODE_RK45_HPP
2#define STAN_MATH_PRIM_FUNCTOR_INTEGRATE_ODE_RK45_HPP
3
7#include <ostream>
8#include <vector>
9
10namespace stan {
11namespace math {
12
16template <typename F, typename T_y0, typename T_param, typename T_t0,
17 typename T_ts>
19 const F& f, const std::vector<T_y0>& y0, const T_t0& t0,
20 const std::vector<T_ts>& ts, const std::vector<T_param>& theta,
21 const std::vector<double>& x, const std::vector<int>& x_int,
22 std::ostream* msgs = nullptr, double relative_tolerance = 1e-6,
23 double absolute_tolerance = 1e-6, int max_num_steps = 1e6) {
25 auto y = ode_rk45_tol_impl("integrate_ode_rk45", f_adapted, to_vector(y0), t0,
26 ts, relative_tolerance, absolute_tolerance,
27 max_num_steps, msgs, theta, x, x_int);
28
29 std::vector<std::vector<return_type_t<T_y0, T_param, T_t0, T_ts>>>
30 y_converted;
31 y_converted.reserve(y.size());
32 for (size_t i = 0; i < y.size(); ++i)
33 y_converted.emplace_back(to_array_1d(y[i]));
34
35 return y_converted;
36}
37
38} // namespace math
39} // namespace stan
40
41#endif
auto to_vector(T_x &&x)
Returns input matrix reshaped into a vector.
Definition to_vector.hpp:21
auto to_array_1d(T_x &&x)
Returns input matrix reshaped into a vector.
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,...
Definition ode_rk45.hpp:59
static constexpr double e()
Return the base of the natural logarithm.
Definition constants.hpp:20
auto integrate_ode_rk45(const F &f, const std::vector< T_y0 > &y0, const T_t0 &t0, const std::vector< T_ts > &ts, const std::vector< T_param > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs=nullptr, double relative_tolerance=1e-6, double absolute_tolerance=1e-6, int max_num_steps=1e6)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Wrap a functor designed for use with integrate_ode_bdf, integrate_ode_rk45, and integrate_ode_adams t...