cirq.google.optimized_for_xmon

cirq.google.optimized_for_xmon(circuit: cirq.circuits.circuit.Circuit, new_device: Optional[cirq.google.xmon_device.XmonDevice] = None, qubit_map: Callable[cirq.ops.raw_types.QubitId, cirq.devices.grid_qubit.GridQubit] = <function <lambda>>, allow_partial_czs: bool = False) → cirq.circuits.circuit.Circuit[source]

Optimizes a circuit with XmonDevice in mind.

Starts by converting the circuit’s operations to the xmon gate set, then
begins merging interactions and rotations, ejecting pi-rotations and phasing
operations, dropping unnecessary operations, and pushing operations earlier.
Parameters:
  • circuit – The circuit to optimize.
  • new_device – The device the optimized circuit should be targeted at. If set to None, the circuit’s current device is used.
  • qubit_map – Transforms the qubits (e.g. so that they are GridQubits).
  • allow_partial_czs – If true, the optimized circuit may contain partial CZ gates. Otherwise all partial CZ gates will be converted to full CZ gates. At worst, two CZ gates will be put in place of each partial CZ from the input.
Returns:

The optimized circuit.