[SciPy-user] Correlate Times?
Travis E. Oliphant
Thu Jan 17 23:02:29 CST 2008
Ryan May wrote:
> Can someone explain this to me?
> In : import scipy as S
> In : import scipy.signal as SS
> In : from numpy.random import rand
> In : up = rand(18000)
> In : %timeit N.correlate(up,up,mode='full')
> 10 loops, best of 3: 829 ms per loop
> In : %timeit S.correlate(up,up,mode='full')
> 10 loops, best of 3: 827 ms per loop
> In : %timeit SS.correlate(up,up,mode='full')
> 10 loops, best of 3: 11.5 s per loop
> Is this a configuration problem? If not, why does
> scipy.signal.correlate even exist?
scipy.signal.correlate is a N-d correlation algorithm as has been
noted. It is going to be slower for 1-d arrays. Now, there is nothing
wrong with checking for that case and calling the 1-d version, it's just
never been done (probably because people who only need 1-d correlation
are already just using numpy.correlate).
ndimage also has N-d correlation inside it which was created much
later. I think it is currently faster (but with different arguments
that I don't fully understand so, I'm not sure what command would be
Try scipy.ndimage.correlate and see how fast it is.
This is part of the kind of clean-up that SciPy really needs.
More information about the SciPy-user