Rstan: Handling / reducing repeated calls to dll

@avehtari I needed a way to test the performance of the log_prob and gradient functions for some optimizations for my model. I knew it had to be possible since there is the log_prob function, so I read through the stanfit class in RStan to figure out how this was done and how to do it without first generating a stanfit object.

It’s not really a supported feature of RStan, as evidence by calling the unexposed grab_cxxfun method (the :::), but it get’s the job done!

I really think that RStan should expose a “model with data” object to make this sort of thing easier.

[edit]
I actually remembered I posted about this when I first discovered it:

1 Like