| 1 |
{# USES_VARIABLES { N } #} |
| 2 |
{% extends 'common_group.pyx' %} |
| 3 |
|
| 4 |
{% block maincode %} |
| 5 |
|
| 6 |
{%set c_type = cpp_dtype(variables['_variable'].dtype) %} |
| 7 |
{%set np_type = numpy_dtype(variables['_variable'].dtype) %} |
| 8 |
|
| 9 |
_vectorisation_idx = 1 |
| 10 |
|
| 11 |
cdef size_t _N = {{constant_or_scalar('N', variables['N'])}} |
| 12 |
cdef size_t _num_elements = 0 |
| 13 |
cdef _numpy.ndarray[{{c_type}}, ndim=1, mode='c'] _elements = _numpy.zeros(_N, dtype=_numpy.{{np_type}}) |
| 14 |
cdef {{c_type}}[:] _elements_view = _elements |
| 15 |
|
| 16 |
|
| 17 |
{{scalar_code|autoindent}} |
| 18 |
|
| 19 |
for _idx in range(_N): |
| 20 |
_vectorisation_idx = _idx |
| 21 |
|
| 22 |
{{vector_code|autoindent}} |
| 23 |
|
| 24 |
if _cond: |
| 25 |
_elements_view[_num_elements] = _variable |
| 26 |
_num_elements += 1 |
| 27 |
|
| 28 |
return _elements[:_num_elements] |
| 29 |
|
| 30 |
{% endblock %} |