[Numpy-discussion] On my Cython/NumPy project
Joris De Ridder
Sat Jun 21 07:57:40 CDT 2008
> General feedback is welcome; in particular, I need more opinions about
> what syntax people would like. We seem unable to find something that
> really like; this is the current best candidate (cdef is the way you
> declare types on variables in Cython):
> cdef int i = 4, j = 6
> cdef np.ndarray[np.float64, 2] arr = np.zeros((10, 10),
> arr[i, j] = 1
> The code above the under the hood acquires a buffer and uses it for
> efficient access. arr, arr[5,6,7], arr[2:4,...] and in general
> but two simple indices will be passed to Python, while arr[i, j]
> will be
> passed to the buffer.
The syntax looks quite good, I think.
Some questions though:
- I guess there are some technical reasons why np.float64 in your
example has to be repeated twice?
- When you say "negative indices are not supported" you mean that they
are passed to python, or
won't they work at all?
I'm looking forward to the results of your Cython project!
More information about the Numpy-discussion