Barebone templates for implementing ODE models in TMB. Mainly to avoid Type
and double
conflicts.
Steps:
- Define the system using the example from the class
harm_osc
, the model must be able to initialize itself when taking the parameter vector as input. - Call the model with the class
ODE<Type, model<Type> >
and initialise it with- initial conditions (e.g.,
DATA_VECTOR
) - parameters (e.g.,
PARAMETER_VECTOR
) tmax
: max time of the ODE (DATA_SCALAR
)dt
: time steps (DATA_SCALAR
)
- initial conditions (e.g.,
Data is stored simply as .track
- a TMB (Eigen) vector, which can be easily reshaped, mapped to other purposed.
The system solutions and time steps can be retreived with out()
method.
Add BH
headers to the include path, e.g.,
TMB::compile("ode.cpp", paste0("-I", qsystem.file("include/", package = "BH")))