Skip to content

Commit

Permalink
refactor: handle istree case in is_parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Nov 20, 2023
1 parent ce7e82a commit 143a180
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/systems/abstractsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,12 @@ function SymbolicIndexingInterface.variable_symbols(sys::AbstractSystem)
end

function SymbolicIndexingInterface.is_parameter(sys::AbstractSystem, sym)
usym = unwrap(sym)
if unwrap(sym) isa Int
return unwrap(sym) in 1:length(parameters(sys))
return usym in 1:length(parameters(sys))
end
if istree(usym) && operation(usym) != getindex
return false
end

return any(isequal(sym), parameters(sys)) || is_parameter(sys, getname(sym))
Expand Down

0 comments on commit 143a180

Please sign in to comment.