use of it.unimi.dsi.fastutil.longs.Long2DoubleMap in project presto by prestodb.
the class KHyperLogLog method uniquenessDistribution.
public Long2DoubleMap uniquenessDistribution(long histogramSize) {
Long2DoubleMap out = new Long2DoubleOpenHashMap();
PrimitiveIterator.OfLong iterator = LongStream.rangeClosed(1, histogramSize).iterator();
while (iterator.hasNext()) {
// Initialize all entries to zero
out.put(iterator.nextLong(), 0D);
}
int size = minhash.size();
for (HyperLogLog hll : minhash.values()) {
long bucket = Math.min(hll.cardinality(), histogramSize);
out.merge(bucket, (double) 1 / size, Double::sum);
}
return out;
}
Aggregations