Automatic Differentiation
 
Loading...
Searching...
No Matches
integrate_ode_bdf.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUNCTOR_INTEGRATE_ODE_BDF_HPP
2#define STAN_MATH_REV_FUNCTOR_INTEGRATE_ODE_BDF_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>
18std::vector<std::vector<return_type_t<T_y0, T_param, T_t0, T_ts>>>
19integrate_ode_bdf(const F& f, const std::vector<T_y0>& y0, const T_t0& t0,
20 const std::vector<T_ts>& ts,
21 const std::vector<T_param>& theta,
22 const std::vector<double>& x, const std::vector<int>& x_int,
23 std::ostream* msgs = nullptr,
24 double relative_tolerance = 1e-10,
25 double absolute_tolerance = 1e-10,
26 long int max_num_steps = 1e8) { // NOLINT(runtime/int)
28 auto y = ode_bdf_tol_impl("integrate_ode_bdf", f_adapted, to_vector(y0), t0,
29 ts, relative_tolerance, absolute_tolerance,
30 max_num_steps, msgs, theta, x, x_int);
31
32 std::vector<std::vector<return_type_t<T_y0, T_param, T_t0, T_ts>>>
33 y_converted;
34 for (size_t i = 0; i < y.size(); ++i)
35 y_converted.push_back(to_array_1d(y[i]));
36
37 return y_converted;
38}
39
40} // namespace math
41} // namespace stan
42#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.
static constexpr double e()
Return the base of the natural logarithm.
Definition constants.hpp:20
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, T_Args... >, Eigen::Dynamic, 1 > > ode_bdf_tol_impl(const char *function_name, const F &f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const T_Args &... args)
Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1,...
Definition ode_bdf.hpp:53
std::vector< std::vector< return_type_t< T_y0, T_param, T_t0, T_ts > > > integrate_ode_bdf(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-10, double absolute_tolerance=1e-10, long int max_num_steps=1e8)
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...