Examples of IntSet


Examples of edu.ucla.sspace.util.primitive.IntSet

        @Override public IntIterator iterator() {
            return new CombinedIterator();
        }

         @Override public int size() {
             IntSet smaller, larger;
             if (inEdges.size() < outEdges.size()) {
                 smaller = inEdges;
                 larger = outEdges;
             }
             else {
                 smaller = outEdges;
                 larger = inEdges;
             }
             int size = larger.size();
             IntIterator iter = smaller.iterator();
             while (iter.hasNext()) {
                 int i = iter.nextInt();
                 if (!larger.contains(i))
                     size++;
             }
View Full Code Here

Examples of edu.ucla.sspace.util.primitive.IntSet

    private void flushBuffer(ByteBuffer buffer, boolean force) throws IOException {
        if (buffer.position()==0) return;
        if (force || buffer.position()==buffer.limit()) {
            buffer.limit(buffer.position());
            buffer.position(0);
            IntSet failedPositions = new TroveIntSet(100);
            long time=System.currentTimeMillis();
            while (buffer.position() != buffer.limit()) {
                final int position = buffer.position();
                if (!updateFromBuffer(buffer)) failedPositions.add(position);
            }
            if (log.isInfoEnabled()) log.info(String.format("flushed buffer %d, kept %d took %d ms.",idx(buffer),failedPositions.size(),System.currentTimeMillis()-time));
            stats[idx(buffer)].written(buffer.position()/RECORD_SIZE - failedPositions.size());
            buffer.limit(capacity);
            int initialPos=failedPositions.isEmpty() ? 0 : copyFailedPositions(buffer, failedPositions);
            buffer.position(initialPos);
        }
    }
View Full Code Here

Examples of edu.ucla.sspace.util.primitive.IntSet

            final int v1 = iter1.nextInt();
            WORK_QUEUE.add(taskKey, new Runnable() {
                    public void run() {
                        veryVerbose(LOGGER, "Computing similarities for " +
                                    "vertex %d", v1);
                        IntSet neighbors = g.getNeighbors(v1);
                        IntIterator it1 = neighbors.iterator();
                        while (it1.hasNext()) {
                            int v2 = it1.nextInt();
                            IntIterator it2 = neighbors.iterator();
                            while (it2.hasNext()) {
                                int v3 = it2.nextInt();
                                if (v2 == v3)
                                    break;
                                double sim = getConnectionSimilarity(
View Full Code Here

Examples of edu.ucla.sspace.util.primitive.IntSet

            final int v1 = iter1.nextInt();
            WORK_QUEUE.add(taskKey, new Runnable() {
                    public void run() {
                        veryVerbose(LOGGER, "Computing similarities for " +
                                    "vertex %d", v1);
                        IntSet neighbors = g.getNeighbors(v1);
                        IntIterator it1 = neighbors.iterator();
                        while (it1.hasNext()) {
                            int v2 = it1.nextInt();
                            IntIterator it2 = neighbors.iterator();
                            while (it2.hasNext()) {
                                int v3 = it2.nextInt();
                                if (v2 == v3)
                                    break;
                                double sim = getConnectionSimilarity(
View Full Code Here

Examples of edu.ucla.sspace.util.primitive.IntSet

            WORK_QUEUE.add(key, new Runnable() {
                    public void run() {
                        veryVerbose(LOGGER, "Computing similarities for " +
                                    "vertex %d", v1);
                        //Set<E> adjList = graph.getAdjacencyList(v1);
                        IntSet neighbors = graph.getNeighbors(v1);
                        // Create a thread-local PriorityQueue that will hold
                        // the edge similarities for this vertex.  Once all the
                        // simialrites have been computed, we can update the
                        // thread-shared queue with minimal locking
                        PriorityQueue<EdgePair> localQ =
                            new PriorityQueue<EdgePair>(neighbors.size());
                        IntIterator it1 = neighbors.iterator();
                        // for (E e1 : adjList) {
                        while (it1.hasNext()) {
                            // int v2 = (e1.to() == v1) ? e1.from() : e1.to();
                            int v2 = it1.nextInt();
                           
                            IntIterator it2 = neighbors.iterator();
                            // for (Edge e2 : graph.getAdjacencyList(v1)) {
                            while (it2.hasNext()) {
                                int v3 = it2.nextInt();
                                if (v2 == v3)
                                    break;
View Full Code Here

Examples of edu.ucla.sspace.util.primitive.IntSet

     * @return the similarity of the edges.a
     */
    protected <E extends Edge> double getConnectionSimilarity(
            Graph<E> graph, int keystone, int impost1, int impost2) {
       
        IntSet n1 = graph.getNeighbors(impost1);
        IntSet n2 = graph.getNeighbors(impost2);
        int n1size = n1.size();
        int n2size = n2.size();
        // Swap based on size prior to searching for which vertices are in
        // common
        if (n1size > n2size) {
            IntSet tmp = n2;
            n2 = n1;
            n1 = tmp;
            int t = impost1;
            impost1 = impost2;
            impost2 = t;
View Full Code Here

Examples of edu.ucla.sspace.util.primitive.IntSet

    /**
     * {@inheritDoc}
     */
    public IntSet predecessors(int vertex) {
        Set<T> in = inEdges(vertex);
        IntSet preds = new TroveIntSet();
        if (in.isEmpty())
            return preds;
        for (T e : in)
            preds.add(e.from());
        return preds;
    }
View Full Code Here

Examples of edu.ucla.sspace.util.primitive.IntSet

    /**
     * {@inheritDoc}
     */
    public IntSet successors(int vertex) {
        Set<T> out = outEdges(vertex);
        IntSet succs = new TroveIntSet();
        if (out.isEmpty())
            return succs;
        for (T e : out)
            succs.add(e.to());
        return succs;
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntSet

      _numIter = numIter;
      _collector = statsCollector;

      int maxDoc = reader.maxDoc();

      IntSet idSet = new IntOpenHashSet();
      while (idSet.size() < numToFetch) {
        int docid = _rand.nextInt(maxDoc);
        if (!idSet.contains(docid) && !reader.isDeleted(docid)) {
          idSet.add(docid);
        }
      }

      docsToFetch = idSet.toIntArray();
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntSet

       
      }
    }
   
    public int[] convert(FacetDataCache dataCache, String[] vals) {
      IntSet intSet = new IntOpenHashSet();
        getFilters(dataCache,intSet,vals, _depth, _strict);
        return intSet.toIntArray();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.