Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpolation bug when calling without extrapolate #572

Open
henry2004y opened this issue Dec 15, 2023 · 2 comments
Open

Interpolation bug when calling without extrapolate #572

henry2004y opened this issue Dec 15, 2023 · 2 comments

Comments

@henry2004y
Copy link

henry2004y commented Dec 15, 2023

I am using Interpolations.jl v0.14.7 (because another low level package KernelDensity has not updated its compatibility).

julia> using Interpolations

julia> itp0 = interpolate([1, 2, 3, 4], BSpline(Linear()))
4-element interpolate(::Vector{Float64}, BSpline(Linear())) with element type Float64:
Error showing value of type Interpolations.BSplineInterpolation{Float64, 1, Vector{Float64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}}}:
ERROR: BoundsError: attempt to access Tuple{} at index [1]
Stacktrace:
  [1] getindex(t::Tuple, i::Int64)
    @ Base .\tuple.jl:31
  [2] _checklubounds(tf::Bool, ls::Tuple{}, us::Tuple{}, xs::Tuple{Int64})
    @ Interpolations C:\Users\hyzho\.julia\packages\Interpolations\nDwIa\src\Interpolations.jl:420

However the following is fine:

etp = extrapolate(interpolate([1,2,3,4], BSpline(Linear())), Periodic())

I found this while reading the documentation on periodic extrapolation.

@mkitti
Copy link
Collaborator

mkitti commented Dec 15, 2023

julia> using Pkg

julia> Pkg.status()
Status `/private/var/folders/5j/phv_vfc97m967ww98fbvtmfr0000gq/T/jl_NVMMuQ/Project.toml`
⌃ [a98d9a8b] Interpolations v0.14.7
Info Packages marked with ⌃ have new versions available and may be upgradable.

julia> itp0 = interpolate([1,2,3,4], BSpline(Linear()))
4-element interpolate(::Vector{Float64}, BSpline(Linear())) with element type Float64:
 1.0
 2.0
 3.0
 4.0

I cannot reproduce the problem on v0.14.7.

@henry2004y
Copy link
Author

Hmm, that's strange. Maybe it's because I'm running on Julia v1.10.0-rc2?

⌅ [a98d9a8b] Interpolations v0.14.7
julia> versioninfo()
Julia Version 1.10.0-rc2
Commit dbb9c46795 (2023-12-03 15:25 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
  Threads: 1 on 12 virtual cores

julia> using Interpolations

julia> itp0 = interpolate([1, 2, 3, 4], BSpline(Linear()))
4-element interpolate(::Vector{Float64}, BSpline(Linear())) with element type Float64:
Error showing value of type Interpolations.BSplineInterpolation{Float64, 1, Vector{Float64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}}}:
ERROR: BoundsError: attempt to access Tuple{} at index [1]
Stacktrace:
  [1] getindex(t::Tuple, i::Int64)
    @ Base .\tuple.jl:31
  [2] _checklubounds(tf::Bool, ls::Tuple{}, us::Tuple{}, xs::Tuple{Int64})
    @ Interpolations C:\Users\hyzho\.julia\packages\Interpolations\nDwIa\src\Interpolations.jl:420

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

No branches or pull requests

2 participants