function mgs_timing ( )

%*****************************************************************************80
%
%% mgs_timing does timing comparisons between mgs and mgs_fact.
%
%  Discussion:
%
%    This program compares the execution time of mgs.m to mgs_fact.m
%    on matrices with 200 rows and various numbers of columns ranging
%    from 50 to 200 in steps of 10.
%
%    The results are saved in a plot.
%
%  Modified:
%
%    20 February 2019
%
%  Author:
%
%    Dianne O'Leary 09/2005
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'mgs_timing\n' );
  fprintf ( 1, '  Compare timings of mgs and mgs_fact\n' );

  m = 200;
  nsizes = 50 : 10 : m;

  disp('Comparing the new algorithm to the old.')
  disp('Ratios of old execution times to new:')

  for j=1:length(nsizes)
    n = nsizes(j)
    C = rand(m,n);
    tic
    [q,r] = mgs(C);
    t1(j) = toc;
    tic
    [q,r] = mgs_fact(C);
    t2(j) = toc;
    disp(sprintf('For %d columns, ratio = %f',n,t1(j)/t2(j)))
  end
%
%  Make a plot.
%
  semilogy(nsizes,t1,nsizes,t2)
  xlabel('number of columns')
  ylabel('time (sec)')
  title('Times for matrices with 200 rows')
  legend('Original algorithm','Modified algorithm')

  print ( '-dpng', 'mgs_timing.png' );

  return
end
