Accord.Math.Optimization.AugmentedLagrangian.relstop C# (CSharp) Method

relstop() static private method

static private relstop ( double vold, double vnew, double reltol, double abstol ) : bool
vold double
vnew double
reltol double
abstol double
return bool
        static bool relstop(double vold, double vnew, double reltol, double abstol)
        {
            if (Double.IsInfinity(vold))
                return false;

            if (Double.IsNaN(vold) || Double.IsNaN(vnew))
                return true;

            return (Math.Abs(vnew - vold) < abstol
               || Math.Abs(vnew - vold) < reltol * (Math.Abs(vnew) + Math.Abs(vold)) * 0.5
               || (reltol > 0 && vnew == vold)); // catch vnew == vold == 0 
        }