Skip to content

Commit 56af95d

Browse files
committed
Fix comments
1 parent 34affff commit 56af95d

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/systems/diffeqs/index_reduction.jl

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# V-nodes `[x_1, x_2, x_3, ..., dx_1, dx_2, ..., y_1, y_2, ...]` where `x`s are
2+
# differential variables and `y`s are algebraic variables.
13
function get_vnodes(sys)
24
diffnodes = Operation[]
35
edges = map(_->Int[], 1:length(sys.eqs))
@@ -48,18 +50,18 @@ function print_bigraph(io::IO, sys, vars, edges)
4850
end
4951

5052

51-
function matching_equation!(edges, i, assignments, active, vcolor=falses(length(active)), ecolor=falses(length(edges)))
53+
function matching_equation!(edges, i, assign, active, vcolor=falses(length(active)), ecolor=falses(length(edges)))
5254
# `edge[active]` are active edges
53-
# i: variables
54-
# j: equations
55-
# assignments: assignments[j] == i means (i-j) is assigned
55+
# i: equations
56+
# j: variables
57+
# assign: assign[j] == i means (i-j) is assigned
5658
#
5759
# color the equation
5860
ecolor[i] = true
59-
# if a V-node j exists s.t. edge (i-j) exists and assignments[j] == 0
61+
# if a V-node j exists s.t. edge (i-j) exists and assign[j] == 0
6062
for j in edges[i]
61-
if active[j] && assignments[j] == 0
62-
assignments[j] = i
63+
if active[j] && assign[j] == 0
64+
assign[j] = i
6365
return true
6466
end
6567
end
@@ -68,18 +70,18 @@ function matching_equation!(edges, i, assignments, active, vcolor=falses(length(
6870
(active[j] && !vcolor[j]) || continue
6971
# color the variable
7072
vcolor[j] = true
71-
if match_equation!(edges, assignments[j], assignments, active, vcolor, ecolor)
72-
assignments[v] = i
73+
if match_equation!(edges, assign[j], assign, active, vcolor, ecolor)
74+
assign[v] = i
7375
return true
7476
end
7577
end
7678
return false
7779
end
7880

7981
function matching(edges, nvars, active=trues(nvars))
80-
assignments = zeros(Int, nvars)
82+
assign = zeros(Int, nvars)
8183
for i in 1:length(edges)
82-
matching_equation!(edges, i, assignments, active)
84+
matching_equation!(edges, i, assign, active)
8385
end
84-
return assignments
86+
return assign
8587
end

0 commit comments

Comments
 (0)