Hierarchical ordinal model - for loop vs. plate

m is the maximum number of indices for a user. Please see the comment in the first line of code for how to compute it. This is just a bit of preprocessing your data. You can just use the for loop for simplicity, kind of:
m = max(intrvl[1:]-intrvl[:-1])
mask = zeros(num_users, m)
for each i in num_users:
mask[i, :intrvl[i+1]-intrvl[i]] = True

There might be bugs in my interpretation but I hope you can get the idea.