Stan works the same way as R in that situation:
> a = 1:3
> b = 2:4
> c = matrix(1:16, c(4,4))
> c[a, b]
[,1] [,2] [,3]
[1,] 5 9 13
[2,] 6 10 14
[3,] 7 11 15What you're asking
What you're asking for goes against the behavior of multi-indexing.
What you can do is write a function:
vector dbl_idx(vector level, int[] ii, int[] jj) {
vector[size(ii)] result;
for (k in 1:size(ii))
result[k] = level[ii[k], jj[k]];
return result;
}
and then you can use
dbl_idx(level, student, season)
in place of where you think you wanted to write level[student, season].
We could, of course, build such a function directly into Stan very
easily.
- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
stan-users+...@googlegroups.com.
> To post to this group, send email to
stan-...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
> <transitions.stan><transitions.R>