function memory_test ( n_log_min, n_log_max )

%*****************************************************************************80
%
%% memory_test() carries out some tests of memory limits in MATLAB.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 June 2009
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N_LOG_MIN, the logarithm of the minimum N to try.
%
%    integer N_LOG_MAX, the logarithm of the maximum N to try.
%
  addpath ( '../memory' );

  timestamp ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'memory_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Try to see how big vectors and matrices can be.\n' );

  if ( nargin < 1 )
    n_log_min = 0;
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Using default value of N_LOG_MIN = %d\n', n_log_min );
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, '  User input value of N_LOG_MIN = %d\n', n_log_min );
  end

  if ( nargin < 2 )
    n_log_max = 25;
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Using default value of N_LOG_MAX = %d\n', n_log_max );
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, '  User input value of N_LOG_MAX = %d\n', n_log_max );
  end
%
%  I4VEC test.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'I4VEC Memory Test\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, ...
    'Log2(N)            N   Ave     CPU        Real\n' );
  fprintf ( 1, '\n' );

  for n_log = n_log_min : n_log_max

    i4vec_memory_test ( n_log );

  end
%
%  R8VEC test.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8VEC Memory Test\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, ...
    'Log2(N)            N   Ave     CPU        Real\n' );
  fprintf ( 1, '\n' );

  for n_log = n_log_min : n_log_max

    r8vec_memory_test ( n_log );

  end
%
%  I4MAT test.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'I4MAT Memory Test\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, ...
    'Log2(N)            N            N1            N2   Ave     CPU        Real\n' );
  fprintf ( 1, '\n' );

  for n_log = n_log_min : n_log_max

    i4mat_memory_test ( n_log );

  end
%
%  R8MAT test.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8MAT Memory Test\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, ...
    'Log2(N)            N            N1            N2   Ave     CPU        Real\n' );
  fprintf ( 1, '\n' );

  for n_log = n_log_min : n_log_max

    r8mat_memory_test ( n_log );

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

  rmpath ( '../memory' );

  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

