use of it.unimi.dsi.fastutil.longs.LongIterator in project angel by Tencent.
the class LongVector method norm.
@Override
public double norm() {
LongVectorStorage lstorage = (LongVectorStorage) storage;
double sumval2 = 0.0;
if (lstorage.isSparse()) {
LongIterator iter = lstorage.valueIterator();
while (iter.hasNext()) {
double val = iter.nextLong();
sumval2 += val * val;
}
} else {
for (double val : lstorage.getValues()) {
sumval2 += val * val;
}
}
return Math.sqrt(sumval2);
}
use of it.unimi.dsi.fastutil.longs.LongIterator in project angel by Tencent.
the class IntLongVector method average.
public double average() {
IntLongVectorStorage dstorage = (IntLongVectorStorage) 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 IntLongVector method std.
public double std() {
IntLongVectorStorage dstorage = (IntLongVectorStorage) storage;
if (dstorage.size() == 0)
return 0;
double sumval = 0.0;
double sumval2 = 0.0;
if (dstorage.isSparse()) {
LongIterator iter = dstorage.valueIterator();
while (iter.hasNext()) {
double val = iter.nextLong();
sumval += val;
sumval2 += val * val;
}
} else {
for (double val : dstorage.getValues()) {
sumval += val;
sumval2 += val * val;
}
}
sumval /= getDim();
sumval2 /= getDim();
return Math.sqrt(sumval2 - sumval * sumval);
}
use of it.unimi.dsi.fastutil.longs.LongIterator in project SpongeCommon by SpongePowered.
the class SpongeWorldManager method updateForcedChunks.
private void updateForcedChunks(final ServerLevel world, final ServerChunkCache serverChunkProvider) {
final ForcedChunksSavedData forcedChunksSaveData = world.getDataStorage().get(ForcedChunksSavedData::new, "chunks");
if (forcedChunksSaveData != null) {
final LongIterator longIterator = forcedChunksSaveData.getChunks().iterator();
while (longIterator.hasNext()) {
final long i = longIterator.nextLong();
final ChunkPos forceChunkPos = new ChunkPos(i);
serverChunkProvider.updateChunkForced(forceChunkPos, true);
}
}
}
use of it.unimi.dsi.fastutil.longs.LongIterator in project geode by apache.
the class DiskInitFile method saveDrfIds.
private void saveDrfIds() {
for (LongIterator i = this.drfIds.iterator(); i.hasNext(); ) {
writeIFRecord(IFREC_DRF_CREATE, i.next());
this.ifLiveRecordCount++;
this.ifTotalRecordCount++;
}
}
Aggregations