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


Java IntSet.size方法代码示例

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


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

示例1: createLocalsChange

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
private DebugLocalsChange createLocalsChange(
    Int2ReferenceMap<DebugLocalInfo> ending, Int2ReferenceMap<DebugLocalInfo> starting) {
  if (ending.isEmpty() && starting.isEmpty()) {
    return null;
  }
  if (ending.isEmpty() || starting.isEmpty()) {
    return new DebugLocalsChange(ending, starting);
  }
  IntSet unneeded = new IntArraySet(Math.min(ending.size(), starting.size()));
  for (Entry<DebugLocalInfo> entry : ending.int2ReferenceEntrySet()) {
    if (starting.get(entry.getIntKey()) == entry.getValue()) {
      unneeded.add(entry.getIntKey());
    }
  }
  if (unneeded.size() == ending.size() && unneeded.size() == starting.size()) {
    return null;
  }
  IntIterator iterator = unneeded.iterator();
  while (iterator.hasNext()) {
    int key = iterator.nextInt();
    ending.remove(key);
    starting.remove(key);
  }
  return new DebugLocalsChange(ending, starting);
}
 
开发者ID:inferjay,项目名称:r8,代码行数:26,代码来源:LinearScanRegisterAllocator.java

示例2: learnNode

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
protected void learnNode(int node, IntSet successors ) throws IOException {
	
	for (int successor : successors) {
		classifier.learn(node2cat.get(node), node2cat.get(successor), true);
		anArcHasBeenLearned();
		pl.lightUpdate();
	}
	int nonSucc;
	for (int i = successors.size()-1; i >= 0; i--) {
		do { 
			nonSucc = rnd.nextInt(numNodes);
		} while (successors.contains(nonSucc));
		classifier.learn(node2cat.get(node), node2cat.get(nonSucc), false);
		anArcHasBeenLearned();
		pl.lightUpdate();
	}
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:18,代码来源:LatentMatrixEstimator.java

示例3: createTestingSet

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
public int[] createTestingSet(int numOfSamples) {
	numOfSamples = Math.min(numOfSamples, numNodes);

	if (verbose) LOGGER.info("Creating test set with "+numOfSamples+" nodes...");
	if (numOfSamples >= (numNodes/2)) {
		final Random rnd = RandomSingleton.get();
		int[] samples = MathArrays.natural(numNodes);
		IntArrays.shuffle(samples, rnd);
		return IntArrays.trim(samples, numOfSamples);
	} else {
		IntSet set = new IntOpenHashSet();
		while (set.size() < numOfSamples) {
			set.add(rnd.nextInt(numNodes));
		}
		int[] r = set.toIntArray();
		return r;
	}
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:19,代码来源:TestMatrix.java

示例4: computeForQuery

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
@Override
public double computeForQuery(int query, UnexpectednessScorer retriever) {
	IntSet evaluatedDocs = groundtruth.getEvaluatedDocs(query);
	double R = groundtruth.getRelevants(query).size();
	double N = evaluatedDocs.size() - R;
	double minNR = Math.min(N, R);
	
	int[] retrieved = retriever.results(query);
	
	double bpref = 0, nonRelevantRankedFirst = 0;
	for (int doc : retrieved)
		if (evaluatedDocs.contains(doc)) {
			if (groundtruth.isRelevant(query, doc)) {
				bpref += 1.0 - (nonRelevantRankedFirst / minNR);
			} else {
				if (nonRelevantRankedFirst < R)
					nonRelevantRankedFirst ++;

			}
		}
	
	bpref /= R;
	printResult(this + "\t" + retriever + "\t" + query(query) + "\t" + bpref);
	
	return bpref;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:27,代码来源:BPrefMeasure.java

示例5: calcRandomHits

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
int calcRandomHits(int _size, int _seed) {
  IntSet _cache = new IntOpenHashSet();
  IntList _list = new IntArrayList();
  Random _random = new Random(_seed);
  int _hitCnt = 0;
  for (int v : getTrace()) {
    if(_cache.contains(v)) {
      _hitCnt++;
    } else {
      if (_cache.size() == _size) {
        int cnt = _random.nextInt(_cache.size());
        _cache.remove(_list.get(cnt));
        _list.remove(cnt);
      }
      _cache.add(v);
      _list.add(v);
    }
  }
  return _hitCnt;
}
 
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:21,代码来源:AccessTrace.java

示例6: countUnique

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
@Override
public int countUnique() {
    IntSet ints = new IntOpenHashSet(size());
    for (int i = 0; i < size(); i++) {
        ints.add(data.getInt(i));
    }
    return ints.size();
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:9,代码来源:DateColumn.java

示例7: scores

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
@Override
public Int2DoubleMap scores(int docI) {
	IntSet successors = successors(docI);
	Int2DoubleMap results = new Int2DoubleOpenHashMap(successors.size());
	IntSet catI = page2cat.get(docI);
	for (int docJ : successors) {
		IntSet catJ = page2cat.get(docJ);
		results.put(docJ, -expectedness(catI, catJ));
	}
	return results;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:12,代码来源:LlamaFurScorer.java

示例8: computeAll

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
public SummaryStatistics[] computeAll() {
	SummaryStatistics[] results = new SummaryStatistics[retrievers.length];
	for (int i = 0; i < retrievers.length; i++)
		results[i] = new SummaryStatistics();
	
	IntSet queries = groundtruth.queriesWithRelevantDocs();
	
	ProgressLogger pl = new ProgressLogger(LOGGER, "query retrievals");
	pl.expectedUpdates = queries.size() * retrievers.length;
	pl.start("Computing results for each of the " + queries.size() + 
			" queries and "+retrievers.length+ " retrieving algorithms..."  );
	
	for (int query : queries) {
		for (int i = 0; i < retrievers.length; i++) {
			double value = computeForQuery(query, retrievers[i]);
			if (Double.isNaN(value))
				continue;
			results[i].addValue(value);
			pl.update();
		}
	}
	
	pl.done();
	
	long nItems = results[0].getN();
	for (SummaryStatistics s : results)
		if (s.getN() != nItems)
			throw new IllegalStateException("The measure returned NaN differently for different algorithms.");
	
	print(retrievers, results);
	
	return results;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:34,代码来源:AbstractMeasure.java

示例9: check

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
public void check(int node) {
	IntSet consideredSuccessors = evaluations.getEvaluatedDocs(node);
	IntSet unmatchedSuccessors = new IntOpenHashSet(consideredSuccessors);
	
	int howMany = (int) (graph.outdegree(node) * ALPHA);
	
	for (UnexpectednessScorer poolMember : pool ) {
		int resultsConsidered = 0;
		for (int succ : poolMember.results(node, howMany))
			if (consideredSuccessors.contains(succ)) {
				resultsConsidered++;
				unmatchedSuccessors.remove(succ);
			}
		
		if (resultsConsidered == 0)
			LOGGER.warn(
					poolMember.toString()
					+ " got no considered results for query " + id2name.get(node)
					);
		
		double fractionOfItsResultsOverConsideredResults =
				(double) resultsConsidered / consideredSuccessors.size();
		retriever2itsFraction.get(poolMember).addValue(fractionOfItsResultsOverConsideredResults);
		retriever2evaluatedTopResults.get(poolMember).addValue((double) resultsConsidered / howMany);
	}
	
	double unmatchedResultsOverConsideredResults =
			(double) unmatchedSuccessors.size() / consideredSuccessors.size();
	unmatchStats.addValue(unmatchedResultsOverConsideredResults);
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:31,代码来源:PooledDatasetChecker.java

示例10: HittingDistanceMinimizer

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
@CommandLine(argNames={"graph", "milestones"})
public HittingDistanceMinimizer(ImmutableGraph graph, IntSet milestones) {
	this.graph = Transform.transpose(graph);
	this.milestones = milestones;
	minMilestoneDistance = new int[graph.numNodes()];
	IntArrays.fill(minMilestoneDistance, Integer.MAX_VALUE);
	closestMilestone = new int[graph.numNodes()];
	IntArrays.fill(closestMilestone, -1);
	milestoneQueue = new IntArrayPriorityQueue(milestones.toIntArray());
	runningVisitors = new ObjectOpenHashSet<Visitor>();
	pl  = new ProgressLogger(LOGGER, "milestones");
	pl.expectedUpdates = milestones.size();
	
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:15,代码来源:HittingDistanceMinimizer.java

示例11: getTopExcluding

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
public IntSet getTopExcluding(final int k, final String[] excludedStrings, PrintWriter plainOutput) {
	LOGGER.info("Computing top-"+k+" categories from those whose name"
			+ " don't contains (case-insensitevely) "
			+ "any of "+Arrays.toString(excludedStrings)+"...");
	
	IntSet okIds = new IntOpenHashSet(k);
	boolean isNameOk;
	String name;
	for (int category : positions) {
		isNameOk = true;
		name = names.get(category).toLowerCase();
		for (String excludedString : excludedStrings)
			if (name.indexOf(excludedString) != -1) {
				isNameOk = false;
				break;
			}
		if (isNameOk) {
			okIds.add(category);
			if (plainOutput != null)
				plainOutput.println(names.get(category));
			if (okIds.size() == k)
				break;
		}
	}

	LOGGER.info("Top-"+k+" categories computed.");
	return okIds;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:29,代码来源:CategoryGraphCentralityRanker.java

示例12: InPredicateEvaluator

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
public InPredicateEvaluator(InPredicate predicate, Dictionary dictionary) {
  IntSet dictIds = new IntOpenHashSet();
  final String[] inValues = predicate.getInRange();
  for (final String value : inValues) {
    final int index = dictionary.indexOf(value);
    if (index >= 0) {
      dictIds.add(index);
    }
  }
  matchingIds = new int[dictIds.size()];
  int i = 0;
  for (int dictId : dictIds) {
    matchingIds[i++] = dictId;
  }
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:16,代码来源:InPredicateEvaluator.java

示例13: initStatistics

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
private void initStatistics() {
  IntSet _values = new IntOpenHashSet();
  for (int v : getTrace()) {
    _values.add(v);
    if (v < lowValue) {
      lowValue = v;
    }
    if (v > highValue) {
      highValue = v;
    }
  }
  valueCount = _values.size();
}
 
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:14,代码来源:AccessTrace.java

示例14: countUnique

import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
@Override
public int countUnique() {
    IntSet ints = new IntOpenHashSet(data);
    return ints.size();
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:6,代码来源:TimeColumn.java


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