Skip to content

Commit 650e629

Browse files
committed
Update pss_graph_modia!'s SelectedState definition and fix alias_elimination's edge case
1 parent d002a03 commit 650e629

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/structural_transformation/partial_state_selection.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ function pss_graph_modia!(structure::SystemStructure, var_eq_matching, varlevel,
9494
end
9595
end
9696
for var in 1:ndsts(graph)
97-
if varlevel[var] !== 0 && var_eq_matching[var] === unassigned
97+
dv = var_to_diff[var]
98+
# If `var` is not algebraic (not differentiated nor a dummy derivative),
99+
# then it's a SelectedState
100+
if !(dv === nothing || (varlevel[dv] !== 0 && var_eq_matching[dv] === unassigned))
98101
var_eq_matching[var] = SelectedState()
99102
end
100103
end

src/systems/alias_elimination.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ const KEEP = typemin(Int)
66

77
function alias_eliminate_graph!(state::TransformationState)
88
mm = linear_subsys_adjmat(state)
9-
size(mm, 1) == 0 && return AliasGraph(ndsts(state.structure.graph)), mm, BitSet() # No linear subsystems
9+
if size(mm, 1) == 0
10+
ag = AliasGraph(ndsts(state.structure.graph))
11+
return ag, ag, mm, BitSet() # No linear subsystems
12+
end
1013

1114
@unpack graph, var_to_diff = state.structure
1215

0 commit comments

Comments
 (0)