EconForge / interpolation.py

BSD 2-Clause "Simplified" License
124 stars 35 forks source link

ENH: add computation of derivatives to smolyak. #11

Closed albop closed 8 years ago

albop commented 8 years ago

Let's denote the smolyak grid by s, the values on this grid by x, and by T(s,x)(p) the values interpolated on points p. Currently, we can compute the derivative of p->T(s,x)(p). It would be nice to compute also the derivatives of x->T(s,x)(p). The convention should actually be independent from the interpolation method. In the particular case of smolyak, refering to the coefficients by c, it would be useful too to compute derivatives of c->T(s,c)(p).

albop commented 8 years ago

@cc7768 , @spencerlyon2 , I plan to work on that during this week. Do you have any thoughts about it ?

sglyon commented 8 years ago

Hey @albop when we worked on this a few years ago I believe we implemented the same derivative methods you had at the time for smolyak in dolo.

I don't have any additional comments on how this should be done. One thing I'd like to do with that whole code is move performance critical parts to numba, but that's another issue.

albop commented 8 years ago

@spencerlyon2 : indeed, there seem to be everything needed for that.

I can't make sense of the ordering of the derivative matrices though. The ordering seems a bit random and I can't see whether it is chosen for performance reasons or because it is mathematically natural. It would be useful to think carefully about that, because, the same problem will come back when we want to do the same experiment with general chebychev or splines.

Another small regression is the lack of support for vector valued functions. Again, in this case, we would like to define correctly the ordering of the relevant matrices.

sglyon commented 8 years ago

I remember trying to follow what dolo.smolyak was doing, but also finding it a bit unintuitive. I'm happy to reorder the derivative matrices in whatever way seems best.

albop commented 8 years ago

Yes, I plead guilty on that one. Also the ordering was setup up at a stage where the points where listed column by column instead of line-by-line as they are now. I will do a new proposition shortly.