[SciPy-User] scipy interpolate.interp1d spline slowness

Pauli Virtanen pav@iki...
Thu Dec 13 06:18:19 CST 2012


Wolfgang Kerzendorf <wkerzendorf <at> gmail.com> writes:
> I've just stumbled across a problem with interpolate.interp1d:
> -------------
> import numpy as np
> from scipy import interpolate
> x = arange(1000)
> y =  y = np.random.random_integers(0, 900, 1000)
> 
> %timeit interp = interpolate.interp1d(x, y, kind='cubic')
> 1 loops, best of 3: 3.63 s per loop

This is indeed slow. The problem is probably that the spline fitting
routine splmake() does not make use of the bandedness of the spline
interpolation matrix, and so it is inefficient.

Switching to FITPACK splines could be a better option --- I think the
duplicated (and partial) spline functionality is not very useful.

-- 
Pauli Virtanen



More information about the SciPy-User mailing list