Calling an external C++ function

I’m trying to calculate the eigenvalues of a NON-symmetric matrix. I’m using rstan, which doesn’t have access to whatever is the latest version of stan with the eigenvalues function. So apparently, I have to write my own C++ function to do a simple eigendecomposition and call that function from stan. There is no damn information about stan’s C++ library. Is stan c++ a header only? If not, what are the dependencies? How can I compile it? My eigendecomposition function is 1 line of code using the Eigen library (TuxFamily). This is the same library that Stan uses for doing math operations. Can I pass my function to rstan without compiling stan c++? rstan’s stan version is 2.26, shall I go and unearth the Neolithic stan 2.26 c++ headers and whatnot? or the newest version will do?

Your best bet is probably to use the experimental versions of RStan which can be installed from source, since even wiring up a C++ implementation of the eigenvalues function won’t get you too far since they are complex numbers for non-symmetric cases

Thanks for the suggestion. First I’ll try pystan, if the stan version is archaic in Python as well, then I’ll try the experimental one. My matrix is a square positive matrix (some variation of Markov matrix) it won’t give me complex values upon decomposition, but if it is going to be a pain in the neck, I’ll give the experimental a shot.