% Script File: BenchChol
%
% Benchmarks five different Cholesky implemntations.

  clc
  n = input('Enter n: ')
  X = rand(2*n,n);
  A = X'*X;
  disp(' ');
  disp(sprintf('n = %2.0f',n))
  disp(' ');
  disp('Algorithm     Time     Flops')
  disp('------------------------------')
  
  
     flops(0);
     t0 = clock;
     G = CholScalar(A);
     t1 = etime(clock,t0);
     f = flops; 
     disp(sprintf('CholScalar   %6.3f   %5.0f',t1/t1,f));
  
     flops(0);
     t0 = clock;
     G = CholDot(A);
     td = etime(clock,t0);
     f = flops; 
     disp(sprintf('CholDot      %6.3f   %5.0f',td/t1,f));
 
     flops(0);
     t0 = clock;
     G = CholSax(A);
     ts = etime(clock,t0);
     f = flops; 
     disp(sprintf('CholSax      %6.3f   %5.0f',ts/t1,f));
 
     flops(0);
     t0 = clock;
     G = CholGax(A);
     tg = etime(clock,t0);
     f = flops; 
     disp(sprintf('CholGax      %6.3f   %5.0f',tg/t1,f));
  
     
     flops(0);
     t0 = clock;
     G = CholRecur(A);
     tr = etime(clock,t0);
     f = flops; 
     disp(sprintf('CholRecur    %6.3f   %5.0f',tr/t1,f));

  
