Package cc.redberry.core.indices

Examples of cc.redberry.core.indices.StructureOfIndices


    }

    private static StructureOfIndices[] createIndicesTypeStructures(byte type) {
        StructureOfIndices[] structures = new StructureOfIndices[1];
        if (!CC.isMetric(type))
            structures[0] = new StructureOfIndices(type, 2, true, false);
        else
            structures[0] = new StructureOfIndices(type, 2);
        return structures;
    }
View Full Code Here


    /**
     * @return {@link NameAndStructureOfIndices}
     */
    public NameAndStructureOfIndices getIndicesTypeStructureAndName() {
        return new NameAndStructureOfIndices(name, new StructureOfIndices[]{new StructureOfIndices(indices)});
    }
View Full Code Here

    }

    private NameDescriptor createDescriptor(final String sname, final StructureOfIndices[] structuresOfIndices, int id) {
        if (structuresOfIndices.length != 1)
            return new NameDescriptorImpl(sname, structuresOfIndices, id);
        final StructureOfIndices its = structuresOfIndices[0];
        if (its.size() != 2)
            return new NameDescriptorImpl(sname, structuresOfIndices, id);
        for (byte b = 0; b < IndexType.TYPES_COUNT; ++b)
            if (its.typeCount(b) == 2) {
                if (CC.isMetric(b)) {
                    if (sname.equals(kroneckerAndMetricNames[0]) || sname.equals(kroneckerAndMetricNames[1])) {
                        NameDescriptor descriptor = new NameDescriptorForMetricAndKronecker(kroneckerAndMetricNames, b, id);
                        descriptor.getSymmetries().add(b, false, 1, 0);
                        return descriptor;
                    }
                } else {
                    if (sname.equals(kroneckerAndMetricNames[1]))
                        throw new ParserException("Metric is not specified for non metric index type.");
                    if (sname.equals(kroneckerAndMetricNames[0])) {
                        if (its.getTypeData(b).states.get(0) != true || its.getTypeData(b).states.get(1) != false)
                            throw new ParserException("Illegal Kroneckers indices states.");
                        NameDescriptor descriptor = new NameDescriptorForMetricAndKronecker(kroneckerAndMetricNames, b, id);
                        return descriptor;
                    }
                }
View Full Code Here

final class TraceUtils {
    static final IndexType[] extractTypesFromMatrix(SimpleTensor matrix) {
        if (matrix.getIndices().size() != 3)
            throw new IllegalArgumentException("Not a matrix: " + matrix + ".");
        NameDescriptor descriptor = CC.getNameDescriptor(matrix.getName());
        StructureOfIndices typeStructure = descriptor.getStructureOfIndices();
        byte metricType = -1, matrixType = -1;
        int typeCount;
        for (byte type = 0; type < IndexType.TYPES_COUNT; ++type) {
            typeCount = typeStructure.typeCount(type);
            if (typeCount == 0)
                continue;
            else if (typeCount == 2) {
                if (matrixType != -1)
                    throw new IllegalArgumentException("Not a matrix: " + matrix + ".");
View Full Code Here

    }

    private static StructureOfIndices[] createIndicesTypeStructures(byte type) {
        StructureOfIndices[] structures = new StructureOfIndices[1];
        if (!CC.isMetric(type))
            structures[0] = new StructureOfIndices(type, 2, true, false);
        else
            structures[0] = new StructureOfIndices(type, 2);
        return structures;
    }
View Full Code Here

    }

    private NameDescriptor createDescriptor(final String sname, final StructureOfIndices[] structuresOfIndices, int id) {
        if (structuresOfIndices.length != 1)
            return new NameDescriptorForTensorFieldImpl(sname, structuresOfIndices, id);
        final StructureOfIndices its = structuresOfIndices[0];
        if (its.size() != 2)
            return new NameDescriptorForSimpleTensor(sname, structuresOfIndices, id);
        for (byte b = 0; b < IndexType.TYPES_COUNT; ++b)
            if (its.typeCount(b) == 2) {
                if (CC.isMetric(b)) {
                    if (sname.equals(kroneckerAndMetricNames[0]) || sname.equals(kroneckerAndMetricNames[1])) {
                        NameDescriptor descriptor = new NameDescriptorForMetricAndKronecker(kroneckerAndMetricNames, b, id);
                        descriptor.getSymmetries().add(b, false, 1, 0);
                        return descriptor;
                    }
                } else {
                    if (sname.equals(kroneckerAndMetricNames[1]))
                        throw new ParserException("Metric is not specified for non metric index type.");
                    if (sname.equals(kroneckerAndMetricNames[0])) {
                        if (its.getTypeData(b).states.get(0) != true || its.getTypeData(b).states.get(1) != false)
                            throw new ParserException("Illegal Kroneckers indices states.");
                        NameDescriptor descriptor = new NameDescriptorForMetricAndKronecker(kroneckerAndMetricNames, b, id);
                        return descriptor;
                    }
                }
View Full Code Here

        return parent.getDerivative(resOrder);
    }

    private void initializeSymmetries() {
        StructureOfIndices baseStructure = structuresOfIndices[0];

        StructureOfIndices[] partition = new StructureOfIndices[1 + ArraysUtils.sum(orders)];
        partition[0] = parent.structuresOfIndices[0];
        int i, j, k = 0;
        for (i = 0; i < orders.length; ++i)
            for (j = 0; j < orders[i]; ++j)
                partition[++k] = structuresOfIndices[i + 1].getInverted();
        int[][] mapping = baseStructure.getPartitionMappings(partition);

        //adding field symmetries
        List<Symmetry> fieldSymmetries = parent.symmetries.getInnerSymmetries().getBasisSymmetries();
        for (k = 1; k < fieldSymmetries.size(); ++k)
            symmetries.addUnsafe(fieldSymmetries.get(k).convert(mapping[0], baseStructure.size()));


        //adding block symmetries
        IntArrayList aggregator = new IntArrayList();
        j = 1;
        int a, b, cycle[];
        for (i = 0; i < orders.length; ++i) {
            if (orders[i] >= 2) {
                //adding symmetries for indices from each slot
                cycle = Combinatorics.createBlockCycle(structuresOfIndices[i + 1].size(), 2);
                aggregator.addAll(mapping[j]);
                aggregator.addAll(mapping[j + 1]);
                symmetries.addUnsafe(
                        new Symmetry(Combinatorics.convertPermutation(cycle, aggregator.toArray(), baseStructure.size()), false));

                if (orders[i] >= 3) {
                    for (k = 2; k < orders[i]; ++k)
                        aggregator.addAll(mapping[j + k]);

                    cycle = Combinatorics.createBlockCycle(structuresOfIndices[i + 1].size(), orders[i]);
                    symmetries.addUnsafe(
                            new Symmetry(Combinatorics.convertPermutation(cycle, aggregator.toArray(), baseStructure.size()), false));
                }
                aggregator.clear();
            }
            j += orders[i];
        }
View Full Code Here

    /**
     * @return {@link NameAndStructureOfIndices}
     */
    public NameAndStructureOfIndices getIndicesTypeStructureAndName() {
        return new NameAndStructureOfIndices(name, new StructureOfIndices[]{new StructureOfIndices(indices)});
    }
View Full Code Here

    }

    @Override
    public NameAndStructureOfIndices getIndicesTypeStructureAndName() {
        StructureOfIndices[] typeStructures = new StructureOfIndices[1 + argumentsIndices.length];
        typeStructures[0] = new StructureOfIndices(indices);
        for (int i = 0; i < argumentsIndices.length; ++i) {
            if (argumentsIndices[i] == null)
                argumentsIndices[i] = IndicesFactory.createSimple(null, content[i].getIndices().getFree());
            typeStructures[i + 1] = new StructureOfIndices(argumentsIndices[i]);
        }
        return new NameAndStructureOfIndices(name, typeStructures);
    }
View Full Code Here

                "iK", "HATK", "HATW", "HATS", "NABLAS",
                "HATN", "HATF", "NABLAF", "HATM", "DELTA",
                "Flat", "FF", "WR", "SR", "SSR", "FR", "RR", "Kn"};

        //F_{lm} type structure
        final StructureOfIndices F_TYPE_STRUCTURE = new StructureOfIndices(IndexType.LatinLower.getType(), 2);
        //matrices indicator for parse preprocessor
        final Indicator<ParseTokenSimpleTensor> matricesIndicator = new Indicator<ParseTokenSimpleTensor>() {

            @Override
            public boolean is(ParseTokenSimpleTensor object) {
View Full Code Here

TOP

Related Classes of cc.redberry.core.indices.StructureOfIndices

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.