ParityMapping#

Module: iqm.qaoa.transpiler.routing

class iqm.qaoa.transpiler.routing.ParityMapping(qpu, initial_mapping)[source]#

Bases: BaseMapping

Maps hardware qubits to sets of logical qubits representing parities.

This class maintains a dynamic mapping between physical (hardware) qubits and logical qubit sets that encode parity relationships used in quantum circuit synthesis of phase polynomials.

Parameters:
  • qpu (QPU) – The QPU providing the hardware graph.

  • initial_mapping (dict[HardQubit, set[LogQubit]]) – Initial mapping from hardware qubits to sets of logical qubits representing parities.

Raises:
  • ValueError – If the initial mapping contains qubits not present in the QPU.

  • ValueError – If the initial mapping maps any hardware qubit to a parity of multiple qubits. The initial mapping may only map hardware qubits to either the empty set set() or to sets containing a single logical qubit, such as e.g., {log_qb}.

Methods

cnot

Simulates the effect of a CNOT gate on the parity mapping.

swap_hard

Swaps the parity mapping between two hardware qubits.

cnot(control, target)[source]#

Simulates the effect of a CNOT gate on the parity mapping.

The CNOT updates the parity of the target qubit by XOR-ing it with the control qubit’s parity set.

Parameters:
  • control (HardQubit) – The control hardware qubit.

  • target (HardQubit) – The target hardware qubit.

Raises:

ValueError – If the control and target qubits are not connected in the QPU hardware graph.

Return type:

None

swap_hard(gate)[source]#

Swaps the parity mapping between two hardware qubits.

This corresponds to exchanging the logical parity assignments of two connected hardware qubits.

Parameters:

gate (HardEdge) – A pair of hardware qubits (qb0, qb1) to swap.

Return type:

None

Inheritance

Inheritance diagram of iqm.qaoa.transpiler.routing.ParityMapping