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


Java IntOpenHashSet类代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.ints.IntOpenHashSet的典型用法代码示例。如果您正苦于以下问题:Java IntOpenHashSet类的具体用法?Java IntOpenHashSet怎么用?Java IntOpenHashSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: syncMatrixInfos

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
/**
 * compare the matrix meta on the master and the matrix meta on ps to find the matrix this parameter server needs to create and delete
 * @param matrixReports parameter server matrix report, include the matrix ids this parameter server hold.
 * @param needCreateMatrixes use to return the matrix partitions this parameter server need to build
 * @param needReleaseMatrixes use to return the matrix ids this parameter server need to remove
 * @param needRecoverParts need recover partitions
 * @param psId parameter server id
*/
public void syncMatrixInfos(List<MatrixReport> matrixReports,
  List<MatrixMeta> needCreateMatrixes, List<Integer> needReleaseMatrixes,
  List<RecoverPartKey> needRecoverParts, ParameterServerId psId) {

  //get matrix ids in the parameter server report
  IntOpenHashSet matrixInPS = new IntOpenHashSet();
  int size = matrixReports.size();
  for (int i = 0; i < size; i++) {
    matrixInPS.add(matrixReports.get(i).matrixId);
  }

  handleMatrixReports(psId, matrixReports);

  Set<RecoverPartKey> parts = getAndRemoveNeedRecoverParts(psId);
  if(parts != null) {
    needRecoverParts.addAll(parts);
  }

  //get the matrices parameter server need to create and delete
  getPSNeedUpdateMatrix(matrixInPS, needCreateMatrixes, needReleaseMatrixes, psId);
  psMatricesUpdate(psId, matrixReports);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:31,代码来源:AMMatrixMetaManager.java

示例2: hashCode

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
@Override
public int hashCode() {
	final int prime = 31;
	int result = 1;

	List<IntOpenHashSet> setCluster = this.convertClustersToSets(this.clusters);

	Collections.sort(setCluster, new Comparator<IntSet>() {
		@Override
		public int compare(IntSet o1, IntSet o2) {
			return o1.hashCode() - o2.hashCode();
		}
	});
	result = prime * result + (setCluster.hashCode());
	return result;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:17,代码来源:PositionListIndex.java

示例3: groupAttributesByValue

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
private Map<String, IntSet> groupAttributesByValue(final IntSet attributes)
    throws AlgorithmExecutionException {

  final Map<String, IntSet> attributesByValue = new HashMap<>();
  for (final int attribute : attributes) {
    final Collection<String> values = getValues(attribute);

    if (configuration.isProcessEmptyColumns() && values.isEmpty()) {
      handleEmptyAttribute(attribute, attributes);
    } else {
      for (final String value : values) {
        attributesByValue.computeIfAbsent(value, k -> new IntOpenHashSet()).add(attribute);
      }
    }
  }
  return attributesByValue;
}
 
开发者ID:HPI-Information-Systems,项目名称:AdvancedDataProfilingSeminar,代码行数:18,代码来源:DeMarchi.java

示例4: PartitionedRegionQueryEvaluator

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
/**
 * Construct a PartitionedRegionQueryEvaluator
 * 
 * @param sys the distributed system
 * @param pr the partitioned region
 * @param query the query
 * @param parameters the parameters for executing the query
 * @param cumulativeResults where to add the results as they come in
 */
public PartitionedRegionQueryEvaluator(InternalDistributedSystem sys, PartitionedRegion pr,
    DefaultQuery query, Object[] parameters, SelectResults cumulativeResults,
    Set<Integer> bucketsToQuery) {
  super(sys, pr.getPRId());
  this.pr = pr;
  this.query = query;
  this.parameters = parameters;
  this.cumulativeResults = cumulativeResults;
  this.bucketsToQuery = bucketsToQuery;
  this.successfulBuckets = new IntOpenHashSet(this.bucketsToQuery.size());
  this.resultsPerMember =
      new ConcurrentHashMap<InternalDistributedMember, Collection<Collection>>();
  this.node2bucketIds = Collections.emptyMap();
  if (query != null && query.isTraced()) {
    prQueryTraceInfoList = new ConcurrentLinkedQueue();
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:27,代码来源:PartitionedRegionQueryEvaluator.java

示例5: getGroundTruthIdsFromEntityIds

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
/**
 * Return the ground truth in an RDD format, each entity represented with an integer entity id. 
 * @param entityIds1RDD
 * @param entityIds2RDD
 * @param gt
 * @param GT_SEPARATOR
 * @return 
 */
public static JavaPairRDD<Integer,Integer> getGroundTruthIdsFromEntityIds (JavaRDD<String> entityIds1RDD, JavaRDD<String> entityIds2RDD, JavaRDD<String> gt, String GT_SEPARATOR) {
    Object2IntOpenHashMap<String> entityIds1 = readEntityIdsMapping(entityIds1RDD, true);
    Object2IntOpenHashMap<String> entityIds2 = readEntityIdsMapping(entityIds2RDD, false); 
    
    return gt.mapToPair(line -> {
                line = line.toLowerCase();
                String [] parts = line.split(GT_SEPARATOR);                    
                parts[1] = encodeURIinUTF8(parts[1]);
                return new Tuple2<>(-entityIds2.getOrDefault(parts[1], -1), //negative id first (keep default -1, since -(-1) == 1)
                                    entityIds1.getOrDefault(parts[0], -1)); //positive id second
            })
            .filter(x-> x._1() != 1 && x._2() != -1) //throw away pairs whose elements (one or both) do not appear in the dataset
            //remove pairs violating the clean-clean constraint
            .aggregateByKey(new IntOpenHashSet(), 
                    (x,y) -> {x.add(y); return x;}, 
                    (x,y) -> {x.addAll(y); return x;})
            .filter(x -> x._2().size() == 1) //not more than one match allowed per (negative) entity
            .mapValues(x -> x.iterator().next());
            
}
 
开发者ID:vefthym,项目名称:MinoanER,代码行数:29,代码来源:Utils.java

示例6: replayTrain

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
private void replayTrain(@Nonnull final ByteBuffer buf) {
    final int itemI = buf.getInt();
    final int knnSize = buf.getInt();

    final Int2ObjectMap<Int2FloatMap> knnItems = new Int2ObjectOpenHashMap<>(1024);
    final IntSet pairItems = new IntOpenHashSet();
    for (int i = 0; i < knnSize; i++) {
        int user = buf.getInt();
        int ruSize = buf.getInt();
        Int2FloatMap ru = new Int2FloatOpenHashMap(ruSize);
        ru.defaultReturnValue(0.f);

        for (int j = 0; j < ruSize; j++) {
            int itemK = buf.getInt();
            pairItems.add(itemK);
            float ruk = buf.getFloat();
            ru.put(itemK, ruk);
        }
        knnItems.put(user, ru);
    }

    for (int itemJ : pairItems) {
        train(itemI, knnItems, itemJ);
    }
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:26,代码来源:SlimUDTF.java

示例7: hashCode

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;

    List<IntOpenHashSet> setCluster = convertClustersToSets(clusters);

    Collections.sort(setCluster, new Comparator<IntSet>() {

        @Override
        public int compare(IntSet o1, IntSet o2) {
            return o1.hashCode() - o2.hashCode();
        }
    });
    result = prime * result + (setCluster.hashCode());
    return result;
}
 
开发者ID:mpoiitis,项目名称:DUCCspark,代码行数:18,代码来源:PositionListIndex.java

示例8: GraphFunctions

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
public GraphFunctions(int[][] edges2D, int noNodes) {
 try {
        nv = noNodes;
        nodes = new IntOpenHashSet[nv];
        
        for(int i = 0;i < nv;i ++) {
            nodes[i] = new IntOpenHashSet();
        }
        for(int i = 0; i < edges2D.length; i++) {
            int v1 = edges2D[i][0];
            int v2 = edges2D[i][1];
            nodes[v1].add(v2);
            nodes[v2].add(v1);
        }
    } catch(Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:ViDA-NYU,项目名称:data-polygamy,代码行数:19,代码来源:GraphFunctions.java

示例9: learnNPassShuffled

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
public void learnNPassShuffled(int n) throws ReflectiveOperationException, IOException {
	pl.info = classifier.shortStats();
	pl.expectedUpdates = graph.numArcs() * 2 * n;
	pl.start();
	
	for (int pass = 0; pass < n; pass++) {
		LOGGER.info("Starting learning pass #"+(pass+1)+"...");
		int[] nodes = MathArrays.natural(numNodes);
		nodes = IntArrays.shuffle(nodes, rnd);
		
		for (int node : nodes)
			learnNode(node, new IntOpenHashSet(
					graph.successorArray(node), 0, graph.outdegree(node)
					));
		
		save(pass+1);
		
	}

	pl.done();
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:22,代码来源:LatentMatrixEstimator.java

示例10: createTestingSet

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的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

示例11: parseCategories

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
private IntSet parseCategories(Document wikiPage) throws IOException {
		String categoryString = IOUtils.toString((Reader) wikiPage.content(CATEGORY_FIELD));
		IntSet categoryIds = new IntOpenHashSet();
		int pipeIndex;
		
		for (String category : categoryString.split(SEPARATOR_REGEX)) {
			if ((pipeIndex = category.indexOf('|')) > -1)
				category = category.substring(0, pipeIndex);
			
			category = StringUtils.strip(category);
			if (category.length() > 0)
				categoryIds.add(getCategoryId(category));
		}
		
		return categoryIds;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:17,代码来源:WikipediaCategoryProducer.java

示例12: removeIfNotOneRelevantAndOneIrrelevant

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
public void removeIfNotOneRelevantAndOneIrrelevant() {
	IntSet queriesToRemove = new IntOpenHashSet();
	for (int query : queries()) {
		int nEval = query2evaluateddocs.get(query).size();
		int nRelev = query2relevantdocs.get(query).size();
		int nIrrelev = nEval - nRelev;
		if (nRelev < 1 || nIrrelev < 1)
			queriesToRemove.add(query);
	}
	
	int originalNQueries = queries().size();
	for (int q : queriesToRemove) {
		query2doc2relevance.remove(q);
		query2evaluateddocs.remove(q);
		query2relevantdocs.remove(q);
	}
	
	LOGGER.info(queriesToRemove.size() + " queries were without "
			+ "relevant or irrilevant results and were removed. "
			+ "Number of queries went from " + originalNQueries 
			+ " to " + queries().size() + ".");
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:23,代码来源:GroundTruth.java

示例13: compute

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
public void compute() {
	ProgressLogger pl = new ProgressLogger(LOGGER, "pages");
	pl.expectedUpdates = page2cat.size();
	pl.start("Moving old categories to closest milestones...");
	for (IntSet entry : page2cat.values()) {
		IntSet newCategories = new IntOpenHashSet();
		int milestone;
		for (int cat : entry) {
			milestone = closestMilestones[cat];
			if (milestone != -1)
				newCategories.add(milestone);
		}
		entry.clear();
		entry.addAll(newCategories);
		pl.lightUpdate();
	}
	pl.done();
	
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:20,代码来源:PagesCategorizationMover.java

示例14: stream

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
@Override
public Stream<? extends FMInstance> stream() {
    return uidxs.stream()
            .flatMap(uidx -> {
                IntSet uidxIidxs = new IntOpenHashSet();
                prefs.getUidxIidxs(uidx).forEachRemaining(uidxIidxs::add);

                List<FMInstance> instances = new ArrayList<>();

                // adding positive examples
                uidxIidxs
                        .forEach(iidx -> instances.add(getInstance(uidx, iidx, 1.0)));

                // adding negative examples
                rnd.ints(iidxs.size(), 0, iidxs.size()).map(iidxs::getInt)
                        .filter(jidx -> !uidxIidxs.contains(jidx))
                        .distinct()
                        .limit((int) (negativeProp * uidxIidxs.size()))
                        .forEach(jidx -> instances.add(getInstance(uidx, jidx, 0.0)));

                Collections.shuffle(instances);

                return instances.stream();
            });
}
 
开发者ID:RankSys,项目名称:RankSys,代码行数:26,代码来源:OneClassPreferenceFMData.java

示例15: setParameters

import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入依赖的package包/类
public void setParameters(int sigma, int gamma, int lambda, Taxonomy taxonomy) {
	this.sigma = sigma;
	this.gamma = gamma;
	this.lambda = lambda;
	this.taxonomy = taxonomy;

	scanIndex = new IntOpenHashSet[lambda - 1][lambda - 1];
	rightIndex = new IntOpenHashSet[lambda - 1][lambda - 1];
	for (int i = 0; i < lambda - 1; ++i) {
		for (int j = 0; j < lambda - 1; ++j) {
			scanIndex[i][j] = new IntOpenHashSet();
			rightIndex[i][j] = new IntOpenHashSet();
		}
	}
	clear();
}
 
开发者ID:uma-pi1,项目名称:lash,代码行数:17,代码来源:PSMwithIndex.java


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