function closest_pair_divcon_test ( )

%*****************************************************************************80
%
%% closest_pair_divcon_test() tests closest_pair_divcon().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 August 2024
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../closest_pair_divcon' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'closest_pair_divcon_test()\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test closest_pair_divcon().\n' );
%
%  Solve a sequence of problems of increasing size N.
%
  nvec = [ 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000 ];
  for i = 1 : length ( nvec )
    n = nvec(i);
    [ s1vec(i), s2vec(i) ] = closest_pair_divcon_test01 ( n );
  end

  clf ( );
  hold ( 'on' );
    plot ( nvec, s1vec, '-ro', 'linewidth', 2 );
    plot ( nvec, s2vec, '-bo', 'linewidth', 2 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( 'Number of data points' );
  ylabel ( 'Execution time (seconds)' );
  title ( 'Time complexity for closest pair problem' );
  legend ( 'brute()', 'divcon()' );
  filename = 'closest_pair_divcon.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'closest_pair_divcon_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../closest_pair_divcon' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

