Hi everyone,
I am confused by how to test new C++ function in Rstan. Since I need to transform data and generate auxiliary matrix before sampling, I wrote a function to be used in transformed data block. It works in terminal, but how to test it in the interface? Also, it that possible for me to test my new target function for stan math library with Rstan?
Thank you very much!
Lu
If you define the function in the functions
block of a Stan program, you can test it in R by calling the expose_stan_functions
function in rstan. But that is a lower level of testing than putting something into Stan Math, which requires unit tests in the tests/ directory,
Ben
Thank you. I think I made a mistake in the description of my question. What I need is to test new C++ function for stan math library with stan language. Sorry for the confusion.
If you want to add a new function to the Stan language, the
implementation goes in stan-dev/math and the signature declaration
in stan-dev/stan. So all the testing is below the RStan level.
See: https://github.com/stan-dev/stan/wiki/Contributing-New-Functions-to-Stan
Thank you so much! Let me learn it first.
Best,
Lu