Skip to content

Commit 600a9b5

Browse files
Merge pull request #408 from SciML/voa_indexing
Simplify VectorOfArray indexing
2 parents b7de81e + c207bc0 commit 600a9b5

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RecursiveArrayTools"
22
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
33
authors = ["Chris Rackauckas <accounts@chrisrackauckas.com>"]
4-
version = "3.27.1"
4+
version = "3.27.2"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/vector_of_array.jl

-25
Original file line numberDiff line numberDiff line change
@@ -321,32 +321,7 @@ end
321321
@deprecate Base.getindex(A::AbstractDiffEqArray, i::Int) Base.getindex(A, :, i) false
322322

323323
__parameterless_type(T) = Base.typename(T).wrapper
324-
Base.@propagate_inbounds function _getindex(A::AbstractVectorOfArray{T, N},
325-
::NotSymbolic, I::Colon...) where {T, N}
326-
@assert length(I) == ndims(A.u[1]) + 1
327-
vecs = if N == 1
328-
A.u
329-
else
330-
vec.(A.u)
331-
end
332-
return Adapt.adapt(__parameterless_type(T),
333-
reshape(reduce(hcat, vecs), size(A.u[1])..., length(A.u)))
334-
end
335-
Base.@propagate_inbounds function _getindex(A::AbstractVectorOfArray{T, N},
336-
::NotSymbolic, I::Colon...) where {T <: Number, N}
337-
@assert length(I) == ndims(A.u)
338-
return A.u[I...]
339-
end
340-
341-
Base.@propagate_inbounds function _getindex(A::AbstractVectorOfArray{T, N},
342-
::NotSymbolic, I::AbstractArray{Bool},
343-
J::Colon...) where {T, N}
344-
@assert length(J) == ndims(A.u[1]) + 1 - ndims(I)
345-
@assert size(I) == size(A)[1:(ndims(A) - length(J))]
346-
return A[ntuple(x -> Colon(), ndims(A))...][I, J...]
347-
end
348324

349-
# Need two of each methods to avoid ambiguities
350325
Base.@propagate_inbounds function _getindex(
351326
A::AbstractVectorOfArray, ::NotSymbolic, ::Colon, I::Int)
352327
A.u[I]

0 commit comments

Comments
 (0)