1#ifndef STAN_MATH_REV_FUNCTOR_DAE_HPP
2#define STAN_MATH_REV_FUNCTOR_DAE_HPP
50template <
typename F,
typename T_yy,
typename T_yp,
typename... T_Args,
51 require_all_eigen_col_vector_t<T_yy, T_yp>* =
nullptr>
53dae_tol_impl(
const char* func,
const F& f,
const T_yy& yy0,
const T_yp& yp0,
54 double t0,
const std::vector<double>& ts,
double rtol,
double atol,
55 int64_t max_num_steps, std::ostream* msgs,
const T_Args&... args) {
69 const auto& args_ref_tuple = std::make_tuple(
to_ref(args)...);
72 std::vector<int> unused_temp{
73 0, (
check_finite(
"dae",
"DAE parameters and data", args), 0)...};
78 [&](
const auto&... args_refs) {
82 return integ(func,
dae, t0, ts);
122template <
typename F,
typename T_yy,
typename T_yp,
typename... T_Args,
125dae_tol(
const F& f,
const T_yy& yy0,
const T_yp& yp0,
double t0,
126 const std::vector<double>& ts,
double rtol,
double atol,
127 int64_t max_num_steps, std::ostream* msgs,
const T_Args&... args) {
128 return dae_tol_impl(
"dae_tol", f, yy0, yp0, t0, ts, rtol, atol, max_num_steps,
164template <
typename F,
typename T_yy,
typename T_yp,
typename... T_Args,
167dae(
const F& f,
const T_yy& yy0,
const T_yp& yp0,
double t0,
168 const std::vector<double>& ts, std::ostream* msgs,
const T_Args&... args) {
169 return dae_tol_impl(
"dae", f, yy0, yp0, t0, ts, 1.e-10, 1.e-10, 1e8, msgs,
IDAS DAE system that contains information on residual equation functor, sensitivity residual equation...
require_all_t< is_eigen_col_vector< std::decay_t< Types > >... > require_all_eigen_col_vector_t
Require all of the types satisfy is_eigen_col_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_yy, T_yp, T_Args... >, -1, 1 > > dae_tol(const F &f, const T_yy &yy0, const T_yp &yp0, double t0, const std::vector< double > &ts, double rtol, double atol, int64_t max_num_steps, std::ostream *msgs, const T_Args &... args)
Solve the DAE initial value problem f(t, y, y')=0, y(t0) = yy0, y'(t0)=yp0 at a set of times,...
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
void check_finite(const char *function, const char *name, const T_y &y)
Return true if all values in y are finite.
std::vector< Eigen::Matrix< stan::return_type_t< T_yy, T_yp, T_Args... >, -1, 1 > > dae_tol_impl(const char *func, const F &f, const T_yy &yy0, const T_yp &yp0, double t0, const std::vector< double > &ts, double rtol, double atol, int64_t max_num_steps, std::ostream *msgs, const T_Args &... args)
Solve the DAE initial value problem f(t, y, y')=0, y(t0) = yy0, y'(t0)=yp0 at a set of times,...
std::vector< Eigen::Matrix< stan::return_type_t< T_yy, T_yp, T_Args... >, -1, 1 > > dae(const F &f, const T_yy &yy0, const T_yp &yp0, double t0, const std::vector< double > &ts, std::ostream *msgs, const T_Args &... args)
Solve the DAE initial value problem f(t, y, y')=0, y(t0) = yy0, y'(t0)=yp0 at a set of times,...
void check_nonzero_size(const char *function, const char *name, const T_y &y)
Check if the specified matrix/vector is of non-zero size.
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
void check_sorted(const char *function, const char *name, const EigVec &y)
Check if the specified vector is sorted into increasing order (repeated values are okay).
void check_less(const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
Throw an exception if y is not strictly less than high.
constexpr decltype(auto) apply(F &&f, Tuple &&t, PreArgs &&... pre_args)
void check_positive_finite(const char *function, const char *name, const T_y &y)
Check if y is positive and finite.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...