function trans = get_trans( states, f) 
%
% get_trans( states, f) - compute state transition matrix
%
% R. Perry, June 2001

global HUGE_VAL;

[r c] = size(states);

trans = HUGE_VAL * ones( c, c);

for i = 1:c
  for j = 1:c
    if( r > 1)
      a = all( states(1:r-1,i) == states(2:r,j));
    else
      a = 0;
    end
    if( (r == 1) | (a ~= 0))
      trans(i,j) = [states(:,j)' states(r,i)] * f;
    end
  end
end
