@@ -136,20 +136,22 @@ times ts (sorted), with values timeseries and derivatives ks
136
136
else
137
137
dt = ts[notsaveat_idxs[i]] - ts[notsaveat_idxs[i- 1 ]]
138
138
Θ = (t- ts[notsaveat_idxs[i- 1 ]])/ dt
139
+
139
140
if idxs == nothing && eltype (timeseries) <: ArrayPartition
140
141
idxs_internal = indices (timeseries[notsaveat_idxs[i- 1 ]])
141
142
elseif idxs == nothing && eltype (timeseries) <: AbstractArray
142
143
idxs_internal = size (timeseries[notsaveat_idxs[i- 1 ]])
143
144
else
144
145
idxs_internal = idxs
145
146
end
146
- if ! id. dense
147
+
148
+ if typeof (cache) <: (DiscreteCache) || typeof (cache) <: DiscreteConstantCache
149
+ vals[j] = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
150
+ elseif ! id. dense
147
151
vals[j] = linear_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],idxs_internal,deriv)
148
152
elseif typeof (cache) <: CompositeCache
149
153
ode_addsteps! (ks[i],ts[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],dt,f,cache. caches[id. alg_choice[notsaveat_idxs[i- 1 ]]]) # update the kcurrent
150
154
vals[j] = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],ks[i],cache. caches[id. alg_choice[notsaveat_idxs[i- 1 ]]],idxs_internal,deriv)
151
- elseif typeof (cache) <: (DiscreteCache) || typeof (cache) <: DiscreteConstantCache
152
- vals[j] = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
153
155
else
154
156
ode_addsteps! (ks[i],ts[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],dt,f,cache) # update the kcurrent
155
157
vals[j] = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],ks[i],cache,idxs_internal,deriv)
@@ -196,7 +198,13 @@ times ts (sorted), with values timeseries and derivatives ks
196
198
else
197
199
idxs_internal = idxs
198
200
end
199
- if ! id. dense
201
+ if typeof (cache) <: (DiscreteCache) || typeof (cache) <: DiscreteConstantCache
202
+ if eltype (timeseries) <: Union{AbstractArray,ArrayPartition}
203
+ ode_interpolant! (vals[j],Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
204
+ else
205
+ vals[j] = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
206
+ end
207
+ elseif ! id. dense
200
208
if eltype (timeseries) <: Union{AbstractArray,ArrayPartition}
201
209
linear_interpolant! (vals[j],Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],idxs_internal,deriv)
202
210
else
@@ -209,12 +217,6 @@ times ts (sorted), with values timeseries and derivatives ks
209
217
else
210
218
vals[j] = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],ks[i],cache. caches[id. alg_choice[notsaveat_idxs[i- 1 ]]],idxs_internal,deriv)
211
219
end
212
- elseif typeof (cache) <: (DiscreteCache) || typeof (cache) <: DiscreteConstantCache
213
- if eltype (timeseries) <: Union{AbstractArray,ArrayPartition}
214
- ode_interpolant! (vals[j],Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
215
- else
216
- vals[j] = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
217
- end
218
220
else
219
221
ode_addsteps! (ks[i],ts[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],dt,f,cache) # update the kcurrent
220
222
if eltype (timeseries) <: Union{AbstractArray,ArrayPartition}
@@ -262,13 +264,13 @@ times ts (sorted), with values timeseries and derivatives ks
262
264
else
263
265
idxs_internal = idxs
264
266
end
265
- if ! id. dense
267
+ if typeof (cache) <: (DiscreteCache) || typeof (cache) <: DiscreteConstantCache
268
+ val = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
269
+ elseif ! id. dense
266
270
val = linear_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],idxs_internal,deriv)
267
271
elseif typeof (cache) <: CompositeCache
268
272
ode_addsteps! (ks[i],ts[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],dt,f,cache. caches[id. alg_choice[notsaveat_idxs[i- 1 ]]]) # update the kcurrent
269
273
val = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],ks[i],cache. caches[id. alg_choice[notsaveat_idxs[i- 1 ]]],idxs_internal,deriv)
270
- elseif typeof (cache) <: (DiscreteCache) || typeof (cache) <: DiscreteConstantCache
271
- val = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
272
274
else
273
275
ode_addsteps! (ks[i],ts[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],dt,f,cache) # update the kcurrent
274
276
val = ode_interpolant (Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],ks[i],cache,idxs_internal,deriv)
@@ -310,13 +312,13 @@ times ts (sorted), with values timeseries and derivatives ks
310
312
else
311
313
idxs_internal = idxs
312
314
end
313
- if ! id. dense
315
+ if typeof (cache) <: (DiscreteCache) || typeof (cache) <: DiscreteConstantCache
316
+ ode_interpolant! (out,Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
317
+ elseif ! id. dense
314
318
linear_interpolant! (out,Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],idxs_internal,deriv)
315
319
elseif typeof (cache) <: CompositeCache
316
320
ode_addsteps! (ks[i],ts[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],dt,f,cache. caches[id. alg_choice[notsaveat_idxs[i- 1 ]]]) # update the kcurrent
317
321
ode_interpolant! (out,Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],ks[i],cache. caches[id. alg_choice[notsaveat_idxs[i- 1 ]]],idxs_internal,deriv)
318
- elseif typeof (cache) <: (DiscreteCache) || typeof (cache) <: DiscreteConstantCache
319
- ode_interpolant! (out,Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],0 ,cache,idxs_internal,deriv)
320
322
else
321
323
ode_addsteps! (ks[i],ts[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],dt,f,cache) # update the kcurrent
322
324
ode_interpolant! (out,Θ,dt,timeseries[notsaveat_idxs[i- 1 ]],timeseries[notsaveat_idxs[i]],ks[i],cache,idxs_internal,deriv)
0 commit comments