ParityMapping#
Module: iqm.qaoa.transpiler.routing
- class iqm.qaoa.transpiler.routing.ParityMapping(qpu, initial_mapping)[source]#
Bases:
BaseMappingMaps 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:
- 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
Simulates the effect of a CNOT gate on the parity mapping.
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
Inheritance
