Le 26/11/2010 17:48, Bruce Sherwood a écrit :
> Although this was mentioned earlier, it's worth emphasizing that if
> you need to use functions such as cosine with scalar arguments, you
> should use math.cos(), not numpy.cos(). The numpy versions of these
> functions are optimized for handling array arguments and are much
> slower than the math versions for scalar arguments.


Yes I understand that. I just want to stress that it was not a benchmark 
(nor a critic) but a test to know if it was interesting to translate 
directly an IDL code into python/numpy before trying to optimize it (I 
know more python than IDL). I expected  to have approximatively the same 
speed for both, was surprised by the result, and wanted to know if there 
was an obvious reason besides the unoptimization for scalars.
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to