Skip to content

Commit d846291

Browse files
Merge pull request #183 from ma-sadeghi/fix-mask-indexing
Fix boolean mask indexing
2 parents 04d35cf + d1e033d commit d846291

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/vector_of_array.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Base.@propagate_inbounds function Base.getindex(A::AbstractVectorOfArray{T, N},
7878
@assert length(J) == ndims(A.u[1])+1-ndims(I)
7979
@assert size(I) == size(A)[1:ndims(A)-length(J)]
8080
vecs = vec.(A.u)
81-
return Adapt.adapt(__parameterless_type(T),reshape(reduce(hcat,vecs[I]),size(A.u[1])...,length(A.u)))
81+
return A[repeat([:], length(size(A)))...][I,J...]
8282
end
8383

8484
Base.@propagate_inbounds Base.getindex(A::AbstractDiffEqArray{T, N}, i::Int,::Colon) where {T, N} = [A.u[j][i] for j in 1:length(A)]

test/gpu/vectorofarray_gpu.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ x[m, :]
1818

1919
va = VectorOfArray([slice for slice in eachslice(x, dims=3)])
2020
@test va[m, :] x[m, :]
21-
va[m, :]
2221

2322
xc = Array(x)
2423
mc = Array(m)
25-
xc[mc, :]
26-
24+
@test xc[mc, :] Array(va[m, :])

0 commit comments

Comments
 (0)