Reduces the list of factors by adding together the precision
for all numerators and denominators.
509618
private int precisionSum(List<UnitFactor> factors) {
    return factors.stream().map(f -> totalPrecision(f.rational())).reduce(0, Math::addExact);
  }
20026
@Override
    public Double reduce(List<Double> values) {
        Double difference = values.get(0);

        for (int i = 1; i < values.size(); i++) {
            Double value = values.get(i);

            if (value == null) {
                continue;
            }
            difference -= value;
        }
        return difference;
    }
949666
void combine(final MomentStatistics b) {
		requireNonNull(b);

		final double m2 = _m2.value();
		final double m3 = _m3.value();

		final double pn = _n;
		final double n = _n + b._n;
		final double nn = n*n;

		final double d = b._m1.value() - _m1.value();
		final double dd = d*d;

		_n += b._n;

		_m1.add(d*b._n/n);

		_m2.add(b._m2).add(dd*pn*b._n/n);

		_m3.add(b._m3)
			.add(dd*d*(pn*b._n*(pn - b._n)/nn))
			.add(3.0*d*(pn*b._m2.value() - b._n*m2)/n);

		final double bnbn = (double)b._n*(double)b._n;

		_m4.add(b._m4)
			.add(dd*dd*(pn*b._n*(pn*pn - pn*b._n + bnbn)/(nn*n)))
			.add(6.0*dd*(pn*pn*b._m2.value() + bnbn*m2)/nn)
			.add(4.0*d*(pn*b._m3.value() - b._n*m3)/n);
	}
639720
private static List<Point> simplifyDouglasPeucker(List<Point> points, double sqTolerance) {
    int last = points.size() - 1;
    ArrayList<Point> simplified = new ArrayList<>();
    simplified.add(points.get(0));
    simplified.addAll(simplifyDpStep(points, 0, last, sqTolerance, simplified));
    simplified.add(points.get(last));
    return simplified;
  }
1025331
@Override
    public Double reduce(List<Double> values) {
        double min = Double.MAX_VALUE;
        double max = Double.MIN_VALUE;

        for (Double value : values) {
            if (value == null) {
                value = 0.0;
            }

            double candidate = (value);

            if (candidate < min) {
                min = candidate;
            }
            if (candidate > max) {
                max = candidate;
            }
        }
        return max - min;
    }
1363875
private void simplifyEnumValues(AbstractCompiler compiler) {
    if (getRhs().isObjectLit() && getRhs().hasChildren()) {
      for (Node key : getRhs().children()) {
        removeStringKeyValue(key);
      }
      compiler.reportChangeToEnclosingScope(getRhs());
    }
  }
742980
void subtractFlakes(int quantity) {
        for (int i = 0; i < quantity; ++i) {
            int index = numFlakes - i - 1;
            flakes.remove(index);
        }
        setNumFlakes(numFlakes - quantity);
    }
5698
def create_calcs(self):
        """"""
        specs = self._combine_core_aux_specs()
        for spec in specs:
            spec['dtype_out_time'] = _prune_invalid_time_reductions(spec)
        return [Calc(**sp) for sp in specs]
107465
private void configureFormatter(NumberFormat formatter) {

        formatter.setGroupingUsed(groupingUsed);
        if (isMaxIntegerDigitsSet()) {
            formatter.setMaximumIntegerDigits(maxIntegerDigits);
        }
        if (isMinIntegerDigitsSet()) {
            formatter.setMinimumIntegerDigits(minIntegerDigits);
        }
        if (isMaxFractionDigitsSet()) {
            formatter.setMaximumFractionDigits(maxFractionDigits);
        }
        if (isMinFractionDigitsSet()) {
            formatter.setMinimumFractionDigits(minFractionDigits);
        }

    }
582633
def precision
      @precision ||= cells.map(&:to_f).map { |n| n.round(3) }.map { |n| n.to_s.split(".").last.gsub(/0+$/, "").length }.max
    end
971909
def defer_reduce(func, items, test, accum=None):
    '''
    '''
    removals = []

    for k, item in enumerate(items):
        if test(item, accum):
            removals.append(k)
            if accum is None:
                accum = item
            else:
                accum = func(accum, item)
        
    deferred = indices_removed(items, removals)
    
    if deferred == items or not deferred:
        return accum, deferred

    return defer_reduce(func, deferred, test, accum)
90309
def adjust(numeral, round_up)
      check_base numeral
      point, digits = Flt::Support.adjust_digits(
        numeral.point, numeral.digits.digits_array,
        round_mode: @mode,
        negative: numeral.sign == -1,
        round_up: round_up,
        base: numeral.base
      )
      if numeral.zero? && simplifying?
        digits = []
        point = 0
      end
      normalization = simplifying? ? :exact : :approximate
      Numeral[digits, point: point, base: numeral.base, sign: numeral.sign, normalize: normalization]
    end
551633
public CharTrie divide(CharTrie z, int factor) {
    return reduceSimple(z, (left, right) -> (null == right ? 0 : ((null == left ? 0 : left) * factor / right)));
  }
824636
def reduce(self):
        """"""
        support = frozenset(range(1, self.nvars+1))
        new_clauses = set()
        for clause in self.clauses:
            vs = list(support - {abs(uniqid) for uniqid in clause})
            if vs:
                for num in range(1 << len(vs)):
                    new_part = {v if bit_on(num, i) else ~v
                                for i, v in enumerate(vs)}
                    new_clauses.add(clause | new_part)
            else:
                new_clauses.add(clause)
        return self.__class__(self.nvars, new_clauses)
1374337
function combineNumeratorsAboveCommonDenominator(node) {
  let newNode = clone(node);

  const commonDenominator = newNode.args[0].args[1];
  const numeratorArgs = [];
  newNode.args.forEach(fraction => {
    numeratorArgs.push(fraction.args[0]);
  });
  const newNumerator = Node.Creator.parenthesis(
    Node.Creator.operator('+', numeratorArgs));

  newNode = Node.Creator.operator('/', [newNumerator, commonDenominator]);
  return Node.Status.nodeChanged(
    ChangeTypes.COMBINE_NUMERATORS, node, newNode);
}
185786
def allDecisions(self, result, **values):
		
		data = self.__getDecision(result, multiple=True, **values)
		data = [data[value] for value in result]
		if len(data) == 1:
			return data[0]
		else:
			return data
122656
def reduce_also(self, sitecol):
        
        array = []
        asset_refs = []
        for idx, sid in enumerate(sitecol.sids):
            mask = self.array['site_id'] == sid
            arr = self.array[mask]
            arr['site_id'] = idx
            array.append(arr)
            asset_refs.append(self.asset_refs[mask])
        new = object.__new__(self.__class__)
        vars(new).update(vars(self))
        new.tot_sites = len(sitecol)
        new.array = numpy.concatenate(array)
        new.array['ordinal'] = numpy.arange(len(new.array))
        new.asset_refs = numpy.concatenate(asset_refs)
        sitecol.make_complete()
        return new