use of it.unimi.dsi.fastutil.longs.LongIterator in project presto by prestodb.
the class KHyperLogLog method mergeWith.
public KHyperLogLog mergeWith(KHyperLogLog other) {
LongIterator iterator = other.minhash.keySet().iterator();
while (iterator.hasNext()) {
long key = iterator.nextLong();
HyperLogLog thisHll = minhash.get(key);
HyperLogLog otherHll = other.minhash.get(key);
if (minhash.containsKey(key)) {
decreaseTotalHllSize(thisHll);
thisHll.mergeWith(otherHll);
increaseTotalHllSize(thisHll);
} else {
minhash.put(key, otherHll);
increaseTotalHllSize(otherHll);
}
}
removeOverflowEntries();
return this;
}
use of it.unimi.dsi.fastutil.longs.LongIterator in project symja_android_library by axkr.
the class DateTimeColumn method removeMissing.
@Override
public DateTimeColumn removeMissing() {
DateTimeColumn noMissing = emptyCopy();
LongIterator iterator = longIterator();
while (iterator.hasNext()) {
long i = iterator.nextLong();
if (!valueIsMissing(i)) {
noMissing.appendInternal(i);
}
}
return noMissing;
}
use of it.unimi.dsi.fastutil.longs.LongIterator in project angel by Tencent.
the class LongLongVector method max.
public long max() {
LongLongVectorStorage idstorage = (LongLongVectorStorage) storage;
if (idstorage.size() == 0)
return 0;
long maxval = Long.MIN_VALUE;
if (idstorage.isSparse()) {
LongIterator iter = idstorage.valueIterator();
while (iter.hasNext()) {
long val = iter.nextLong();
if (val > maxval) {
maxval = val;
}
}
} else {
for (long val : idstorage.getValues()) {
if (val > maxval) {
maxval = val;
}
}
}
return maxval;
}
use of it.unimi.dsi.fastutil.longs.LongIterator in project angel by Tencent.
the class LongLongVector method average.
public double average() {
LongLongVectorStorage dstorage = (LongLongVectorStorage) storage;
if (dstorage.size() == 0)
return 0;
double sumval = 0.0;
if (dstorage.isSparse()) {
LongIterator iter = dstorage.valueIterator();
while (iter.hasNext()) {
sumval += iter.nextLong();
}
} else {
for (double val : dstorage.getValues()) {
sumval += val;
}
}
sumval /= getDim();
return sumval;
}
use of it.unimi.dsi.fastutil.longs.LongIterator in project angel by Tencent.
the class LongLongVector method min.
public long min() {
LongLongVectorStorage idstorage = (LongLongVectorStorage) storage;
if (idstorage.size() == 0)
return 0;
long minval = Long.MAX_VALUE;
if (idstorage.isSparse()) {
LongIterator iter = idstorage.valueIterator();
while (iter.hasNext()) {
long val = iter.nextLong();
if (val < minval) {
minval = val;
}
}
} else {
for (long val : idstorage.getValues()) {
if (val < minval) {
minval = val;
}
}
}
return minval;
}
Aggregations