function trans = get_trans_multi( states)
%
% get_trans_multi( states) - compute multi-user state transition matrix
%
% for a transition from state i to state j,
% this sets trans(i,j) = 0 if the transition is not feasible,
% otherwise it sets trans(i,j) = 1.
%
% R. Perry, June 2001

global HUGE_VAL;
global Nusers;
global Memory;

c = size(states,2);

trans = zeros( c, c);

for i = 1:c
  for j = 1:c
    a = 0;
    for u = 1:Nusers
      ui = (u-1)*Memory + [1:Memory];
      a = a + all( states(ui(1:Memory-1),i) == states(ui(2:Memory),j));
      if( a ~= u)
        break;
      end
    end
    if( a == Nusers)
      trans(i,j) = 1;
    end
  end
end
