Skip to content

Commit

Permalink
Fixed test in acset2symbolics
Browse files Browse the repository at this point in the history
Added a fix to the acset2symbolics code that helps fix the issue caused there by #77. A full fix to this issue can restore the code to just use infer_terminal_names
  • Loading branch information
GeorgeR227 committed Oct 9, 2024
1 parent 467a93c commit 7c5155d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/acset2symbolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ end
# e.g. ∂ₜ(G) == κ*u becomes ∂ₜ(G) == u*κ
function merge_equations(d::SummationDecapode)
eqn_lookup, terminal_eqns = Dict(), SymEqSym[]
deriv_op_tgts = d[incident(d, DerivOp, :op1), [:tgt, :name]] # Patches over issue #77
terminal_vars = Set{Symbol}(vcat(infer_terminal_names(d), deriv_op_tgts))

foreach(to_symbolics(d)) do x
sub = SymbolicUtils.substitute(x.rhs, eqn_lookup)
push!(eqn_lookup, (x.lhs => sub))
if x.lhs.name in infer_terminal_names(d)
if x.lhs.name in terminal_vars
push!(terminal_eqns, SymEqSym(x.lhs, sub))
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/acset2symbolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ using Catlab
c_exp == ∂ₜ(c_exp)
end

@test_broken repeated_vars == symbolic_rewriting(self_changing)
@test self_changing == symbolic_rewriting(self_changing)

literal = @decapode begin
A::Form0
Expand Down

0 comments on commit 7c5155d

Please sign in to comment.