function matrix_chain_dynamic_test ( )

%*****************************************************************************80
%
%% matrix_chain_dynamic_test() tests matrix_chain_dynamic().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 April 2024
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../matrix_chain_dynamic' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'matrix_chain_dynamic_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test matrix_chain_dynamic().\n' );

  fprintf ( 1, '\n' );
  dims = [ 40, 20, 30, 10, 30 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 2 )

  fprintf ( 1, '\n' );
  dims = [ 1, 2, 3, 4, 3 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 2 )

  fprintf ( 1, '\n' );
  dims = [ 10, 20, 30 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 2 )

  fprintf ( 1, '\n' );
  dims = [ 10, 30, 5, 60 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 2 )

  fprintf ( 1, '\n' );
  dims = [ 10, 20 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 2 )

  fprintf ( 1, '\n' );
  dims = [ 40, 20, 0, 10, 30 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 1 )

  fprintf ( 1, '\n' );
  dims = [ 40, 20, 0, 10 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 2 )

  fprintf ( 1, '\n' );
  dims = [ 20, 0, 10, 30 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 2 )

  fprintf ( 1, '\n' );
  dims = [ 20, 0, 10 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 2 )

  fprintf ( 1, '\n' );
  dims = [ 40 ]
  n = length ( dims )
  cost = matrix_chain_dynamic ( dims )
  orderings = catalan_number ( n - 2 )
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'matrix_chain_dynamic_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../matrix_chain_dynamic' );

  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

