clear all
fun = @normest1;
t = 2;
disp(sprintf('table 3, t=%d',t))
exact = 0;
mv = 0;
tt = 0;
for i = 1:5000
  A = inv(randn(100));
  norm1 = norm(A,1);
  tic
  [est,v,w,it] = fun(A,t);  
  tt = tt+toc;
  if (abs(est-norm1) < 8*eps)
     exact = exact+1;
  end
  mv = mv+it(2);
end
exact/5000*100,mv/5000,tt/5000
disp(sprintf('table 4, t=%d',t))
exact = 0;
mv = 0;
tt = 0;
for i = 1:5000
  A = rand(100);
  A(A<=1/3) = -1;
  A(A>1/3&A<=2/3) = 0;
  A(A>2/3) = 1;
  norm1 = norm(A,1);
  tic
  [est,v,w,it] = fun(A,t);  
  tt = tt+toc;
  if (abs(est-norm1) < 8*eps)
     exact = exact+1;
  end
  mv = mv+it(2);
end
exact/5000*100,mv/5000,tt/5000
disp(sprintf('table 5, t=%d',t))
alpha=1-1e-6;,n=100;
A = diag(ones(n,1));
for i = 1:n-1
  A = A+(-1)^i*diag(alpha^i*ones(n-i,1),i);
end
norm1 = norm(A,1);
exact = 0;
mv = 0;
tt = 0;
for i = 1:1000
  tic    
  [est,v,w,it] = fun(A,t);
  tt = tt+toc;
  if (abs(est - norm1) < 100*eps)
     exact = exact+1;
  end
  mv = mv+it(2);
end
exact/1000*100,mv/1000,tt/1000
disp(sprintf('table 6, t=%d',t))
n=100;
exact = 0;
mv = 0;
tt = 0;
for i = 1:5000
  A = inv(rand(n)+1i*rand(n));
  norm1 = norm(A,1);
  tic  
  [est,v,w,it] = fun(A,t);
  tt = tt+toc;
  if (abs(est - norm1) < 100*eps)
     exact = exact+1;
  end
  mv = mv+it(2);
end
exact/5000*100,mv/5000,tt/5000
