use of it.unimi.dsi.fastutil.doubles.DoubleIterator in project angel by Tencent.
the class IntDoubleVector method max.
public double max() {
IntDoubleVectorStorage idstorage = (IntDoubleVectorStorage) storage;
if (idstorage.size() == 0)
return 0;
double maxval = Double.MIN_VALUE;
if (idstorage.isSparse()) {
DoubleIterator iter = idstorage.valueIterator();
while (iter.hasNext()) {
double val = iter.nextDouble();
if (val > maxval) {
maxval = val;
}
}
} else {
for (double val : idstorage.getValues()) {
if (val > maxval) {
maxval = val;
}
}
}
return maxval;
}
use of it.unimi.dsi.fastutil.doubles.DoubleIterator in project angel by Tencent.
the class IntDoubleVector method min.
public double min() {
IntDoubleVectorStorage idstorage = (IntDoubleVectorStorage) storage;
if (idstorage.size() == 0)
return 0;
double minval = Double.MAX_VALUE;
if (idstorage.isSparse()) {
DoubleIterator iter = idstorage.valueIterator();
while (iter.hasNext()) {
double val = iter.nextDouble();
if (val < minval) {
minval = val;
}
}
} else {
for (double val : idstorage.getValues()) {
if (val < minval) {
minval = val;
}
}
}
return minval;
}
Aggregations