Package gnu.trove.set.hash

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


            SparseVector svB = (SparseVector)b;

            int[] aNonZero = svA.getNonZeroIndices();
            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);
View Full Code Here


    public FiniteAutomaton union(FiniteAutomaton otherI) {
        FiniteAutomaton other = (FiniteAutomaton) otherI;
        Automaton union = this.representedBy.union(other.representedBy);
        TIntHashSet alphabet = new TIntHashSet(this.alphabet.toArray());
        alphabet.addAll(other.alphabet.toArray());
        return new FiniteAutomaton(union, alphabet);

    }

    public FiniteAutomaton intersection(IAutomaton otherI) {
View Full Code Here

    public FiniteAutomaton concatenate(FiniteAutomaton otherI) {
        FiniteAutomaton other = (FiniteAutomaton) otherI;
        Automaton conc = this.representedBy.concatenate(other.representedBy);
        TIntHashSet alphabet = new TIntHashSet(this.alphabet.toArray());
        alphabet.addAll(other.alphabet.toArray());
        return new FiniteAutomaton(conc, alphabet);
    }

    public void addEpsilon(int source, int destination) {
        try {
View Full Code Here

            int didx = _var[i][1];
            if (_var[i].length > 2) {
                vars[vidx] = VariableFactory.fixed(_var[i][2], solver);
            } else {
                vars[vidx] = VariableFactory.enumerated("v_" + vidx, _dom[didx], solver);
                values.addAll(_dom[didx]);
            }
            prev = vidx + 1;
        }
        int[][] graph = new int[n][n];
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

        ArrayList<Tensor> toResolve = new ArrayList<>();
        int position = -1;
        for (Tensor f : factors) {
            if (f instanceof Sum || f.getIndices().getFree().size() == 0) {
                toResolve.add(f);
                forbidden.addAll(f.getIndices().getFree().getAllIndices().copy());
            } else {
                forbidden.addAll(TensorUtils.getAllIndicesNamesT(f));
                result[++position] = f;
            }
        }
View Full Code Here

        for (Tensor f : factors) {
            if (f instanceof Sum || f.getIndices().getFree().size() == 0) {
                toResolve.add(f);
                forbidden.addAll(f.getIndices().getFree().getAllIndices().copy());
            } else {
                forbidden.addAll(TensorUtils.getAllIndicesNamesT(f));
                result[++position] = f;
            }
        }

        Tensor factor, newFactor;
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

            assertTrue( keyset.contains( keys[i] ) );
        }
        assertFalse( keyset.isEmpty() );

        TIntSet other = new TIntHashSet();
        other.addAll( keys );

        assertTrue( "sets incorrectly not equal: " + keyset + ", " + other,
                keyset.equals( other ) );

        int[] mismatched = {72, 49, 53, 1024, 999};
View Full Code Here

        assertTrue( "sets incorrectly not equal: " + keyset + ", " + other,
                keyset.equals( other ) );

        int[] mismatched = {72, 49, 53, 1024, 999};
        TIntSet unequal = new TIntHashSet();
        unequal.addAll( mismatched );

        assertFalse( "sets incorrectly equal: " + keyset + ", " + unequal,
                keyset.equals( unequal ) );

        // Change length, different code branch
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.