Hi there,

I am a very basic Stan user who’s been using it for constraining cosmological models for a couple of months now.

My challenges so far have been quite simple, taking a dataset with a x, f(x) and an error σ, and compare it with my model which as an analytical expression for f(x), which I have coded in Stan, using a Gaussian likelihood.

Now, I am looking to extend my analysis using a function which cannot be easily coded in Stan, in fact, most people in my field don’t code it either as there are already pre-existing programs optimized to perform such calculations, as they are quite expensive.

In this case, the program which I am looking to use, which is called CLASS, is written in C, can be called directly from the terminal given a configuration file, and features both a Python and C++ wrapper.

I know that Stan can work with external C++ functions, but this is a wrapper for a C program which I have no idea how it works internally.

Considering that Stan has showed to perform significantly well, I would like to know how hard could it be to have Stan use the output of this program has its model, instead of a function coded in a .stan model file, consider its available wrappers.