iqm.pulla.utils_qir.generate_qiskit_qir_qubit_mapping#
- iqm.pulla.utils_qir.generate_qiskit_qir_qubit_mapping(qiskit_circuit, qiskit_backend)#
qiskit-qir has a bug, which causes qubit pointers to not be generated correctly according to the final_layout. So we replicate this logic here and generate a new mapping. Then we assign qiskit-qir index to the qiskit logic qubit idx.
- Parameters:
qiskit_circuit (QuantumCircuit) – The Qiskit circuit to generate the mapping for.
qiskit_backend (BackendV2) – The Qiskit backend object to be used for qubit name generation.
- Returns:
A dictionary mapping Qiskit qubit indices to QIR qubit pointers.
- Return type:
Annotated[dict[str, str], BeforeValidator(func=~iqm.station_control.interface.models.circuit._parse_legacy_qubit_mapping, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~iqm.station_control.interface.models.circuit._serialize_as_legacy_qubit_mapping, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={‘anyOf’: [{‘type’: ‘array’, ‘items’: {‘type’: ‘object’, ‘required’: [‘logical_name’, ‘physical_name’], ‘properties’: {‘logical_name’: {‘type’: ‘string’}, ‘physical_name’: {‘type’: ‘string’}}, ‘additionalProperties’: False}}, {‘type’: ‘null’}]}, mode=None)]