fid = fopen('cond_test_bd.txt','w');

repeats = 10;
randn('seed',0);

for n = [50 60 70]
  for eta = [0.5 1]
    
    se_time = 0;
    adm_time = 0;
    se_fval = 0;
    adm_fval = 0;
    adm_iter = 0;
    condQ = 0;
    numbersize = inf;
    
    for kk = 1:repeats
      Q = randn(n);
      Q = Q*Q';
      condQ = condQ + cond(Q);
      numbersize = min(max(max(Q)),numbersize);
      
      Eta = eta*ones(n,n); % 0.5, 1
      fprintf(' done construction\n')
      
      [answer0,time0] = cond_se_bd_dual2(Q,Eta);
      se_time = se_time + time0;
      se_fval = se_fval + answer0;
      fprintf(' min condition number = %6.1f\n', answer0)
      
      [answer,X,iter,time] = cond_adm_bd(Q,Eta,1e-4,inf);
      adm_time = adm_time + time;
      adm_fval = adm_fval + answer;
      adm_iter = adm_iter + iter;
    end
    
    se_time = se_time/repeats;
    adm_time = adm_time/repeats;
    se_fval = se_fval/repeats;
    adm_fval = adm_fval/repeats;
    adm_iter = adm_iter/repeats;
    condQ = condQ/repeats;
    
    fprintf(fid,'& n = %3d, eta = %4.2f, condQ = %4.3e, se_time = %6.1f, adm_time = %6.1f (%8.0f), se_ans = %5.1f, adm_ans = %5.1f, numbersize = %5.1f\n',...
      n, eta, condQ, se_time, adm_time, adm_iter, se_fval, adm_fval, numbersize)
  end  
end
fclose(fid)