Hi there, I am assuming this is a simple issue, I have a matrix ‘expectations’ I want to divide all the elements by the sums of the row. So I used the following code
int Y = 10;
int A = 8;
matrix[Y, A] expectations;
real year_total;
for (t in 1:Y) {
year_total = sum(expectations[t,]);
expectations[t,] /= year_total;
}
But get the following error ‘PARSER EXPECTED: <expression>’ the manual says I should be allowed to use the /= operator between a row_vector and real, so I am unsure whats going on. Any help would be much appreciated.
I am not a Stan dev, but this really looks like a bug, especially since expectations[t,] = expectations[t,] / year_total; is OK. The compound operators are new so maybe that is something that was overlooked. Consider filing an issue at https://github.com/stan-dev/stan/issues/ (with a more minimal example of the issue).
I am in the process of making a simple reproducible example, the error occurs using stanc() call in R which I use to debug models. I am using rstan_2.17.3 StanHeaders_2.17.2, if that helps
I moved the issue to Stan, but you can get there by following the links. The problem is that we don’t support sliced lvalues in compound declare-define.