File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -635,6 +635,7 @@ function trivial_tearing!(ts::TearingState)
635635 matched_vars = BitSet ()
636636 # variable to index in fullvars
637637 var_to_idx = Dict {Any, Int} (ts. fullvars .=> eachindex (ts. fullvars))
638+ sys_eqs = equations (ts)
638639
639640 complete! (ts. structure)
640641 var_to_diff = ts. structure. var_to_diff
@@ -654,6 +655,14 @@ function trivial_tearing!(ts::TearingState)
654655 push! (blacklist, i)
655656 continue
656657 end
658+ # Edge case for `var ~ var` equations. They don't show up in the incidence
659+ # graph because `TearingState` makes them `0 ~ 0`, but they do cause `var`
660+ # to show up twice in `original_eqs` which fails the assertion.
661+ sys_eq = sys_eqs[i]
662+ if isequal (sys_eq. lhs, 0 ) && isequal (sys_eq. rhs, 0 )
663+ continue
664+ end
665+
657666 # if a variable was the LHS of two trivial observed equations, we wouldn't have
658667 # included it in the list. Error if somehow it made it through.
659668 @assert ! (vari in matched_vars)
You can’t perform that action at this time.
0 commit comments