Package cc.redberry.core.indices

Examples of cc.redberry.core.indices.IndicesTypeStructure


    }

    private NameDescriptor createDescriptor(final String sname, final IndicesTypeStructure[] indicesTypeStructures, int id) {
        if (indicesTypeStructures.length != 1)
            return new NameDescriptorImpl(sname, indicesTypeStructures, id);
        final IndicesTypeStructure its = indicesTypeStructures[0];
        if (its.size() != 2)
            return new NameDescriptorImpl(sname, indicesTypeStructures, id);
        for (byte b = 0; b < IndexType.TYPES_COUNT; ++b)
            if (its.typeCount(b) == 2)
                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;
                }
View Full Code Here


        NameDescriptor nameDescriptor;
        for (i = 0; i < N; ++i) {
            typesCount = new int[IndexType.TYPES_COUNT];
            for (j = 0; j < IndexType.TYPES_COUNT; ++j)
                typesCount[j] = nextInt(random, maxIndicesPerTensor[j]);
            IndicesTypeStructure typeStructure = new IndicesTypeStructure(TYPES, typesCount);
            descriptors.add(nameDescriptor = new NameDescriptor(getName(i), typeStructure));
            CC.getNameManager().mapNameDescriptor(descriptors.get(i));
            if (withSymmetries)
                addRandomSymmetries(nameDescriptor);
        }
View Full Code Here

    }

    private void addRandomSymmetries(NameDescriptor descriptor) {
        if (!descriptor.getSymmetries().isEmpty())
            throw new RuntimeException("Symmetries already exists");
        IndicesTypeStructure typeStructure = descriptor.getIndexTypeStructure();
        int i;
        for (byte type = 0; type < IndexType.TYPES_COUNT; ++type) {
            IndicesTypeStructure.TypeData typeData = typeStructure.getTypeDatas(type);
            if (typeData == null)
                continue;
            if (typeData.length == 0)//redundant
                continue;
            for (i = 0; i < random.nextInt(3); ++i)
View Full Code Here

            --lengths[type];
            return index;
        }

        SimpleIndices next(NameDescriptor nd) {
            IndicesTypeStructure typeStructure = nd.getIndexTypeStructure();
            final int[] indices = new int[typeStructure.size()];
            for (int i = 0; i < indices.length; ++i) {
                if (lengths[typeStructure.get(i)] <= minLegth[typeStructure.get(i)])
                    return null;
                indices[i] = next(typeStructure.get(i));
            }
            return IndicesFactory.createSimple(indices);
        }
View Full Code Here

        this.tensorNames = new int[nameSpaceSize];
        for(int i=0; i< nameSpaceSize; ++i){
            int first = i % ALPHABET_SIZE;
            int second = i - first;
            String sName = new String(new char[]{(char) (0x41 + first), (char) (0x41 + second)});
            tensorNames[i] = CC.getNameManager().mapNameDescriptor(new NameDescriptor(sName, new IndicesTypeStructure(EmptyIndices.INSTANCE)));
        }
    }
View Full Code Here

                final SimpleIndices i1 = o1.getIndices(), i2 = o2.getIndices();
                if (i1.size() < i2.size())
                    return -1;
                if (i1.size() > i2.size())
                    return 1;
                final IndicesTypeStructure s1 = new IndicesTypeStructure(i1), s2 = new IndicesTypeStructure(i2);
                return Integer.compare(s1.hashCode(), s2.hashCode());
            }
View Full Code Here

        Tensor[] arguments = argsList.toArray(new Tensor[argsList.size()]);
        SimpleIndices[] arumentsIndices = argIndices.toArray(new SimpleIndices[argIndices.size()]);

        IndicesTypeStructure[] structures = new IndicesTypeStructure[1 + arguments.length];
        structures[0] = new IndicesTypeStructure(stp.indices);
        for (int i = 1; i < structures.length; ++i)
            structures[i] = new IndicesTypeStructure(argIndices.get(i - 1));
        NameDescriptor descriptor = new NameDescriptor(stp.name, structures);
        int tensorName = CC.getNameManager().mapNameDescriptor(descriptor);
        return new TensorField(tensorName, stp.indices, arguments, arumentsIndices);
    }
View Full Code Here

    private static final int parserID = 10;

    @Override
    public SimpleTensor parse(String expression, Parser parser) {
        ParserSimpleTensorStructure stp = new ParserSimpleTensorStructure(expression);
        NameDescriptor descriptor = new NameDescriptor(stp.name, new IndicesTypeStructure(stp.getIndices()));
        int tensorName = CC.getNameManager().mapNameDescriptor(descriptor);
        return new SimpleTensor(tensorName, stp.getIndices());
    }
View Full Code Here

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

        //F_{\\mu\\nu} type structure
        final IndicesTypeStructure F_TYPE_STRUCTURE = new IndicesTypeStructure(IndexType.GreekLower.getType(), 2);
        //matrices indicator for parse preprocessor
        final Indicator<ParseNodeSimpleTensor> matricesIndicator = new Indicator<ParseNodeSimpleTensor>() {

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

        this.names = names;
    }

    private static IndicesTypeStructure[] createIndicesTypeStructures(byte type) {
        IndicesTypeStructure[] structures = new IndicesTypeStructure[1];
        structures[0] = new IndicesTypeStructure(type, 2);
        return structures;
    }
View Full Code Here

TOP

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

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.