File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
structural_transformation Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 68
68
69
69
function complete (m:: Matching{U} ) where {U}
70
70
m. inv_match != = nothing && return m
71
- inv_match = Union{U, Int}[unassigned for _ = 1 : length (m. match)]
71
+ N = length (m. match)
72
+ inv_match = Union{U, Int}[unassigned for _ = 1 : N]
72
73
for (i, eq) in enumerate (m. match)
73
74
isa (eq, Int) || continue
74
- inv_match[eq] = i
75
+ if eq <= N
76
+ inv_match[eq] = i
77
+ else # this only happens when the system is imbalanced
78
+ for k in N+ 1 : eq- 1
79
+ push! (inv_match, unassigned)
80
+ end
81
+ push! (inv_match, i)
82
+ end
75
83
end
76
84
return Matching {U} (collect (m. match), inv_match)
77
85
end
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ function check_consistency(state::TearingState)
59
59
iseqs = n_highest_vars < neqs
60
60
if iseqs
61
61
eq_var_matching = invview (complete (var_eq_matching)) # extra equations
62
- bad_idxs = findall (isnothing , @view eq_var_matching[1 : nsrcs (graph)])
62
+ bad_idxs = findall (isequal (unassigned) , @view eq_var_matching[1 : nsrcs (graph)])
63
63
else
64
64
bad_idxs = findall (isequal (unassigned), var_eq_matching)
65
65
end
You can’t perform that action at this time.
0 commit comments