[SciPy-user] Speed differences in sqrt calculation: what is good to know

David Cournapeau david@ar.media.kyoto-u.ac...
Thu Jun 12 22:23:00 CDT 2008


Lubos Vrbka wrote:
> hi,
>
> slightly off-topic, but still regarding the speed differences... what's 
> the difference between the following 2 functions?
>
> numpy.linalg.solve
> scipy.linalg.solve
>
> the first is almost 2 times faster on the same data (4096 repetitions of 
> a A*a = b problem with A = 2x2 float32 matrix) - typically 0.30 vs. 0.57 
> sec for the whole operation...
>   

I think you will find a lot of those differences with very small data. I 
would not even be surprised if it was faster to do the inversion in 
python. Using numpy and scipy for those kind of data just do not make 
much sense. I am sure you will have exactly the same problem in matlab, 
albeit in a less significant way, because recent matlab engines have JIT 
(and a much simpler language, which certainly helps here).

Difference in functionalities between numpy and scipy are much more 
bothering to me (sqrt(-1) giving a different answer for numpy and scipy, 
for example).

cheers,

David


More information about the SciPy-user mailing list