function tuple_next_fast_test ( )

%*****************************************************************************80
%
%% TUPLE_NEXT_FAST_TEST tests TUPLE_NEXT_FAST.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    04 June 2015
%
%  Author:
%
%    John Burkardt
%
  n = 2;
  m = 3;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'TUPLE_NEXT_FAST_TEST\n' );
  fprintf ( 1, '  TUPLE_NEXT_FAST returns the next "tuple", that is,\n' );
  fprintf ( 1, '  a vector of N integers, each between 1 and M.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  M = %d\n', m );
  fprintf ( 1, '  N = %d\n', n );
  fprintf ( 1, '\n' );
%
%  Initialize.
%
  rank = -1;
  base = zeros ( n, 1 );
  [ x, base ] = tuple_next_fast ( m, n, rank, base );

  rank_max = m ^ n - 1;

  for rank = 0 : rank_max

    [ x, base ] = tuple_next_fast ( m, n, rank, base );

    fprintf ( 1, '%4d  ', rank );
    for j = 1 : n
      fprintf ( 1, '%10d  ', x(j) );
    end
    fprintf ( 1, '\n' );

  end

  return
end
