Package cc.redberry.core.tensor.iterator

Examples of cc.redberry.core.tensor.iterator.TreeTraverseIterator.current()


        TraverseState currentState;
        Tensor currentTensor, newTensor;
        while ((currentState = iterator.next()) != null) {
            if (currentState != state)
                continue;
            currentTensor = newTensor = iterator.current();

            for (Transformation transformation : transformations)
                newTensor = transformation.transform(newTensor);
            if (currentTensor != newTensor)
                iterator.set(newTensor);
View Full Code Here


        TraverseState state;
        Tensor current;
        while ((state = iterator.next()) != null) {
            if (state != TraverseState.Leaving)
                continue;
            current = iterator.current();
            if (current instanceof Product && indicator.is(current))
                iterator.set(expandProductOfSums(current, indicator, transformations, threads));
            else if (current instanceof Power && current.get(0) instanceof Sum
                    && TensorUtils.isNatural(current.get(1)) && indicator.is(current))
                iterator.set(expandPower((Sum) current.get(0), ((Complex) current.get(1)).getReal().intValue(), transformations, threads));
View Full Code Here

        SimpleTensor simpleTensor;
        while ((state = iterator.next()) != null) {
            if (state != TraverseState.Leaving)
                continue;

            if (!(iterator.current() instanceof SimpleTensor))
                continue;
            simpleTensor = (SimpleTensor) iterator.current();
            oldIndices = simpleTensor.getIndices();
            newIndices = oldIndices.applyIndexMapping(mapper);
            if (oldIndices != newIndices)
View Full Code Here

            if (state != TraverseState.Leaving)
                continue;

            if (!(iterator.current() instanceof SimpleTensor))
                continue;
            simpleTensor = (SimpleTensor) iterator.current();
            oldIndices = simpleTensor.getIndices();
            newIndices = oldIndices.applyIndexMapping(mapper);
            if (oldIndices != newIndices)
                if (simpleTensor instanceof TensorField)
                    iterator.set(Tensors.setIndicesToField((TensorField) simpleTensor, newIndices));
View Full Code Here

        Tensor s = Tensors.parse("s");
        for (int i = 0; i < 1000; ++i) {
            TreeTraverseIterator iterator = new TreeTraverseIterator(target);

            while (iterator.next() != null)
                if (TensorUtils.equals(iterator.current(), pT))
                    iterator.set(M8);
                else if (TensorUtils.equals(iterator.current(), s))
                    iterator.set(AllToM);
            iterator.result();
        }
View Full Code Here

            TreeTraverseIterator iterator = new TreeTraverseIterator(target);

            while (iterator.next() != null)
                if (TensorUtils.equals(iterator.current(), pT))
                    iterator.set(M8);
                else if (TensorUtils.equals(iterator.current(), s))
                    iterator.set(AllToM);
            iterator.result();
        }
    }
View Full Code Here

        TraverseState state;
        Tensor current;
        while ((state = iterator.next()) != null) {
            if (state != TraverseState.Leaving)
                continue;
            current = iterator.current();
            IndexMappingBuffer buffer = IndexMappings.getFirst(from, current);
            if (buffer != null) {
                Tensor newFrom = ApplyIndexMapping.applyIndexMapping(to, buffer);
                iterator.set(newFrom);
            }
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.