cdef vs. def only affects the speed of the *call* of the function, not the time 
spent in the function itself. If you are processing anything but a very small 
amount of array data there won't be a difference.

Or did you mean that your function only wants to e.g. process a single element? 
Yes, then you need to not use arrays at the moment.

Dag Sverre Seljebotn
-----Original Message-----
From: Jean-Francois Moulin <[email protected]>
Date: Sunday, Sep 20, 2009 3:52 pm
Subject: Re: [Cython] numpy array declaration problem
To: [email protected]: [email protected]


>Oooppss... sorry for not reading correctly!
>But... does that mean that there will be no speed imporvement for these
> functions (which are the ones I want to speed up the most in my code)
>Moreover I see (now) in the manual that the def fns might include some
>cdef declarations of np.ndarrays.... what is happening there?
>Should I better try to implement my stuff without numpy arrays if I am
>really looking for speed (I do not think that would be very wise in my
>case).
>
>Thanks for your patience! ;0)
>Best
>JF
>Johan Grönqvist wrote:
>> Hi,
>> 
>> You must use def, not cdef. It is not possible to use such a dtype 
>> declaration with cdef.
>> 
>> <http://trac.cython.org/cython_trac/ticket/177>
>> 
>> / johan
>> 
>> Jean-Francois Moulin skrev:
>>> I tried to use the cdef instead as cpdef as suggested and it still
>>> fails, 
>>> Dag Sverre Seljebotn wrote:
>>>> You need to use "def", not "cpdef", when dealing with array arguments. 
>>>> Sorry, this should have been mentioned in the docs...
>>>>
>>>> Dag Sverre Seljebotn
>>>> -----Original Message-----
>>>> From: Jean-Francois Moulin <[email protected]>
>>>>
>>>>>> cpdef tuple discri_sweep_2D(...
>>>>>>                             np.ndarray[DTYPE_t, ndim=1] tof_histo,
>>>>>>                             np.ndarray[DTYPE_t, ndim=3] slab
>>>>>>                             ):
>> 
>> _______________________________________________
>> Cython-dev mailing list
>> [email protected]
>> http://codespeak.net/mailman/listinfo/cython-dev
>
>_______________________________________________
>Cython-dev mailing list
>[email protected]
>http://codespeak.net/mailman/listinfo/cython-dev
>

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to