[SciPy-Dev] Multilinear interpolation

Pablo Winant pablo.winant at gmail.com
Mon May 6 11:58:34 EDT 2013


Hi Pierre,

Sorry for the late answer, I was travelling.

Yes, I am still willing to propose it for integration into scipy. I 
develop it in another github directory, and have synchronized the "dolo" 
version where I use it and where you can take it in the meantime. It is 
in a subdirectory that is supposed to be completely independent from the 
rest of the library.

Here are some infos about the state of the code:

- So far I have only regular grids, but extension to rectangular grids 
is pending.

- It uses Cython code generated by Tempita templates. There seem to be a 
bug with tempita which makes the implementation messier than it should 
be. I haven't found the time to dig into that bug, and didn't receive 
much echo on that from the tempita developers.

- I don't have extensive benchmarks yet. To interpolate  a grid with 500 
points at 10000 intermediate points, I find my Cython version to be 
around 10 time faster than the original scipy version. I recall it was 
beating Matlab too but I don't have it on my laptop to test.

Best,

Pablo


On 25/04/2013 16:24, Pierre Haessig wrote:
> Hi Pablo,
>
> Le 25/02/2013 13:04, Pablo Winant a écrit :
>> So I made an attempt using tempita in the case of regularly spaced
>> grids. For now, it is in a temporary repository in github:
>>
>> https://github.com/albop/python_interpolation
>>
>> There is a file multilinear_cython.pyx.in which must be interpreted to
>> produce multilinear_cython.pyx . There is also a multilinear.py file
>> containing an object oriented wrapper for the compiled routines.
>>
>> Here is an example:
>>
>> http://nbviewer.ipython.org/urls/raw.github.com/albop/python_interpolation/master/interpolation.ipynb
>>
>> Before, I do the same for irregularly spaced grid, I have some questions:
>> - I included the templates as Python strings in the .pyx.in file . Was
>> there a better way ?
>> - I was not sure about how to deal with single/double precision in the
>> cython code.
> I was just wondering what was the status of your work on a multilinear
> interpolation. I'm currently working on a small stochastic dynamic
> programming code where an interpolator is a key underlying component.
> I've been using scipy.interpolate.RectBivariateSpline so far because I
> was solving only a 2D state-space problem, but for genericity, a N-D
> interpolator is required (although the "curse of dimensionality"
> probably implies N <= 3 !)
>
> By looking at you're Githup repositories, it seems you've integrated the
> interpolation code inhttps://github.com/albop/dolo. Is that indeed the
> case ?
>
> This makes me ask two questions :
>   1) do you plan to integrate it in scipy.interpolate ?
>   2) did you benchmark your code against existing N-D interpolator like
> LinearNDInterpolator ?
>
> best,
> Pierre
>
>
>
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20130506/c3e7c0bd/attachment.html>


More information about the SciPy-Dev mailing list