loopy/symbolic.py
def _get_new_substitutions_and_renames(self):
        """This makes a new dictionary of substitutions from the ones
        encountered in mapping all the encountered expressions.
        It tries hard to keep substitution names the same--i.e.
        if all derivative versions of a substitution rule ended
        up with the same mapped version, then this version should
        retain the name that the substitution rule had previously.
        Unfortunately, this can't be done in a single pass, and so
        the routine returns an additional dictionary *subst_renames*
        of renamings to be performed on the processed expressions.

        The returned substitutions already have the rename applied
        to them.

        :returns: (new_substitutions, subst_renames)
        """

        from loopy.kernel.data import SubstitutionRule

        orig_name_histogram = {}
        for key, (name, orig_name) in six.iteritems(self.subst_rule_registry):
            if self.subst_rule_use_count.get(key, 0):
                orig_name_histogram[orig_name] = \
                        orig_name_histogram.get(orig_name, 0) + 1

        result = {}
        renames = {}

        for key, (name, orig_name) in six.iteritems(self.subst_rule_registry):
            args, body = key

            if self.subst_rule_use_count.get(key, 0):
                if orig_name_histogram[orig_name] == 1 and name != orig_name:
                    renames[name] = orig_name
                    name = orig_name

                result[name] = SubstitutionRule(
                        name=name,
                        arguments=args,
                        expression=body)

        # {{{ perform renames on new substitutions

        subst_renamer = SubstitutionRuleRenamer(renames)

        renamed_result = {}
        for name, rule in six.iteritems(result):
            renamed_result[name] = rule.copy(
                    expression=subst_renamer(rule.expression))

        # }}}

        return renamed_result, renames
This makes a new dictionary of substitutions from the ones
        encountered in mapping all the encountered expressions.
        It tries hard to keep substitution names the same--i.e.
        if all derivative versions of a substitution rule ended
        up with the same mapped version, then this version should
        retain the name that the substitution rule had previously.
        Unfortunately, this can't be done in a single pass, and so
        the routine returns an additional dictionary *subst_renames*
        of renamings to be performed on the processed expressions.

        The returned substitutions already have the rename applied
        to them.

        :returns: (new_substitutions, subst_renames)
        
This makes a new dictionary of substitutions from the ones
encountered in mapping all the encountered expressions.
It tries hard to keep substitution names the same--i.e.
if all derivative versions of a substitution rule ended
up with the same mapped version, then this version should
retain the name that the substitution rule had previously.
Unfortunately, this can't be done in a single pass, and so
the routine returns an additional dictionary *subst_renames
of renamings to be performed on the processed expressions.

The returned substitutions already have the rename applied
to them.
This makes a new dictionary of substitutions from the ones encountered in mapping all the encountered expressions . It tries hard to keep substitution names the same -- i . e . if all derivative versions of a substitution rule ended up with the same mapped version then this version should retain the name that the substitution rule had previously . Unfortunately this can ' t be done in a single pass and so the routine returns an additional dictionary * subst_renames of renamings to be performed on the processed expressions . The returned substitutions already have the rename applied to them .
def _get_new_substitutions_and_renames(self):
        from loopy.kernel.data import SubstitutionRule
        orig_name_histogram = {}
        for key, (name, orig_name) in six.iteritems(self.subst_rule_registry):
            if self.subst_rule_use_count.get(key, 0):
                orig_name_histogram[orig_name] = \
                        orig_name_histogram.get(orig_name, 0) + 1
        result = {}
        renames = {}
        for key, (name, orig_name) in six.iteritems(self.subst_rule_registry):
            args, body = key
            if self.subst_rule_use_count.get(key, 0):
                if orig_name_histogram[orig_name] == 1 and name != orig_name:
                    renames[name] = orig_name
                    name = orig_name
                result[name] = SubstitutionRule(
                        name=name,
                        arguments=args,
                        expression=body)
        subst_renamer = SubstitutionRuleRenamer(renames)
        renamed_result = {}
        for name, rule in six.iteritems(result):
            renamed_result[name] = rule.copy(
                    expression=subst_renamer(rule.expression))
        return renamed_result, renames
def _get_new_substitutions_and_renames ( self ) : from loopy . kernel . data import SubstitutionRule orig_name_histogram = { } for key , ( name , orig_name ) in six . iteritems ( self . subst_rule_registry ) : if self . subst_rule_use_count . get ( key , 0 ) : orig_name_histogram [ orig_name ] = orig_name_histogram . get ( orig_name , 0 ) + 1 result = { } renames = { } for key , ( name , orig_name ) in six . iteritems ( self . subst_rule_registry ) : args , body = key if self . subst_rule_use_count . get ( key , 0 ) : if orig_name_histogram [ orig_name ] == 1 and name != orig_name : renames [ name ] = orig_name name = orig_name result [ name ] = SubstitutionRule ( name = name , arguments = args , expression = body ) subst_renamer = SubstitutionRuleRenamer ( renames ) renamed_result = { } for name , rule in six . iteritems ( result ) : renamed_result [ name ] = rule . copy ( expression = subst_renamer ( rule . expression ) ) return renamed_result , renames
This makes a new dictionary of substitutions from the ones
encountered in mapping all the encountered expressions.
This makes a new dictionary of substitutions from the ones encountered in mapping all the encountered expressions .
"""This makes a new dictionary of substitutions from the ones
        encountered in mapping all the encountered expressions.
        It tries hard to keep substitution names the same--i.e.
        if all derivative versions of a substitution rule ended
        up with the same mapped version, then this version should
        retain the name that the substitution rule had previously.
        Unfortunately, this can't be done in a single pass, and so
        the routine returns an additional dictionary *subst_renames*
        of renamings to be performed on the processed expressions.

        The returned substitutions already have the rename applied
        to them.

        :returns: (new_substitutions, subst_renames)
        """ # {{{ perform renames on new substitutions # }}}
None
self