Skip to content

Instantly share code, notes, and snippets.

@shoyer
Last active September 18, 2019 08:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shoyer/c8bb9e4d689b297a170296426a08aef7 to your computer and use it in GitHub Desktop.
Save shoyer/c8bb9e4d689b297a170296426a08aef7 to your computer and use it in GitHub Desktop.
scipy vs numba interp1d.ipynb
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@teoliphant
Copy link

This is very helpful. Definitely binary-search would be much better for large N. In my case, N was about 10 with most interpolations being done in the first 2-3 and so binary-search didn't really help. But, in general, of course it's much better.

In my use-case, also scipy.interpolate.interp1d doesn't do what I needed for the situation where yvals.shape = (len(xnew), len(xvals)) with both xvals and xnew being 1-d. I needed the output to be 1-d with length the same as xnew. But, the output of scipy.interpolate.interp1d would have shape (yvals.shape[0], len(xnew)) --- i.e. an cross-product instead of a "zip" operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment