True if outer iteration error is decreasing.
323638
def _outer_error_is_decreasing(self):
        """"""
        is_decreasing, self._last_outer_error = self._error_is_decreasing(self._last_outer_error)
        return is_decreasing
174139
private static boolean canBeNewCurrInterval(Bound<?> lastBound, Bound<?> currentBound) {
        int vCompare = BoundValueComparator.compareValueDispatchingToInf(lastBound, currentBound);
        if (vCompare != 0) {
            return true;
        } else {
            if (lastBound.isLowerBound() && currentBound.isUpperBound()) {
                return true;
            } else if (lastBound.isUpperBound() && lastBound.getBoundaryType() == RangeBoundary.OPEN 
                && currentBound.isLowerBound() && currentBound.getBoundaryType() == RangeBoundary.OPEN) {
                return true; // the case x) (x
            } else {
                return false;
            }
        }
    }
125230
def still_optimizing(self):
        """"""

        # Check if we need to give up on optimizing.
        if (self.iterations > self.max_iter) or (self.time_elapsed() > self.max_time):
            return False

        # Always optimize for at least 'min_iter' iterations.
        elif not hasattr(self, 'improvement') or (self.iterations < self.min_iter):
            return True

        # Check convergence.
        else:
            self.converged = self.improvement < self.tol
            return False if self.converged else True
569812
private int compareToLastRow(int depth)
        {
            for (int i = 0 ; i <= depth ; i++)
            {
                int p = currentRow[i], l = lastRow[i], r = clusteringComponents[i].size();
                if ((p == l) | (r == 1))
                    continue;
                return p - l;
            }
            return 0;
        }
250359
private boolean checkForNaNs(NumberVector vec) {
    for(int i = 0, d = vec.getDimensionality(); i < d; i++) {
      double v = vec.doubleValue(i);
      if(v != v) { // NaN!
        return true;
      }
    }
    return false;
  }
1144288
def _mean_absolute_error(y, y_pred, w):
    """"""
    return np.average(np.abs(y_pred - y), weights=w)
83304
private boolean isError(Object result) {
		if(result != null){
			if(result instanceof BaseResult){
				BaseResult baseResult = (BaseResult)result;
				return !baseResult.isSuccess();
			}else if(result instanceof MchBase){
				MchBase mchBase = (MchBase)result;
				if("FAIL".equalsIgnoreCase(mchBase.getReturn_code())||
				   "FAIL".equalsIgnoreCase(mchBase.getResult_code())){
					return true;
				}
			}
		}
		return false;
	}
232225
function rangeWhile(cond, fn) {
    var i = 0, res = [];

    while(cond(i)) {
        res[i] = fn(i);
        i++;
    }
    return res;
}
1204296
def on_batch_end(self, iteration:int, smooth_loss:TensorOrNumber, **kwargs:Any)->None:
        ""
        if iteration==0 or smooth_loss < self.best_loss: self.best_loss = smooth_loss
        self.opt.lr = self.sched.step()
        if self.sched.is_done or (self.stop_div and (smooth_loss > 4*self.best_loss or torch.isnan(smooth_loss))):
            #We use the smoothed loss to decide on the stopping since it's less shaky.
            return {'stop_epoch': True, 'stop_training': True}
56599
def _is_converged(self):
        ''''''
        if self.is_relaxed():
            # relaxation run case
            return self._get_line(['End of', 'Geometry Optimization'], self.outputf, return_string=False)
        else:
            # static run case
            return self._get_line('convergence has been achieved', self.outputf, return_string=False)
102456
function min(array) {
  var length = array.length;

  if (length === 0) {
    return 0;
  }

  var index = -1;
  var result = array[++index];

  while (++index < length) {
    if (array[index] < result) {
      result = array[index];
    }
  }

  return result;
}
419994
function bnpMultiplyLowerTo(a,n,r) {
  var i = Math.min(this.t+a.t,n);
  r.s = 0; // assumes a,this >= 0
  r.t = i;
  while(i > 0) r[--i] = 0;
  var j;
  for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t);
  for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i);
  r.clamp();
}
1192544
function minBy (valueComputer, list) {
    var
      idx = 0,
      winner = list[idx],
      computedWinner = valueComputer(winner),

      computedCurrent;

    while (++idx < list.length) {
      computedCurrent = valueComputer(list[idx]);

      if (computedCurrent < computedWinner) {
        computedWinner = computedCurrent;
        winner = list[idx];
      }
    }

    return winner;
  }
575346
def is_neg_unate(self, vs=None):
        
        """
        vs = self._expect_vars(vs)
        basis = self.support - set(vs)
        maxcov = [PC_ONE] * (1 << len(basis))
        # Test whether table entries are monotonically decreasing
        for cf in self.iter_cofactors(vs):
            for i, item in enumerate(cf.pcdata):
                if maxcov[i] == PC_ZERO and item == PC_ONE:
                    return False
                maxcov[i] = item
        return True
592132
def is_converged(self):
        '''
        '''

        # Check for cached result
        if self._converged is None:
            self._converged = self._is_converged()
        return Property(scalars=[Scalar(value=self._converged)])
729007
def hasnew(self,allowempty=False):
        """"""
        for e in  self.select(New,None,False, False):
            if not allowempty and len(e) == 0: continue
            return True
        return False
575021
def _has_converged(pi_star, pi):
    
    node_count = pi.shape[0]
    EPS = 10e-6
    for i in range(node_count):
        if pi[i] - pi_star[i] > EPS:
            return False

    return True