JuliaMath / FastChebInterp.jl

fast multidimensional Chebyshev interpolation and regression in Julia
MIT License
58 stars 6 forks source link

add chainrules #9

Closed stevengj closed 2 years ago

stevengj commented 2 years ago

Fixes #8, adding both a forward frule and a reverse rrule for ChebPoly evaluation.

Note that for the rrule, we don't yet support propagating derivatives through to changes in the ChebPoly object itself. It seems like this would involve allocating huge Tangent objects for something that is rarely needed, so I marked it as @notimplemented instead. (@gaurav-arya, do you know a way to do this only when it is desired?)

Nor do we yet have rules for differentiating the ChebPoly constructor functions (e.g. if you want to compute sensitivity of the polynomial outputs to the data used to construct the polynomial). In principle, this should be straightforward since the polynomial construction is linear in the data.

stevengj commented 2 years ago

Oh, it looks like if we want to support backpropagation through the polynomial coefficients then we should use a "thunk" tangent to defer computation to the time when it is actually needed.