-
-
Notifications
You must be signed in to change notification settings - Fork 52
Ensure that the interpolation domain is sorted #421
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
Conversation
Sorry, got the function wrong 😅 |
hmm, It looks like |
We have 3 arguments here and the 3rd one has to be sorted instead of the second.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I remember being somewhat surprised that we didn't validate for the ordering of t
before. I left a few comments.
src/interpolation_utils.jl
Outdated
if Tu === eltype(u) && Tt === eltype(t) | ||
if !(issorted(check_sorted) || issorted(check_sorted, rev = true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we support reverse ordering? It wouldn't surprise me if that violates an implicit assumption in certain methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me see if there's actually any test that errors if I remove reverse ordering. Some methods explicitly mention that they need monotonically increasing values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
842f606 changes to just monotonically increasing, nothing seems to be using reverse ordering and as you mention it likely is wrong. Is that would be needed in the future, we can add another flag to the function for that.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
A frequent user error is forgetting the correct argument error. This results in silently wrong results or extrapolation errors. I think that we can surface this error earlier to avoid further confusion. Let me know what you think about this.