apply_loop_invariant_optimisations function

(Shortest import: from brian2.codegen.translation import apply_loop_invariant_optimisations)

brian2.codegen.translation.apply_loop_invariant_optimisations(statements, variables, dtype)[source]

Analyzes statements to pull out expressions that need to be evaluated only once.


statements : list of Statement

The statements to analyze.

variables : dict-like

A mapping of identifier names used in statements to Variable or Function objects.

dtype : dtype

The data type to use for the newly introduced scalar constants


scalar_stmts, vector_stmts : pair of list of Statement objects

A list of new scalar statements to define constant for expressions that need to be evaluated only once and the rewritten statements using those constants