Package cc.redberry.core.tensor

Examples of cc.redberry.core.tensor.ProductContent


                if (buffer == null)
                    break;

                boolean sign = buffer.getSignum();
                buffer = null;
                ProductContent currentContent = cp.getContent();
                final Tensor[] currentData = currentContent.getDataCopy();
                int[] dataBijection;
                ProductsBijectionsPort dataPort = new ProductsBijectionsPort(fromContent, currentContent);
                while ((dataBijection = dataPort.take()) != null) {
                    buffer = IndexMappings.createBijectiveProductPort(fromData, extract(currentData, dataBijection)).take();
                    if (buffer != null)
View Full Code Here


        this.dummyProvider = new DummyIndexMappingProvider(opu);
//        this.from = from;
//        this.to = to;
        int begin = 0;
        int i;
        ProductContent fromContent = from.getContent(),
                toContent = to.getContent();

//        List<PermutationsProvider> disjointProviders = new ArrayList<>();
        List<Pair> stretches = new ArrayList<>();
        //non permutable
        //TODO uncomment
        //List<Tensor> npFrom = new ArrayList<>(), npTo = new ArrayList<>();
        List<IndexMappingProvider> providers = new ArrayList<>();

        IndexMappingProvider lastOutput = dummyProvider;

        Tensor[] indexlessFrom = from.getIndexless(), indexlessTo = to.getIndexless();

        for (i = 1; i <= indexlessFrom.length; ++i)
            if (i == indexlessFrom.length || indexlessFrom[i].hashCode() != indexlessFrom[i - 1].hashCode()) {
                if (i - 1 != begin)
                    providers.add(lastOutput =
                            new PermutatorProvider(lastOutput, Arrays.copyOfRange(indexlessFrom, begin, i),
                                                   Arrays.copyOfRange(indexlessTo, begin, i)));
                begin = i;
            }

        begin = 0;
        for (i = 1; i <= indexlessFrom.length; ++i)
            if (i == indexlessFrom.length || indexlessFrom[i].hashCode() != indexlessFrom[i - 1].hashCode()) {
                if (i - 1 == begin)
                    providers.add(lastOutput =
                            IndexMappings.createPort(lastOutput,
                                                     indexlessFrom[begin],
                                                     indexlessTo[begin]));
                begin = i;
            }

        begin = 0;
        for (i = 1; i <= fromContent.size(); ++i)
            if (i == fromContent.size() || !fromContent.getContractionStructure().get(i).equals(fromContent.getContractionStructure().get(i - 1))) {
                if (i - 1 != begin)
                    stretches.add(new Pair(fromContent.getRange(begin, i), toContent.getRange(begin, i)));
                else
                    providers.add(lastOutput =
                            IndexMappings.createPort(lastOutput,
                                                     fromContent.get(begin),
                                                     toContent.get(begin)));
                begin = i;
            }

        Collections.sort(stretches);
View Full Code Here

TOP

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

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.