@@ -377,20 +377,20 @@ function set_state!(u::AbstractArray, value::Real, i, ds::DynamicalSystem)
377
377
end
378
378
379
379
"""
380
- set_state!(ds::DynamicalSystem, mapping::Dict )
380
+ set_state!(ds::DynamicalSystem, mapping::AbstractDict )
381
381
382
382
Convenience version of `set_state!` that iteratively calls `set_state!(ds, val, i)`
383
383
for all index-value pairs `(i, val)` in `mapping`. This allows you to
384
384
partially set only some state variables.
385
385
"""
386
- function set_state! (ds:: DynamicalSystem , mapping:: Dict )
386
+ function set_state! (ds:: DynamicalSystem , mapping:: AbstractDict )
387
387
# ensure we use a mutable vector, so same code works for in-place problems
388
388
# (SymbolicIndexingInterface only works with mutable objects)
389
389
um = Array (copy (current_state (ds)))
390
390
set_state! (um, mapping, ds)
391
391
set_state! (ds, um)
392
392
end
393
- function set_state! (um:: Array{<:Real} , mapping:: Dict , ds:: DynamicalSystem )
393
+ function set_state! (um:: Array{<:Real} , mapping:: AbstractDict , ds:: DynamicalSystem )
394
394
for (i, value) in pairs (mapping)
395
395
set_state! (um, value, i, ds)
396
396
end
438
438
Set the parameter values in the [`current_parameters`](@ref)`(ds)` to match those in `p`.
439
439
This is done as an in-place overwrite by looping over the keys of `p`
440
440
hence `p` can be an arbitrary container mapping parameter indices to values
441
- (such as a `Vector{Real}`, `Vector{Pair}`, or `Dict `).
441
+ (such as a `Vector{Real}`, `Vector{Pair}`, or `AbstractDict `).
442
442
443
443
The keys of `p` must be valid keys that can be given to [`set_parameter!`](@ref).
444
444
"""
@@ -481,10 +481,10 @@ with initial state `u`. Practically every function of the ecosystem that evolves
481
481
`ds` first calls this function on it. Besides the new state `u`, you
482
482
can also configure the keywords `t0 = initial_time(ds)` and `p = current_parameters(ds)`.
483
483
484
- reinit!(ds::DynamicalSystem, u::Dict ; kwargs...) → ds
484
+ reinit!(ds::DynamicalSystem, u::AbstractDict ; kwargs...) → ds
485
485
486
- If `u` is a `Dict ` (for partially setting specific state variables in [`set_state`](@ref)),
487
- then the alterations in `u` are still done in the state given by the keyword
486
+ If `u` is a `AbstractDict ` (for partially setting specific state variables in [`set_state! `](@ref)),
487
+ then the alterations are done in the state given by the keyword
488
488
`reference_state = copy(initial_state(ds))`.
489
489
490
490
reinit!(ds, ::Nothing; kwargs...)
@@ -493,7 +493,7 @@ This method does nothing and leaves the system as is. This is so that downstream
493
493
that call `reinit!` can still be used without resetting the system but rather
494
494
continuing from its exact current state.
495
495
"""
496
- function SciMLBase. reinit! (ds:: DynamicalSystem , mapping:: Dict ;
496
+ function SciMLBase. reinit! (ds:: DynamicalSystem , mapping:: AbstractDict ;
497
497
reference_state = copy (initial_state (ds)), kwargs... )
498
498
um = Array (reference_state)
499
499
set_state! (um, mapping, ds)
0 commit comments