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
        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.getStructureOfContractionsHashed().get(i).equals(fromContent.getStructureOfContractionsHashed().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

        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
        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

        if (tensor instanceof ScalarFunction)
            return tensor.hashCode();

        int hash = tensor.hashCode();
        if (tensor instanceof Product) {
            ProductContent pc = ((Product) tensor).getContent();
            //TODO may be refactor with noncommutative operation using stretcIds
            for (int i = pc.size() - 1; i >= 0; --i)
                hash += HashFunctions.JenkinWang32shift((int) pc.getStretchId(i)) * _hashWithIndices(pc.get(i), indices);
            return hash;
        }

        for (Tensor t : tensor)
            hash ^= _hashWithIndices(t, indices);
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
        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.getStructureOfContractionsHashed().get(i).equals(fromContent.getStructureOfContractionsHashed().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

        if (tensor instanceof ScalarFunction)
            return tensor.hashCode();

        int hash = tensor.hashCode();
        if (tensor instanceof Product) {
            ProductContent pc = ((Product) tensor).getContent();
            //TODO may be refactor with noncommutative operation using stretcIds
            for (int i = pc.size() - 1; i >= 0; --i)
                hash += HashFunctions.JenkinWang32shift((int) pc.getStretchId(i)) * _hashWithIndices(pc.get(i), indices);
            return hash;
        }

        for (Tensor t : tensor)
            hash ^= _hashWithIndices(t, indices);
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
        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.getStructureOfContractionsHashed().get(i).equals(fromContent.getStructureOfContractionsHashed().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

        if (tensor instanceof ScalarFunction)
            return tensor.hashCode();

        int hash = tensor.hashCode();
        if (tensor instanceof Product) {
            ProductContent pc = ((Product) tensor).getContent();
            //TODO may be refactor with noncommutative operation using stretcIds
            for (int i = pc.size() - 1; i >= 0; --i)
                hash += HashFunctions.JenkinWang32shift((int) pc.getStretchId(i)) * _hashWithIndices(pc.get(i), indices);
            return hash;
        }

        for (Tensor t : tensor)
            hash ^= _hashWithIndices(t, indices);
View Full Code Here

        if (tensor instanceof ScalarFunction)
            return tensor.hashCode();

        int hash = tensor.hashCode();
        if (tensor instanceof Product) {
            ProductContent pc = ((Product) tensor).getContent();
            //TODO may be refactor with noncommutative operation using stretcIds
            for (int i = pc.size() - 1; i >= 0; --i)
                hash += HashFunctions.JenkinWang32shift((int) pc.getStretchId(i)) * _hashWithIndices(pc.get(i), indices);
            return hash;
        }

        for (Tensor t : tensor)
            hash ^= _hashWithIndices(t, indices);
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
        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.getStructureOfContractionsHashed().get(i).equals(fromContent.getStructureOfContractionsHashed().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.