Interpolation and extrapolation for large arrays
问题 I have a large array y defined on a non-uniform, ordered grid x . The length of the array is typically N~2^14 to N~2^18. I want to get a spline-interpolation (or quadratic) of the array. The problem I am facing is that even for lower values of N the interpolation takes very long. import numpy as np from scipy.interpolate import interp1d N = 2 ** 12 # = 4096 x = np.linspace(0, 2*np.pi, N) y = np.sin(x) %time f = interp1d(x, y, 'cubic', ) CPU times: user 8min 5s, sys: 1.39 s, total: 8min 7s