function comp_to_ksub_test ( )

%*****************************************************************************80
%
%% comp_to_ksub_test() tests comp_to_ksub().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 December 2013
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'comp_to_ksub_test():\n' );
  fprintf ( 1, '  comp_to_ksub() returns the K subset corresponding to a composition.\n' );

  nc = 10;
  kc = 5;

  for i = 1 : 5

    fprintf ( 1, '\n' );

    ac = comp_random ( nc, kc );
    fprintf ( '  COMP:' );
    for j = 1 : kc
      fprintf ( 1, '  %2d', ac(j) );
    end
    fprintf ( 1, '\n' );

    [ ns, ks, as ] = comp_to_ksub ( nc, kc, ac );
    fprintf ( '  KSUB:' );
    for j = 1 : ks
      fprintf ( 1, '  %2d', as(j) );
    end
    fprintf ( 1, '\n' );

    [ nc, kc, ac ] = ksub_to_comp ( ns, ks, as );
    fprintf ( '  COMP:' );
    for j = 1 : kc
      fprintf ( 1, '  %2d', ac(j) );
    end
    fprintf ( 1, '\n' );
    
  end

  return
end
