Package cc.redberry.core.indexgenerator

Examples of cc.redberry.core.indexgenerator.IndexGenerator.generate()


        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));
                    im.add(index, newIndex);
                    im.add(inverseIndexState(index), inverseIndexState(newIndex));
                }
            } else
                checked.add(getNameWithType(index));
View Full Code Here


            IndexMappingDirectAllowingUnmapped im = new IndexMappingDirectAllowingUnmapped();
            IndexGenerator ig = createIndexGenerator(tensor);
            for (int i = 0; i < indices.size(); ++i) {
                int index = indices.get(i);
                if (checked.contains(inverseIndexState(index))) {
                    int newIndex = getRawStateInt(index) | ig.generate(getType(index));
                    im.add(index, newIndex);
                } else
                    checked.add(index);
            }
            if (im.isEmpty())
View Full Code Here

                        } else if (uncontractedIndicesCollected.contains(getNameWithType(indexCollected))) {
                            kroneckerToCollect = CC.createKronecker(indexToCollect, inverseIndexState(indexCollected));
                            split.factoredOut.add(kroneckerToCollect);
//                            continue;
                        } else {
                            int newIndex = ig.generate(getType(indexToCollect));
                            collectedTerm.getCollectedFactorsIndicesNames().add(getNameWithType(indexCollected));
                            collectedTerm.getCollectedFactorsIndicesNames().add(newIndex);
                            collectedTerm.getCollectedTermIndicesNames().replaceFirst(getNameWithType(indexCollected), newIndex);
//                        uncontractedIndicesCollected.addAll(newIndex);
//                        uncontractedIndicesToCollect.addAll(newIndex);
View Full Code Here

            for (int i = 0; i < indices.size(); ++i) {
                int index = indices.get(i);
                if (checked.contains(inverseIndexState(index)))
                    if (Arrays.binarySearch(indicesToRenameNames, getNameWithType(index)) < 0) {
//                        uncontracted.addAll(inverseIndexState(index));
                        int newIndex = getRawStateInt(index) | ig.generate(getType(index));
                        im.add(index, newIndex);
                    } else {
                        if (renameUsedIndices == null)
                            renameUsedIndices = new IndexMappingDirectAllowingUnmapped();
                        int newIndex = getRawStateInt(index) | ig.generate(getType(index));
View Full Code Here

                        int newIndex = getRawStateInt(index) | ig.generate(getType(index));
                        im.add(index, newIndex);
                    } else {
                        if (renameUsedIndices == null)
                            renameUsedIndices = new IndexMappingDirectAllowingUnmapped();
                        int newIndex = getRawStateInt(index) | ig.generate(getType(index));
                        int kroneckerIndex = getRawStateInt(index) | ig.generate(getType(index));
                        renameUsedIndices.add(index, kroneckerIndex);
                        renameUsedIndices.add(inverseIndexState(index), inverseIndexState(newIndex));
                        im.add(newIndex, kroneckerIndex);
          
View Full Code Here

                        im.add(index, newIndex);
                    } else {
                        if (renameUsedIndices == null)
                            renameUsedIndices = new IndexMappingDirectAllowingUnmapped();
                        int newIndex = getRawStateInt(index) | ig.generate(getType(index));
                        int kroneckerIndex = getRawStateInt(index) | ig.generate(getType(index));
                        renameUsedIndices.add(index, kroneckerIndex);
                        renameUsedIndices.add(inverseIndexState(index), inverseIndexState(newIndex));
                        im.add(newIndex, kroneckerIndex);
          
                    }
View Full Code Here

                freeIndices[b] = new int[typeData.length];
                System.arraycopy(_freeIndices, typeData.from, freeIndices[b], 0, typeData.length);
            }
            int diff = (totalIndicesCounts[b] - freeIndices[b].length) / 2;
            for (i = 0; i < diff; ++i)
                indicesSpace[b][i] = indexGenerator.generate(b);
            for (i = 0; i < diff; ++i)
                indicesSpace[b][i + diff] = IndicesUtils.inverseIndexState(indicesSpace[b][i]);
            System.arraycopy(freeIndices[b], 0, indicesSpace[b], diff * 2, freeIndices[b].length);
            shuffle(indicesSpace[b]);
        }
View Full Code Here

                    }

                    for (j = indices.length - 1; j >= 0; --j)
                        indices[j] = setRawState(getRawStateInt(var.getIndices().get(j)),
                                ig.generate(getType(var.getIndices().get(j))));
                    varIndices = UnsafeIndicesFactory.createIsolatedUnsafeWithoutSort(null, indices);
                    var = Tensors.setIndices(var, varIndices);
                    __from = Tensors.fieldDerivative(__from, varIndices.getInverted(), i);
                    __to = new DifferentiateTransformation(var).transform(__to);
                    --order;
View Full Code Here

        int fromIndex;
        for (i = upperLower.length - 1; i >= 0; --i) {
            fromIndex = upperLower[i];
            if (dummyIndices.contains(fromIndex)) {
                from.add(fromIndex);
                to.add(generator.generate(IndicesUtils.getType(fromIndex)));
            }
        }

        int[] _from = from.toArray(), _to = to.toArray();
        ArraysUtils.quickSort(_from, _to);
View Full Code Here

            int state, i = 0, length = allFreeArgIndices.length;
            IndexGenerator indexGenerator = new IndexGenerator(varIndices);
            for (; i < length; ++i) {
                type = getType(varIndices.get(i));
                state = getRawStateInt(varIndices.get(i));
                allFreeVarIndices[i] = setRawState(indexGenerator.generate(type), inverseIndexState(state));
                allFreeArgIndices[i] = setRawState(indexGenerator.generate(type), state);
            }
            int[] allIndices = addAll(allFreeVarIndices, allFreeArgIndices);
            SimpleIndices dIndices = IndicesFactory.createSimple(null, allIndices);
            SimpleTensor symmetric = simpleTensor("@!@#@##_AS@23@@#", dIndices);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.