function matrix_chain_test ( )

%*****************************************************************************80
%
%% matrix_chain_test() tests matrix_chain().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 December 2023
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../matrix_chain' );

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

  fprintf ( 1, '\n' );
  dims = [ 40, 20, 30, 10, 30 ]
  cost = matrix_chain ( dims )

  fprintf ( 1, '\n' );
  dims = [ 1, 2, 3, 4, 3 ]
  cost = matrix_chain ( dims )

  fprintf ( 1, '\n' );
  dims = [ 10, 20, 30 ]
  cost = matrix_chain ( dims )

  fprintf ( 1, '\n' );
  dims = [ 10, 30, 5, 60 ]
  cost = matrix_chain ( dims )

  fprintf ( 1, '\n' );
  dims = [ 10, 20 ]
  cost = matrix_chain ( dims )

  fprintf ( 1, '\n' );
  dims = [ 40, 20, 0, 10, 30 ]
  cost = matrix_chain ( dims )

  fprintf ( 1, '\n' );
  dims = [ 40, 20, 0, 10 ]
  cost = matrix_chain ( dims )

  fprintf ( 1, '\n' );
  dims = [ 20, 0, 10, 30 ]
  cost = matrix_chain ( dims )

  fprintf ( 1, '\n' );
  dims = [ 20, 0, 10 ]
  cost = matrix_chain ( dims )

  fprintf ( 1, '\n' );
  dims = [ 40 ]
  cost = matrix_chain ( dims )
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'matrix_chain_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../matrix_chain' );

  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

