Skip to content

Commit a6d4a32

Browse files
committed
Merge pull request #76 from tlycken/teh/splat_si
Avoid splatting penalty for getindex(::ScaledInterpolation, xs...)
2 parents 2ba7253 + 9452d1b commit a6d4a32

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/scaling/scaling.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For every `NoInterp` dimension of the interpolation object, the range must be ex
1616
function scale{T,N,IT,GT}(itp::AbstractInterpolation{T,N,IT,GT}, ranges::Range...)
1717
length(ranges) == N || throw(ArgumentError("Must scale $N-dimensional interpolation object with exactly $N ranges (you used $(length(ranges)))"))
1818
for d in 1:N
19-
if iextract(IT,d) != NoInterp
19+
if iextract(IT,d) != NoInterp
2020
length(ranges[d]) == size(itp,d) || throw(ArgumentError("The length of the range in dimension $d ($(length(ranges[d]))) did not equal the size of the interpolation object in that direction ($(size(itp,d)))"))
2121
elseif ranges[d] != 1:size(itp,d)
2222
throw(ArgumentError("NoInterp dimension $d must be scaled with unit range 1:$(size(itp,d))"))
@@ -31,7 +31,7 @@ end
3131
interp_types = length(IT.parameters) == N ? IT.parameters : tuple([IT.parameters[1] for _ in 1:N]...)
3232
interp_dimens = map(it -> interp_types[it] != NoInterp, 1:N)
3333
interp_indices = map(i -> interp_dimens[i] ? :(coordlookup(sitp.ranges[$i], xs[$i])) : :(xs[$i]), 1:N)
34-
return :(getindex(sitp.itp, $(interp_indices...)))
34+
return :($(Expr(:meta,:inline)); getindex(sitp.itp, $(interp_indices...)))
3535
end
3636

3737
getindex{T}(sitp::ScaledInterpolation{T,1}, x::Number, y::Int) = y == 1 ? sitp[x] : throw(BoundsError())

0 commit comments

Comments
 (0)