Package cc.redberry.core.indexgenerator

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


            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);
            Tensor derivative = SymmetrizeSimpleTensorTransformation.symmetrize(
View Full Code Here


                currentFactorIndices = factors[i].getIndices();

                for (j = currentFactorIndices.size() - 1; j >= 0; --j) {
                    index = currentFactorIndices.get(j);
                    if (freeIndices.contains(getNameWithType(index))) {
                        newIndex = setRawState(getRawStateInt(index), generator.generate(getType(index)));
                        from.add(index);
                        to.add(newIndex);
                        kroneckers.add(Tensors.createKronecker(index, inverseIndexState(newIndex)));
                    } else if (IndicesUtils.getState(index) && dummies.contains(getNameWithType(index))) {
                        newIndex = setRawState(getRawStateInt(index), generator.generate(getType(index)));
View Full Code Here

                        newIndex = setRawState(getRawStateInt(index), generator.generate(getType(index)));
                        from.add(index);
                        to.add(newIndex);
                        kroneckers.add(Tensors.createKronecker(index, inverseIndexState(newIndex)));
                    } else if (IndicesUtils.getState(index) && dummies.contains(getNameWithType(index))) {
                        newIndex = setRawState(getRawStateInt(index), generator.generate(getType(index)));
                        from.add(index);
                        to.add(newIndex);
                        kroneckers.add(Tensors.createKronecker(index, inverseIndexState(newIndex)));
                    }
                }
View Full Code Here

                mkCollectedList.add(mkCollected);
            } else if (uncontractedIndicesCollected.contains(getNameWithType(indexCollected))) {
                mkToCollect = CC.createMetricOrKronecker(indexToCollect, inverseIndexState(indexCollected));
                split.factoredOut.add(mkToCollect);
            } else {
                int newIndex = ig.generate(getType(indexToCollect));
                factorsIndicesNames.add(getNameWithType(indexCollected));
                factorsIndicesNames.add(newIndex);
                termIndicesNames.replaceFirst(getNameWithType(indexCollected), newIndex);

                newIndex = getRawStateInt(indexCollected) | newIndex;
View Full Code Here

        for (; i < from.length; ++i) {
            //diff states mapping detected
            if ((fromState = IndicesUtils.getRawStateInt(from[i])) != (toState = IndicesUtils.getRawStateInt(to[i]))) {

                fromIndex = IndicesUtils.getNameWithType(from[i]);
                toIndex = ig.generate(IndicesUtils.getType(fromIndex));
                preprocess.add(fromIndex, toIndex);

                if (fromState != 0)
                    metrics.add(CC.createMetric(fromIndex, toIndex));
                else
View Full Code Here

            IndexMappingBufferRecord record = entry.getValue();

            //diff states mapping detected
            if (record.diffStatesInitialized() && !record.isContracted()) {
                fromIndex = entry.getKey().intValue();
                toIndex = ig.generate(IndicesUtils.getType(fromIndex));
                preprocess.add(fromIndex, toIndex);

                byte states = record.getStates();
                if ((states & 1) == 1)
                    metrics.add(CC.createMetric(fromIndex, toIndex));
View Full Code Here

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

                        uncontracted.add(getNameWithType(newIndex));
                        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);
                        uncontracted.add(getNameWithType(newIndex));                       
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);
                        uncontracted.add(getNameWithType(newIndex));                       
                        uncontracted.add(getNameWithType(kroneckerIndex));
View Full Code Here

            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

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.