Skip to content

Conversation

@mateuszbaran
Copy link
Contributor

I've encountered some round-off errors, so I think it would be a good idea to support extrapolations for monotonic interpolations.

@codecov-io
Copy link

codecov-io commented Oct 2, 2018

Codecov Report

Merging #250 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #250   +/-   ##
=======================================
  Coverage   98.97%   98.97%           
=======================================
  Files          19       19           
  Lines         488      488           
=======================================
  Hits          483      483           
  Misses          5        5
Impacted Files Coverage Δ
src/monotonic/monotonic.jl 97.22% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07b386c...f25c5f6. Read the comment docs.

@timholy
Copy link
Member

timholy commented Oct 2, 2018

Out of curiosity, can you show some of the bounds errors you were getting?

@mateuszbaran
Copy link
Contributor Author

They are caused by my not published yet library. They are actually irrelevant to this pull request, sorry for bringing it up here.

@timholy timholy merged commit 40274ac into JuliaMath:master Oct 3, 2018
@timholy
Copy link
Member

timholy commented Oct 3, 2018

I was just curious if it was end-points, somewhat reminiscent of #244 where the problem was triggered by the difference between 8.3 and nextfloat(8.3). If that's the case then we might want to see if there's another approach that doesn't force the user to use an extrapolation type rather than interpolation type.

Thanks for doing this! I'm tagging a new release now.

@mateuszbaran
Copy link
Contributor Author

mateuszbaran commented Oct 3, 2018

I'm not sure now what the original problem was but working further I have a somewhat similar problem:

julia> it1 = interpolate(0.0:0.1:1.0, Array(0.0:0.1:1.0).^2, FritschButlandMonotonicInterpolation())

11-element interpolate(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Array{Float64,1}, FritschButlandMonotonicInterpolation()) with element type Float64:
   0.9999999999999999
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef
julia> it1r = interpolate([it1(t) for t in 0.0:0.1:1.0], 0.0:0.1:1.0, FritschButlandMonotonicInterpolation())
11-element interpolate(::Array{Float64,1}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, FritschButlandMonotonicInterpolation()) with element type
 Float64:
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef
 #undef

julia> it1r(1.0)
ERROR: BoundsError: attempt to access 11-element interpolate(::Array{Float64,1}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, FritschButlandMonotonicInterpolation()) with element type Float64 at index [1.0]
Stacktrace:
 [1] throw_boundserror(::Interpolations.MonotonicInterpolation{Float64,Float64,Float64,FritschButlandMonotonicInterpolation,Array{Float64,1},StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}, ::Tuple{Float64}) at ./abstractarray.jl:484
 [2] (::Interpolations.MonotonicInterpolation{Float64,Float64,Float64,FritschButlandMonotonicInterpolation,Array{Float64,1},StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}})(::Float64) at /home/mateusz/.julia/dev/Interpolations/src/monotonic/monotonic.jl:175
 [3] top-level scope at none:0

julia> it1r(prevfloat(1.0))
1.0

I think there are many ways to get such out-of-bounds-by-epsilon errors. I don't know how to solve this problem in a generic way.

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 this pull request may close these issues.

3 participants