iqm.qiskit_iqm.iqm_transpilation.IQMOptimizeSingleQubitGates

iqm.qiskit_iqm.iqm_transpilation.IQMOptimizeSingleQubitGates#

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

Bases: TransformationPass

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

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

  1. Convert single-qubit gates to \(U\) gates and combine all neighbouring \(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.

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

Attributes

Methods

_validate_ops(dag)

run(dag)

Run a pass on the DAGCircuit.

run(dag)#

Run a pass on the DAGCircuit. This is implemented by the pass developer.

Parameters:

dag (DAGCircuit) – the dag on which the pass is run.

Raises:

NotImplementedError – when this is left unimplemented for a pass.

Return type:

DAGCircuit