Package cc.redberry.core.indexmapping

Examples of cc.redberry.core.indexmapping.Mapping


            int[] match;
            for (Split base : nodes) {
                if ((match = matchFactors(base.factors, toAdd.factors)) != null) {
                    Tensor[] toAddFactors = Permutations.permute(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


        final int[] newIndices = new int[indicesArray.length];
        for (int i = 0; i < indicesArray.length; ++i)
            newIndices[i] = indicesArray[permutation[i]];

        //processing new tensor
        return ApplyIndexMapping.applyIndexMapping(tensor, new Mapping(indicesArray, newIndices), new int[0]);
    }
View Full Code Here

        super(from, to);
    }

    @Override
    Tensor newTo_(Tensor currentNode, SubstitutionIterator iterator) {
        Mapping mapping =
                IndexMappings.getFirst(from, currentNode);
        if (mapping == null)
            return currentNode;
        return applyIndexMappingToTo(currentNode, to, mapping, iterator);
    }
View Full Code Here

    @Override
    public BijectionContainer take() {
        if (finished)
            return null;
        List<int[]> bijections = new ArrayList<>();
        Mapping buffer;
        int i, b[];
        final int mappersSize = mappers.size();
        OUT:
        while (true) {
            buffer = source.take();
View Full Code Here

            return mapping;
        }

        @Override
        public Mapping take() {
            Mapping buf;
            while (true) {
                if (currentSource != null && (buf = currentSource.take()) != null)
                    return buf;
                if (!permutationGenerator.hasNext())
                    return null;
View Full Code Here

            SumBijectionPort.BijectionContainer bc = new SumBijectionPort(from, current).take();
            if (bc == null)
                return current;

            Mapping mapping = bc.mapping;
            Tensor newTo = applyIndexMappingToTo(current, to, mapping, iterator);

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

    public static List<Permutation> getSymmetriesFromMappings(final int[] indices, MappingsPort mappingsPort) {
        List<Permutation> symmetries = new ArrayList<>();
        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

                for (int j = 0; j < metricInds.length; ++j)
                    if (temp[j] == 0xFFFFFFFF)
                        temp[j] = createIndex(counter++, getType(metricInds[j]), false);//lower index
                IntArrayList _result = nonMetricIndices.clone();
                _result.addAll(temp);
                Tensor renamed = ApplyIndexMapping.applyIndexMapping(st, new Mapping(indicesArray, _result.toArray()));
                //todo bottleneck
                for (Tensor existing : combinationArray)
                    if (TensorUtils.compare1(existing, renamed) != null)
                        continue combinations;
                combinationArray.add(renamed);
View Full Code Here

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

            //creating term & processing combinatorics
            Tensor[] prodArray = 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

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.