Skip to content

Commit 19c7ba6

Browse files
Merge pull request #419 from efaulhaber/patch-1
Fix `fill!(::ArrayPartition)`
2 parents 96abc3e + 9454936 commit 19c7ba6

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ SafeTestsets = "0.1"
6060
SparseArrays = "1.10"
6161
StaticArrays = "1.6"
6262
StaticArraysCore = "1.4"
63-
Statistics = "1.10"
63+
Statistics = "1.10, 1.11"
6464
StructArrays = "0.6.11, 0.7"
6565
SymbolicIndexingInterface = "0.3.25"
6666
Tables = "1.11"

src/array_partition.jl

+7-1
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,19 @@ function Base.copyto!(A::ArrayPartition, src::ArrayPartition)
209209
A
210210
end
211211

212+
function Base.fill!(A::ArrayPartition, x)
213+
unrolled_foreach!(A.x) do x_
214+
fill!(x_, x)
215+
end
216+
A
217+
end
218+
212219
function recursivefill!(b::ArrayPartition, a::T2) where {T2 <: Union{Number, Bool}}
213220
unrolled_foreach!(b.x) do x
214221
fill!(x, a)
215222
end
216223
end
217224

218-
219225
## indexing
220226

221227
# Interface for the linear indexing. This is just a view of the underlying nested structure

test/gpu/arraypartition_gpu.jl

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ mask = pA .> 0
1414
# Test recursive filling is done using GPU kernels and not scalar indexing
1515
RecursiveArrayTools.recursivefill!(pA, true)
1616
@test all(pA .== true)
17+
18+
# Test that regular filling is done using GPU kernels and not scalar indexing
19+
fill!(pA, false)
20+
@test all(pA .== false)

0 commit comments

Comments
 (0)