iqm.qiskit_iqm.qiskit_to_iqm.serialize_instructions#
- iqm.qiskit_iqm.qiskit_to_iqm.serialize_instructions(circuit: QuantumCircuit, qubit_index_to_name: dict[int, str], allowed_nonnative_gates: Collection[str] = (), *, clbit_to_measure: dict[Clbit, CircuitOperation] | None = None, overwrite_layout: Layout | None = None) list[CircuitOperation]#
- Serialize a quantum circuit into the IQM data transfer format. - This is IQM’s internal helper for - IQMBackend.serialize_circuit()that gives slightly more control. See- IQMBackend.serialize_circuit()for details.- Parameters:
- circuit (QuantumCircuit) – quantum circuit to serialize 
- qubit_index_to_name (dict[int, str]) – Mapping from qubit indices to the corresponding qubit names. 
- allowed_nonnative_gates (Collection[str]) – Names of gates that are converted as-is without validation. By default, any gate that can’t be converted will raise an error. If such gates are present in the circuit, the caller must edit the result to be valid and executable. Notably, since IQM transfer format requires named parameters and qiskit parameters don’t have names, the i th parameter of an unrecognized instruction is given the name - "p<i>".
- clbit_to_measure (dict[Clbit, CircuitOperation] | None) – Maps clbits to the latest “measure” instruction to store its result there, or None if nothing has been measured yet. 
- overwrite_layout (Layout | None) – A layout indicating the physical qubit mapping to use for the serialized instructions, this overwrites the circuit’s layout. 
 
- Returns:
- list of IQM instructions representing the circuit 
- Raises:
- ValueError – circuit contains an unsupported instruction or is not transpiled in general 
- Return type:
- list[CircuitOperation] 
 
