function vec_gray_unrank_test ( )

%*****************************************************************************80
%
%% vec_gray_unrank_test() tests vec_gray_unrank().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 April 2009
%
%  Author:
%
%    John Burkardt
%
  n = 4;
  base = [ 2, 2, 1, 4 ];
  number = prod ( base );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'vec_gray_unrank_test():\n' );
  fprintf ( 1, '  vec_gray_unrank() unranks product space elements.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  The number of components is %d\n', n );
  fprintf ( 1, '  The number of elements is %d\n', number );
  fprintf ( 1, '  Each component has its own number of degrees of\n' );
  fprintf ( 1, '  freedom, which, for this example, are:\n' );

  rank = 7;
  a = vec_gray_unrank ( n, base, rank );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  VEC_GRAY_UNRANK reports the element of rank %d\n', rank );
  fprintf ( 1, '  is:\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %4d', a(i) );
  end
  fprintf ( 1, '\n' );
  fprintf ( 1, '\n' );

  return
end
