function r8col_sorted_tol_unique_test ( )

%*****************************************************************************80
%
%% R8COL_SORTED_TOL_UNIQUE_TEST tests R8COL_SORTED_TOL_UNIQUE.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    16 July 2010
%
%  Author:
%
%    John Burkardt
%
  m = 3;
  n = 22;

  a = [ ...
    1.9,  0.0, 10.0; ...
    2.0,  6.0, 10.0; ...
    4.0,  8.0, 12.0; ...
    1.0,  5.0,  9.0; ...
    3.0,  7.0, 11.0; ...
    2.0,  6.0,  0.0; ...
    2.0,  0.0, 10.1; ...
    2.0,  0.1, 10.0; ...
    3.0,  4.0, 18.0; ...
    1.9,  8.0, 10.0; ...
    0.0,  0.0,  0.0; ...
    0.0,  6.0, 10.0; ...
    2.1,  0.0, 10.0; ...
    2.0,  6.0, 10.0; ...
    3.0,  7.0, 11.0; ...
    2.0,  0.0, 10.0; ...
    2.0,  0.0, 10.0; ...
    2.0,  6.0, 10.0; ...
    1.0,  5.0,  9.0; ...
    2.0,  0.0, 10.1; ...
    1.0,  5.0,  9.1; ...
    1.0,  5.1,  9.0  ]';

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8COL_SORTED_TOL_UNIQUE_TEST\n' );
  fprintf ( 1, '  R8COL_SORTED_TOL_UNIQUE returns tolerably unique columns\n' );
  fprintf ( 1, '  in a sorted R8COL.\n' );
  fprintf ( 1, '\n' );

  r8col_transpose_print ( m, n, a, '  The unsorted R8COL (transposed):' );

  a = r8col_sort_heap_a ( m, n, a );

  r8col_transpose_print ( m, n, a, '  The sorted R8COL (transposed):' );

  tol = 0.25;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Equality tolerance set to %e\n', tol );

  [ a, unique_num ] = r8col_sorted_tol_unique ( m, n, a, tol );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of tolerably unique columns is %d\n', unique_num );

  r8col_transpose_print ( m, unique_num, a, ...
    '  The tolerably unique sorted R8COL (transposed):' );


  return
end
