thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

numpy.abs is ~5x slower on complex64 than on complex128 under 32-bit Vista (Trac #2102) #5898

Open numpy-gitbot opened 11 years ago

numpy-gitbot commented 11 years ago

Original ticket http://projects.scipy.org/numpy/ticket/2102 on 2012-04-11 by trac user hgomersall, assigned to unknown.

I experience the following on my Windows Vista 32-bit machine (note the significant slowdown when doing abs() on the complex64 array):

In [95]: a = numpy.random.randn(256,2048) + 1j*numpy.random.randn(256,2048)

In [96]: b = numpy.complex64(a)

In [97]: timeit numpy.abs(a)  # for comparison
10 loops, best of 3: 30 ms per loop

In [98]: timeit numpy.abs(b)  # (slow slow slow)
1 loops, best of 3: 153 ms per loop

In [99]: timeit numpy.sqrt(a*numpy.conj(a))
10 loops, best of 3: 61.9 ms per loop

In [100]: timeit numpy.sqrt(b*numpy.conj(b))
10 loops, best of 3: 27.2 ms per loop

The final 2 lines suggest the problem is in abs() itself.

This bug is consistent and reliable. It is not present on my 64-bit Ubuntu installation.