Skip to content

Commit 309f613

Browse files
authored
Fix need_batch for cartesianindex arguments (#166)
1 parent c926307 commit 309f613

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/diskarray.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ _need_batch(_, ::Tuple{}, _) = false
6363

6464
need_batch_index(::Union{Integer,UnitRange,Colon}, cs, _) = false, Base.tail(cs)
6565
need_batch_index(i::CartesianIndices{N}, cs, _) where N = false, last(splitcs(i, cs))
66+
need_batch_index(i::CartesianIndex{N}, cs, _) where N = false, last(splitcs(i,cs))
6667
need_batch_index(::StepRange, cs, ::ChunkStrategy{CanStepRange}) = false, Base.tail(cs)
6768
function need_batch_index(i, cs, batchstrat)
6869
csnow, csrem = splitcs(i, cs)
@@ -159,6 +160,7 @@ end
159160
splitcs(i::AbstractArray{<:CartesianIndex}, cs) = splitcs(first(i).I, (), cs)
160161
splitcs(i::AbstractArray{Bool}, cs) = splitcs(size(i), (), cs)
161162
splitcs(i::CartesianIndices, cs) = splitcs(i.indices, (), cs)
163+
splitcs(i::CartesianIndex, cs) = splitcs(i.I,(),cs)
162164
splitcs(_, cs) = (first(cs),), Base.tail(cs)
163165
splitcs(si, csnow, csrem) = splitcs(Base.tail(si), (csnow..., first(csrem)), Base.tail(csrem))
164166
splitcs(::Tuple{}, csnow, csrem) = (csnow, csrem)

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ function test_setindex(a)
9393
a[[2, 4], 1:2, 1] = [1 2; 5 6]
9494
@test trueparent(a)[[2, 4], 1:2, 1] == [1 2; 5 6]
9595
@test setindex_count(a) == 8
96+
a[CartesianIndex(1,1,1)] = -10
97+
@test trueparent(a)[1,1,1] == -10
9698
end
9799

98100
function test_view(a)

0 commit comments

Comments
 (0)