{# USES_VARIABLES { _synaptic_post, N } #}
{# ITERATE_ALL { _idx } #}
import numpy as _numpy

{% set _target_var_array = get_array_name(_target_var) %}

# scalar code
_vectorisation_idx = 1
{{scalar_code|autoindent}}

# vector code
_vectorisation_idx = N
{{vector_code|autoindent}}

# We write to the array, using the name provided as a keyword argument to the
# template
{{_target_var_array}}[:] = _numpy.bincount({{_synaptic_post}},
                                 minlength=len({{_target_var_array}}),
                                 weights=_synaptic_var)