Skip to content

Commit

Permalink
Add helpful suggestion when calling full_optimize with non-Clifford…
Browse files Browse the repository at this point in the history
…+T circuit.

See zxcalc#198 for context.
  • Loading branch information
dlyongemallo committed Apr 17, 2024
1 parent da80447 commit 72e150c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyzx/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def phase_block_optimize(circuit: Circuit, pre_optimize:bool=True, quiet:bool=Tr
if not isinstance(g, ZPhase):
raise TypeError("Unknown gate {}. Maybe simplify the gates with circuit.to_basic_gates()?".format(str(g)))
elif g.phase.denominator not in (1,2,4):
raise TypeError("This method only works on Clifford+T circuits. This circuit contains a {}".format(str(g)))
raise TypeError("This method only works on Clifford+T circuits. This circuit contains a {}. For these circuits, stick to basic_optimization().".format(str(g)))
gates[g.target].append(g)
else:
gates[g.target].append(g)
Expand Down

0 comments on commit 72e150c

Please sign in to comment.