Package cc.redberry.core.tensor.iterator

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


        TraverseState state;
        Tensor current;
        while ((state = iterator.next()) != null) {
            if (state != TraverseState.Leaving)
                continue;
            current = iterator.current();
            Mapping mapping = IndexMappings.getFirst(from, current);
            if (mapping != null) {
                Tensor newFrom = ApplyIndexMapping.applyIndexMapping(to, mapping);
                iterator.set(newFrom);
            }
View Full Code Here


        TraverseState state;
        Tensor c;
        while ((state = iterator.next()) != null) {
            if (state != TraverseState.Leaving)
                continue;
            c = iterator.current();
            if (TensorUtils.isZeroDueToSymmetry(c))
                iterator.set(Complex.ZERO);
        }
        return iterator.result();
    }
View Full Code Here

        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();
            Mapping mapping = IndexMappings.getFirst(from, current);
            if (mapping != null) {
                Tensor newFrom = ApplyIndexMapping.applyIndexMapping(to, mapping);
                iterator.set(newFrom);
            }
View Full Code Here

        start = System.currentTimeMillis();
        Tensor ptM = null;
        for (i = 0; i < 100; ++i) {
            iterator = new TreeTraverseIterator(target);
            while (iterator.next() != null)
                if (TensorUtils.equals(iterator.current(), pT))
                    iterator.set(M);
            ptM = iterator.result();
        }
        stop = System.currentTimeMillis();
        status = TensorUtils.equals(ptM, pTToM);
View Full Code Here

        start = System.currentTimeMillis();
        Tensor sM = null;
        for (i = 0; i < 100; ++i) {
            iterator = new TreeTraverseIterator(target);
            while (iterator.next() != null)
                if (TensorUtils.equals(iterator.current(), s))
                    iterator.set(M2);
            sM = iterator.result();
        }
        status = TensorUtils.equals(sM, sToM);
        stop = System.currentTimeMillis();
View Full Code Here

        start = System.currentTimeMillis();
        Tensor allM = null;
        for (i = 0; i < 100; ++i) {
            iterator = new TreeTraverseIterator(target);
            while (iterator.next() != null)
                if (TensorUtils.equals(iterator.current(), pT))
                    iterator.set(M);
                else if (TensorUtils.equals(iterator.current(), s))
                    iterator.set(M2);
            allM = iterator.result();
        }
View Full Code Here

        for (i = 0; i < 100; ++i) {
            iterator = new TreeTraverseIterator(target);
            while (iterator.next() != null)
                if (TensorUtils.equals(iterator.current(), pT))
                    iterator.set(M);
                else if (TensorUtils.equals(iterator.current(), s))
                    iterator.set(M2);
            allM = iterator.result();
        }
        status = TensorUtils.equals(allM, AllToM);
        stop = System.currentTimeMillis();
View Full Code Here

        SimpleIndices oldIndices, newIndices;
        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

        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)
                if (simpleTensor instanceof TensorField)
                    iterator.set(Tensors.setIndicesToField((TensorField) simpleTensor, newIndices));
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.