Package gnu.trove.set.hash

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


        SimpleTensor[] resolvedVars = vars;
        if (needRename) {
            TIntHashSet allTensorIndices = TensorUtils.getAllIndicesNamesT(tensor);
            TIntHashSet dummyTensorIndices = new TIntHashSet(allTensorIndices);
            dummyTensorIndices.removeAll(tensor.getIndices().getFree().getAllIndices().copy());

            needRename = false;
            for (SimpleTensor var : vars)
                if (containsIndicesNames(allTensorIndices, var.getIndices().getNamesOfDummies())
                        || containsIndicesNames(dummyTensorIndices, var.getIndices())) {
View Full Code Here


    private static Tensor differentiate(Tensor tensor, Transformation[] expandAndContract, SimpleTensor var) {
        if (var.getIndices().size() != 0) {
            TIntHashSet allTensorIndices = TensorUtils.getAllIndicesNamesT(tensor);
            TIntHashSet dummyTensorIndices = new TIntHashSet(allTensorIndices);
            dummyTensorIndices.removeAll(tensor.getIndices().getFree().getAllIndices().copy());
            if (containsIndicesNames(allTensorIndices, var.getIndices().getNamesOfDummies())
                    || containsIndicesNames(dummyTensorIndices, var.getIndices())) {
                allTensorIndices.addAll(IndicesUtils.getIndicesNames(var.getIndices()));
                var = (SimpleTensor) renameDummy(var, TensorUtils.getAllIndicesNamesT(tensor).toArray());
                tensor = renameDummy(tensor, TensorUtils.getAllIndicesNamesT(var).toArray(), allTensorIndices);
View Full Code Here

                for (int index : dataBijection) {
                    allowed.addAll(TensorUtils.getAllDummyIndicesT(currentData[index]));
                    ib.append(currentData[index]);
                }
                allowed.addAll(ib.getIndices().getNamesOfDummies());
                allowed.removeAll(IndicesUtils.getIndicesNames(mapping.getToData()));
                newTo = applyIndexMappingAndRenameAllDummies(to, mapping, allowed.toArray());
            }
        }
        return new SubsResult(newTo, remainder);
    }
View Full Code Here

                TIntHashSet oldDummyIndices = TensorUtils.getAllDummyIndicesT(oldTensor);
                TIntHashSet newDummyIndices = TensorUtils.getAllDummyIndicesT(tensor);

                TIntHashSet added = new TIntHashSet(newDummyIndices);
                added.removeAll(oldDummyIndices);

                if (!added.isEmpty() || previous.isPayloadInitialized()) {
                    ForbiddenContainer fc = previous.getPayload();

                    TIntHashSet removed = new TIntHashSet(oldDummyIndices);
View Full Code Here

                if (!added.isEmpty() || previous.isPayloadInitialized()) {
                    ForbiddenContainer fc = previous.getPayload();

                    TIntHashSet removed = new TIntHashSet(oldDummyIndices);
                    removed.removeAll(newDummyIndices);

                    fc.submit(removed, added);
                }
            }
        }
View Full Code Here

        @Override
        public TIntSet getForbidden() {
            insureInitialized();
            TIntHashSet result = new TIntHashSet(forbidden);
//            result.removeAll(TensorUtils.getAllIndicesNamesT(position.tensor.get(currentBranch)));
            result.removeAll(TensorUtils.getAllIndicesNamesT(tensor.get(position.currentIndex())));
            return result;
        }
    }

    private final static class ProductFC extends AbstractFC {
View Full Code Here

            allowedDummies.addAll(IndicesUtils.getIndicesNames(temp.getIndices()));
            if (!(temp instanceof SimpleTensor) && !(temp instanceof TensorField))
                throw new IllegalArgumentException("Derivative with respect to non simple argument: " + temp);
            vars[i - 1] = (SimpleTensor) temp;
        }
        allowedDummies.removeAll(IndicesUtils.getIndicesNames(free.getIndices().getFree()));
        Tensor result = new DifferentiateTransformation(
                vars, new Transformation[]{ExpandAndEliminateTransformation.EXPAND_AND_ELIMINATE}
        ).transform(content[0].toTensor());
        result = ApplyIndexMapping.optimizeDummies(result);
        TIntHashSet generated = TensorUtils.getAllDummyIndicesT(result);
View Full Code Here

        Tensor result = new DifferentiateTransformation(
                vars, new Transformation[]{ExpandAndEliminateTransformation.EXPAND_AND_ELIMINATE}
        ).transform(content[0].toTensor());
        result = ApplyIndexMapping.optimizeDummies(result);
        TIntHashSet generated = TensorUtils.getAllDummyIndicesT(result);
        generated.removeAll(allowedDummies);

        result = ApplyIndexMapping.renameDummy(result, generated.toArray(), allowedDummies.toArray());
        return result;
    }
}
View Full Code Here

    }

    public static TIntHashSet getAllDummyIndicesT(Tensor tensor) {
        TIntHashSet set = new TIntHashSet();
        appendAllIndicesNamesT(tensor, set);
        set.removeAll(IndicesUtils.getIndicesNames(tensor.getIndices().getFree()));
        return set;
    }

    public static TIntHashSet getAllIndicesNamesT(Collection<? extends Tensor> tensors) {
        TIntHashSet set = new TIntHashSet();
View Full Code Here

            TIntHashSet removed = new TIntHashSet(oldDummyIndices),
                    added = new TIntHashSet(newDummyIndices);

            removed.removeAll(newDummyIndices);
            added.removeAll(oldDummyIndices);

            fc.submit(removed, added);
        }
        innerIterator.set(tensor);
    }
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.