function ksub_to_compnz_test ( )

%*****************************************************************************80
%
%% ksub_to_compnz_test() tests ksub_to_compnz().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 July 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'ksub_to_compnz_test():\n' );
  fprintf ( 1, '  ksub_to_compnz() returns the nonzero composition \n' );
  fprintf ( 1, '  corresponding to a K subset.\n' );

  ns = 14;
  ks = 4;

  for i = 1 : 5

    fprintf ( 1, '\n' );

    as = ksub_random2 ( ns, ks );
    fprintf ( '  KSUB:  ' );
    for j = 1 : ks
      fprintf ( 1, '  %2d', as(j) );
    end
    fprintf ( 1, '\n' );

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

  return
end
