Jean-Francois Moulin wrote:
> Great! Just tried it and it works fine!
> I gain something like a tenfold factor in speed with respect to my
> initial python code.
>>From what I read I expect I should still gain quite a lot by
> optimizing the calls to the Numpy functions.
> Namely using the buffer notation defining the type of array I am using.
> A question arises, should I also apply this notation in the definition
> of my pointers? and if yes, how?
>
> so, I presently have statements like:
> cdef int (*locate)(DelayLine, np.ndarray)
>
> and would write something like:
> cdef int (*locate)(DelayLine, np.ndarray[DTYPE_t,ndim=2])
This is simply not supported with cdef functions. You need to do
cdef int (*locate)(DelayLine, np.ndarray)
and then inside the implementation of the function you assign to it, you do
cdef int (*locate)(DelayLine a, np.ndarray b)
cdef np.ndarray[DTYPE_t, ndim=2] b_buf = b
.... access b through b_buf ...
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev