Package cc.redberry.core.transformations.substitutions

Examples of cc.redberry.core.transformations.substitutions.SubstitutionIterator


        this.traverseGuide = traverseGuide;
    }

    @Override
    public Tensor transform(Tensor tensor) {
        SubstitutionIterator iterator = new SubstitutionIterator(tensor, traverseGuide);
        Tensor current;
        while ((current = iterator.next()) != null) {
            if (current instanceof Product)
                iterator.unsafeSet(expandProduct((Product) current, transformations));
            else if (ExpandUtils.isExpandablePower(current)) {
                Sum sum = (Sum) current.get(0);
                int exponent = ((Complex) current.get(1)).intValue();
                if (exponent == -1)
                    continue;
                boolean symbolic = TensorUtils.isSymbolic(sum),
                        reciprocal = exponent < 0;
                exponent = Math.abs(exponent);
                Tensor temp;
                if (symbolic)
                    temp = ExpandUtils.expandSymbolicPower(sum, exponent, transformations);
                else
                    temp = ExpandUtils.expandPower(sum, exponent, iterator.getForbidden(), transformations);
                if (reciprocal)
                    temp = reciprocal(temp);
                if (symbolic)
                    iterator.unsafeSet(temp);
                else
                    iterator.set(temp);
            }
        }
        return iterator.result();
    }
View Full Code Here


        this(Indicator.Utils.iterativeIndicator(varsToIndicator(vars)));
    }

    @Override
    public Tensor transform(Tensor t) {
        SubstitutionIterator iterator = new SubstitutionIterator(t);
        Tensor c;

        while ((c = iterator.next()) != null)
            if (powerExpandApplicable(c, toExpandIndicator))
                iterator.set(Tensors.multiply(powerExpandIntoChainToArray1(c, iterator.getForbidden(), toExpandIndicator)));


        return iterator.result();
    }
View Full Code Here

        this.traverseGuide = traverseGuide;
    }

    @Override
    public Tensor transform(Tensor tensor) {
        SubstitutionIterator iterator = new SubstitutionIterator(tensor, traverseGuide);
        Tensor current;
        while ((current = iterator.next()) != null) {
            if (current instanceof Product)
                iterator.unsafeSet(expandProduct((Product) current, transformations));
            else if (ExpandUtils.isExpandablePower(current)) {
                Sum sum = (Sum) current.get(0);
                int exponent = ((Complex) current.get(1)).intValue();
                if (exponent == -1)
                    continue;
                boolean symbolic = TensorUtils.isSymbolic(sum),
                        reciprocal = exponent < 0;
                exponent = Math.abs(exponent);
                Tensor temp;
                if (symbolic)
                    temp = ExpandUtils.expandSymbolicPower(sum, exponent, transformations);
                else
                    temp = ExpandUtils.expandPower(sum, exponent, iterator.getForbidden(), transformations);
                if (reciprocal)
                    temp = reciprocal(temp);
                if (symbolic)
                    iterator.unsafeSet(temp);
                else
                    iterator.set(temp);
            }
        }
        return iterator.result();
    }
View Full Code Here

        this(Indicator.Utils.iterativeIndicator(varsToIndicator(vars)));
    }

    @Override
    public Tensor transform(Tensor t) {
        SubstitutionIterator iterator = new SubstitutionIterator(t);
        Tensor c;

        while ((c = iterator.next()) != null)
            if (powerUnfoldApplicable(c, toExpandIndicator))
                iterator.set(Tensors.multiply(powerExpandIntoChainToArray1(c, iterator.getForbidden(), toExpandIndicator)));

        return iterator.result();
    }
View Full Code Here

        this(Indicator.Utils.iterativeIndicator(varsToIndicator(vars)));
    }

    @Override
    public Tensor transform(Tensor t) {
        SubstitutionIterator iterator = new SubstitutionIterator(t);
        Tensor c;

        while ((c = iterator.next()) != null)
            if (powerExpandApplicable(c, toExpandIndicator))
                iterator.set(Tensors.multiply(powerExpandIntoChainToArray1(c, iterator.getForbidden(), toExpandIndicator)));


        return iterator.result();
    }
View Full Code Here

TOP

Related Classes of cc.redberry.core.transformations.substitutions.SubstitutionIterator

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.