Package cc.redberry.core.indexmapping

Examples of cc.redberry.core.indexmapping.Mapping


    Tensor newTo_(Tensor currentNode, SubstitutionIterator iterator) {
        SumBijectionPort.BijectionContainer bc = new SumBijectionPort(from, currentNode).take();
        if (bc == null)
            return currentNode;

        Mapping mapping = bc.mapping;
        Tensor newTo;
        if (toIsSymbolic)
            newTo = mapping.getSign() ? Tensors.negate(to) : to;
        else
            newTo = ApplyIndexMapping.applyIndexMapping(to, mapping, iterator.getForbidden());

        SumBuilder builder = new SumBuilder();
        int[] bijection = bc.bijection;
View Full Code Here


    private Tensor __newTo(DFromTo fromTo, TensorField currentField,
                           Tensor currentNode, SubstitutionIterator iterator) {

        TensorField from = fromTo.from;
        Mapping mapping = IndexMappings.simpleTensorsPort(from, currentField).take();
        if (mapping == null)
            return currentNode;

        Indices[] fromIndices = from.getArgIndices(),
                currentIndices = currentField.getArgIndices();

        List<Tensor> argFrom = new ArrayList<>(), argTo = new ArrayList<>();
        Tensor fArg;
        int[] cIndices, fIndices;
        int i;
        for (i = from.size() - 1; i >= 0; --i) {
            if (IndexMappings.positiveMappingExists(currentNode.get(i), from.get(i)))
                continue;

            fIndices = fromIndices[i].getAllIndices().copy();
            cIndices = currentIndices[i].getAllIndices().copy();

            assert cIndices.length == fIndices.length;

            fArg = ApplyIndexMapping.applyIndexMapping(from.get(i), new Mapping(fIndices, cIndices), new int[0]);

            argFrom.add(fArg);
            argTo.add(currentNode.get(i));
        }

        Tensor newTo = fromTo.to;
        newTo = new SubstitutionTransformation(
                argFrom.toArray(new Tensor[argFrom.size()]),
                argTo.toArray(new Tensor[argTo.size()]),
                false).transform(newTo);
        if (!TensorUtils.isSymbolic(newTo))
            newTo = ApplyIndexMapping.applyIndexMapping(newTo, mapping, iterator.getForbidden());
        else if (mapping.getSign())
            newTo = Tensors.negate(newTo);
        return newTo;
    }
View Full Code Here

                    }
                    for (k = 0; k < termLow.length(); ++k) {
                        oldIndices[k + termUp.length()] = termLow.get(k);
                        newIndices[k + termUp.length()] = lowerArray[l++];
                    }
                    temp = ApplyIndexMapping.applyIndexMapping(temp, new Mapping(oldIndices, newIndices), new int[0]);
                    tCombination.add(temp);
                }

            //creating term & processing combinatorics           
            Tensor term = SymmetrizeUpperLowerIndicesTransformation.symmetrizeUpperLowerIndices(Tensors.multiplyAndRenameConflictingDummies(tCombination.toArray(new Tensor[tCombination.size()])));
View Full Code Here

                if (list == null) {
                    list = new ArrayList<>();
                    coefficients.put(oldCoefficient.hashCode(), list);
                }

                Mapping match = null;
                for (Tensor[] transformed : list) {
                    match = IndexMappings.getFirst(transformed[0], oldCoefficient);
                    if (match != null) {
                        newCoefficient = match.getSign() ? Tensors.negate(transformed[1]) : transformed[1];
                        break;
                    }
                }
                if (match == null) {
                    if (oldCoefficient instanceof SimpleTensor) {
View Full Code Here

    public static Symmetries getSymmetriesFromMappings(final int[] indices, MappingsPort mappingsPort) {
        Symmetries symmetries = SymmetriesFactory.createSymmetries(indices.length);
        int[] sortedIndicesNames = IndicesUtils.getIndicesNames(indices);
        int[] sortPermutation = ArraysUtils.quickSortP(sortedIndicesNames);
        Mapping buffer;
        while ((buffer = mappingsPort.take()) != null)
            symmetries.add(getSymmetryFromMapping1(sortedIndicesNames, sortPermutation, buffer));
        return symmetries;
    }
View Full Code Here

                    symmetric,
                    allFreeVarIndices,
                    varIndices.getSymmetries().getInnerSymmetries());
            derivative = applyIndexMapping(
                    derivative,
                    new Mapping(allIndices,
                            addAll(varIndices.getInverted().getAllIndices().copy(), allFreeArgIndices)),
                    new int[0]);
            ProductBuilder builder = new ProductBuilder(0, length);
            for (i = 0; i < length; ++i)
                builder.put(createMetricOrKronecker(allFreeArgIndices[i], allFreeVarIndices[i]));
View Full Code Here

        @Override
        Tensor differentiateSimpleTensorWithoutCheck(SimpleTensor simpleTensor) {
            int[] to = simpleTensor.getIndices().getAllIndices().copy();
            to = addAll(to, freeVarIndices);
            return applyIndexMapping(derivative, new Mapping(allFreeFrom, to), new int[0]);
        }
View Full Code Here

            System.arraycopy(toAdd, 0, to, oldFromLength, toAdd.length);
        }

        assert from.length == freeIndices.length;

        return applyIndexMapping(tensor, new Mapping(from, to, mapping.getSign()), forbidden);
    }
View Full Code Here

            int[] match;
            for (Split base : nodes) {
                if ((match = matchFactors(base.factors, toAdd.factors)) != null) {
                    Tensor[] toAddFactors = Combinatorics.reorder(toAdd.factors, match);
                    Mapping mapping =
                            IndexMappings.createBijectiveProductPort(toAddFactors, base.factors).take();

//                    mapping =  mapping.inverseStates();
//                    for (Map.Entry<Integer, IndexMappingBufferRecord> entry : mapping.getMap().entrySet())
//                        entry.getValue().invertStates();
View Full Code Here

            //symmetries of eps indices, which are contracted with other product (also totally antisymmetric)
            Map<Permutation, Boolean> symmetries = getEpsilonSymmetries(indices.length);

            //symmetries of product, which is contracted with Levi-Civita
            MappingsPort port = IndexMappings.createPort(temp, temp);
            Mapping mapping;
            Permutation sym;

            //check for two symmetric indices of product contracted with two antisymmetric indices of eps
            while ((mapping = port.take()) != null) {
                //symmetry of product indices
View Full Code Here

TOP

Related Classes of cc.redberry.core.indexmapping.Mapping

Copyright © 2018 www.massapicom. 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.