当前位置: 首页>>代码示例>>Java>>正文


Java Long2DoubleOpenHashMap.long2DoubleEntrySet方法代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap.long2DoubleEntrySet方法的典型用法代码示例。如果您正苦于以下问题:Java Long2DoubleOpenHashMap.long2DoubleEntrySet方法的具体用法?Java Long2DoubleOpenHashMap.long2DoubleEntrySet怎么用?Java Long2DoubleOpenHashMap.long2DoubleEntrySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap的用法示例。


在下文中一共展示了Long2DoubleOpenHashMap.long2DoubleEntrySet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:gdfm,项目名称:sssj,代码行数:27,代码来源:L2Index.java

示例2: 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;
}
 
开发者ID:gdfm,项目名称:sssj,代码行数:27,代码来源:L2APIndex.java

示例3: 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;
}
 
开发者ID:gdfm,项目名称:sssj,代码行数:17,代码来源:APIndex.java

示例4: 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.log(to.defaultReturnValue()));
  for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
    to.put(entry.getKey().longValue(), Math.log(entry.getValue()));
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:11,代码来源:Log.java

示例5: doProcessRow

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected double doProcessRow(ServerSparseDoubleLongKeyRow row) {
  long entireSize = row.getEndCol() - row.getStartCol();

  Long2DoubleOpenHashMap data = row.getData();
  double asum = 0.0;
  for (Map.Entry<Long, Double> entry: data.long2DoubleEntrySet()) {
    asum += entry.getValue();
  }
  asum += data.defaultReturnValue() * (entireSize - data.size());
  return asum;
}
 
开发者ID:Tencent,项目名称:angel,代码行数:13,代码来源:Sum.java

示例6: doProcessRow

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected double doProcessRow(ServerSparseDoubleLongKeyRow row) {
  Long2DoubleOpenHashMap data = row.getIndex2ValueMap();

  double amin = data.defaultReturnValue();
  for (Map.Entry<Long, Double> entry: data.long2DoubleEntrySet()) {
    amin = Math.min(amin, entry.getValue());
  }
  return amin;
}
 
开发者ID:Tencent,项目名称:angel,代码行数:11,代码来源:Min.java

示例7: doUpdate

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, double[] values) {
  double scalar = values[0];
  Long2DoubleOpenHashMap from = rows[0].getData();
  Long2DoubleOpenHashMap to = from.clone();
  to.defaultReturnValue(scalar);

  for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
    entry.setValue(entry.getValue() - scalar);
  }
  rows[1].setIndex2ValueMap(to);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:13,代码来源:SubS.java

示例8: doProcessRow

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected double doProcessRow(ServerSparseDoubleLongKeyRow row) {
  Long2DoubleOpenHashMap data = row.getIndex2ValueMap();

  double amax = Math.abs(data.defaultReturnValue());
  for (Map.Entry<Long, Double> entry: data.long2DoubleEntrySet()) {
    amax = Math.max(amax, Math.abs(entry.getValue()));
  }
  return amax;
}
 
开发者ID:Tencent,项目名称:angel,代码行数:11,代码来源:Amax.java

示例9: mergeIndexValueMap

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
/**
 * Merge a Long2DoubleOpenHashMap to this vector partition
 * @param index2ValueMap
 */
public void mergeIndexValueMap(Long2DoubleOpenHashMap index2ValueMap) {
  try {
    lock.writeLock().lock();
    for (Map.Entry<Long, Double> entry: index2ValueMap.long2DoubleEntrySet()) {
      index2ValueMap.addTo(entry.getKey(), entry.getValue());
    }
  } finally {
    lock.writeLock().unlock();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:15,代码来源:ServerSparseDoubleLongKeyRow.java

示例10: doUpdate

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, double[] scalars) {
  Long2DoubleOpenHashMap from = rows[0].getIndex2ValueMap();
  Long2DoubleOpenHashMap to = from.clone();

  double value = scalars[0];

  double defaultValue = to.defaultReturnValue();
  to.defaultReturnValue(defaultValue / value);
  for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
    to.put(entry.getKey().longValue(), entry.getValue() / defaultValue);
  }

  rows[1].setIndex2ValueMap(to);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:16,代码来源:DivS.java

示例11: doUpdate

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows) {
  Long2DoubleOpenHashMap from = rows[0].getIndex2ValueMap();

  Long2DoubleOpenHashMap to = from.clone();

  to.defaultReturnValue(Math.ceil(to.defaultReturnValue()));
  for (Map.Entry<Long, Double> entry : to.long2DoubleEntrySet()) {
    entry.setValue(Math.ceil(entry.getValue()));
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:12,代码来源:Ceil.java

示例12: doUpdate

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, Serialize func) {
  MapFunc mapper = (MapFunc) func;
  Long2DoubleOpenHashMap data1 = rows[0].getData();

  Long2DoubleOpenHashMap data2 = data1.clone();
  double defaultValue = data2.defaultReturnValue();
  data2.defaultReturnValue(mapper.call(defaultValue));

  for (java.util.Map.Entry<Long, Double> entry: data2.long2DoubleEntrySet()) {
    double value = entry.getValue();
    entry.setValue(mapper.call(value));
  }
  rows[1].setIndex2ValueMap(data2);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:16,代码来源:Map.java

示例13: doUpdate

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, Serialize func) {
  MapFunc mapper = (MapFunc) func;
  Long2DoubleOpenHashMap data1 = rows[0].getData();

  double defaultValue = data1.defaultReturnValue();
  data1.defaultReturnValue(mapper.call(defaultValue));

  for (java.util.Map.Entry<Long, Double> entry: data1.long2DoubleEntrySet()) {
    double value = entry.getValue();
    entry.setValue(mapper.call(value));
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:14,代码来源:MapInPlace.java

示例14: doUpdate

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows) {
  Long2DoubleOpenHashMap from = rows[0].getIndex2ValueMap();

  Long2DoubleOpenHashMap to = from.clone();
  to.defaultReturnValue(Math.signum(to.defaultReturnValue()));
  for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
    entry.setValue(Math.signum(entry.getValue()));
  }
  rows[1].setIndex2ValueMap(to);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:12,代码来源:Signum.java

示例15: doUpdate

import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerSparseDoubleLongKeyRow[] rows, double[] scalars) {
  double scalar = scalars[0];
  Long2DoubleOpenHashMap from = rows[0].getData();
  Long2DoubleOpenHashMap to = from.clone();
  to.defaultReturnValue(scalar);

  for (Map.Entry<Long, Double> entry: to.long2DoubleEntrySet()) {
    to.addTo(entry.getKey(), scalar);
  }

  rows[1].setIndex2ValueMap(to);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:14,代码来源:AddS.java


注:本文中的it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap.long2DoubleEntrySet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。