@@ -39,13 +39,26 @@ DiffEqArray(vec::AbstractVector{VT},ts::AbstractVector) where {T, N, VT<:Abstrac
3939@inline Base. getindex (VA:: AbstractVectorOfArray{T, N} , I:: AbstractArray{Int} ) where {T, N} = VectorOfArray (VA. u[I])
4040@inline Base. getindex (VA:: AbstractDiffEqArray{T, N} , I:: AbstractArray{Int} ) where {T, N} = DiffEqArray (VA. u[I],VA. t[I])
4141@inline 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
4248@inline Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: Int ) where {T, N} = VA. u[I] = v
4349@inline Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: Colon ) where {T, N} = VA. u[I] = v
4450@inline Base. setindex! (VA:: AbstractVectorOfArray{T, N} , v, I:: AbstractArray{Int} ) where {T, N} = VA. u[I] = v
4551@inline 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
0 commit comments