-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
1-point ConstantInterpolation gets BoundsError with cache_parameters #373
Comments
I think it is fixed on master. julia> ConstantInterpolation([2], [0.0]; extrapolation=DataInterpolations.ExtrapolationType.Constant, cache_parameters = true)
ConstantInterpolation with 1 points, in left direction
┌──────┬─────┐
│ time │ u │
├──────┼─────┤
│ 0.0 │ 2.0 │
└──────┴─────┘ We just need to do a release. @ChrisRackauckas, can you release it? This would be a breaking release as |
Thanks, I should've checked master, just released as v7. Indeed the construction now works regardless of itp = ConstantInterpolation([2], [0.0]; extrapolation=ExtrapolationType.Constant)
itp(1.0)
This worked on v6.6. I get the same error for two datapoints with constant u, |
@SouthEndMusic can you look into this case? |
I looked into it, and the problem comes from derivative calculation here: DataInterpolations.jl/src/derivatives.jl Lines 161 to 163 in f37ff2a
This code makes sure that evaluating the derivative of a constant interpolation in a datapoint yields a I'm unfamiliar with the history how this came to be, but I suggest just returning a derivative of The sad thing is that we don't even need derivative calculations for constant extrapolation numerically, it's only added in the extrapolation code for type stability reasons. P.s.: @visr I was going to say that I was happy that caching was picked up by more users before I saw your name, you don't count 🙃 |
Describe the bug 🐞
A
ConstantInterpolation
works fine for single data points as long as extrapolation is enabled. However it cannot be constructed when usingcache_parameters
.Expected behavior
I expect
cache_parameters
to work just like with the setting turned off.Minimal Reproducible Example 👇
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
versioninfo()
The text was updated successfully, but these errors were encountered: