|
321 | 321 | @deprecate Base.getindex(A::AbstractDiffEqArray, i::Int) Base.getindex(A, :, i) false |
322 | 322 |
|
323 | 323 | __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 |
348 | 324 |
|
349 | | -# Need two of each methods to avoid ambiguities |
350 | 325 | Base.@propagate_inbounds function _getindex( |
351 | 326 | A::AbstractVectorOfArray, ::NotSymbolic, ::Colon, I::Int) |
352 | 327 | A.u[I] |
|
0 commit comments