public void addAll(Stats values) {
    if (values.count() == 0) {
      return;
    }

    if (count == 0) {
      count = values.count();
      mean = values.mean();
      sumOfSquaresOfDeltas = values.sumOfSquaresOfDeltas();
      min = values.min();
      max = values.max();
    } else {
      count += values.count();
      if (isFinite(mean) && isFinite(values.mean())) {
        // This is a generalized version of the calculation in add(double) above.
        double delta = values.mean() - mean;
        mean += delta * values.count() / count;
        sumOfSquaresOfDeltas +=
            values.sumOfSquaresOfDeltas() + delta * (values.mean() - mean) * values.count();
      } else {
        mean = calculateNewMeanNonFinite(mean, values.mean());
        sumOfSquaresOfDeltas = NaN;
      }
      min = Math.min(min, values.min());
      max = Math.max(max, values.max());
    }
  }
public void addAll(Stats values) {
    if (values.count() == 0) {
      return;
    }

    if (count == 0) {
      count = values.count();
      mean = values.mean();
      sumOfSquaresOfDeltas = values.sumOfSquaresOfDeltas();
      min = values.min();
      max = values.max();
    } else {
      count += values.count();
      if (isFinite(mean) && isFinite(values.mean())) {
        
        double delta = values.mean() - mean;
        mean += delta * values.count() / count;
        sumOfSquaresOfDeltas +=
            values.sumOfSquaresOfDeltas() + delta * (values.mean() - mean) * values.count();
      } else {
        mean = calculateNewMeanNonFinite(mean, values.mean());
        sumOfSquaresOfDeltas = NaN;
      }
      min = Math.min(min, values.min());
      max = Math.max(max, values.max());
    }
  }
public void addAll ( Stats values ) { if ( values . count ( ) == 0 ) { return ; } if ( count == 0 ) { count = values . count ( ) ; mean = values . mean ( ) ; sumOfSquaresOfDeltas = values . sumOfSquaresOfDeltas ( ) ; min = values . min ( ) ; max = values . max ( ) ; } else { count += values . count ( ) ; if ( isFinite ( mean ) && isFinite ( values . mean ( ) ) ) { // This is a generalized version of the calculation in add(double) above. double delta = values . mean ( ) - mean ; mean += delta * values . count ( ) / count ; sumOfSquaresOfDeltas += values . sumOfSquaresOfDeltas ( ) + delta * ( values . mean ( ) - mean ) * values . count ( ) ; } else { mean = calculateNewMeanNonFinite ( mean , values . mean ( ) ) ; sumOfSquaresOfDeltas = NaN ; } min = Math . min ( min , values . min ( ) ) ; max = Math . max ( max , values . max ( ) ) ; } }
Adds the given statistics to the dataset, as if the individual values used to compute the
statistics had been added directly.
Adds the given statistics to the dataset as if the individual values used to compute the statistics had been added directly .