本文整理汇总了Java中it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java Long2DoubleOpenHashMap.put方法的具体用法?Java Long2DoubleOpenHashMap.put怎么用?Java Long2DoubleOpenHashMap.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap
的用法示例。
在下文中一共展示了Long2DoubleOpenHashMap.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, Serialize func) {
Zip2MapWithIndexFunc mapper = (Zip2MapWithIndexFunc) func;
Long2DoubleOpenHashMap from1 = rows[0].getData();
Long2DoubleOpenHashMap from2 = rows[1].getData();
Long2DoubleOpenHashMap to = from1.clone();
// TODO: a better way is needed to deal with defaultValue
assert (from1.defaultReturnValue() == 0.0 && from2.defaultReturnValue() == 0.0);
LongSet keySet = from1.keySet();
keySet.addAll(from2.keySet());
for (long key: keySet) {
to.put(key, mapper.call((int)key, from1.get(key), from2.get(key)));
}
rows[2].setIndex2ValueMap(to);
}
示例2: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, Serialize func) {
Zip2MapFunc mapper = (Zip2MapFunc) func;
Long2DoubleOpenHashMap from1 = rows[0].getData();
Long2DoubleOpenHashMap from2 = rows[1].getData();
Long2DoubleOpenHashMap to = from1.clone();
to.defaultReturnValue(mapper.call(from1.defaultReturnValue(), from2.defaultReturnValue()));
LongSet keySet = from1.keySet();
keySet.addAll(from2.keySet());
for (long key: keySet) {
to.put(key, mapper.call(from1.get(key), from2.get(key)));
}
rows[2].setIndex2ValueMap(to);
}
示例3: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, Serialize func) {
Zip3MapWithIndexFunc mapper = (Zip3MapWithIndexFunc) func;
Long2DoubleOpenHashMap from1 = rows[0].getData();
Long2DoubleOpenHashMap from2 = rows[1].getData();
Long2DoubleOpenHashMap from3 = rows[2].getData();
Long2DoubleOpenHashMap to = from1.clone();
// TODO: a better way is needed to deal with defaultValue
assert (from1.defaultReturnValue() == 0.0 && from2.defaultReturnValue() == 0.0);
LongSet keySet = from1.keySet();
keySet.addAll(from2.keySet());
for (long key: keySet) {
to.put(key, mapper.call((int)key, from1.get(key), from2.get(key), from3.get(key)));
}
rows[2].setIndex2ValueMap(to);
}
示例4: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, Serialize func) {
Zip3MapFunc mapper = (Zip3MapFunc) func;
Long2DoubleOpenHashMap from1 = rows[0].getData();
Long2DoubleOpenHashMap from2 = rows[1].getData();
Long2DoubleOpenHashMap from3 = rows[2].getData();
Long2DoubleOpenHashMap to = from1.clone();
to.defaultReturnValue(mapper
.call(from1.defaultReturnValue(), from2.defaultReturnValue(), from3.defaultReturnValue()));
LongSet keySet = from1.keySet();
keySet.addAll(from2.keySet());
for (long key: keySet) {
to.put(key, mapper.call(from1.get(key), from2.get(key), from3.get(key)));
}
rows[2].setIndex2ValueMap(to);
}
示例5: loadSparseDoubleLongKeyPartition
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
private static void loadSparseDoubleLongKeyPartition(SparseDoubleLongKeyModel model,
FSDataInputStream input, ModelPartitionMeta partMeta) throws IOException {
int rowNum = input.readInt();
int rowId = 0;
int nnz = 0;
int totalNNZ = 0;
Long2DoubleOpenHashMap row = null;
for (int i = 0; i < rowNum; i++) {
rowId = input.readInt();
nnz = input.readInt();
totalNNZ = (int) (nnz * (model.col) / (partMeta.getEndCol() - partMeta.getStartCol()));
row = model.getRow(rowId, partMeta.getPartId(), totalNNZ);
for (int j = 0; j < nnz; j++) {
row.put(input.readLong(), input.readDouble());
}
}
}
示例6: verifyCandidates
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
private final Long2DoubleOpenHashMap verifyCandidates(final Vector v, Long2DoubleOpenHashMap accumulator) {
Long2DoubleOpenHashMap matches = new Long2DoubleOpenHashMap();
for (Long2DoubleMap.Entry e : accumulator.long2DoubleEntrySet()) {
final long candidateID = e.getLongKey();
if (Double.compare(e.getDoubleValue() + ps.get(candidateID), theta) < 0) // A[y] = dot(x, y'')
continue; // l2 pruning
Vector residual = residuals.get(candidateID);
assert (residual != null);
final double ds1 = e.getDoubleValue()
+ Math.min(v.maxValue() * residual.sumValues(), residual.maxValue() * v.sumValues());
if (Double.compare(ds1, theta) < 0)
continue; // dpscore, eq. (5)
final double sz2 = e.getDoubleValue() + Math.min(v.maxValue() * residual.size(), residual.maxValue() * v.size());
if (Double.compare(sz2, theta) < 0)
continue; // dpscore, eq. (9)
final long deltaT = v.timestamp() - candidateID;
double score = e.getDoubleValue() + Vector.similarity(v, residual); // dot(x, y) = A[y] + dot(x, y')
score *= forgettingFactor(lambda, deltaT); // apply forgetting factor
numSimilarities++;
if (Double.compare(score, theta) >= 0) // final check
matches.put(candidateID, score);
}
numMatches += matches.size();
return matches;
}
示例7: verifyCandidates
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
private final Long2DoubleOpenHashMap verifyCandidates(final Vector v, Long2DoubleOpenHashMap accumulator) {
Long2DoubleOpenHashMap matches = new Long2DoubleOpenHashMap();
for (Long2DoubleMap.Entry e : accumulator.long2DoubleEntrySet()) {
final long candidateID = e.getLongKey();
if (Double.compare(e.getDoubleValue() + ps.get(candidateID), theta) < 0) // A[y] = dot(x, y'')
continue; // l2 pruning
final Vector residual = residuals.get(candidateID);
assert (residual != null);
final double ds1 = e.getDoubleValue()
+ Math.min(v.maxValue() * residual.sumValues(), residual.maxValue() * v.sumValues());
if (Double.compare(ds1, theta) < 0)
continue; // dpscore, eq. (5)
final double sz2 = e.getDoubleValue() + Math.min(v.maxValue() * residual.size(), residual.maxValue() * v.size());
if (Double.compare(sz2, theta) < 0)
continue; // dpscore, eq. (9)
final long deltaT = v.timestamp() - candidateID;
double score = e.getDoubleValue() + Vector.similarity(v, residual); // dot(x, y) = A[y] + dot(x, y')
score *= forgettingFactor(lambda, deltaT); // apply forgetting factor
numSimilarities++;
if (Double.compare(score, theta) >= 0) // final check
matches.put(candidateID, score);
}
numMatches += matches.size();
return matches;
}
示例8: verifyCandidates
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
private Long2DoubleOpenHashMap verifyCandidates(final Vector v, Long2DoubleOpenHashMap accumulator) {
Long2DoubleOpenHashMap matches = new Long2DoubleOpenHashMap();
for (Long2DoubleMap.Entry e : accumulator.long2DoubleEntrySet()) {
long candidateID = e.getLongKey();
Vector candidateResidual = residuals.get(candidateID);
assert (candidateResidual != null);
double score = e.getDoubleValue() + Vector.similarity(v, candidateResidual); // A[y] + dot(y',x)
long deltaT = v.timestamp() - candidateID;
score *= Commons.forgettingFactor(lambda, deltaT); // apply forgetting factor
numSimilarities++;
if (Double.compare(score, theta) >= 0) // final check
matches.put(candidateID, score);
}
numMatches += matches.size();
return matches;
}
示例9: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows) {
Long2DoubleOpenHashMap from = rows[0].getData();
Long2DoubleOpenHashMap to = from.clone();
to.defaultReturnValue(Math.round(to.defaultReturnValue()));
for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
to.put(entry.getKey(), Math.round(entry.getValue()));
}
}
示例10: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows) {
Long2DoubleOpenHashMap from = rows[0].getData();
Long2DoubleOpenHashMap to = from.clone();
to.defaultReturnValue(Math.log10(to.defaultReturnValue()));
for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
to.put(entry.getKey().longValue(), Math.log10(entry.getValue()));
}
}
示例11: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows) {
Long2DoubleOpenHashMap from = rows[0].getData();
Long2DoubleOpenHashMap to = from.clone();
to.defaultReturnValue(Math.log1p(to.defaultReturnValue()));
for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
to.put(entry.getKey().longValue(), Math.log1p(entry.getValue()));
}
}
示例12: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows) {
Long2DoubleOpenHashMap from = rows[0].getData();
Long2DoubleOpenHashMap to = from.clone();
to.defaultReturnValue(Math.floor(to.defaultReturnValue()));
for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
to.put(entry.getKey().longValue(), Math.floor(entry.getValue()));
}
}
示例13: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows) {
Long2DoubleOpenHashMap from = rows[0].getData();
Long2DoubleOpenHashMap to = from.clone();
to.defaultReturnValue(Math.expm1(to.defaultReturnValue()));
for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
to.put(entry.getKey().longValue(), Math.expm1(entry.getValue()));
}
}
示例14: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows) {
Long2DoubleOpenHashMap from = rows[0].getData();
Long2DoubleOpenHashMap to = from.clone();
to.defaultReturnValue(Math.exp(to.defaultReturnValue()));
for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
to.put(entry.getKey().longValue(), Math.exp(entry.getValue()));
}
}
示例15: doUpdate
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, double[] values) {
Long2DoubleOpenHashMap from = rows[0].getData();
Long2DoubleOpenHashMap to = from.clone();
double value = values[0];
for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
to.put(entry.getKey().longValue(), Math.pow(entry.getValue(), value));
}
}