Package cc.redberry.core.tensor

Examples of cc.redberry.core.tensor.Tensor


        super(from, to);
    }

    @Override
    Tensor newTo_(Tensor current, SubstitutionIterator iterator) {
        Tensor old = null;
        while (old != current) {
            old = current;

            SumBijectionPort.BijectionContainer bc = new SumBijectionPort(from, current).take();
            if (bc == null)
                return current;

            Mapping mapping = bc.mapping;
            Tensor newTo = applyIndexMappingToTo(current, to, mapping, iterator);

            SumBuilder builder = new SumBuilder();
            int[] bijection = bc.bijection;
            builder.put(newTo);
View Full Code Here


        int i;
        for (i = 0; i < equations.length; ++i) {
            Expression eq = equations[i];
            //iterating over the whole equation
            FromChildToParentIterator iterator = new FromChildToParentIterator(eq);
            Tensor t;
            while ((t = iterator.next()) != null) {
                if (!(t instanceof Product) || t.getIndices().size() == 0)
                    continue;
                //scalars content
                Tensor[] scalars = ((Product) t).getContent().getScalars();
                for (Tensor scalar : scalars) {
                    if (!tensorSubstitutions.containsKey(scalar)) {
View Full Code Here

    }

    @Override
    public Tensor transform(Tensor t) {
        FromChildToParentIterator iterator = new FromChildToParentIterator(t);
        Tensor c;
        while ((c = iterator.next()) != null)
            if (c instanceof Complex)
                iterator.set(((Complex) c).conjugate());
        return iterator.result();
    }
View Full Code Here

        return content[0].getIndices().getFree();
    }

    @Override
    public Tensor toTensor() {
        Tensor expression = Tensors.expression(content[0].toTensor(), content[1].toTensor());
        if (tokenType == TokenType.PreprocessingExpression) {
            for (Transformation tr : Context.get().getParseManager().defaultTensorPreprocessors)
                expression = tr.transform(expression);
            Context.get().getParseManager().defaultTensorPreprocessors.add((Transformation) expression);
        }
View Full Code Here

    @Override
    public Tensor toTensor() {
        if (content.length != 1)
            throw new IllegalArgumentException("Wrong scalar function node.");
        Tensor arg = content[0].toTensor();
        switch (function.toLowerCase()) {
            case "sin":
                return Tensors.sin(arg);
            case "cos":
                return Tensors.cos(arg);
View Full Code Here

     */
    public Tensor parse(String expression, Transformation[] tensorPreprocessors, ParseTokenTransformer[] nodesPreprocessors) {
        ParseToken node = parser.parse(expression);
        for (ParseTokenTransformer tr : nodesPreprocessors)
            node = tr.transform(node);
        Tensor t = node.toTensor();
        for (Transformation tr : tensorPreprocessors)
            t = tr.transform(t);
        return t;
    }
View Full Code Here

     */
    public Tensor parse(String expression, List<Transformation> tensorPreprocessors, List<ParseTokenTransformer> nodesPreprocessors) {
        ParseToken node = parser.parse(expression);
        for (ParseTokenTransformer tr : nodesPreprocessors)
            node = tr.transform(node);
        Tensor t = node.toTensor();
        for (Transformation tr : tensorPreprocessors)
            t = tr.transform(t);
        return t;
    }
View Full Code Here

    }

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

        while ((c = iterator.next()) != null)
            if (powerExpandApplicable(c, toExpandIndicator))
                iterator.set(Tensors.multiply(powerExpandToArray1(c, toExpandIndicator)));
View Full Code Here

    }

    @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)));
View Full Code Here

                for (int j = 0; j < metricInds.length; ++j)
                    if (temp[j] == 0xFFFFFFFF)
                        temp[j] = createIndex(counter++, getType(metricInds[j]), false);//lower index
                IntArrayList _result = nonMetricIndices.clone();
                _result.addAll(temp);
                Tensor renamed = ApplyIndexMapping.applyIndexMapping(st, new Mapping(indicesArray, _result.toArray()));
                //todo bottleneck
                for (Tensor existing : combinationArray)
                    if (TensorUtils.compare1(existing, renamed) != null)
                        continue combinations;
                combinationArray.add(renamed);
View Full Code Here

TOP

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

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.