MCPcopy Create free account
hub / github.com/numpy/numpy / _indices_for_nelems

Function _indices_for_nelems

numpy/core/tests/test_mem_overlap.py:21–34  ·  view source on GitHub ↗

Returns slices of length nelems, from start onwards, in direction sign.

(nelems)

Source from the content-addressed store, hash-verified

19
20
21def _indices_for_nelems(nelems):
22 """Returns slices of length nelems, from start onwards, in direction sign."""
23
24 if nelems == 0:
25 return [size // 2] # int index
26
27 res = []
28 for step in (1, 2):
29 for sign in (-1, 1):
30 start = size // 2 - nelems * step * sign // 2
31 stop = start + nelems * step * sign
32 res.append(slice(start, stop, step * sign))
33
34 return res
35
36
37def _indices_for_axis():

Callers 1

_indices_for_axisFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected