Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export internal model functions #168

Open
pratikunterwegs opened this issue Feb 7, 2024 · 4 comments
Open

Export internal model functions #168

pratikunterwegs opened this issue Feb 7, 2024 · 4 comments
Assignees
Labels
C++ Related to C++ code wontfix This will not be worked on

Comments

@pratikunterwegs
Copy link
Collaborator

This issue proposes that the internal ODE model functions be exposed to the user as 'unsafe' scalar versions of the updated, vectorised model functions, as detailed in #160.

For Rcpp implementations, this would involve exposing .model_*_cpp(). R-only implementations may be removed as part of this project (see #162), and if not, would require a thin wrapper accepting only scalars around .ode_model_*(), while model_*_r() would be vectorised.

This issue is planned to be taken up if a specific need for exposing these internal functions to users becomes evident.

@sdwfrost
Copy link

Hi @pratikunterwegs

Just checking whether this is the right place for this; I'm trying to demonstrate interop with Julia SciML, and all I need for this is a function that returns either the RHS of the ODE (as odin can do) or the next step for discrete models. The idea here is that if you can step through a model, you can link different models together more easily. Is it possible to return this information?

@pratikunterwegs
Copy link
Collaborator Author

Hi @sdwfrost thanks, this seems really interesting!

The deterministic model ODE systems are defined as RHS in the package headers inst/include/model_*.h - one header per model. They're FunctionObjects suitable for the Boost odeint paradigm, so might work for your use case?

We only have one discrete model for Ebola in R/model_ebola.R, but the 'next step' function is combined with a loop in model_ebola_internal().

Happy to hear any feedback on the model functions for better interoperability/more efficiency! Also, I've got Epidemics.jl as an unregistered package that mirrors this one, and would be happy to include an interop demo there.

@sdwfrost
Copy link

Thanks @pratikunterwegs! I've added an issue to my repo here as it'll take me a little while to get the boilerplate code working.

Thanks for the pointer to Epidemics.jl - I took a quick look. Have you thought about generating ModelingToolkit code rather than low level stuff?

@pratikunterwegs
Copy link
Collaborator Author

Thanks @sdwfrost - I've seen the repo before - looks interesting!

With Epidemics.jl it's mostly just a way for me to learn and keep engaged with Julia programming; I haven't looked into ModelingToolkit at all before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ Related to C++ code wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants