Hi all,
I would like to convert a matrix into an array. Following this How to convert a matrix to an array of vectors?, I wrote the code as:
transformed parameters{
matrix[J,K] theta_raw;
real theta[J,K];
theta_raw = exp(a +b); // a and b are J by K dimensional matrices
for(j in 1:J){
theta[j,] = theta_raw[j,];
}
}
I am getting the following error, which I do not understand why? Please help
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
Dimension mismatch in assignment; variable name = theta, num dimensions given = 1; right-hand side dimensions = 0
Illegal statement beginning with non-void expression parsed as
theta[j, ]
Not a legal assignment, sampling, or function statement. Note that
* Assignment statements only allow variables (with optional indexes) on the left;
* Sampling statements allow arbitrary value-denoting expressions on the left.
* Functions used as statements must be declared to have void returns