Package gnu.trove.set.hash

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


            newTo = mapping.getSign() ? Tensors.negate(to) : to;
        else {
            TIntHashSet remainderIndices = new TIntHashSet(forbidden);
            remainderIndices.addAll(getAllIndicesNamesT(indexlessRemainder));
            remainderIndices.addAll(getAllIndicesNamesT(dataRemainderT));
            newTo = applyIndexMapping(to, mapping, remainderIndices.toArray());
            forbidden.addAll(getAllIndicesNamesT(newTo));
        }
        return new SubsResult(newTo, remainder);
    }
View Full Code Here


        Tensor factor, newFactor;
        int toResolvePosition = toResolve.size();
        for (i = factors.length - 1; i >= 0; --i)
            if (result[i] == null) {
                factor = toResolve.get(--toResolvePosition);
                newFactor = ApplyIndexMapping.renameDummy(factor, forbidden.toArray());
                forbidden.addAll(TensorUtils.getAllIndicesNamesT(newFactor));
                result[i] = newFactor;
            }
//        for (int i = toResolve.size() - 1; i >= 0; --i) {
//            factor = toResolve.get(i);
View Full Code Here

                return null;
            TIntHashSet added = new TIntHashSet(initialForbidden);
            ProductBuilder builder = new ProductBuilder();
            builder.put(base.get(tuple[0]));
            for (int i = 1; i < tuple.length; ++i)
                builder.put(ApplyIndexMapping.renameDummy(base.get(tuple[i]), added.toArray(), added));

            return createPort(builder.build());
        }

        @Override
View Full Code Here

        if (TensorUtils.passOutDummies(tensor)) {
            TIntHashSet forbidden = new TIntHashSet();
            for (j = 0; j < size; ++j)
                if (j != i)
                    TensorUtils.appendAllIndicesNamesT(get(j), forbidden);
            tensor = ApplyIndexMapping.renameDummy(tensor, forbidden.toArray());
        }

        Boolean compare = TensorUtils.compare1(old, tensor);
        if (compare == null)
            return super.set(i, tensor);
View Full Code Here

            resolvedVars = vars.clone();
            for (int i = 0; i < vars.length; ++i)
                if (!forbidden.isEmpty() && resolvedVars[i].getIndices().size() != 0) {
                    if (resolvedVars[i].getIndices().size() != resolvedVars[i].getIndices().getFree().size())
                        resolvedVars[i] = (SimpleTensor) renameDummy(resolvedVars[i], forbidden.toArray());
                    forbidden.addAll(getIndicesNames(resolvedVars[i].getIndices()));
                }
            tensor = renameDummy(tensor, TensorUtils.getAllIndicesNamesT(resolvedVars).toArray(), forbidden);
            tensor = renameIndicesOfFieldsArguments(tensor, forbidden);
        }
View Full Code Here

            newTo = mapping.getSign() ? Tensors.negate(to) : to;
        else {
            TIntHashSet remainderIndices = new TIntHashSet(forbidden);
            remainderIndices.addAll(getAllIndicesNamesT(indexlessRemainder));
            remainderIndices.addAll(getAllIndicesNamesT(dataRemainderT));
            newTo = applyIndexMapping(to, mapping, remainderIndices.toArray());
            forbidden.addAll(getAllIndicesNamesT(newTo));
        }
        return new SubsResult(newTo, remainder);
    }
View Full Code Here

        Tensor factor, newFactor;
        int toResolvePosition = toResolve.size();
        for (i = factors.length - 1; i >= 0; --i)
            if (result[i] == null) {
                factor = toResolve.get(--toResolvePosition);
                newFactor = ApplyIndexMapping.renameDummy(factor, forbidden.toArray());
                forbidden.addAll(TensorUtils.getAllIndicesNamesT(newFactor));
                result[i] = newFactor;
            }
//        for (int i = toResolve.size() - 1; i >= 0; --i) {
//            factor = toResolve.get(i);
View Full Code Here

            //All dummy indices in this sum
            TIntHashSet allDummyIndicesT = TensorUtils.getAllDummyIndicesT(tensor);

            //Creating array to index individual indices origin
            allDummyIndices = allDummyIndicesT.toArray();
            Arrays.sort(allDummyIndices);

            //For performance
            final int size = tensor.size();
View Full Code Here

                    //lazy initialization
                    if (indices.length != 0 && ig == null) {
                        TIntHashSet forbidden = new TIntHashSet(iterator.getForbidden());
                        forbidden.addAll(TensorUtils.getAllIndicesNamesT(this.from));
                        forbidden.addAll(TensorUtils.getAllIndicesNamesT(this.to));
                        ig = new IndexGenerator(forbidden.toArray());

                    }

                    for (j = indices.length - 1; j >= 0; --j)
                        indices[j] = setRawState(getRawStateInt(var.getIndices().get(j)),
View Full Code Here

            resolvedVars = vars.clone();
            for (int i = 0; i < vars.length; ++i)
                if (!forbidden.isEmpty() && resolvedVars[i].getIndices().size() != 0) {
                    if (resolvedVars[i].getIndices().size() != resolvedVars[i].getIndices().getFree().size())
                        resolvedVars[i] = (SimpleTensor) renameDummy(resolvedVars[i], forbidden.toArray());
                    forbidden.addAll(getIndicesNames(resolvedVars[i].getIndices()));
                }
            tensor = renameDummy(tensor, TensorUtils.getAllIndicesNamesT(resolvedVars).toArray(), forbidden);
            tensor = renameIndicesOfFieldsArguments(tensor, forbidden);
        }
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.