Skip to content

Commit d416a3a

Browse files
committed
remove the unecessary type-convertion in observe_state
1 parent 2d2e443 commit d416a3a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DynamicalSystemsBase"
22
uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
33
repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git"
4-
version = "3.5.4"
4+
version = "3.5.5"
55

66
[deps]
77
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"

src/core/dynamicalsystem_interface.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,16 @@ state of the system is the full state space state, not the projected one
180180
(this makes the most sense for allowing MTK-based indexing).
181181
"""
182182
function observe_state(ds::DynamicalSystem, index, u::AbstractArray = current_state(ds))
183-
prob = referrenced_sciml_prob(ds)
184-
T = eltype(u)
185183
if index isa Function
186-
return index(u)::T
184+
return index(u)
187185
elseif index isa Int
188-
return u[index]::T
189-
elseif has_referrenced_model(prob)
186+
return u[index]
187+
elseif has_referrenced_model(ds)
188+
prob = referrenced_sciml_prob(ds)
190189
ugetter = SymbolicIndexingInterface.observed(prob, index)
191190
p = current_parameters(ds)
192191
t = current_time(ds)
193-
return ugetter(u, p, t)::T
192+
return ugetter(u, p, t)
194193
else
195194
throw(ArgumentError("Invalid index to observe state, or if symbolic index, the "*
196195
"dynamical system does not referrence a ModelingToolkit.jl system."))

0 commit comments

Comments
 (0)