Skip to content

Commit

Permalink
Add helpful suggestion to parse_gate when called with non-basic gate.
Browse files Browse the repository at this point in the history
This also makes the error message consistent with the one in `phase_block_optimize`.

See #196 for context.
  • Loading branch information
dlyongemallo committed Apr 6, 2024
1 parent da80447 commit 2feea75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyzx/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,9 @@ def parse_gate(self, g: Gate) -> None:
else: # Only the control has a hadamard gate in front of it
self.add_hadamard(c)
self.add_cnot(g)

else:
raise TypeError("Unknown gate {}".format(str(g)))
raise TypeError("Unknown gate {}. Maybe simplify the gates with circuit.to_basic_gates()?".format(str(g)))



Expand Down

0 comments on commit 2feea75

Please sign in to comment.