Stan Math Library  2.20.0
reverse mode automatic differentiation
integrate_dae.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_MAT_FUNCTOR_INTEGRATOR_DAE_HPP
2 #define STAN_MATH_REV_MAT_FUNCTOR_INTEGRATOR_DAE_HPP
3 
4 #include <stan/math/rev/meta.hpp>
7 #include <ostream>
8 #include <vector>
9 
10 namespace stan {
11 namespace math {
36 template <typename F, typename Tpar>
37 std::vector<std::vector<Tpar> > integrate_dae(
38  const F& f, const std::vector<double>& yy0, const std::vector<double>& yp0,
39  double t0, const std::vector<double>& ts, const std::vector<Tpar>& theta,
40  const std::vector<double>& x_r, const std::vector<int>& x_i,
41  const double rtol, const double atol,
42  const int64_t max_num_steps = idas_integrator::IDAS_MAX_STEPS,
43  std::ostream* msgs = nullptr) {
44  /* it doesn't matter here what values @c eq_id has, as we
45  don't allow yy0 or yp0 to be parameters */
46  const std::vector<int> dummy_eq_id(yy0.size(), 0);
47 
48  stan::math::idas_integrator solver(rtol, atol, max_num_steps);
50  f, dummy_eq_id, yy0, yp0, theta, x_r, x_i, msgs};
51 
52  dae.check_ic_consistency(t0, atol);
53 
54  return solver.integrate(dae, t0, ts);
55 }
56 } // namespace math
57 } // namespace stan
58 
59 #endif
IDAS DAE integrator.
IDAS DAE system with forward sensitivity calculation.
static constexpr int IDAS_MAX_STEPS
void check_ic_consistency(const double &t0, const double &tol)
std::vector< std::vector< Tpar > > integrate_dae(const F &f, const std::vector< double > &yy0, const std::vector< double > &yp0, double t0, const std::vector< double > &ts, const std::vector< Tpar > &theta, const std::vector< double > &x_r, const std::vector< int > &x_i, const double rtol, const double atol, const int64_t max_num_steps=idas_integrator::IDAS_MAX_STEPS, std::ostream *msgs=nullptr)
Return the solutions for a semi-explicit DAE system with residual specified by functor F...

     [ Stan Home Page ] © 2011–2018, Stan Development Team.