ConstantInterpolation Extrapolation#387
Closed
SouthEndMusic wants to merge 2 commits intoSciML:masterfrom
Closed
Conversation
Member
|
Add a test for this case? |
Contributor
|
Yeah, it probably makes sense to close the issue, I forgot to use the magic keywords in the PR. Regarding this PR, the only issue I see is that this is consistent with the first / last open interval, but not with evaluation at the edge point, right? Currently, evaluation of a julia> using DataInterpolations
julia> u = [2, 3];
julia> t = [0.0, 1.0];
julia> ConstantInterpolation(u, t; dir=:left)(t)
2-element Vector{Float64}:
2.0
3.0
julia> ConstantInterpolation(u, t; dir=:right)(t)
2-element Vector{Float64}:
2.0
3.0Incidentally I just realized there seems to be another julia> ConstantInterpolation(u, t; dir=:right)(t)
2-element Vector{Float64}:
2.0
3.0
julia> ConstantInterpolation(u, t; dir=:right).(t)
2-element Vector{Int64}:
2
3 |
Member
Author
|
@DaniGlez Thanks for pointing out that boundary evaluation behaviour, I made a wrong assumption about it. Then this PR doesn't make sense. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #378
I started working on this but then I found out this was already fxed by @DaniGlez in #379, but the issue wasn't closed. I did some nitpicking taking into account the
dirof theConstantInterpolationand the edgecase that there is only 1 datapoint.On a more general note, I see that we use
firstandlasta lot (also in this PR) which only works properly ifuis a vector (or at least indexed as such). We also have specialized methods for vector versus matrixu. To ensure consistency and avoid code duplication, should we define custom indexing functions based on the type ofu?