function perm1_to_inversion_test ( )

%*****************************************************************************80
%
%% perm1_to_inversion_test() tests perm1_to_inversion().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  n = 5;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'perm1_to_inversion_test():\n' );
  fprintf ( 1, '  perm1_to_inversion(): permutation (1,...,N) => inversion.\n' );
  fprintf ( 1, '\n' );

  perm(1:n) = [ 3, 5, 1, 4, 2 ];

  ins = perm1_to_inversion ( n, perm );

  perm2 = inversion_to_perm1 ( n, ins );

  for i = 1 : n
    fprintf ( 1, '  %3d', i );
  end
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %3d', perm(i) );
  end
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %3d', ins(i) );
  end
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %3d', perm2(i) );
  end
  fprintf ( 1, '\n' );
 
  return
end
