Create parameter constraint index vector inside the transformed data block

You can look at my implementation of the R %in% function in Stan here – Stan equivalent of R's %in% function

Look down in the comments for an even faster version from a real programmer.

This can help with accessing ragged arrays.