function B = matrix_mod ( A, n )

%% matrix_mod() replaces each matrix entry by its representative modulo n.
%
  [ r, c ] = size ( A );
  B = zeros ( r, c );
  for i = 1 : r
    for j = 1 : c
      B(i,j) = i4_modp ( A(i,j), n );
    end
  end

  return
end

