How to call a function that returns a function efficiently

Instead of the QuantEcon interpolation, please try out Interpolations.jl. To do this, first add in the library, and a convenience function (hopefully unnecessary if a recent PR is merged)

using Interpolations
function (itp::Interpolations.GriddedInterpolation{T,N,TCoefs,IT,K,pad})(args...)where {T,N,TCoefs,IT,K,pad}
    itp[args...]
end

Then you should be able to replace the following

With something like

aux_inter = interpolate((f.a_values,), aux_exp, Gridded(Linear()))

Please tell us if there is a performance difference.

1 Like