private static SummaryStatistics[] getStats(final ArrayOfDoublesSketch sketch) { final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } return stats; }
@Override public DoublesSketch compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final UpdateDoublesSketch qs = DoublesSketch.builder().setK(k).build(); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { qs.update(it.getValues()[column - 1]); // convert 1-based column number to zero-based index } return qs; }
@Override public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] means = new double[sketch.getNumValues()]; Arrays.setAll(means, i -> stats[i].getMean()); return means; }
@Override public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] variances = new double[sketch.getNumValues()]; Arrays.setAll(variances, i -> stats[i].getVariance()); return variances; }
private static long[] convertToHashTable(final ArrayOfDoublesSketch sketch) { final int size = Math.max( ceilingPowerOf2((int) Math.ceil(sketch.getRetainedEntries() / REBUILD_THRESHOLD)), 1 << MIN_LG_NOM_LONGS ); final long[] hashTable = new long[size]; final ArrayOfDoublesSketchIterator it = sketch.iterator(); final int lgSize = Integer.numberOfTrailingZeros(size); while (it.next()) { HashOperations.hashInsertOnly(hashTable, lgSize, it.getKey()); } return hashTable; }
private void getNoMatchSetFromSketch(final ArrayOfDoublesSketch sketch) { count_ = sketch.getRetainedEntries(); keys_ = new long[count_]; values_ = new double[count_ * numValues_]; final ArrayOfDoublesSketchIterator it = sketch.iterator(); int i = 0; while (it.next()) { keys_[i] = it.getKey(); System.arraycopy(it.getValues(), 0, values_, i * numValues_, numValues_); i++; } }
keys_ = new long[noMatchSize]; values_ = new double[noMatchSize * numValues_]; final ArrayOfDoublesSketchIterator it = a.iterator(); while (it.next()) { final int index = HashOperations.hashSearch(hashTable, lgHashTableSize, it.getKey());
final ArrayOfDoublesSketchIterator it = sketchIn.iterator(); while (it.next()) { sketch_.insert(it.getKey(), it.getValues()); final double[][] matchValues = new double[matchSize][]; int matchCount = 0; final ArrayOfDoublesSketchIterator it = sketchIn.iterator(); while (it.next()) { final double[] values = sketch_.find(it.getKey());
/** * Updates the union by adding a set of entries from a given sketch * @param sketchIn sketch to add to the union */ public void update(final ArrayOfDoublesSketch sketchIn) { if (sketchIn == null) { return; } Util.checkSeedHashes(seedHash_, sketchIn.getSeedHash()); if (sketch_.getNumValues() != sketchIn.getNumValues()) { throw new SketchesArgumentException("Incompatible sketches: number of values mismatch " + sketch_.getNumValues() + " and " + sketchIn.getNumValues()); } if (sketchIn.isEmpty()) { return; } if (sketchIn.getThetaLong() < theta_) { theta_ = sketchIn.getThetaLong(); } final ArrayOfDoublesSketchIterator it = sketchIn.iterator(); while (it.next()) { sketch_.merge(it.getKey(), it.getValues()); } }
private static long[] convertToHashTable(final ArrayOfDoublesSketch sketch) { final int size = Math.max( ceilingPowerOf2((int) Math.ceil(sketch.getRetainedEntries() / REBUILD_THRESHOLD)), 1 << MIN_LG_NOM_LONGS ); final long[] hashTable = new long[size]; final ArrayOfDoublesSketchIterator it = sketch.iterator(); final int lgSize = Integer.numberOfTrailingZeros(size); while (it.next()) { HashOperations.hashInsertOnly(hashTable, lgSize, it.getKey()); } return hashTable; }
private void getNoMatchSetFromSketch(final ArrayOfDoublesSketch sketch) { count_ = sketch.getRetainedEntries(); keys_ = new long[count_]; values_ = new double[count_ * numValues_]; final ArrayOfDoublesSketchIterator it = sketch.iterator(); int i = 0; while (it.next()) { keys_[i] = it.getKey(); System.arraycopy(it.getValues(), 0, values_, i * numValues_, numValues_); i++; } }
private static SummaryStatistics[] getStats(final ArrayOfDoublesSketch sketch) { final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } return stats; }
@Override public DoublesSketch compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final UpdateDoublesSketch qs = UpdateDoublesSketch.builder().setK(k).build(); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { qs.update(it.getValues()[column - 1]); // convert 1-based column number to zero-based index } return qs; }
keys_ = new long[noMatchSize]; values_ = new double[noMatchSize * numValues_]; final ArrayOfDoublesSketchIterator it = a.iterator(); while (it.next()) { final int index = HashOperations.hashSearch(hashTable, lgHashTableSize, it.getKey());
@Override public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] variances = new double[sketch.getNumValues()]; Arrays.setAll(variances, i -> stats[i].getVariance()); return variances; }
@Override public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] means = new double[sketch.getNumValues()]; Arrays.setAll(means, i -> stats[i].getMean()); return means; }
final ArrayOfDoublesSketchIterator it = sketchIn.iterator(); while (it.next()) { sketch_.insert(it.getKey(), it.getValues()); final double[][] matchValues = new double[matchSize][]; int matchCount = 0; final ArrayOfDoublesSketchIterator it = sketchIn.iterator(); while (it.next()) { final double[] values = sketch_.find(it.getKey());
/** * Updates the union by adding a set of entries from a given sketch * @param sketchIn sketch to add to the union */ public void update(final ArrayOfDoublesSketch sketchIn) { if (sketchIn == null) { return; } Util.checkSeedHashes(seedHash_, sketchIn.getSeedHash()); if (sketch_.getNumValues() != sketchIn.getNumValues()) { throw new SketchesArgumentException("Incompatible sketches: number of values mismatch " + sketch_.getNumValues() + " and " + sketchIn.getNumValues()); } if (sketchIn.isEmpty()) { return; } if (sketchIn.getThetaLong() < theta_) { theta_ = sketchIn.getThetaLong(); } final ArrayOfDoublesSketchIterator it = sketchIn.iterator(); while (it.next()) { sketch_.merge(it.getKey(), it.getValues()); } }