@@ -59,6 +59,13 @@ Base.@propagate_inbounds Base.getindex(VA::AbstractVectorOfArray{T, N}, I::Colon
5959Base. @propagate_inbounds Base. getindex (VA:: AbstractDiffEqArray{T, N} , I:: Colon ) where {T, N} = VA. u[I]
6060Base. @propagate_inbounds Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: AbstractArray{Int} ) where {T, N} = VectorOfArray (VA. u[I])
6161Base. @propagate_inbounds Base. getindex (VA:: AbstractDiffEqArray{T, N} , I:: AbstractArray{Int} ) where {T, N} = DiffEqArray (VA. u[I],VA. t[I])
62+ Base. @propagate_inbounds function Base. getindex (A:: AbstractDiffEqArray{T, N} ,
63+ I:: Union{Int,AbstractArray{Int},CartesianIndex,Colon,BitArray,AbstractArray{Bool}} ...) where {T, N}
64+ RecursiveArrayTools. VectorOfArray (A. u)[I... ]
65+ end
66+ 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)]
67+ Base. @propagate_inbounds Base. getindex (A:: AbstractDiffEqArray{T, N} , :: Colon ,i:: Int ) where {T, N} = A. u[i]
68+ Base. @propagate_inbounds Base. getindex (A:: AbstractDiffEqArray{T, N} , i:: Int ,II:: AbstractArray{Int} ) where {T, N} = [A. u[j][i] for j in II]
6269Base. @propagate_inbounds function Base. getindex (A:: AbstractDiffEqArray{T, N} ,sym) where {T, N}
6370 if issymbollike (sym) && A. syms != = nothing
6471 i = findfirst (isequal (Symbol (sym)),A. syms)
@@ -76,6 +83,23 @@ Base.@propagate_inbounds function Base.getindex(A::AbstractDiffEqArray{T, N},sym
7683 Base. getindex .(A. u, i)
7784 end
7885end
86+ Base. @propagate_inbounds function Base. getindex (A:: AbstractDiffEqArray{T, N} ,sym,args... ) where {T, N}
87+ if issymbollike (sym) && A. syms != = nothing
88+ i = findfirst (isequal (Symbol (sym)),A. syms)
89+ else
90+ i = sym
91+ end
92+
93+ if i === nothing
94+ if issymbollike (i) && A. indepsym != = nothing && Symbol (i) == A. indepsym
95+ A. t[args... ]
96+ else
97+ observed (A,sym,args... )
98+ end
99+ else
100+ Base. getindex .(A. u, i, args... )
101+ end
102+ end
79103Base. @propagate_inbounds Base. getindex (A:: AbstractDiffEqArray{T, N} , I:: Int... ) where {T, N} = A. u[I[end ]][Base. front (I)... ]
80104Base. @propagate_inbounds Base. getindex (A:: AbstractDiffEqArray{T, N} , i:: Int ) where {T, N} = A. u[i]
81105function observed (A:: AbstractDiffEqArray{T, N} ,sym,i:: Int ) where {T, N}
0 commit comments