function magic4_matrix_test ( )

%*****************************************************************************80
%
%% magic4_matrix_test() tests magic4_matrix().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    01 February 2025
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../magic4_matrix' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'magic4_matrix_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test magic4_matrix()\n' );

  for n = [ 4, 8, 12 ]
    A = magic4_matrix ( n );
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Magic4 matrix for n = %d\n', n );
    disp ( A );
    fprintf ( 1, '  Row sums:\n' );
    rsum = sum ( A, 1 );
    disp ( rsum );
    fprintf ( 1, '  Column sums:\n' );
    csum = sum ( A, 2 );
    disp ( csum' );
    fprintf ( 1, '  Diagonal sum:' );
    disp ( trace ( A ) );
    fprintf ( 1, '  Antidiagonal sum:' );
    disp ( trace ( A' ) );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'magic4_matrix_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../magic4_matrix' );

  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

