Skip to content

Commit 62dd04b

Browse files
authored
Merge pull request #179 from JuliaMath/teh/fix_178
Fix computation of element type (fixes #178)
2 parents 1201501 + b10a8c8 commit 62dd04b

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/b-splines/indexing.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ function getindex_return_type(::Type{BSplineInterpolation{T,N,TCoefs,IT,GT,Pad}}
9494
_promote_mul(eltype(TCoefs), I)
9595
end
9696

97-
@noinline function getindex_return_type(::Type{Tel}, ::Type{BSplineInterpolation{T,N,TCoefs,IT,GT,Pad}}, argtypes::Tuple) where {Tel,T,N,TCoefs,IT<:DimSpec{BSpline},GT<:DimSpec{GridType},Pad}
98-
reduce(_promote_mul, eltype(TCoefs), (Tel, argtypes...))
99-
end
100-
10197
@generated function gradient!(g::AbstractVector, itp::BSplineInterpolation{T,N}, xs::Number...) where {T,N}
10298
length(xs) == N || error("Can only be called with $N indexes")
10399
gradient_impl(itp)

src/extrapolation/filled.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function getindex_impl(fitp::Type{FilledExtrapolation{T,N,ITP,IT,GT,FT}}, args)
2121
n = length(args)
2222
n == N || return error("Must index $(N)-dimensional interpolation objects with $(nindexes(N))")
2323

24-
Tret = FT<:Number ? getindex_return_type(T, ITP, args) : FT
24+
Tret = FT<:Number ? getindex_return_type(ITP, (T, args...)) : FT
2525
meta = Expr(:meta, :inline)
2626
quote
2727
$meta

test/extrapolation/runtests.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ etp100g = extrapolate(interpolate(([10;20],),[100;110], Gridded(Linear())), Flat
8181
@test @inferred(getindex(etp100g, 5)) == 100
8282
@test @inferred(getindex(etp100g, 15)) == 105
8383
@test @inferred(getindex(etp100g, 25)) == 110
84-
84+
# issue #178
85+
a = randn(10,10) + im*rand(10,10)
86+
etp = @inferred(extrapolate(interpolate((1:10, 1:10), a, Gridded(Linear())), 0.0))
87+
@test @inferred(etp[-1,0]) === 0.0+0.0im
8588

8689
# check all extrapolations work with vectorized indexing
8790
for E in [0,Flat(),Linear(),Periodic(),Reflect()]

0 commit comments

Comments
 (0)