C++ program of a Stan program

Hi all,

I am using Stan and in the meanwhile learning C++. I know from the manual that C++ is behind the scene when running Stan. I am just curious about the translated C++ codes.

So my question is how we can extract the C++ code that actually runs behind the scene?

Thank you!

Kind regards,
Trung Dung.

Iā€™d recommend using stanc from CmdStan for this purpose.

Thank you but unfortunately, I am using Rstan.

Trung Dung.

get_cppcode applied to a stanmodel. So, if post is your stanfit object it would be

writeLines(get_cppcode(get_stanmodel(post)))
3 Likes

Check out stanc function in rstan