iqm.qiskit_iqm.qir_utils.generate_qiskit_qir_qubit_mapping#
- iqm.qiskit_iqm.qir_utils.generate_qiskit_qir_qubit_mapping(qiskit_circuit: QuantumCircuit, qiskit_backend: BackendV2) 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)]#
Generate qubit mapping for QIR.
qiskit-qirhas 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 assignqiskit-qirindex 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)]