function retval = superlinstop(xold,xnew)
% usage: doneflag = superlinstop(xold,xnew)
% description: tests for successful quadratic stopping criterion
% and returns boolean true if successful, false otherwise.
% xold: starting point
% xnew: new point

% global variables:
global parms;
global countiter;

countiter = countiter + 1;
maxiter = parms.maxiter;
releps = parms.releps;
abseps = parms.abseps;
ordcoef = parms.ordcoef;
retval = 1;
if (countiter == maxiter) % too many iterations?
  disp('Iteration limit reached')
else
  if (norm(xnew-xold)>ordcoef*releps+abseps)
    retval = 0;
  end
end
