-
Notifications
You must be signed in to change notification settings - Fork 113
Closed
Description
Two nearly-equivalent ranges used for scaling produce different behavior:
The one using StepRangeLen works fine.
> using Interpolations
> s= [x^2 for x in 1:5]
> ts = StepRangeLen(0, 0.5, 5)
> itp = interpolate(s, (BSpline(Cubic(Line(OnGrid())))))
> sitp = scale(itp, ts)
5-element scale(interpolate(OffsetArray(::Array{Float64,1}, 0:6), BSpline(Cubic(Line(OnGrid())))), (0.0:0.5:2.0,)) with element type Float64:
0.9999999999999999
4.0
8.999999999999998
15.999999999999998
24.999999999999996 However, using LinRange produces an error
> using Interpolations
> s= [x^2 for x in 1:5]
> ts = LinRange(0, 2.0, 5)
> itp = interpolate(s, (BSpline(Cubic(Line(OnGrid())))))
> sitp = scale(itp, ts)
MethodError: no method matching coordlookup(::LinRange{Float64}, ::Float64)
Closest candidates are:
coordlookup(!Matched::NoInterp, ::Any, !Matched::Any) at /home/danmackinlay/.julia/dev/Interpolations/src/scaling/scaling.jl:88
coordlookup(!Matched::Interpolations.Flag, ::Any, !Matched::Any) at /home/danmackinlay/.julia/dev/Interpolations/src/scaling/scaling.jl:89
coordlookup(!Matched::UnitRange, ::Any) at /home/danmackinlay/.julia/dev/Interpolations/src/scaling/scaling.jl:91
...I wish to avoid StepRangeLen, as it uses TwicePrecision number internally, and these have irritating properties when using ForwardDiff.
Possibly related: #165
This looks fixable; in fact I'm stuck on understanding the test suite which stubbornly refuses to fail for me when I try to insert a test for this, which is probably due to a case of foolishness on my part
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels