Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/systems/index_cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,16 @@ function IndexCache(sys::AbstractSystem)

dependent_pars = Set{BasicSymbolic}()
for eq in parameter_dependencies(sys)
push!(dependent_pars, eq.lhs)
sym = eq.lhs
ttsym = default_toterm(sym)
rsym = renamespace(sys, sym)
rttsym = renamespace(sys, ttsym)
for s in [sym, ttsym, rsym, rttsym]
push!(dependent_pars, s)
if hasname(s) && (!iscall(s) || operation(s) != getindex)
symbol_to_variable[getname(s)] = sym
end
end
end

return IndexCache(
Expand Down
9 changes: 9 additions & 0 deletions test/symbolic_indexing_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,12 @@ get_dep = @test_nowarn getu(prob, 2p1)
@test getu(prob, p1)(prob) == getu(prob, :p1)(prob)
@test getu(prob, p2)(prob) == getu(prob, :p2)(prob)
end

@testset "Parameter dependencies as symbols" begin
@variables x(t) = 1.0
@parameters a=1 b
@named model = ODESystem(D(x) ~ x + a - b, t, parameter_dependencies = [b ~ a + 1])
sys = complete(model)
prob = ODEProblem(sys, [], (0.0, 1.0))
@test prob.ps[b] == prob.ps[:b]
end
Loading