Package java.util

Examples of java.util.BitSet.nextSetBit()


            bsProto.and(bsProtoPruner[1][(f.getY()+128) >> 2]);
            bsProto.and(bsProtoPruner[2][f.getTheta() >> 2]);
           
            if (!bsProto.isEmpty()) {
                for (int nProto=0;
                    -1 != (nProto = bsProto.nextSetBit(nProto));
                    nProto++) {
                    LearntFeature lf = proto.get(nProto);
                    byte rbConfigs[] = lf.getConfigs();
                    int nX = Math.abs(lf.getA() * f.getX() - lf.getB() * f.getY() + lf.getC());
                    int nY = Math.abs((f.getTheta() - lf.getAngle()) << 8);
View Full Code Here


            }
        }
        this.mrbConfig = new byte[Configs.cardinality()];
        int nBit = 0;
        for (int nConfig = 0;
        -1 != (nConfig = Configs.nextSetBit(nConfig));
        nConfig++) {
          this.mrbConfig[nBit++] = (byte) nConfig;
        }
    }
   
View Full Code Here

        // Select a subset of data points to be the new centroids.
        BitSet selectedCentroids = Statistics.randomDistribution(
                numCentroids, dataPoints.rows());

        // Convert the selection indices into vectors.
        for (int c = 0, i = selectedCentroids.nextSetBit(0); i >= 0;
                c++, i = selectedCentroids.nextSetBit(i+1))
            centers[c] = dataPoints.getRowVector(i);

        return centers;
    }
View Full Code Here

        BitSet selectedCentroids = Statistics.randomDistribution(
                numCentroids, dataPoints.rows());

        // Convert the selection indices into vectors.
        for (int c = 0, i = selectedCentroids.nextSetBit(0); i >= 0;
                c++, i = selectedCentroids.nextSetBit(i+1))
            centers[c] = dataPoints.getRowVector(i);

        return centers;
    }
}
View Full Code Here

        // Output the assignments for a single clustering.
        int clusterId = 0;
        for (Cluster<SparseDoubleVector> cluster : newClusters) {
            BitSet contextIds = cluster.dataPointIds();
            for (int contextId = contextIds.nextSetBit(0); contextId >= 0;
                     contextId = contextIds.nextSetBit(contextId + 1)) {
                reporter.updateAssignment(
                        primaryKey, contextLabels[contextId], clusterId);
            }
            clusterId++;
View Full Code Here

        // Output the assignments for a single clustering.
        int clusterId = 0;
        for (Cluster<SparseDoubleVector> cluster : newClusters) {
            BitSet contextIds = cluster.dataPointIds();
            for (int contextId = contextIds.nextSetBit(0); contextId >= 0;
                     contextId = contextIds.nextSetBit(contextId + 1)) {
                reporter.updateAssignment(
                        primaryKey, contextLabels[contextId], clusterId);
            }
            clusterId++;
        }
View Full Code Here

        // Fill in each assignment with the secondary key attached to each
        // context id.
        String[] contextLabels = new String[totalAssignments];
        for (Map.Entry<String, BitSet> entry : termContexts.entrySet()) {
            BitSet contextIds = entry.getValue();
            for (int contextId = contextIds.nextSetBit(0); contextId >= 0;
                     contextId = contextIds.nextSetBit(contextId+1))
                contextLabels[contextId] = entry.getKey();
        }
        return contextLabels;
    }
View Full Code Here

        // context id.
        String[] contextLabels = new String[totalAssignments];
        for (Map.Entry<String, BitSet> entry : termContexts.entrySet()) {
            BitSet contextIds = entry.getValue();
            for (int contextId = contextIds.nextSetBit(0); contextId >= 0;
                     contextId = contextIds.nextSetBit(contextId+1))
                contextLabels[contextId] = entry.getKey();
        }
        return contextLabels;
    }
}
View Full Code Here

    public Set<TypedEdge<T>> getEdges(int vertex) {
        BitSet b = edges.get(vertex);
        if (b == null)
            return Collections.<TypedEdge<T>>emptySet();
        Set<TypedEdge<T>> s = new HashSet<TypedEdge<T>>();
        for (int i = b.nextSetBit(0); i >= 0; i = b.nextSetBit(i+1)) {
            @SuppressWarnings("unchecked")
            T type = (T)(TYPES.get(i));
            s.add(new SimpleTypedEdge<T>(type, vertex, rootVertex));
        }
        return s;
View Full Code Here

    public Set<TypedEdge<T>> getEdges(int vertex) {
        BitSet b = edges.get(vertex);
        if (b == null)
            return Collections.<TypedEdge<T>>emptySet();
        Set<TypedEdge<T>> s = new HashSet<TypedEdge<T>>();
        for (int i = b.nextSetBit(0); i >= 0; i = b.nextSetBit(i+1)) {
            @SuppressWarnings("unchecked")
            T type = (T)(TYPES.get(i));
            s.add(new SimpleTypedEdge<T>(type, vertex, rootVertex));
        }
        return s;
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.