@@ -29,6 +29,7 @@ returns a vector of the series for each component, that is, `A[i,:]` for each `i
2929A plot recipe is provided, which plots the `A[i,:]` series.
3030
3131There is also support for `VectorOfArray` constructed from multi-dimensional arrays
32+
3233```julia
3334VectorOfArray(u::AbstractArray{AT}) where {T, N, AT <: AbstractArray{T, N}}
3435```
@@ -351,48 +352,53 @@ Base.@propagate_inbounds function _getindex(A::AbstractDiffEqArray, ::NotSymboli
351352end
352353
353354struct ParameterIndexingError <: Exception
354- sym
355+ sym:: Any
355356end
356357
357358function Base. showerror (io:: IO , pie:: ParameterIndexingError )
358- print (io, " Indexing with parameters is deprecated. Use `getp(A, $(pie. sym) )` for parameter indexing." )
359+ print (io,
360+ " Indexing with parameters is deprecated. Use `getp(A, $(pie. sym) )` for parameter indexing." )
359361end
360362
361363# Symbolic Indexing Methods
362364for (symtype, elsymtype, valtype, errcheck) in [
363- (ScalarSymbolic, SymbolicIndexingInterface. SymbolicTypeTrait, Any, :(is_parameter (A, sym))),
364- (ArraySymbolic, SymbolicIndexingInterface. SymbolicTypeTrait, Any, :(is_parameter (A, sym))),
365- (NotSymbolic, SymbolicIndexingInterface. SymbolicTypeTrait, Union{<: Tuple , <: AbstractArray },
366- :(all (x -> is_parameter (A, x), sym))),
365+ (ScalarSymbolic, SymbolicIndexingInterface. SymbolicTypeTrait,
366+ Any, :(is_parameter (A, sym))),
367+ (ArraySymbolic, SymbolicIndexingInterface. SymbolicTypeTrait,
368+ Any, :(is_parameter (A, sym))),
369+ (NotSymbolic, SymbolicIndexingInterface. SymbolicTypeTrait,
370+ Union{<: Tuple , <: AbstractArray },
371+ :(all (x -> is_parameter (A, x), sym)))
367372]
368- @eval Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: $symtype ,
369- :: $elsymtype , sym:: $valtype )
370- if $ errcheck
371- throw (ParameterIndexingError (sym))
373+ @eval Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: $symtype ,
374+ :: $elsymtype , sym:: $valtype )
375+ if $ errcheck
376+ throw (ParameterIndexingError (sym))
377+ end
378+ getu (A, sym)(A)
372379 end
373- getu (A, sym)(A)
374- end
375- @eval Base . @propagate_inbounds function _getindex (A :: AbstractDiffEqArray , :: $symtype ,
376- :: $elsymtype , sym :: $valtype , arg )
377- if $ errcheck
378- throw ( ParameterIndexingError ( sym))
380+ @eval Base . @propagate_inbounds function _getindex (A :: AbstractDiffEqArray , :: $symtype ,
381+ :: $elsymtype , sym :: $valtype , arg)
382+ if $ errcheck
383+ throw ( ParameterIndexingError (sym) )
384+ end
385+ getu (A, sym)(A, arg )
379386 end
380- getu (A, sym)(A, arg)
381- end
382- @eval Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: $symtype ,
383- :: $elsymtype , sym:: $valtype , arg:: Union{AbstractArray{Int}, AbstractArray{Bool}} )
384- if $ errcheck
385- throw (ParameterIndexingError (sym))
387+ @eval Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: $symtype ,
388+ :: $elsymtype , sym:: $valtype , arg:: Union {
389+ AbstractArray{Int}, AbstractArray{Bool}})
390+ if $ errcheck
391+ throw (ParameterIndexingError (sym))
392+ end
393+ getu (A, sym).((A,), arg)
386394 end
387- getu (A, sym).((A,), arg)
388- end
389- @eval Base . @propagate_inbounds function _getindex (A :: AbstractDiffEqArray , :: $symtype ,
390- :: $elsymtype , sym :: $valtype , :: Colon )
391- if $ errcheck
392- throw ( ParameterIndexingError ( sym))
395+ @eval Base . @propagate_inbounds function _getindex (A :: AbstractDiffEqArray , :: $symtype ,
396+ :: $elsymtype , sym :: $valtype , :: Colon )
397+ if $ errcheck
398+ throw ( ParameterIndexingError (sym) )
399+ end
400+ getu (A, sym)(A )
393401 end
394- getu (A, sym)(A)
395- end
396402end
397403
398404Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: ScalarSymbolic ,
@@ -410,8 +416,9 @@ Base.@propagate_inbounds function Base.getindex(A::AbstractVectorOfArray, _arg,
410416 elsymtype = symbolic_type (eltype (_arg))
411417
412418 if symtype == NotSymbolic () && elsymtype == NotSymbolic ()
413- if _arg isa Union{Tuple, AbstractArray} && any (x -> symbolic_type (x) != NotSymbolic (), _arg)
414- _getindex (A, symtype, elsymtype, _arg, args... )
419+ if _arg isa Union{Tuple, AbstractArray} &&
420+ any (x -> symbolic_type (x) != NotSymbolic (), _arg)
421+ _getindex (A, symtype, elsymtype, _arg, args... )
415422 else
416423 _getindex (A, symtype, _arg, args... )
417424 end
@@ -727,7 +734,6 @@ function Base.similar(vec::VectorOfArray{
727734 return Base. similar (vec, eltype (vec))
728735end
729736
730-
731737# fill!
732738# For DiffEqArray it ignores ts and fills only u
733739function Base. fill! (VA:: AbstractVectorOfArray , x)
0 commit comments