Let\'s say I want to implement Numpy\'s
x[:] += 1
in Cython. I could write
@cython.boundscheck(False) @cython.wraparoundcheck(F
You could try using the flat attribute of the ndarray, which provides an iterator over the flattened array object. It always iterates in C-major ordering, with the last index varying the fastest. Something like:
flat
ndarray
for i in range(x.size): x.flat[i] += 1