-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invert interpolation integrals #282
Conversation
Integral inversion POC: using DataInterpolations
using Plots
t = collect(1:5)
u = [1.0, 1.0, 2.0, 4.0, 3.0]
A = LinearInterpolation(u, t)
ts = range(first(t), last(t), length = 100)
Is = DataInterpolations.integral.(Ref(A), ts)
A_intinv = DataInterpolations.invert_integral(A)
ts_ = A_intinv.(Is)
plot(ts, Is, label = "Original integral")
plot!(ts_, Is, label = "Integral inverse") It handles the edge case of the interpolation being constant perfectly 🥳 |
Speed boost when using cached integral values: using DataInterpolations
using BenchmarkTools
using Random
Random.seed!(42)
N = 100
t = cumsum(rand(N))
ddu = rand(N)
du = rand(N)
u = rand(N)
A = QuinticHermiteSpline(ddu, du, u, t)
@btime DataInterpolations.integral(A, last(t))
# old: 1.320 μs (2 allocations: 32 bytes)
# new: 66.395 ns (2 allocations: 32 bytes) |
@sathvikbhagavan how shall I document this new feature? |
Make a new docs page on it with a short tutorial and then the docstrings. And make a list of the methods which are compatible with it on there. |
I'm wondering what to do with the docstrings of the |
Fixes #277
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.