e22ec775fbde41968ca64ba2ed0e09e8f5cf687d,brian2/codegen/generators/GSL_generator.py,GSLCodeGenerator,diff_var_to_replace,#GSLCodeGenerator#,67

Before Change



    // A series of functions that should be overridden by child class:
    def diff_var_to_replace(self, diff_vars):
        raise NotImplementedError
    def get_dimension_code(self, diff_num):
        raise NotImplementedError
    def yvector_code(self, diff_vars):
        raise NotImplementedError

After Change


        return diff_vars

    def diff_var_to_replace(self, diff_vars):
        variables = self.variables
        to_replace = {}
        for var, diff_num in diff_vars.items():
            lhs = self.diff_var_declaration(var, diff_num)
            to_replace[lhs] = "f[{ind}]".format(ind=diff_num)
            var_obj = variables[var]
            array_name = self.generator.get_array_name(var_obj, access_data=True)
            idx_name = "_idx" //TODO: could be dynamic?
            replace_what = "{var} = {array_name}[{idx_name}]".format(array_name=array_name, idx_name=idx_name, var=var)
            replace_with = "{var} = y[{ind}]".format(ind=diff_num, var=var)
            to_replace[replace_what] = replace_with
            replace_what = "{array_name}[{idx_name}] = {var}".format(array_name=array_name,
                                                                     idx_name=idx_name,
                                                                     var=var)
            replace_with = ""
            to_replace[replace_what] = replace_with
        return to_replace

    def get_dimension_code(self, diff_num):
        start_function = self.get_syntax("start_function")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: brian-team/brian2
Commit Name: e22ec775fbde41968ca64ba2ed0e09e8f5cf687d
Time: 2017-07-10
Author: charleetje@gmail.com
File Name: brian2/codegen/generators/GSL_generator.py
Class Name: GSLCodeGenerator
Method Name: diff_var_to_replace


Project Name: interactiveaudiolab/nussl
Commit Name: 478d440f0902562314e6780f1b694ae48084f002
Time: 2020-04-23
Author: abugler@gmail.com
File Name: nussl/datasets/transforms.py
Class Name:
Method Name: _pitch_shift


Project Name: interactiveaudiolab/nussl
Commit Name: ae454df2f747d1a630a70a7d1fb528f927b29ea4
Time: 2020-05-14
Author: abugler@gmail.com
File Name: nussl/datasets/transforms.py
Class Name:
Method Name: _pitch_shift