[SciPy-user] NumPy vs. SciPy and other speed comparisons
Sebastian Haase
haase@msg.ucsf....
Wed Jun 11 03:50:14 CDT 2008
On Wed, Jun 11, 2008 at 10:39 AM, Gael Varoquaux
<gael.varoquaux@normalesup.org> wrote:
> On Wed, Jun 11, 2008 at 09:15:44AM +0200, Matthieu Brucher wrote:
>> The difference in speed may be only due to the fact that the scipy modle
>> has much more functions than numpy's.
>
> Matthieux does pipoint an interesting point: import time of scipy will be
> much larger than import time of numpy. You could try to run the tests in
> order to get rid of import time, eg by importing once, and running the
> code many times.
>
> However, if I recall correctly, there are other differences in fonctions
> between scipy and numpy. Some functions in scipy do more than the
> corresponding fonctions in numpy. Here is an example:
>
> In [1]: from scipy import sqrt as ssqrt
>
> In [2]: from numpy import sqrt as nsqrt
>
> In [3]: ssqrt(-1)
> Out[3]: 1j
>
> In [4]: nsqrt(-1)
> Out[4]: nan
>
> In [5]: %timeit ssqrt(-1)
> 10000 loops, best of 3: 37.7 µs per loop
>
> In [6]: %timeit nsqrt(-1)
> 100000 loops, best of 3: 6.14 µs per loop
>
> Maybe this is what you are seeing.
>
Not to say that this is scary, that two functions, same name, give
different results ....
But is there a list of these differences ? (Maybe a wiki page, like
ScipyNumpyDifferences !?)
Thanks,
Sebastian Haase
More information about the SciPy-user
mailing list