Skip to content

Commit

Permalink
forgot to check cases in the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RazinShaikh committed Aug 18, 2023
1 parent cf8a2a5 commit f3fde52
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pyzx/basicrules.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,14 @@ def check_fuse_w(g: BaseGraph[VT,ET], v1: VT, v2: VT) -> bool:

def fuse_w(g: BaseGraph[VT,ET], v1: VT, v2: VT) -> bool:
if not check_fuse_w(g, v1, v2): return False
apply_rule(g, w_fusion, [(v1, v2)])
v1_in, v1_out = get_w_io(g, v1)
v2_in, v2_out = get_w_io(g, v2)
if g.edge_type(g.edge(v1_out, v2_in)) == EdgeType.SIMPLE:
apply_rule(g, w_fusion, [(v1, v2)])
else:
g.set_position(v2_in, g.qubit(v1_in), g.row(v1_in))
g.set_position(v2_out, g.qubit(v1_out), g.row(v1_out))
apply_rule(g, w_fusion, [(v2, v1)])
return True

def check_remove_id(g: BaseGraph[VT,ET], v: VT) -> bool:
Expand Down

0 comments on commit f3fde52

Please sign in to comment.