Package gnu.trove.iterator

Examples of gnu.trove.iterator.TIntIterator


        if ( collection == this ) {
            clear();
            return true;
        }
        boolean changed = false;
        TIntIterator iter = collection.iterator();
        while ( iter.hasNext() ) {
            int element = iter.next();
            if ( remove( element ) ) {
                changed = true;
            }
        }
        return changed;
View Full Code Here


        if (w != null) {
          w.write(concept.getConceptID());
          w.write("\t");
          w.write(Integer.toString(leaves.size()));
          w.write("\t");
          TIntIterator iter = leaves.iterator();
          while (iter.hasNext()) {
            w.write(cg.getConceptList().get(iter.next())
                .getConceptID());
            w.write(" ");
          }
          w.newLine();
        }
View Full Code Here

        this.from = ApplyIndexMapping.optimizeDummies(from);
        this.to = ApplyIndexMapping.optimizeDummies(to);

        int[] typesCounts = new int[IndexType.TYPES_COUNT];

        TIntIterator iterator = TensorUtils.getAllDummyIndicesIncludingScalarFunctionsT(to).iterator();
        while (iterator.hasNext())
            ++typesCounts[IndicesUtils.getType(iterator.next())];

        iterator = TensorUtils.getAllDummyIndicesT(from).iterator();
        while (iterator.hasNext())
            --typesCounts[IndicesUtils.getType(iterator.next())];

        boolean possiblyAddsDummies = false;
        for (int i : typesCounts)
            if (i > 0) {
                possiblyAddsDummies = true;
View Full Code Here

                usedArrays[i] = new BitArray(size);

            //Fulfilling origins array
            for (i = size - 1; i >= 0; --i) {
                dummy = TensorUtils.getAllDummyIndicesT(tensor.get(i));
                TIntIterator iterator = dummy.iterator();

                while (iterator.hasNext())
                    usedArrays[Arrays.binarySearch(allDummyIndices, iterator.next())].set(i);
            }
        }
View Full Code Here

        @Override
        public void submit(TIntSet removed, TIntSet added) {
            insureInitialized();
            TIntSet parentRemoved = null, parentAdded;
            //Calculating really removed indices set
            TIntIterator iterator = removed.iterator();
            int iIndex, index;
            while (iterator.hasNext()) {
                iIndex = Arrays.binarySearch(allDummyIndices, index = iterator.next());
                usedArrays[iIndex].clear(position.currentIndex());

                if (usedArrays[iIndex].bitCount() == 0) {
                    if (parentRemoved == null)
                        parentRemoved = new TIntHashSet(removed.size());
                    parentRemoved.add(index);
                }
            }
            if (parentRemoved == null)
                parentRemoved = EMPTY_INT_SET;

            //Processing added indices and calculating added set to
            //propagate to position.
            parentAdded = new TIntHashSet(added);
            iterator = parentAdded.iterator();
            while (iterator.hasNext()) {
                //Searching index in initial dummy indices set
                iIndex = Arrays.binarySearch(allDummyIndices, iterator.next());

                //If this index is new for this sum it will never be removed,
                //so we don't need to store information about it.
                if (iIndex < 0)
                    continue;

                //If this index was already somewhere in the sum,
                //we don't have to propagate it to position
                if (!usedArrays[iIndex].isEmpty())
                    iterator.remove();

                //Marking this index as added to current summand
                usedArrays[iIndex].set(position.currentIndex());
            }
View Full Code Here

        TIntList oldSorterKeys = sorterKeys;
        sorterKeys = new TIntArrayList();
        sorters = new TIntObjectHashMap<Sorter>();
        reverseIndexer = new TIntObjectHashMap<TIntSet>();

        TIntIterator iter = oldSorterKeys.iterator();
        while (iter.hasNext()) {
            int srcId = iter.next();
            if (this.source.contains(srcId)) {
                sorterKeys.add(srcId);
                Sorter oldSorter = oldSorters.get(srcId);
                Sorter sorter = new Sorter(this, srcId, oldSorter.order, oldSorter.limits);
                sorters.put(srcId, sorter);
View Full Code Here

    private void processDenseChangedEvt(VectorSet evtSrc, int vecid, float[] vector) {
        if (evtSrc == this.source) {
            target.rescore(source.key(), vecid, vector, this);
        } else if (evtSrc == this.target) {
            int tgtVecId = vecid;
            TIntIterator iter = sorterKeys.iterator();
            while (iter.hasNext()) {
                int srcVecId = iter.next();
                float score = scoring.score(source.key(), srcVecId, source.get(srcVecId), target.key(), tgtVecId,
                        vector);
                add(srcVecId, tgtVecId, score);
            }
        }
View Full Code Here

    private void processSparseChangedEvt(VectorSet evtSrc, int vecid, int[] vector) {
        if (evtSrc == this.source) {
            target.rescore(source.key(), vecid, vector, this);
        } else if (evtSrc == this.target) {
            int tgtVecId = vecid;
            TIntIterator iter = sorterKeys.iterator();
            while (iter.hasNext()) {
                int srcVecId = iter.next();
                float score = scoring.score(source.key(), srcVecId, source._get(srcVecId), source.length(srcVecId),
                        target.key(), tgtVecId, vector, vector.length);
                add(srcVecId, tgtVecId, score);
            }
        }
View Full Code Here

    }

    private void processDeletedEvt(int tgtVecId) {
        if (this.reverseIndexer.containsKey(tgtVecId)) {
            TIntSet range = this.reverseIndexer.get(tgtVecId);
            TIntIterator iter = range.iterator();
            while (iter.hasNext()) {
                int srcVecId = iter.next();
                this.sorters.get(srcVecId).remove(tgtVecId);
            }
        }
        reverseIndexer.remove(tgtVecId);
    }
View Full Code Here

   */
  public void mergeCluster() {
    maxc1 = -1;
    maxc2 = -1;
    maxL = Float.NEGATIVE_INFINITY;
    TIntIterator it1 = slots.iterator();
   
    while(it1.hasNext()){
      int i = it1.next();
      TIntIterator it2 = slots.iterator();
//      System.out.print(i+": ");
      while(it2.hasNext()){
        int j= it2.next();
       
        if(i>=j)
          continue;
//        System.out.print(j+" ");
        Multiplesolve c = new Multiplesolve(i,j);
View Full Code Here

TOP

Related Classes of gnu.trove.iterator.TIntIterator

Copyright © 2018 www.massapicom. 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.