Skip to content

Commit d994a14

Browse files
authored
Merge pull request #351 from JuliaMath/teh/axes
Fix eachvalue for offset arrays
2 parents 93d5c8d + 24dc2c5 commit d994a14

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Interpolations"
22
uuid = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
3-
version = "0.12.7"
3+
version = "0.12.8"
44

55
[deps]
66
AxisAlgorithms = "13072b0f-2c55-5437-9ae7-d433b7a33950"

src/scaling/scaling.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ function Base.iterate(iter::ScaledIterator)
210210
item, cistate = ret
211211
wis = getindex.(iter.wis, Tuple(item))
212212
ces = cache_evaluations(iter.sitp.itp.coefs, indexes(wis[1]), weights(wis[1]), Base.tail(wis))
213-
return _reduce(+, weights(wis[1]).*ces), ScaledIterState(cistate, first(iter.breaks1), ces)
213+
return _reduce(+, weights(wis[1]).*ces), ScaledIterState(cistate, firstindex(iter.breaks1), ces)
214214
end
215215

216216
function Base.iterate(iter::ScaledIterator, state)
@@ -227,7 +227,7 @@ function Base.iterate(iter::ScaledIterator, state)
227227
# Re-evaluate. We're being a bit lazy here: in some cases, some of the cached values could be reused
228228
wis = getindex.(iter.wis, Tuple(item))
229229
ces = cache_evaluations(iter.sitp.itp.coefs, indexes(wis[1]), weights(wis[1]), Base.tail(wis))
230-
return _reduce(+, weights(wis[1]).*ces), ScaledIterState(cistate, isnext1 ? state.ibreak+1 : first(iter.breaks1), ces)
230+
return _reduce(+, weights(wis[1]).*ces), ScaledIterState(cistate, isnext1 ? state.ibreak+1 : firstindex(iter.breaks1), ces)
231231
end
232232

233233
_reduce(op, list) = op(list[1], _reduce(op, Base.tail(list)))

test/scaling/scaling.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,10 @@ end
128128
sitp = scale(interpolate(A, BSpline(Cubic(Line(OnGrid())))), 1:3, 1:2)
129129
@test first(eachvalue(sitp)) @SVector [1.,2.]
130130
end
131+
132+
@testset "axes" begin
133+
saxs = -50:10:50
134+
itp = interpolate(-5:5, BSpline(Linear()))
135+
sitp = @inferred(scale(itp, saxs))
136+
@test collect(eachvalue(sitp)) OffsetArray(-5:0.1:5, -50:50)
137+
end

0 commit comments

Comments
 (0)