iqm.qiskit_iqm.qiskit_to_iqm.serialize_instructions

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] = ()) list[Instruction]#

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>".

Returns:

list of instructions representing the circuit

Raises:

ValueError – circuit contains an unsupported instruction or is not transpiled in general

Return type:

list[Instruction]