function matrix_assemble_parfor_test ( )

%*****************************************************************************80
%
%% matrix_assemble_parfor_test() assembles a matrix in parallel.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 December 2023
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../matrix_assemble_parfor' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'matrix_assemble_parfor_test():\n' );
  fprintf ( 1, '  matrix_assemble_parfor() assembles a matrix.\n' );
  fprintf ( 1, '  The parfor() function is used for parallel execution.\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Workers  Time\n' );
  fprintf ( 1, '\n' );

  m = 100;
  n = 100;

  for w = [ 1, 2, 4, 8 ]

    pool = parpool ( w );

    tic
    A = matrix_assemble_parfor ( m, n );
    tw = toc;

    fprintf ( 1, '  %2d  %g\n', w, tw );
    delete ( pool );

  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'matrix_assemble_parfor_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../matrix_assemble_parfor' );

  return
end
function timestamp ( )

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

  return
end

