Complex custom functions not working?

Using rstan 2.32, I assumed complex numbers should be working but seem to have trouble?


sylstan <- '
functions{

 complex times_i(complex z){
    return z;
  }
}
parameters{
}
'


sm <- stan_model(model_code = sylstan)
Error in stanc(file = file, model_code = model_code, model_name = model_name,  : 
  0

Syntax error in 'string', line 2, column 1 to column 8, parsing error:

Function forward declaration, definition or "}" expected after "functions {".

I think the problem is that StanHeaders needs to catch up to RStan now. I believe we tried submitting both StanHeaders 2.32 and RStan 2.32 but StanHeaders got held up by CRAN again, so currently StanHeaders is still at 2.26 (a lot of the complex number functionality was added in 2.28). @andrjohns @hsbadr @bgoodri is that accurate or am I mistaken?

2 Likes