[Cython] Thoughts on numerical computing/NumPy support
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Tue Mar 4 22:02:30 CET 2008
Correction:
> def myfunc(numpy.ndarray arr):
> if arr.nd != 2 or arr.dtype != numpy.dtype(numpy.uint8):
> raise ValueError("Must pass 2-dimensional uint8 array.")
> cdef unsigned char* arr_buf = <unsigned char*>arr.data
> arr.data[4 * arr.strides[0] + 5 * arr.strides[1]] = 10
>
Last line should index arr_buf, not arr.data.
BTW,
> perfect, but perhaps in a few years we can have something that will
> finally kill FORTRAN :-)
>
In case you were wondering, this is definitely a joke. One can hope though.
--
Dag Sverre
More information about the Cython-dev
mailing list