quri_parts.circuit.transpile.qubit_remapping module#
- class quri_parts.circuit.transpile.qubit_remapping.QubitRemappingTranspiler(qubit_mapping: Mapping[int, int])#
Bases:
CircuitTranspilerProtocol
Remap qubits in the circuit with the specified mapping.
The mapping
qubit_mapping
should be specified with “from” qubit indices as keys and “to” qubit indices as values. For example, if you want to convert a circuit using qubits 0, 1, 2, 3 by mapping them as 0 → 4, 1 → 2, 2 → 5, 3 → 0, then thequbit_mapping
should be{0: 4, 1: 2, 2: 5, 3: 0}
. Thequbit_count
of the converted circuit is determined by the largest destination qubit index. In the above example, the largest index is 5, so the converted circuit is for 6 qubits.