Open Micket opened 1 year ago
Looking at some examples at https://juliamath.github.io/Interpolations.jl/stable/control/ i see
a = rand(10) # test data # Nearest-neighbor interpolation itp = interpolate(a, BSpline(Constant())) v = itp(5.4) # returns a[5] # Previous-neighbor interpolation itp = interpolate(a, BSpline(Constant(Previous))) # this fails
because
julia> Constant(Previous) ERROR: MethodError: no method matching (Constant{Nearest})(::Type{Previous}) Closest candidates are: (Constant{T})() where T<:Interpolations.ConstantInterpType at ~/.julia/packages/Interpolations/Sxe87/src/b-splines/constant.jl:41 (Constant{T})(::Periodic{Nothing}) where T<:Interpolations.ConstantInterpType at ~/.julia/packages/Interpolations/Sxe87/src/b-splines/constant.jl:43 (Constant{T})(::BC) where {T<:Interpolations.ConstantInterpType, BC<:Interpolations.BoundaryCondition} at ~/.julia/packages/Interpolations/Sxe87/src/b-splines/constant.jl:42 Stacktrace: [1] Constant(args::Type) @ Interpolations ~/.julia/packages/Interpolations/Sxe87/src/b-splines/constant.jl:40 [2] top-level scope @ REPL[16]:1
As far as I can tell, you are supposed to do
itp = interpolate(a, BSpline(Constant{Previous}()))
Tested on julia 1.8.0 and 1.7.3 with Interpolations v0.14.6
So i think just the documentation is wrong here? https://github.com/JuliaMath/Interpolations.jl/blob/33409a657cacabf877681439605f16431f4bc8f4/docs/src/control.md?plain=1#L18
Looking at some examples at https://juliamath.github.io/Interpolations.jl/stable/control/ i see
because
As far as I can tell, you are supposed to do
Tested on julia 1.8.0 and 1.7.3 with Interpolations v0.14.6
So i think just the documentation is wrong here? https://github.com/JuliaMath/Interpolations.jl/blob/33409a657cacabf877681439605f16431f4bc8f4/docs/src/control.md?plain=1#L18