File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -58,8 +58,19 @@ function alias_elimination!(state::TearingState)
58
58
# D(y) appears in the equation, so that D(-D(x)) becomes -D(D(x)).
59
59
to_expand = Int[]
60
60
diff_to_var = invview (var_to_diff)
61
+ # TODO /FIXME : this also needs to be computed recursively because we need to
62
+ # follow the alias graph like `a => b => c` and make sure that the final
63
+ # graph always contains the destination.
64
+ extra_eqs = Equation[]
65
+ extra_vars = BitSet ()
61
66
for (v, (coeff, alias)) in pairs (ag)
62
- subs[fullvars[v]] = iszero (coeff) ? 0 : coeff * fullvars[alias]
67
+ if iszero (alias) || ! (isempty (𝑑neighbors (graph, alias)) && isempty (𝑑neighbors (graph, v)))
68
+ subs[fullvars[v]] = iszero (coeff) ? 0 : coeff * fullvars[alias]
69
+ else
70
+ push! (extra_eqs, 0 ~ coeff * fullvars[alias] - fullvars[v])
71
+ push! (extra_vars, v)
72
+ # @show fullvars[v] => fullvars[alias]
73
+ end
63
74
if coeff == - 1
64
75
# if `alias` is like -D(x)
65
76
diff_to_var[alias] === nothing && continue
You can’t perform that action at this time.
0 commit comments