Stan Math Library  2.20.0
reverse mode automatic differentiation
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
stan::math::cvodes_ode_data< F, T_initial, T_param > Class Template Reference

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_
 

Detailed Description

template<typename F, typename T_initial, typename T_param>
class stan::math::cvodes_ode_data< F, T_initial, T_param >

CVODES ode data holder object which is used during CVODES integration for CVODES callbacks.

Template Parameters
Ftype of functor for the base ode system.
T_initialtype of initial values
T_paramtype of parameters

Definition at line 27 of file cvodes_ode_data.hpp.

Constructor & Destructor Documentation

◆ cvodes_ode_data()

template<typename F , typename T_initial , typename T_param >
stan::math::cvodes_ode_data< F, T_initial, T_param >::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 
)
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.

Parameters
[in]fode functor.
[in]y0initial state of the base ode.
[in]thetaparameters of the base ode.
[in]xcontinuous data vector for the ODE.
[in]x_intinteger data vector for the ODE.
[in]msgsstream to which messages are printed.

Definition at line 73 of file cvodes_ode_data.hpp.

◆ ~cvodes_ode_data()

template<typename F , typename T_initial , typename T_param >
stan::math::cvodes_ode_data< F, T_initial, T_param >::~cvodes_ode_data ( )
inline

Definition at line 101 of file cvodes_ode_data.hpp.

Member Function Documentation

◆ cv_jacobian_states()

template<typename F , typename T_initial , typename T_param >
static int stan::math::cvodes_ode_data< F, T_initial, T_param >::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 
)
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.

◆ cv_rhs()

template<typename F , typename T_initial , typename T_param >
static int stan::math::cvodes_ode_data< F, T_initial, T_param >::cv_rhs ( realtype  t,
N_Vector  y,
N_Vector  ydot,
void *  user_data 
)
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.

◆ cv_rhs_sens()

template<typename F , typename T_initial , typename T_param >
static int stan::math::cvodes_ode_data< F, T_initial, T_param >::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 
)
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.

Member Data Documentation

◆ A_

template<typename F , typename T_initial , typename T_param >
SUNMatrix stan::math::cvodes_ode_data< F, T_initial, T_param >::A_

Definition at line 48 of file cvodes_ode_data.hpp.

◆ coupled_ode_

template<typename F , typename T_initial , typename T_param >
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.

◆ coupled_state_

template<typename F , typename T_initial , typename T_param >
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.

◆ LS_

template<typename F , typename T_initial , typename T_param >
SUNLinearSolver stan::math::cvodes_ode_data< F, T_initial, T_param >::LS_

Definition at line 49 of file cvodes_ode_data.hpp.

◆ nv_state_

template<typename F , typename T_initial , typename T_param >
N_Vector stan::math::cvodes_ode_data< F, T_initial, T_param >::nv_state_

Definition at line 46 of file cvodes_ode_data.hpp.

◆ nv_state_sens_

template<typename F , typename T_initial , typename T_param >
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.


The documentation for this class was generated from the following file:

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