Search in sources :

Example 1 with LongIterator

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;
}
Also used : LongIterator(it.unimi.dsi.fastutil.longs.LongIterator) HyperLogLog(com.facebook.airlift.stats.cardinality.HyperLogLog)

Example 2 with LongIterator

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;
}
Also used : LongIterator(it.unimi.dsi.fastutil.longs.LongIterator)

Example 3 with LongIterator

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;
}
Also used : LongLongVectorStorage(com.tencent.angel.ml.math2.storage.LongLongVectorStorage) LongIterator(it.unimi.dsi.fastutil.longs.LongIterator)

Example 4 with LongIterator

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;
}
Also used : LongLongVectorStorage(com.tencent.angel.ml.math2.storage.LongLongVectorStorage) LongIterator(it.unimi.dsi.fastutil.longs.LongIterator)

Example 5 with LongIterator

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;
}
Also used : LongLongVectorStorage(com.tencent.angel.ml.math2.storage.LongLongVectorStorage) LongIterator(it.unimi.dsi.fastutil.longs.LongIterator)

Aggregations

LongIterator (it.unimi.dsi.fastutil.longs.LongIterator)20 IntLongVectorStorage (com.tencent.angel.ml.math2.storage.IntLongVectorStorage)5 LongLongVectorStorage (com.tencent.angel.ml.math2.storage.LongLongVectorStorage)5 LongVectorStorage (com.tencent.angel.ml.math2.storage.LongVectorStorage)2 HyperLogLog (com.facebook.airlift.stats.cardinality.HyperLogLog)1 Long2ObjectOpenHashMap (it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap)1 LongRBTreeSet (it.unimi.dsi.fastutil.longs.LongRBTreeSet)1 LongSortedSet (it.unimi.dsi.fastutil.longs.LongSortedSet)1 ChunkPos (net.minecraft.world.level.ChunkPos)1 ForcedChunksSavedData (net.minecraft.world.level.ForcedChunksSavedData)1