[SciPy-Dev] replacing integrate.cumtrapz with numpy.trapz

Ralf Gommers ralf.gommers@googlemail....
Sat Jul 17 03:42:47 CDT 2010


integrate.cumtrapz and numpy.trapz do exactly the same thing and the code is
very similar but not identical, as pointed out in
http://projects.scipy.org/scipy/ticket/720. Assuming numpy.trapz is not
going anywhere, can we replace the scipy version with it?

For a small bonus, the numpy version is about 10% faster (tested for several
array shapes):
>>> a = np.arange(1e4).reshape(500, 20)
>>> %timeit np.trapz(a, axis=1)
10000 loops, best of 3: 182 us per loop
>>> %timeit sp.integrate.cumtrapz(a, axis=1)
1000 loops, best of 3: 209 us per loop

Cheers,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20100717/470f9bf8/attachment.html 


More information about the SciPy-Dev mailing list