it.unimi.dsi.fastutil.doubles.Double2IntMap Java Examples

The following examples show how to use it.unimi.dsi.fastutil.doubles.Double2IntMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Dimensions.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
private static Dimension toDimension(DoubleSortedSet thresholds) {
	int size = thresholds.size();
	Double2IntMap map = new Double2IntOpenHashMap(size);
	int i = 1;
	OfDouble it = thresholds.iterator();
	while (it.hasNext()) {
		double threshold = it.nextDouble();
		map.put(threshold, i++);
	}
	return new Dimension(map);
}
 
Example #2
Source File: NoDictionarySingleColumnGroupKeyGenerator.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private int getKeyForValue(double value) {
  Double2IntMap map = (Double2IntMap) _groupKeyMap;
  int groupId = map.get(value);
  if (groupId == INVALID_ID) {
    if (_numGroups < _globalGroupIdUpperBound) {
      groupId = _numGroups;
      map.put(value, _numGroups++);
    }
  }
  return groupId;
}