@@ -34,25 +34,38 @@ DiffEqArray(vec::AbstractVector{VT},ts::AbstractVector) where {T, N, VT<:Abstrac
3434@inline Base. IteratorSize (VA:: AbstractVectorOfArray ) = Base. HasLength ()
3535# Linear indexing will be over the container elements, not the individual elements
3636# unlike an true AbstractArray
37- @inline Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: Int ) where {T, N} = VA. u[I]
38- @inline Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: Colon ) where {T, N} = VA. u[I]
39- @inline Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: AbstractArray{Int} ) where {T, N} = VectorOfArray (VA. u[I])
40- @inline Base. getindex (VA:: AbstractDiffEqArray{T, N} , I:: AbstractArray{Int} ) where {T, N} = DiffEqArray (VA. u[I],VA. t[I])
41- @inline Base. getindex (VA:: AbstractVectorOfArray{T, N} , i:: Int ,:: Colon ) where {T, N} = [VA. u[j][i] for j in 1 : length (VA)]
42- @inline Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: Int ) where {T, N} = VA. u[I] = v
43- @inline Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: Colon ) where {T, N} = VA. u[I] = v
44- @inline Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: AbstractArray{Int} ) where {T, N} = VA. u[I] = v
45- @inline function Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, i:: Int ,:: Colon ) where {T, N}
37+ Base. @propagate_inbounds Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: Int ) where {T, N} = VA. u[I]
38+ Base. @propagate_inbounds Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: Colon ) where {T, N} = VA. u[I]
39+ Base. @propagate_inbounds Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: AbstractArray{Int} ) where {T, N} = VectorOfArray (VA. u[I])
40+ Base. @propagate_inbounds Base. getindex (VA:: AbstractDiffEqArray{T, N} , I:: AbstractArray{Int} ) where {T, N} = DiffEqArray (VA. u[I],VA. t[I])
41+ Base. @propagate_inbounds Base. getindex (VA:: AbstractVectorOfArray{T, N} , i:: Int ,:: Colon ) where {T, N} = [VA. u[j][i] for j in 1 : length (VA)]
42+ Base. @propagate_inbounds function Base. getindex (VA:: AbstractVectorOfArray{T,N} , ii:: CartesianIndex ) where {T, N}
43+ ti = Tuple (ii)
44+ i = first (ti)
45+ jj = CartesianIndex (Base. tail (ti))
46+ return VA. u[i][jj]
47+ end
48+ Base. @propagate_inbounds Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: Int ) where {T, N} = VA. u[I] = v
49+ Base. @propagate_inbounds Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: Colon ) where {T, N} = VA. u[I] = v
50+ Base. @propagate_inbounds Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: AbstractArray{Int} ) where {T, N} = VA. u[I] = v
51+ Base. @propagate_inbounds function Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, i:: Int ,:: Colon ) where {T, N}
4652 for j in 1 : length (VA)
4753 VA. u[j][i] = v[j]
4854 end
55+ return v
56+ end
57+ Base. @propagate_inbounds function Base. setindex! (VA:: AbstractVectorOfArray{T,N} , x, ii:: CartesianIndex ) where {T, N}
58+ ti = Tuple (ii)
59+ i = first (ti)
60+ jj = CartesianIndex (Base. tail (ti))
61+ return VA. u[i][jj] = x
4962end
5063
5164# Interface for the two dimensional indexing, a more standard AbstractArray interface
5265@inline Base. size (VA:: AbstractVectorOfArray ) = (size (VA. u[1 ])... , length (VA. u))
53- @inline Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: Int... ) where {T, N} = VA. u[I[end ]][Base. front (I)... ]
54- @inline Base. getindex (VA:: AbstractVectorOfArray{T, N} , :: Colon , I:: Int ) where {T, N} = VA. u[I]
55- @inline Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: Int... ) where {T, N} = VA. u[I[end ]][Base. front (I)... ] = v
66+ Base . @propagate_inbounds Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: Int... ) where {T, N} = VA. u[I[end ]][Base. front (I)... ]
67+ Base . @propagate_inbounds Base. getindex (VA:: AbstractVectorOfArray{T, N} , :: Colon , I:: Int ) where {T, N} = VA. u[I]
68+ Base . @propagate_inbounds Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: Int... ) where {T, N} = VA. u[I[end ]][Base. front (I)... ] = v
5669
5770# The iterator will be over the subarrays of the container, not the individual elements
5871# unlike an true AbstractArray
0 commit comments