Skip to content

Commit 4913d3b

Browse files
authored
Merge pull request #384 from briochemc/master
patch_UniftulVector
2 parents 4f16e8d + 1c3a2d7 commit 4913d3b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/extrapolation/extrapolation.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ count_interp_dims(::Type{<:Extrapolation{T,N,ITPT}}, n) where {T,N,ITPT} = count
5353
end
5454
@inline function (etp::Extrapolation{T,N})(x::Vararg{Union{Number,AbstractVector},N}) where {T,N}
5555
itp = parent(etp)
56-
Tret = typeof(lispyprod(zero(T), x...))
57-
ret = zeros(Tret, shape(x...))
56+
ret = zeros(T, shape(x...))
5857
for (i, y) in zip(eachindex(ret), Iterators.product(x...))
5958
ret[i] = etp(y...)
6059
end

test/extrapolation/type-stability.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,10 @@ using Test, Interpolations, DualNumbers, Unitful
6969
@test @inferred(itp(2018)) === 2.0f0 * u
7070
@test @inferred(etp(2018)) === 2.0f0 * u
7171
@test @inferred(etp(2019)) === 1.0f0 * u
72+
73+
# Unitful vector knots
74+
t = [0.0, 1.0] * u"m"
75+
itp = LinearInterpolation(t, y)
76+
@test itp(0.5u"m") == 1.5f0 * u
77+
@test itp([0.5, 0.75]u"m") == [1.5f0, 1.75f0] * u
7278
end

0 commit comments

Comments
 (0)