IQMOptimizeSingleQubitGates

IQMOptimizeSingleQubitGates#

Module: iqm.qiskit_iqm.iqm_transpilation

class iqm.qiskit_iqm.iqm_transpilation.IQMOptimizeSingleQubitGates(*args, **kwargs)#

Bases: TransformationPass

Optimize the decomposition of single-qubit gates for the IQM gate set.

This optimization pass expects the circuit to be correctly layouted and translated to the IQM architecture and raises an error otherwise. The optimization logic follows the steps:

  1. Convert single-qubit gates to \(U\) gates and combine all neighboring \(U\) gates.

  2. Convert \(U\) gates according to \(U(\theta , \phi , \lambda) = ~ RZ(\phi + \lambda) R(\theta, \pi / 2 - \lambda)\).

  3. Commute RZ gates to the end of the circuit using the fact that RZ and CZ gates commute, and \(R(\theta , \phi) RZ(\lambda) = RZ(\lambda) R(\theta, \phi - \lambda)\).

  4. Drop RZ gates immediately before measurements, and otherwise replace them according to \(RZ(\lambda) = R(\pi, \lambda / 2) R(- \pi, 0)\).

Parameters:
  • drop_final_rz – Drop terminal RZ gates even if there are no measurements following them (since they do not affect the measurement results). Note that this will change the unitary propagator of the circuit. It is recommended always to set this to true as the final RZ gates do no change the measurement outcomes of the circuit.

  • ignore_barriers (bool) – Removes the barriers from the circuit before optimization (default = False).

Attributes

Methods

run

Run the single-qubit gate optimization pass.

run(dag: DAGCircuit, decompose_rz_to_r: bool = True) DAGCircuit#

Run the single-qubit gate optimization pass.

Parameters:
  • dag (DAGCircuit) – The input DAG circuit to optimize.

  • decompose_rz_to_r (bool) – Whether to decompose RZ gates into R gates, or add the to the DAG as RZ gates. This is used in recursive calls to communicate the accumulated RZ angles in rz_angles.

Returns:

The optimized DAG circuit.

Return type:

DAGCircuit

Inheritance

Inheritance diagram of iqm.qiskit_iqm.iqm_transpilation.IQMOptimizeSingleQubitGates