diff --git a/.travis.yml b/.travis.yml index 477d44dc..d7a41917 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: julia sudo: false julia: - - 0.4 - 0.5 - nightly matrix: diff --git a/REQUIRE b/REQUIRE index e0816f51..6aae19c3 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ -julia 0.4 +julia 0.5 WoodburyMatrices 0.1.5 Ratios diff --git a/src/Interpolations.jl b/src/Interpolations.jl index cf565e8c..bf5d952b 100644 --- a/src/Interpolations.jl +++ b/src/Interpolations.jl @@ -37,7 +37,7 @@ export using Compat using WoodburyMatrices, Ratios, AxisAlgorithms -import Base: convert, size, getindex, gradient, promote_rule, ndims, eltype +import Base: convert, size, getindex, gradient, promote_rule, ndims, eltype, checkbounds # Julia v0.5 compatibility if isdefined(:scaling) import Base.scaling end diff --git a/src/extrapolation/extrapolation.jl b/src/extrapolation/extrapolation.jl index b94d1127..58415dec 100644 --- a/src/extrapolation/extrapolation.jl +++ b/src/extrapolation/extrapolation.jl @@ -54,10 +54,12 @@ function getindex_impl{T,N,ITPT,IT,GT,ET}(etp::Type{Extrapolation{T,N,ITPT,IT,GT end end -@generated function getindex{T,N,ITPT,IT,GT,ET}(etp::Extrapolation{T,N,ITPT,IT,GT,ET}, xs...) +@generated function getindex{T,N,ITPT,IT,GT,ET}(etp::Extrapolation{T,N,ITPT,IT,GT,ET}, xs::Number...) getindex_impl(etp, xs...) end +checkbounds(::AbstractExtrapolation,I...) = nothing + function gradient!_impl{T,N,ITPT,IT,GT,ET}(g, etp::Type{Extrapolation{T,N,ITPT,IT,GT,ET}}, xs...) coords = [Symbol("xs_", d) for d in 1:N] diff --git a/test/extrapolation/runtests.jl b/test/extrapolation/runtests.jl index fd79d893..ae59f7b6 100644 --- a/test/extrapolation/runtests.jl +++ b/test/extrapolation/runtests.jl @@ -79,6 +79,13 @@ etp100g = extrapolate(interpolate(([10;20],),[100;110], Gridded(Linear())), Flat @test @inferred(getindex(etp100g, 5)) == 100 @test @inferred(getindex(etp100g, 15)) == 105 @test @inferred(getindex(etp100g, 25)) == 110 + + +# check all extrapolations work with vectorized indexing +for E in [0,Flat(),Linear(),Periodic(),Reflect()] + @test (@inferred(getindex(extrapolate(interpolate([0,0],BSpline(Linear()),OnGrid()),E),[1.2, 1.8, 3.1]))) == [0,0,0] +end + end include("type-stability.jl")