function rgf_to_setpart_test ( )

%*****************************************************************************80
%
%% RGF_TO_SETPART_TEST tests RGF_TO_SETPART.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    31 December 2015
%
%  Author:
%
%    John Burkardt
%
  m = 8;

  fprintf ( 1, ' \n' );
  fprintf ( 1, 'RGF_TO_SETPART_TEST\n' );
  fprintf ( 1, '  RGF_TO_SETPART converts a balanced\n' );
  fprintf ( 1, '  sequence to a restricted growth function;\n' );

  f = [ 1, 1, 1, 1, 1, 2, 1, 3 ];

  i4vec_print ( m, f,  '  Restricted growth function:' );
%
%  Convert the RGF to a set partition.
%
  [ nsub, s, index ] = rgf_to_setpart ( m, f );

  fprintf ( 1, ' \n' );
  fprintf ( 1, '  Corresponding set partition\n' );
  fprintf ( 1, ' \n' );
  jlo = 1;
  for i = 1 : nsub
    for j = jlo : index(i)
      fprintf ( 1, '%4d', s(j) );
    end
    fprintf ( 1, '\n');
    jlo = index(i) + 1;
  end

  return
end
