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.

Ok. I see. I already have everything in external C++ functions that returns a logLL for a set of free parameters. Can I use this as a custom logLL function in the model block?

Also, I’m figuring that simply doing everything by using std::complex won’t do the job, since I need a stan var type complex for it to work, right? Is that because of the autodiff? What exactly is the var type? And how will a complex var type variable look like?

Thanks again!

Isaac