JuliaMath / Interpolations.jl

Fast, continuous interpolation of discrete datasets in Julia
http://juliamath.github.io/Interpolations.jl/
Other
523 stars 110 forks source link

MWEs for `interpolate!` not working #529

Closed fatteneder closed 1 year ago

fatteneder commented 1 year ago

MWE

using Interpolations
x = 1:4
y = view(rand(4), :)
itp = interpolate!((x,), y, Gridded(Linear()))
y .= 0
@show itp(2.5)

Taken from here: https://juliamath.github.io/Interpolations.jl/stable/control/

The above gives

julia> include("mwe.jl")
ERROR: LoadError: MethodError: no method matching interpolate!(::Type{Float64}, ::Type{Float64}, ::Tuple{UnitRange{Int64}}, ::SubArray{Float64, 1, Vector{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}}, true}, ::Gridded{Linear{Throw{OnGrid}}})
Closest candidates are:
  interpolate!(::Type{TWeights}, ::Any, ::IT, ::GT) where {TWeights, IT<:Union{NoInterp, Tuple{Vararg{Union{NoInterp, BSpline}}}, BSpline}, GT<:Union{NoInterp, Tuple{Vararg{Union{NoInterp, Interpolations.GridType}}}, Interpolations.GridType}} at ~/.julia/packages/Interpolations/y4lLj/src/deprecations.jl:25
  interpolate!(::Type{TWeights}, ::AbstractArray, ::IT) where {TWeights, IT<:Union{NoInterp, Tuple{Vararg{Union{NoInterp, BSpline}}}, BSpline}} at ~/.julia/packages/Interpolations/y4lLj/src/b-splines/b-splines.jl:227
  interpolate!(::Type{TWeights}, ::AbstractArray, ::IT, ::Real, ::Int64) where {TWeights, IT<:Union{NoInterp, Tuple{Vararg{Union{NoInterp, BSpline}}}, BSpline}} at ~/.julia/packages/Interpolations/y4lLj/src/b-splines/b-splines.jl:237
  ...
Stacktrace:
 [1] interpolate!(knots::Tuple{UnitRange{Int64}}, A::SubArray{Float64, 1, Vector{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}}, true}, it::Gridded{Linear{Throw{OnGrid}}})
   @ Interpolations ~/.julia/packages/Interpolations/y4lLj/src/gridded/gridded.jl:172
 ...
fatteneder commented 1 year ago

Nevermind, my Interpolations.jl was stuck at v0.13.6. Updating to v0.14.6 fixed it ...