![]() |
Stan Math Library
2.20.0
reverse mode automatic differentiation
|
CVODES ode data holder object which is used during CVODES integration for CVODES callbacks. More...
#include <cvodes_ode_data.hpp>
Public Member Functions | |
cvodes_ode_data (const F &f, const std::vector< T_initial > &y0, const std::vector< T_param > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs) | |
Construct CVODES ode data object to enable callbacks from CVODES during ODE integration. More... | |
~cvodes_ode_data () | |
Static Public Member Functions | |
static int | cv_rhs (realtype t, N_Vector y, N_Vector ydot, void *user_data) |
Implements the function of type CVRhsFn which is the user-defined ODE RHS passed to CVODES. More... | |
static int | cv_rhs_sens (int Ns, realtype t, N_Vector y, N_Vector ydot, N_Vector *yS, N_Vector *ySdot, void *user_data, N_Vector tmp1, N_Vector tmp2) |
Implements the function of type CVSensRhsFn which is the RHS of the sensitivity ODE system. More... | |
static int | cv_jacobian_states (realtype t, N_Vector y, N_Vector fy, SUNMatrix J, void *user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3) |
Implements the function of type CVDlsJacFn which is the user-defined callback for CVODES to calculate the jacobian of the ode_rhs wrt to the states y. More... | |
Public Attributes | |
const coupled_ode_system< F, T_initial, T_param > | coupled_ode_ |
std::vector< double > | coupled_state_ |
N_Vector | nv_state_ |
N_Vector * | nv_state_sens_ |
SUNMatrix | A_ |
SUNLinearSolver | LS_ |
CVODES ode data holder object which is used during CVODES integration for CVODES callbacks.
F | type of functor for the base ode system. |
T_initial | type of initial values |
T_param | type of parameters |
Definition at line 27 of file cvodes_ode_data.hpp.
|
inline |
Construct CVODES ode data object to enable callbacks from CVODES during ODE integration.
Static callbacks are defined for the ODE RHS (cv_rhs
), the ODE sensitivity RHS (cv_rhs_sens
) and for the ODE Jacobian wrt to the states (cv_jacobian_states
).
The callbacks required by CVODES are detailled in https://computation.llnl.gov/sites/default/files/public/cvs_guide.pdf
Note: The supplied callbacks do always return 0 which flags to CVODES that the function was successfully evaluated. Errors are handled within Stan using exceptions such that any thrown error leads to the termination of the ODE integration.
[in] | f | ode functor. |
[in] | y0 | initial state of the base ode. |
[in] | theta | parameters of the base ode. |
[in] | x | continuous data vector for the ODE. |
[in] | x_int | integer data vector for the ODE. |
[in] | msgs | stream to which messages are printed. |
Definition at line 73 of file cvodes_ode_data.hpp.
|
inline |
Definition at line 101 of file cvodes_ode_data.hpp.
|
inlinestatic |
Implements the function of type CVDlsJacFn which is the user-defined callback for CVODES to calculate the jacobian of the ode_rhs wrt to the states y.
The jacobian is stored in column major format.
Definition at line 137 of file cvodes_ode_data.hpp.
|
inlinestatic |
Implements the function of type CVRhsFn which is the user-defined ODE RHS passed to CVODES.
Definition at line 113 of file cvodes_ode_data.hpp.
|
inlinestatic |
Implements the function of type CVSensRhsFn which is the RHS of the sensitivity ODE system.
Definition at line 123 of file cvodes_ode_data.hpp.
SUNMatrix stan::math::cvodes_ode_data< F, T_initial, T_param >::A_ |
Definition at line 48 of file cvodes_ode_data.hpp.
const coupled_ode_system<F, T_initial, T_param> stan::math::cvodes_ode_data< F, T_initial, T_param >::coupled_ode_ |
Definition at line 44 of file cvodes_ode_data.hpp.
std::vector<double> stan::math::cvodes_ode_data< F, T_initial, T_param >::coupled_state_ |
Definition at line 45 of file cvodes_ode_data.hpp.
SUNLinearSolver stan::math::cvodes_ode_data< F, T_initial, T_param >::LS_ |
Definition at line 49 of file cvodes_ode_data.hpp.
N_Vector stan::math::cvodes_ode_data< F, T_initial, T_param >::nv_state_ |
Definition at line 46 of file cvodes_ode_data.hpp.
N_Vector* stan::math::cvodes_ode_data< F, T_initial, T_param >::nv_state_sens_ |
Definition at line 47 of file cvodes_ode_data.hpp.