Examples of Symmetries


Examples of cc.redberry.core.combinatorics.Symmetries

    private final Symmetries symmetries;
    private short[] diffIds = null;

    IndicesSymmetries(IndicesTypeStructure indicesTypeStructure) {
        this.indicesTypeStructure = indicesTypeStructure;
        this.symmetries = new Symmetries(indicesTypeStructure.size());
    }
View Full Code Here

Examples of cc.redberry.core.combinatorics.Symmetries

    private final Symmetries symmetries;
    private short[] diffIds = null;

    IndicesSymmetries(IndicesTypeStructure indicesTypeStructure) {
        this.indicesTypeStructure = indicesTypeStructure;
        this.symmetries = new Symmetries(indicesTypeStructure.size());
    }
View Full Code Here

Examples of cc.redberry.core.combinatorics.Symmetries

    public Tensor transform(Tensor tensor) {
        if (!tensor.getIndices().getFreeIndices().equalsIgnoreOrder(indices))
            return tensor;
        if (symmetries.isEmpty())
            return TensorNumber.createZERO();
        Symmetries tensorSymmetries = IndexMappingUtils.getSymmetriesFromMappings(indices, tensor, allowDiffStates);

        List<Tensor> generatedTensors = new ArrayList<>();
        List<Permutation> generatedPermutations = new ArrayList<>();
        OUT:
        for (Permutation permutation : symmetries) {
View Full Code Here

Examples of cc.redberry.core.combinatorics.Symmetries

//        for (IndexMappingBufferImpl buffer : buffers)
//            symmetries.add(getSymmetryFromMapping(indices, buffer));
//        return symmetries;
//    }
    public static Symmetries getSymmetriesFromMappings(Indices indices, OutputPortUnsafe<IndexMappingBuffer> buffers) {
        Symmetries symmetries = new Symmetries(indices.size());
        IndexMappingBuffer buffer;
        while ((buffer = buffers.take()) != null)
            symmetries.add(getSymmetryFromMapping(indices, buffer));
        return symmetries;
    }
View Full Code Here

Examples of cc.redberry.core.combinatorics.symmetries.Symmetries

    public static Symmetry getSymmetryFromMapping(final int[] indices, IndexMappingBuffer indexMappingBuffer) {
        return getSymmetryFromMapping1(IndicesUtils.getIndicesNames(indices), indexMappingBuffer);
    }

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

Examples of cc.redberry.core.combinatorics.symmetries.Symmetries

    public static Symmetries findIndicesSymmetries(SimpleIndices indices, Tensor tensor) {
        return getSymmetriesFromMappings(indices.getAllIndices().copy(), IndexMappings.createPort(tensor, tensor));
    }

    public static Symmetries getIndicesSymmetriesForIndicesWithSameStates(final int[] indices, Tensor tensor) {
        Symmetries total = findIndicesSymmetries(indices, tensor);
        Symmetries symmetries = SymmetriesFactory.createSymmetries(indices.length);
        int i;
        OUT:
        for (Symmetry s : total) {
            for (i = 0; i < indices.length; ++i)
                if (IndicesUtils.getRawStateInt(indices[i]) != IndicesUtils.getRawStateInt(indices[s.newIndexOf(i)]))
                    continue OUT;
            symmetries.add(s);
        }
        return symmetries;
    }
View Full Code Here

Examples of cc.redberry.core.combinatorics.symmetries.Symmetries

    public static Symmetry getSymmetryFromMapping(final int[] indices, IndexMappingBuffer indexMappingBuffer) {
        return getSymmetryFromMapping1(IndicesUtils.getIndicesNames(indices), indexMappingBuffer);
    }

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

Examples of cc.redberry.core.combinatorics.symmetries.Symmetries

    private static Map<IntArray, Boolean> getEpsilonSymmetries(int indicesSize) {
        Map<IntArray, Boolean> symmetries = cachedLeviCivitaSymmetries.get(indicesSize);
        if (symmetries != null)
            return symmetries;
        symmetries = new HashMap<>();
        Symmetries ss = SymmetriesFactory.createSymmetries(indicesSize);
        ss.addUnsafe(new Symmetry(Combinatorics.createTransposition(indicesSize, 0, 1), true));
        if (indicesSize % 2 == 0)
            ss.addUnsafe(new Symmetry(Combinatorics.createCycle(indicesSize), true));
        else
            ss.addUnsafe(new Symmetry(Combinatorics.createCycle(indicesSize), false));
        for (Symmetry symmetry : ss)
            symmetries.put(symmetry.getPermutation(), symmetry.isAntiSymmetry());
        cachedLeviCivitaSymmetries.put(indicesSize, symmetries);
        return symmetries;
    }
View Full Code Here

Examples of cc.redberry.core.combinatorics.symmetries.Symmetries

    }

    public static Tensor symmetrizeUpperLowerIndices(Tensor tensor, boolean multiplyOnSymmetryFactor) {
        Indices indices = IndicesFactory.create(tensor.getIndices().getFree());
        int[] indicesArray = indices.getAllIndices().copy();
        Symmetries symmetries = TensorUtils.getIndicesSymmetriesForIndicesWithSameStates(indicesArray, tensor);
        int lowerCount = indices.getLower().length(), upperCount = indices.getUpper().length();

        IntPermutationsGenerator lowIndicesPermutationsGenerator,
                upperIndicesPermutationGenerator;
        SumBuilder sumBuilder = new SumBuilder();
View Full Code Here

Examples of cc.redberry.core.combinatorics.symmetries.Symmetries

        int[] _sortPermutation = ArraysUtils.quickSortP(sortedIndicesNames);
        return getSymmetryFromMapping1(sortedIndicesNames, _sortPermutation, mapping);
    }

    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
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.