| 1 |
{# Note that we use this template only for subexpressions -- for normal arrays |
| 2 |
we do not generate any code but simply access the data in the underlying |
| 3 |
array directly. See RuntimeDevice.get_with_array #} |
| 4 |
{# USES_VARIABLES { _group_idx } #} |
| 5 |
{% extends 'common_group.pyx' %} |
| 6 |
|
| 7 |
{% block maincode %} |
| 8 |
|
| 9 |
{%set c_type = cpp_dtype(variables['_variable'].dtype) %} |
| 10 |
{%set np_type = numpy_dtype(variables['_variable'].dtype) %} |
| 11 |
|
| 12 |
_vectorisation_idx = 1 |
| 13 |
|
| 14 |
cdef size_t _num_elements = 0 |
| 15 |
cdef _numpy.ndarray[{{c_type}}, ndim=1, mode='c'] _elements = _numpy.zeros(_num{{_group_idx}}, dtype=_numpy.{{np_type}}) |
| 16 |
cdef {{c_type}}[:] _elements_view = _elements |
| 17 |
|
| 18 |
{{scalar_code|autoindent}} |
| 19 |
|
| 20 |
for _idx_group_idx in range(_num{{_group_idx}}): |
| 21 |
_idx = {{_group_idx}}[_idx_group_idx] |
| 22 |
_vectorisation_idx = _idx |
| 23 |
|
| 24 |
{{vector_code|autoindent}} |
| 25 |
|
| 26 |
_elements_view[_idx_group_idx] = _variable |
| 27 |
|
| 28 |
return _elements |
| 29 |
|
| 30 |
{% endblock %} |