LineMappingPTN#
Module: iqm.qaoa.transpiler.ptn.ptn
- class iqm.qaoa.transpiler.ptn.ptn.LineMappingPTN(*args, **kwargs)[source]#
Bases:
BaseMappingThe mapping class for line PTN routing algorithm.
The mapping instance for line PTN routing has the responsibility to keep track of two important attributes:
hard2lineandline_of_parities. The former keeps track of mapping hardware qubits on the QPU intoLineQubits of the PTN. The latter keeps track what parity is mapped onto whichLineQubit.- Parameters:
- Raises:
ValueError – If the provided
line_of_hw_qubitscontains duplicates.ValueError – If the provided
line_of_hw_qubitsis too short.ValueError – If the provided
line_of_hw_qubitsis not a chain on the QPU (i.e., two consecutive HW qubits are not connected on the QPU).
Warning
- UserWarning: If the provided
line_of_hw_qubitsis longer than the number of problem variables. In that case it is truncated.
Attributes
The mapping from hardware qubits to line qubits in the PTN circuit.
The line of parity information carried by the qubits of the PTN circuit.
Methods
Applies the CNOT gate to the mapping at line qubits
qb0andqb1.Applies the DCNOT gate to the mapping at line qubits
qb0andqb1.Update the mapping from the input
layer.- property hard2line: dict[HardQubit, int | None]#
The mapping from hardware qubits to line qubits in the PTN circuit.
- property line_of_parities: list[set[int]]#
The line of parity information carried by the qubits of the PTN circuit.
- update(layer)[source]#
Update the mapping from the input
layer.Goes through the
layerand applies each DCNOT therein. Thelayerrepresents a Parity Twine Chain, i.e., one chain of DCNOTs going through the line qubits.
- cnot(qb0, qb1)[source]#
Applies the CNOT gate to the mapping at line qubits
qb0andqb1.The gate acts on
qb1, controlled byqb0. This modifiesself._line_of_paritiesin-place.
Inheritance
