Package gnu.trove.set.hash

Examples of gnu.trove.set.hash.TIntHashSet.toArray()


            }
            if (count == max)
                ties.add(clazz);
        }

        int[] options = ties.toArray(new int[ties.size()]);
        return (options.length == 1)
            ? options[0]
            : options[RANDOM.nextInt(options.length)];
    }
View Full Code Here


                ties.add(iter.key());
           
        }
       
        // If there wasn't a tie after all
        int[] options = ties.toArray();
        return (options.length == 1)
            ? options[0]
            : options[RANDOM.nextInt(options.length)];
    }
}
View Full Code Here

            int[] bNonZero = svB.getNonZeroIndices();
            TIntSet union = new TIntHashSet(aNonZero);
            union.addAll(bNonZero);
           
            double sum = 0;
            int[] nzIndices = union.toArray();
            for (int nz : nzIndices) {
                double x = a.get(nz);
                double y = b.get(nz);
                double diff = x - y;
                sum += diff * diff;
 
View Full Code Here

                Node o = in[i * pi.getNbStates() + k];
                if (o != null) {
                    th.add(o.id);
                }
            }
            intLayer[i] = th.toArray();
        }
        intLayer[n + 1] = new int[]{tink.id};

        if (intLayer[0].length > 0) {
      IEnvironment environment = solver.getEnvironment();
View Full Code Here

                Node o = in[i * pi.getNbStates() + k];
                if (o != null) {
                    th.add(o.id);
                }
            }
            intLayer[i] = th.toArray();
        }
        intLayer[size + 1] = new int[]{tink.id};


        if (intLayer[0].length > 0)
View Full Code Here

        for (Transition t : s.getTransitions()) {
            for (char c = t.getMin(); c <= t.getMax(); c++) {
                set.add(getIntFromChar(c));
            }
        }
        return new TIntArrayList(set.toArray());

    }

    private TIntHashSet tmpSet = new TIntHashSet();
View Full Code Here

            graph[ci[1] - 1][ci[0] - 1] = 1;

        }
        if (opt) {
            cards = VariableFactory.boundedArray("c", values.size(), 0, vars.length, solver);
            freqs = values.toArray();
            Arrays.sort(freqs);
            for (int i = 0; i < freqs.length; i++) {
                solver.post(IntConstraintFactory.count(freqs[i], vars, cards[i]));
            }
            nb0 = VariableFactory.bounded("nb0", 0, freqs.length, solver);
View Full Code Here

                Scanner sc = new Scanner(line);
                sc.nextInt();
                while (sc.hasNextInt()) {
                    values.add(sc.nextInt());
                }
                domains.add(values.toArray());
                values.clear();
            }
            int[][] data = new int[domains.size()][];
            for (int i = 0; i < domains.size(); i++) {
                data[i] = domains.get(i);
View Full Code Here

    private int[] union(int[][] domains) {
        TIntHashSet union = new TIntHashSet();
        for (int i = 0; i < domains.length; i++) {
            union.addAll(domains[i]);
        }
        int[] values = union.toArray();
        Arrays.sort(values);
        return values;
    }

View Full Code Here

        }

        Tensor factor, newFactor;
        for (int i = toResolve.size() - 1; i >= 0; --i) {
            factor = toResolve.get(i);
            newFactor = ApplyIndexMapping.renameDummy(factor, forbidden.toArray());
            forbidden.addAll(TensorUtils.getAllIndicesNamesT(newFactor));
            result[++position] = newFactor;
        }
        return result;
    }
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.