Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ dae()

template<typename F , typename T_yy , typename T_yp , typename... T_Args, require_all_eigen_col_vector_t< T_yy, T_yp > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_yy, T_yp, T_Args... >, -1, 1 > > stan::math::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, { t1, t2, t3, ... } using IDAS, assuming default controls (relative tol, absolute tol, max number of steps) = (1.e-10, 1.e-10, 1e8).

f must define an operator() with the signature as: template<typename T_yy, typename T_yp, typename... T_Args> Eigen::Matrix<stan::return_type_t<T_yy, T_yp, T_Args...>, Eigen::Dynamic, 1> operator()(double t, const Eigen::Matrix<T_yy, Eigen::Dynamic, 1>& yy, const Eigen::Matrix<T_yp, Eigen::Dynamic, 1>& yp, std::ostream* msgs, const T_Args&... args);

t is the time, yy the vector-valued state, yp the vector-valued state derivative, msgs a stream for error messages, and args the optional arguments passed to the DAE solve function (which are passed through to f without modification).

Template Parameters
FType of DAE residual functor
T_yy0Type of initial state
T_yp0Type of initial state derivatives
T_ArgsTypes of pass-through parameters
Parameters
fDAE residual functor
yy0Initial state
yp0Initial state derivatives
t0Initial time
tsTimes at which to solve the DAE at. All values must be sorted and not less than t0.
[in,out]msgsthe print stream for warning messages
argsExtra arguments passed unmodified through to DAE right hand side
Returns
Solution to DAE at times ts

Definition at line 167 of file dae.hpp.