Skip to content
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

Inplace GriddedInterpolation is not available #495

Closed
jaemolihm opened this issue Jun 23, 2022 · 0 comments · Fixed by #496
Closed

Inplace GriddedInterpolation is not available #495

jaemolihm opened this issue Jun 23, 2022 · 0 comments · Fixed by #496

Comments

@jaemolihm
Copy link
Contributor

jaemolihm commented Jun 23, 2022

For B-splines, in-place interpolation is possible. But for GriddedInterpolation, it is not.

My motivation for doing that is to make the coefs a view of a larger array which will be dynamically updated. I could copy the values from the large array to itp.coefs every time, but this is unnecessary if the in-place gridded interpolation is possible.

x = 1:4
y_large = [2, 4, 6, 8, 10]
y = view(y_large, 1:4)
f1 = interpolate!(y, BSpline(Linear()))
f2 = interpolate((x,), y, Gridded(Linear()))
# f2 = interpolate!((x,), y, Gridded(Linear())) # Does not work
@show f1(2.5), f2(2.5) # 5.0, 5.0

y_large .= 0
@show f1(2.5), f2(2.5) # 0.0, 5.0
@jaemolihm jaemolihm changed the title Inplace GriddedInterpolation Inplace GriddedInterpolation is not available Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant