Integrating STAN with CASAL2


I’m working on integrating STAN with CASAL2 ( We’ve previously implemented ADOL-C and CPPAD as autodifferentiation minimisers and we’d like to implement STAN to provide autodiff, optimisation and MCMC capabilities.

I see no documentation on how to use STAN without the .stan file language. Is there an existing C++ interface? or someone who could provide us a small amount of assistance to understand the code points we’d need to use and objects we’d need to enumerate?


To understand how this works you might just want to take a simple .stan file, run it through CmdStan, and look at the generated c++ file. It’s a little obscure if you don’t do that.

1 Like

I’m not sure what you’re trying to do. What services did you want from Stan?

For the reverse-mode autodiff, we have an arXiv paper:

For the model concept, you an do what @sakrejda suggests or you can read the doc here:

The obstacle you might run into, depending on what you want to do, is that our optimizers and MCMC are tied directly into the Stan model concept. We’re about to add an abstract base class to make this a bit easier for others to both code against and to implement.

Thanks for the reply. We’re trying to enumerate the Stan Model concept with or own modeling platform. This would allow us to leverage STAN as an autodiff minimiser and provider of new MCMC algorithm (NUTS specifically).