Package cc.redberry.core.indices

Examples of cc.redberry.core.indices.IndicesBuilderSorted


        if (freeIndices.size() == 0)
            nonScalarContent = EMPTY_CONTENT;
    }

    private ProductContentImpl(final boolean isDerivativeContent, final Tensor[] data) {
        this(isDerivativeContent, new IndicesBuilderSorted().append(data).getIndices(), ComplexElement.ONE, data);
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    @Override
    protected void updateIndices() {
        IndicesBuilderSorted ib = new IndicesBuilderSorted();
        for (Tensor t : this)
            ib.append(t.getIndices());
        try {
            indices = ib.getIndices();
        } catch (InconsistentIndicesException ex) {
            //Adding information about source tensor
            throw new InconsistentIndicesException(ex, this);
        }
    }
View Full Code Here

        } else
            return tensor.clone();
    }

    private IndexGenerator createIndexGenerator(Tensor tensor) {
        return new IndexGenerator(new IndicesBuilderSorted().append(indices).append(TensorUtils.getAllIndices(tensor)).asArray());
    }
View Full Code Here

            Indices indices = tensor.getIndices();
            checked.ensureCapacity(indices.size());
            int index;
            IndexMappingDirectAllowingUnmapped im = new IndexMappingDirectAllowingUnmapped();
            //TODO discover case to put allIndices in ig
            IndexGenerator ig = new IndexGenerator(new IndicesBuilderSorted().append(indices).append(usedNames).asArray());
            for (int i = 0; i < indices.size(); i++) {
                index = indices.get(i);
                if (checked.contains(getNameWithType(index))) {
                    if (Arrays.binarySearch(usedNames, getNameWithType(index)) >= 0) {
                        int newIndex = getRawStateInt(index) | ig.generate(getType(index));
View Full Code Here

        }
        return tensor;
    }

    public void transform(Tensor tensor1, Tensor tensor2) {
        Indices indices = new IndicesBuilderSorted().append(tensor1.getIndices()).append(tensor2.getIndices()).getIndices();
        checked.ensureCapacity(indices.size());
        int index;
        IndexMappingDirectAllowingUnmapped im = new IndexMappingDirectAllowingUnmapped();
        //TODO discover case to put allIndices in ig
        IndexGenerator ig = new IndexGenerator(new IndicesBuilderSorted().append(indices).append(usedNames).asArray());
        for (int i = 0; i < indices.size(); i++) {
            index = indices.get(i);
            if (checked.contains(getNameWithType(index))) {
                if (Arrays.binarySearch(usedNames, getNameWithType(index)) >= 0) {
                    int newIndex = getRawStateInt(index) | ig.generate(getType(index));
View Full Code Here

        for (Tensor t : data)
            t.setParent(this);
    }

    private void testConsistent() {
        IndicesBuilderSorted ib = new IndicesBuilderSorted();
        ib.append(data[0].getIndices().getFreeIndices());
        for (int i = 1; i < data.length; ++i)
            ib.append(data[i].getIndices());
        Indices indices = ib.getIndices();
        if (indices.size() == 0)
            return;
        if (CC.getRegim() == Context.Regim.TESTING)
            return;
        try {
View Full Code Here

    }

    @Override
    public Indices getIndices() {
        if (indices == null) {
            IndicesBuilderSorted ib = new IndicesBuilderSorted();
            for (int i = 0; i < data.length; ++i)
                ib.append(data[i].getIndices());
            indices = ib.getIndices();
        }
        return indices;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    protected void updateIndices() {
        IndicesBuilderSorted ib = new IndicesBuilderSorted();
        for (Tensor t : this)
            ib.append(t.getIndices());
        try {
            indices = ib.getIndices();
        } catch (InconsistentIndicesException ex) {
            //Adding information about source tensor
            throw new InconsistentIndicesException(ex, this);
        }
    }
View Full Code Here

        if (freeIndices.size() == 0)
            nonScalarContent = EMPTY_CONTENT;
    }

    private ProductContentImpl(final boolean isDerivativeContent, final Tensor[] data) {
        this(isDerivativeContent, new IndicesBuilderSorted().append(data).getIndices(), ComplexElement.ONE, data);
    }
View Full Code Here

public class TensorUtils {
    private TensorUtils() {
    }

    public static IndicesBuilderSorted getAllIndicesBuilder(final Tensor tensor) {
        final IndicesBuilderSorted ib = new IndicesBuilderSorted();
        TensorLastTreeIterator iterator = new TensorLastTreeIterator(tensor, IterationGuide.EXCEPT_DENOMINATOR_TENSORFIELD_ARGUMENTS);
        Tensor current;
        while (iterator.hasNext()) {
            current = iterator.next();
            if (!(current instanceof SimpleTensor))
                continue;
            if (Derivative.onVarsIndicator.is(iterator))
                ib.append(current.getIndices().getInverseIndices());
            else
                ib.append(current.getIndices());
        }
        return ib;
    }
View Full Code Here

TOP

Related Classes of cc.redberry.core.indices.IndicesBuilderSorted

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.