I think this is not possible in stan but I am sometimes surprised, so:
I have a lot of data and a piece of code:
pcorrect= 1.0 - 1.0 ./ ( 1.0 + exp( a[item[1:Nobs]] .* ( base + ability[id,scale]+ age*ageeffect + square(age)*age2effect - b[item] )));
the ability[id,scale] reference is the crucial piece, id is an Nobs length vec of subject references, while scale is an Nobs length vec of scale references. The code as it stands does not work, because ability[id,scale] returns a huge matrix. Is there any easy way to get it to treat [id,scale] in some kind of rowwise fashion, returning only a single real (and thus in the end a 1 dim array or vector) for every i,j pair?