本文整理汇总了Java中it.unimi.dsi.fastutil.doubles.DoubleIterator.nextDouble方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleIterator.nextDouble方法的具体用法?Java DoubleIterator.nextDouble怎么用?Java DoubleIterator.nextDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.doubles.DoubleIterator
的用法示例。
在下文中一共展示了DoubleIterator.nextDouble方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProductMap
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
private Int2DoubleMap getProductMap(int uidx) {
Int2DoubleOpenHashMap productMap = new Int2DoubleOpenHashMap();
productMap.defaultReturnValue(0.0);
if (data.useIteratorsPreferentially()) {
IntIterator iidxs = data.getUidxIidxs(uidx);
DoubleIterator ivs = data.getUidxVs(uidx);
while (iidxs.hasNext()) {
int iidx = iidxs.nextInt();
double iv = ivs.nextDouble();
IntIterator vidxs = data.getIidxUidxs(iidx);
DoubleIterator vvs = data.getIidxVs(iidx);
while (vidxs.hasNext()) {
productMap.addTo(vidxs.nextInt(), iv * vvs.nextDouble());
}
}
} else {
data.getUidxPreferences(uidx)
.forEach(ip -> data.getIidxPreferences(ip.v1)
.forEach(up -> productMap.addTo(up.v1, ip.v2 * up.v2)));
}
productMap.remove(uidx);
return productMap;
}
示例2: getProductArray
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
private double[] getProductArray(int uidx) {
double[] productArray = new double[data.numUsers()];
if (data.useIteratorsPreferentially()) {
IntIterator iidxs = data.getUidxIidxs(uidx);
DoubleIterator ivs = data.getUidxVs(uidx);
while (iidxs.hasNext()) {
int iidx = iidxs.nextInt();
double iv = ivs.nextDouble();
IntIterator vidxs = data.getIidxUidxs(iidx);
DoubleIterator vvs = data.getIidxVs(iidx);
while (vidxs.hasNext()) {
productArray[vidxs.nextInt()] += iv * vvs.nextDouble();
}
}
} else {
data.getUidxPreferences(uidx)
.forEach(ip -> data.getIidxPreferences(ip.v1)
.forEach(up -> productArray[up.v1] += ip.v2 * up.v2));
}
productArray[uidx] = 0.0;
return productArray;
}
示例3: getNorm2
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
private double getNorm2(int uidx) {
if (data.useIteratorsPreferentially()) {
DoubleIterator ivs = data.getUidxVs(uidx);
double sum = 0;
while (ivs.hasNext()) {
double iv = ivs.nextDouble();
sum += iv * iv;
}
return sum;
} else {
return data.getUidxPreferences(uidx)
.mapToDouble(IdxPref::v2)
.map(x -> x * x)
.sum();
}
}
示例4: isBad
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
@Override
public boolean isBad() {
final DoubleIterator iterator = values.values().iterator();
while (iterator.hasNext()) {
final double value = iterator.nextDouble();
if (Double.isNaN(value) || Double.isInfinite(value)) {
return true;
}
}
return false;
}
示例5: cosineProduct
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
private double cosineProduct(Object2DoubleMap<String> vector1, Object2DoubleMap<String> vector2) {
double aa = 0, bb = 0, ab = 0;
for(Object2DoubleMap.Entry<String> e : vector1.object2DoubleEntrySet()) {
aa += e.getDoubleValue() * e.getDoubleValue();
ab += e.getDoubleValue() * vector2.getDouble(e.getKey());
}
DoubleIterator di = vector2.values().iterator();
while(di.hasNext()) {
double d = di.nextDouble();
bb += d * d;
}
return ab / Math.sqrt(aa * bb);
}
示例6: isEqualTo
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
public Selection isEqualTo(DoubleColumn d) {
Selection results = new BitmapBackedSelection();
int i = 0;
DoubleIterator doubleIterator = d.iterator();
for (double doubles : data) {
if (doubles == doubleIterator.nextDouble()) {
results.add(i);
}
i++;
}
return results;
}
示例7: isGreaterThan
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
public Selection isGreaterThan(DoubleColumn d) {
Selection results = new BitmapBackedSelection();
int i = 0;
DoubleIterator doubleIterator = d.iterator();
for (double doubles : data) {
if (doubles > doubleIterator.nextDouble()) {
results.add(i);
}
i++;
}
return results;
}
示例8: isLessThan
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
public Selection isLessThan(DoubleColumn d) {
Selection results = new BitmapBackedSelection();
int i = 0;
DoubleIterator doubleIterator = d.iterator();
for (double doubles : data) {
if (doubles < doubleIterator.nextDouble()) {
results.add(i);
}
i++;
}
return results;
}
示例9: numberOfNonZeroEntries
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
public int numberOfNonZeroEntries() {
int n = 0;
DoubleIterator values = values();
while (values.hasNext())
if (values.nextDouble() != 0)
n++;
return n;
}
示例10: norm2
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
public double norm2() {
double sumOfSquares = 0;
DoubleIterator values = values();
double v;
while (values.hasNext()) {
v = values.nextDouble();
sumOfSquares += v * v;
}
return Math.sqrt(sumOfSquares);
}
示例11: cutBelow
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
public void cutBelow(double k) {
DoubleIterator iter = values().iterator();
while (iter.hasNext()) {
if (iter.nextDouble() < k)
iter.remove();
}
}
示例12: cutAbove
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
public void cutAbove(double k) {
DoubleIterator iter = values().iterator();
while (iter.hasNext()) {
if (iter.nextDouble() > k)
iter.remove();
}
}
示例13: cutBelow
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
public void cutBelow(double k) {
DoubleIterator iter = values().iterator();
while (iter.hasNext()) {
if (iter.nextDouble() < k) {
iter.remove();
}
}
}
示例14: cutAbove
import it.unimi.dsi.fastutil.doubles.DoubleIterator; //导入方法依赖的package包/类
public void cutAbove(double k) {
DoubleIterator iter = values().iterator();
while (iter.hasNext()) {
if (iter.nextDouble() > k) {
iter.remove();
}
}
}