@@ -60,13 +60,11 @@ A[1, :] # all time periods for f(t)
60
60
A.t
61
61
```
62
62
"""
63
- mutable struct DiffEqArray{T, N, A, B, F, S, D <: Union{Nothing, ParameterTimeseriesCollection} } < :
64
- AbstractDiffEqArray{T, N, A}
63
+ mutable struct DiffEqArray{T, N, A, B, F, S} <: AbstractDiffEqArray{T, N, A}
65
64
u:: A # A <: AbstractVector{<: AbstractArray{T, N - 1}}
66
65
t:: B
67
66
p:: F
68
67
sys:: S
69
- discretes:: D
70
68
end
71
69
# ## Abstract Interface
72
70
struct AllObserved
@@ -176,32 +174,29 @@ function DiffEqArray(vec::AbstractVector{T},
176
174
ts:: AbstractVector ,
177
175
:: NTuple{N, Int} ,
178
176
p = nothing ,
179
- sys = nothing ; discretes = nothing ) where {T, N}
180
- DiffEqArray {eltype(T), N, typeof(vec), typeof(ts), typeof(p), typeof(sys), typeof(discretes) } (vec,
177
+ sys = nothing ) where {T, N}
178
+ DiffEqArray {eltype(T), N, typeof(vec), typeof(ts), typeof(p), typeof(sys)} (vec,
181
179
ts,
182
180
p,
183
- sys,
184
- discretes)
181
+ sys)
185
182
end
186
183
187
184
# ambiguity resolution
188
185
function DiffEqArray (vec:: AbstractVector{VT} ,
189
186
ts:: AbstractVector ,
190
187
:: NTuple{N, Int} ) where {T, N, VT <: AbstractArray{T, N} }
191
- DiffEqArray {eltype(T), N, typeof(vec), typeof(ts), Nothing, Nothing, Nothing } (vec,
188
+ DiffEqArray {eltype(T), N, typeof(vec), typeof(ts), Nothing, Nothing} (vec,
192
189
ts,
193
190
nothing ,
194
- nothing ,
195
191
nothing )
196
192
end
197
193
function DiffEqArray (vec:: AbstractVector{VT} ,
198
194
ts:: AbstractVector ,
199
- :: NTuple{N, Int} , p; discretes = nothing ) where {T, N, VT <: AbstractArray{T, N} }
200
- DiffEqArray {eltype(T), N, typeof(vec), typeof(ts), typeof(p), Nothing, typeof(discretes) } (vec,
195
+ :: NTuple{N, Int} , p) where {T, N, VT <: AbstractArray{T, N} }
196
+ DiffEqArray {eltype(T), N, typeof(vec), typeof(ts), typeof(p), Nothing} (vec,
201
197
ts,
202
198
p,
203
- nothing ,
204
- discretes)
199
+ nothing )
205
200
end
206
201
# Assume that the first element is representative of all other elements
207
202
@@ -211,8 +206,7 @@ function DiffEqArray(vec::AbstractVector,
211
206
sys = nothing ;
212
207
variables = nothing ,
213
208
parameters = nothing ,
214
- independent_variables = nothing ,
215
- discretes = nothing )
209
+ independent_variables = nothing )
216
210
sys = something (sys,
217
211
SymbolCache (something (variables, []),
218
212
something (parameters, []),
@@ -225,13 +219,11 @@ function DiffEqArray(vec::AbstractVector,
225
219
typeof (vec),
226
220
typeof (ts),
227
221
typeof (p),
228
- typeof (sys),
229
- typeof (discretes)
222
+ typeof (sys)
230
223
}(vec,
231
224
ts,
232
225
p,
233
- sys,
234
- discretes)
226
+ sys)
235
227
end
236
228
237
229
function DiffEqArray (vec:: AbstractVector{VT} ,
@@ -240,8 +232,7 @@ function DiffEqArray(vec::AbstractVector{VT},
240
232
sys = nothing ;
241
233
variables = nothing ,
242
234
parameters = nothing ,
243
- independent_variables = nothing ,
244
- discretes = nothing ) where {T, N, VT <: AbstractArray{T, N} }
235
+ independent_variables = nothing ) where {T, N, VT <: AbstractArray{T, N} }
245
236
sys = something (sys,
246
237
SymbolCache (something (variables, []),
247
238
something (parameters, []),
@@ -252,30 +243,18 @@ function DiffEqArray(vec::AbstractVector{VT},
252
243
typeof (vec),
253
244
typeof (ts),
254
245
typeof (p),
255
- typeof (sys),
256
- typeof (discretes),
246
+ typeof (sys)
257
247
}(vec,
258
248
ts,
259
249
p,
260
- sys,
261
- discretes)
250
+ sys)
262
251
end
263
252
264
- has_discretes (:: T ) where {T <: AbstractDiffEqArray } = hasfield (T, :discretes )
265
- get_discretes (x) = getfield (x, :discretes )
266
-
267
253
SymbolicIndexingInterface. is_timeseries (:: Type{<:AbstractVectorOfArray} ) = Timeseries ()
268
- function SymbolicIndexingInterface. is_parameter_timeseries (:: Type {DiffEqArray{T, N, A, B,
269
- F, S, D}}) where {T, N, A, B, F, S, D <: ParameterIndexingProxy }
270
- Timeseries ()
271
- end
272
254
SymbolicIndexingInterface. state_values (A:: AbstractDiffEqArray ) = A. u
273
255
SymbolicIndexingInterface. current_time (A:: AbstractDiffEqArray ) = A. t
274
256
SymbolicIndexingInterface. parameter_values (A:: AbstractDiffEqArray ) = A. p
275
257
SymbolicIndexingInterface. symbolic_container (A:: AbstractDiffEqArray ) = A. sys
276
- function SymbolicIndexingInterface. get_parameter_timeseries_collection (A:: AbstractDiffEqArray )
277
- return get_discretes (A)
278
- end
279
258
280
259
Base. IndexStyle (A:: AbstractVectorOfArray ) = Base. IndexStyle (typeof (A))
281
260
Base. IndexStyle (:: Type{<:AbstractVectorOfArray} ) = IndexCartesian ()
@@ -384,18 +363,39 @@ end
384
363
385
364
# Symbolic Indexing Methods
386
365
for (symtype, elsymtype, valtype, errcheck) in [
387
- (ScalarSymbolic, SymbolicIndexingInterface. SymbolicTypeTrait, Any, :(is_parameter (A, sym) && ! is_timeseries_parameter (A, sym) )),
388
- (ArraySymbolic, SymbolicIndexingInterface. SymbolicTypeTrait, Any, :(is_parameter (A, sym) && ! is_timeseries_parameter (A, sym) )),
366
+ (ScalarSymbolic, SymbolicIndexingInterface. SymbolicTypeTrait, Any, :(is_parameter (A, sym))),
367
+ (ArraySymbolic, SymbolicIndexingInterface. SymbolicTypeTrait, Any, :(is_parameter (A, sym))),
389
368
(NotSymbolic, SymbolicIndexingInterface. SymbolicTypeTrait, Union{<: Tuple , <: AbstractArray },
390
- :(all (x -> is_parameter (A, x) && ! is_timeseries_parameter (A, x) , sym))),
369
+ :(all (x -> is_parameter (A, x), sym))),
391
370
]
392
- @eval Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: $symtype ,
393
- :: $elsymtype , sym:: $valtype , arg... )
394
- if $ errcheck
395
- throw (ParameterIndexingError (sym))
396
- end
397
- getu (A, sym)(A, arg... )
371
+ @eval Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: $symtype ,
372
+ :: $elsymtype , sym:: $valtype )
373
+ if $ errcheck
374
+ throw (ParameterIndexingError (sym))
398
375
end
376
+ getu (A, sym)(A)
377
+ end
378
+ @eval Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: $symtype ,
379
+ :: $elsymtype , sym:: $valtype , arg)
380
+ if $ errcheck
381
+ throw (ParameterIndexingError (sym))
382
+ end
383
+ getu (A, sym)(A, arg)
384
+ end
385
+ @eval Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: $symtype ,
386
+ :: $elsymtype , sym:: $valtype , arg:: Union{AbstractArray{Int}, AbstractArray{Bool}} )
387
+ if $ errcheck
388
+ throw (ParameterIndexingError (sym))
389
+ end
390
+ getu (A, sym).((A,), arg)
391
+ end
392
+ @eval Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: $symtype ,
393
+ :: $elsymtype , sym:: $valtype , :: Colon )
394
+ if $ errcheck
395
+ throw (ParameterIndexingError (sym))
396
+ end
397
+ getu (A, sym)(A)
398
+ end
399
399
end
400
400
401
401
Base. @propagate_inbounds function _getindex (A:: AbstractDiffEqArray , :: ScalarSymbolic ,
0 commit comments