Package cc.redberry.core.tensor

Examples of cc.redberry.core.tensor.TensorField


        super(from, to);
    }

    @Override
    Tensor newTo_(Tensor currentNode, SubstitutionIterator iterator) {
        TensorField currentField = (TensorField) currentNode;
        TensorField from = (TensorField) this.from;
        IndexMappingBuffer buffer = IndexMappings.simpleTensorsPort(from, currentField).take();
        if (buffer == 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), fIndices, cIndices, new int[0]);

            argFrom.add(fArg);
            argTo.add(currentNode.get(i));
        }
View Full Code Here


    private ParseUtils() {
    }

    public static ParseToken tensor2AST(Tensor tensor) {
        if (tensor instanceof TensorField) {
            TensorField tf = (TensorField) tensor;
            ParseToken[] content = new ParseToken[tf.size()];
            int i = 0;
            for (Tensor t : tf)
                content[i++] = tensor2AST(t);
            return new ParseTokenTensorField(tf.getIndices(), tf.getStringName(), content, tf.getArgIndices());
        }
        if (tensor instanceof SimpleTensor) {
            SimpleTensor st = (SimpleTensor) tensor;
            return new ParseTokenSimpleTensor(st.getIndices(), st.getStringName());
        }
View Full Code Here

        Tensor current;
        OUT:
        while ((current = iterator.next()) != null) {
            if (!(current instanceof TensorField))
                continue;
            TensorField currentField = (TensorField) current;
            IndexMappingBuffer buffer = IndexMappings.simpleTensorsPort(from, currentField).take();
            if (buffer == null)
                continue;


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

            List<Transformation> transformations = new ArrayList<>();
            Tensor fArg;
            int[] cIndices, fIndices;
            int i;
View Full Code Here

TOP

Related Classes of cc.redberry.core.tensor.TensorField

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.