CythonCodeGenerator class¶
(Shortest import: from brian2.codegen.generators.cython_generator import CythonCodeGenerator)
-
class
brian2.codegen.generators.cython_generator.
CythonCodeGenerator
(*args, **kwds)[source]¶ Bases:
brian2.codegen.generators.base.CodeGenerator
Cython code generator
Methods
A dictionary of values that is made available to the templated.
translate_expression
(expr)Translate the given expression string into a string in the target language, returns a string.
translate_one_statement_sequence
(statements)translate_statement
(statement)Translate a single line
Statement
into the target language, returns a string.translate_statement_sequence
(sc_statements, …)Translate a sequence of
Statement
into the target language, taking care to declare variables, etc.translate_to_read_arrays
(read, indices)translate_to_statements
(statements, …)translate_to_write_arrays
(write)Details
-
determine_keywords
()[source]¶ A dictionary of values that is made available to the templated. This is used for example by the
CPPCodeGenerator
to set up all the supporting code
-
translate_expression
(expr)[source]¶ Translate the given expression string into a string in the target language, returns a string.
-
translate_statement
(statement)[source]¶ Translate a single line
Statement
into the target language, returns a string.
-
translate_statement_sequence
(sc_statements, ve_statements)[source]¶ Translate a sequence of
Statement
into the target language, taking care to declare variables, etc. if necessary.Returns a tuple
(scalar_code, vector_code, kwds)
wherescalar_code
is a list of the lines of code executed before the inner loop,vector_code
is a list of the lines of code in the inner loop, andkwds
is a dictionary of values that is made available to the template.
-