function rank = ubvec_rank_gray ( n, ubvec )

%*****************************************************************************80
%
%% ubvec_rank_gray() ranks a UBVEC according to the Gray ordering.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 November 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of components of the vector.
%
%    integer UBVEC(N), the vector to be printed.
%
%  Output:
%
%    integer RANK, the rank of the BVEC.
%
  ui4 = ubvec_to_ui4 ( n, ubvec );
  rank = ui4_rank_gray ( ui4 );

  return
end

