function cvtp_test01 ( )

%*****************************************************************************80
%
%% cvtp_test01() tests cvtp().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    31 July 2016
%
%  Author:
%
%    John Burkardt
%
  m = 2;
  n = 400;
  a = zeros ( m, 1 );
  b = ones ( m, 1 );
  generator = zeros ( m, n );
  modular = true;
  sample_num_cvt = 100000;
 
  cvt_steps = 50;
  filename = 'cvtp_1x1.txt';
  sample_num_steps = 50;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'CVTP_TEST01\n' );
  fprintf ( 1, '  CVTP can compute a periodic Centroidal Voronoi Tessellation\n' );
  fprintf ( 1, '  We set MODULAR to TRUE to do this.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Spatial dimension M =        %d\n', m );
  fprintf ( 1, '  Number of generators =       %d\n', n );
  fprintf ( 1, '  MODULAR arithmetic option =  %s\n', l4_to_s ( modular ) );
  fprintf ( 1, '  Number of sample points =    %d\n', sample_num_cvt );
  fprintf ( 1, '  Number of iterations =       %d\n', sample_num_steps );
%
%  Initialize the generators.
%
  generator = cvtp_region_sampler ( m, n, a, b );
%
%  Carry out iterations.
%
  for i = 1 : 50

    [ generator, change_l2 ] = cvtp_iteration ( m, n, a, b, generator, ...
      modular, sample_num_cvt );

  end
%
%  Save the last result to a file.
%
  save ( filename, 'generator', '-ASCII' );

  return
end
