function r8mat_memory_test ( n_log )

%*****************************************************************************80
%
%% r8mat_memory_test() declares and uses an R8MAT of total size N.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 June 2009
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N_LOG, the logarithm base 2 of N.
%
  n = 2^n_log;

  n1_log = floor ( n_log / 2 );
  n1 = 2^n1_log;
  n2_log = n_log - n1_log;
  n2 = 2^n2_log;

  fprintf ( 1, '  %4d  %12d', n_log, n );

  tic;
  cpu_time1 = cputime;

  r8mat = zeros ( n1, n2 );

  r8mat = 2.0 * rand ( n1, n2 );

  average = ( sum ( sum ( r8mat(1:n1,1:n2) ) ) ) / n1 / n2;

  cpu_time2 = cputime;
  real_diff = toc;

  cpu_diff = cpu_time2 - cpu_time1;

  fprintf ( 1, '  %12d  %12d  %4.2f  %10e  %10e\n', ...
    n1, n2, average, cpu_diff, real_diff );

  return
end

