[Numpy-discussion] On my Cython/NumPy project

Joris De Ridder Joris.DeRidder at ster.kuleuven.be
Sat Jun 21 08:57:40 EDT 2008


Hi Dag,

> General feedback is welcome; in particular, I need more opinions about
> what syntax people would like. We seem unable to find something that  
> we
> 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),  
> dtype=np.float64)
> arr[i, j] = 1
> ...
>
> The code above the under the hood acquires a buffer and uses it for
> efficient access. arr[5], arr[5,6,7], arr[2:4,...] and in general  
> anything
> 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!

Cheers,
Joris


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




More information about the NumPy-Discussion mailing list