iqm.cirq_iqm.optimizers.simplify_circuit

iqm.cirq_iqm.optimizers.simplify_circuit#

iqm.cirq_iqm.optimizers.simplify_circuit(circuit, *, max_iterations=20, drop_final_rz=False)#

Simplifies and optimizes the given circuit.

Currently it

  • merges any neighboring gates belonging to the same one-parameter family

  • merges all one-qubit rotations into phased X rotations followed by Z rotations

  • pushes the Z rotations towards the end of the circuit as far as possible

  • drops any empty Moments

This sequence of optimization passes is repeated until the circuit hits a fixed point, or max_iterations is exceeded.

Finally, it removes Z rotations that are immediately followed by a Z-basis measurement.

Parameters:
  • circuit (Circuit) – circuit to simplify

  • max_iterations (int) – maximum number of simplification rounds

  • drop_final_rz (bool) – iff True, drop z rotations that have no successor operations

Returns:

simplified circuit

Return type:

Circuit