當前位置: 首頁>>代碼示例>>Java>>正文


Java TIntHashSet.size方法代碼示例

本文整理匯總了Java中gnu.trove.set.hash.TIntHashSet.size方法的典型用法代碼示例。如果您正苦於以下問題:Java TIntHashSet.size方法的具體用法?Java TIntHashSet.size怎麽用?Java TIntHashSet.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gnu.trove.set.hash.TIntHashSet的用法示例。


在下文中一共展示了TIntHashSet.size方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: jaccardIndex

import gnu.trove.set.hash.TIntHashSet; //導入方法依賴的package包/類
public static double jaccardIndex(TIntHashSet a, TIntHashSet b) {
	TIntHashSet union = new TIntHashSet(a);
	union.addAll(b);

	// count up intersection:
	AtomicInteger count = new AtomicInteger();
	a.forEach(x -> {
		if(b.contains(x)) {
			count.incrementAndGet();
		}
		return true;
	});

	double unionSize = union.size();
	double isectSize = count.get();
	return isectSize / unionSize;
}
 
開發者ID:jjfiv,項目名稱:chai,代碼行數:18,代碼來源:SetFns.java

示例2: removeFilteredFluorophores

import gnu.trove.set.hash.TIntHashSet; //導入方法依賴的package包/類
/**
 * Remove all fluorophores which were not drawn
 * 
 * @param fluorophores
 * @param localisations
 * @return
 */
private List<? extends FluorophoreSequenceModel> removeFilteredFluorophores(
		List<? extends FluorophoreSequenceModel> fluorophores, List<LocalisationModel> localisations)
{
	if (fluorophores == null)
		return null;
	// movingMolecules will be created with an initial capacity to hold all the unique IDs
	TIntHashSet idSet = new TIntHashSet((movingMolecules != null) ? movingMolecules.capacity() : 0);
	for (LocalisationModel l : localisations)
		idSet.add(l.getId());
	List<FluorophoreSequenceModel> newFluorophores = new ArrayList<FluorophoreSequenceModel>(idSet.size());
	for (FluorophoreSequenceModel f : fluorophores)
	{
		if (idSet.contains(f.getId()))
			newFluorophores.add(f);
	}
	return newFluorophores;
}
 
開發者ID:aherbert,項目名稱:GDSC-SMLM,代碼行數:25,代碼來源:CreateData.java

示例3: cmpCosineSim

import gnu.trove.set.hash.TIntHashSet; //導入方法依賴的package包/類
private float cmpCosineSim(TIntFloatHashMap v1, TIntFloatHashMap v2) {

		TIntHashSet inters = new TIntHashSet();
		inters.addAll(v1.keySet());
		inters.retainAll(v2.keySet());

		if (inters.size() == 0)
			return 0;
		else {
			int i = 0;
			TIntIterator it = inters.iterator();
			float num = 0;
			float norm_v1 = 0;
			float norm_v2 = 0;
			while (it.hasNext()) {
				i = it.next();
				num += v1.get(i) * v2.get(i);
			}
			for (int k1 : v1.keys())
				norm_v1 += (v1.get(k1) * v1.get(k1));
			for (int k2 : v2.keys())
				norm_v2 += (v2.get(k2) * v2.get(k2));
			return num / (float) (Math.sqrt(norm_v1) * Math.sqrt(norm_v2));

		}

	}
 
開發者ID:sisinflab,項目名稱:lodreclib,代碼行數:28,代碼來源:UserProfileSimilarityRecommenderWorker.java

示例4: simJaccard

import gnu.trove.set.hash.TIntHashSet; //導入方法依賴的package包/類
public double simJaccard(TIntHashSet s1, TIntHashSet s2) {
	int com = 0;
	if(s1==null||s2==null)
		return 0;
	TIntIterator it = s1.iterator();
	for ( int i = s1.size(); i-- > 0; ) {
		int v = it.next();
		if(s2.contains(v))
			com++;
	}
	double sim = com*1.0/(s1.size()+s2.size()-com);
	return sim;
}
 
開發者ID:FudanNLP,項目名稱:fnlp,代碼行數:14,代碼來源:SimilaritySlow.java


注:本文中的gnu.trove.set.hash.TIntHashSet.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。