mrc-ide / drjacoby

Flexible Markov chain monte carlo via reparameterization
https://mrc-ide.github.io/drjacoby/
Other
12 stars 6 forks source link

Pass data and params by reference #24

Closed bobverity closed 3 years ago

bobverity commented 4 years ago

Can we pass by reference, as would significantly speed up when data/params are large? May not be possible given strange things we are doing with function pointers. Also should try and apply const so that user cannot modify accidentally.

bobverity commented 3 years ago

We are passing in as Rcpp objects (NumericVector, List), which it turns out are always be reference. So currently you can modify values in e.g. misc and changes will be retained when writing a C++ function, but not an R function, which is a bit weird but hopefully not a big issue.