cd4186d816ef7482e64fe66c671fba9578eae19b,brian2/codegen/generators/GSL_generator.py,GSLCodeGenerator,get_dimension_code,#GSLCodeGenerator#,122

Before Change


        return to_replace

    def get_dimension_code(self, diff_num):
        start_function = self.get_syntax("start_function")
        open_function = self.get_syntax("open_function")
        end_statement = self.get_syntax("end_statement")
        end_function = self.get_syntax("end_function")
        code = "\n{start_function}int set_dimension(size_t * dimension){open_function}".format(start_function=start_function,
                                                                                            open_function=open_function)
        code += "\n\tdimension[0] = {diff_num}{end_statement}".format(diff_num=diff_num, end_statement=end_statement)
        code += "\n\treturn GSL_SUCCESS{end_statement}\n".format(end_statement=end_statement)
        code += end_function
        return code

    def yvector_code(self, diff_vars):
        start_function = self.get_syntax("start_function")
        open_function = self.get_syntax("open_function")

After Change


        return to_replace

    def get_dimension_code(self, diff_num):
        code = ["\n{start_function}int set_dimension(size_t * dimension){open_function}"]
        code += ["\tdimension[0] = %d{end_statement}"%diff_num]
        code += ["\treturn GSL_SUCCESS{end_statement}"]
        return ("\n").join(code).format(**self.syntax)

    def yvector_code(self, diff_vars):
        allocate_y = ["\n{start_function}double* assign_memory_y(){open_function}"]
        allocate_y += ["\treturn {open_cast}double *{close_cast} malloc(%d*sizeof(double))"%len(diff_vars)]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 10

Instances


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


Project Name: DagnyT/hardnet
Commit Name: 04cd555be76efc7baced753c751c4257d41eb75d
Time: 2017-07-27
Author: ducha.aiki@gmail.com
File Name: EvalMetrics.py
Class Name:
Method Name: ErrorRateAt95Recall


Project Name: tensorflow/ranking
Commit Name: 6bf3f51cd0a312da842157665663c2dad9983248
Time: 2021-01-29
Author: xuanhui@google.com
File Name: tensorflow_ranking/python/losses_impl.py
Class Name: ClickEMLoss
Method Name: _compute_latent_prob


Project Name: mariogeiger/se3cnn
Commit Name: 36eef6a9be308b137a106ea84c5553e3a6691333
Time: 2019-08-23
Author: geiger.mario@gmail.com
File Name: se3cnn/point/operations.py
Class Name: PairConvolution
Method Name: forward