Complex numbers and matrix inversion in Stan

Yeah, calling a C++ function from a Stan function is sort of unpredictable. I encountered the same thing here

Anyway, it should be possible to wrap up everything into a C++ function that calls other C++ functions to do what you want. But at the moment, the complex number support is only in CmdStan 2.23.