C++ program of a Stan program


#1

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.


#2

I’d recommend using stanc from CmdStan for this purpose.


#3

Thank you but unfortunately, I am using Rstan.

Trung Dung.


#4

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

writeLines(get_cppcode(get_stanmodel(post)))

#5

Check out stanc function in rstan