I was wondering if there is any benefit to using an array (real y[n];) over a vector (vector[n] y;).
As far as I can see the only benefit of arrays is that you can declare an integer array but not an integer vector and thus save space. But if I am working with real numbers, do I just use vectors?
With vectors I am able to vectorize (hah!) a lot more for example
price ~ normal(beta_0 + beta_1 * temp, sigma2)
is only possible when price and temp are vectors but I would have to use an explicit loop when they are arrays.
Am I overlooking something?
Cheers!
T
Arrays that are not just real numbers have their uses. If you want to extract “by row” it executes slightly faster to extract the first dimension of a two-dimensional array than a row of a matrix due to the way that the numbers are stored in memory.