optimise_statements function¶
(Shortest import: from brian2.codegen.optimisation import optimise_statements)
-
brian2.codegen.optimisation.
optimise_statements
(scalar_statements, vector_statements, variables, blockname='')[source]¶ Optimise a sequence of scalar and vector statements
Performs the following optimisations:
- Constant evaluations (e.g. exp(0) to 1). See
evaluate_expr
. - Arithmetic simplifications (e.g. 0*x to 0). See
ArithmeticSimplifier
,collect()
. - Pulling out loop invariants (e.g. v*exp(-dt/tau) to a=exp(-dt/tau) outside the loop and v*a inside).
See
Simplifier
. - Boolean simplifications (allowing the replacement of expressions with booleans with a sequence of if/thens).
See
Simplifier
.
- Constant evaluations (e.g. exp(0) to 1). See