qiskit_superstaq.compiler_output

Classes

CompilerOutput

A class that stores the results of compiled circuits.

Functions

active_qubit_indices(→ list[int])

Returns the indices of the non-idle qubits in the input quantum circuit.

classical_bit_mapping(→ dict[int, int])

Returns the index of the (final) measured qubit associated with each classical bit.

measured_qubit_indices(→ list[int])

Returns the indices of the measured qubits in the input quantum circuit.

read_json(→ CompilerOutput)

Reads out returned JSON from Superstaq API's compilation endpoints.

read_json_aqt(→ CompilerOutput)

Reads out the returned JSON from Superstaq API's AQT compilation endpoint.

read_json_qscout(→ CompilerOutput)

Reads out the returned JSON from Superstaq API's QSCOUT compilation endpoint.

Module Contents

class qiskit_superstaq.compiler_output.CompilerOutput(circuits: qiskit.QuantumCircuit | list[qiskit.QuantumCircuit] | list[list[qiskit.QuantumCircuit]], initial_logical_to_physicals: dict[int, int] | list[dict[int, int]] | list[list[dict[int, int]]], final_logical_to_physicals: dict[int, int] | list[dict[int, int]] | list[list[dict[int, int]]], pulse_gate_circuits: qiskit.QuantumCircuit | list[qiskit.QuantumCircuit] = None, seq: qtrl.sequencer.Sequence | None = None, jaqal_programs: str | list[str] | None = None)

A class that stores the results of compiled circuits.

has_multiple_circuits() bool

Checks if this object has plural attributes (e.g. .circuits).

Otherwise, the object represents a single circuit, and has singular attributes (.circuit).

Returns:

A boolean indicating whether this object represents multiple circuits.

seq = None
qiskit_superstaq.compiler_output.active_qubit_indices(circuit: qiskit.QuantumCircuit) list[int]

Returns the indices of the non-idle qubits in the input quantum circuit.

Parameters:

circuit – A qiskit.QuantumCircuit circuit.

Returns:

A list containing the indices of the non-idle qubits.

qiskit_superstaq.compiler_output.classical_bit_mapping(circuit: qiskit.QuantumCircuit) dict[int, int]

Returns the index of the (final) measured qubit associated with each classical bit.

If more than one measurement is assigned to the same classical bit, only the final measurement is considered.

Parameters:

circuit – A qiskit.QuantumCircuit circuit.

Returns:

A dictionary mapping classical bit indices to the indices of the measured qubits.

qiskit_superstaq.compiler_output.measured_qubit_indices(circuit: qiskit.QuantumCircuit) list[int]

Returns the indices of the measured qubits in the input quantum circuit.

Parameters:

circuit – A qiskit.QuantumCircuit circuit.

Returns:

A list containing the indices of the measured qubits.

qiskit_superstaq.compiler_output.read_json(json_dict: collections.abc.Mapping[str, Any], circuits_is_list: bool, api_version: str = 'v0.2.0') CompilerOutput

Reads out returned JSON from Superstaq API’s compilation endpoints.

Parameters:
  • json_dict – A JSON dictionary matching the format returned by /compile endpoint.

  • circuits_is_list – A bool flag that controls whether the returned object has a .circuits attribute (if True) or a .circuit attribute (False).

  • api_version – A string indicating the API version.

Returns:

A CompilerOutput object with the compiled circuit(s) and (if applicable to this target) corresponding pulse gate circuit(s).

qiskit_superstaq.compiler_output.read_json_aqt(json_dict: dict[str, str], circuits_is_list: bool, num_eca_circuits: int | None = None) CompilerOutput

Reads out the returned JSON from Superstaq API’s AQT compilation endpoint.

Parameters:
  • json_dict – A JSON dictionary matching the format returned by /aqt_compile endpoint.

  • circuits_is_list – Bool flag that controls whether the returned object has a .circuits attribute (if True) or a .circuit attribute (False).

  • num_eca_circuits – Optional number of logically equivalent random circuits to generate for each input circuit.

Returns:

A CompilerOutput object with the compiled circuit(s). If qtrl is available locally, the returned object also stores the pulse sequence in the .seq attribute.

qiskit_superstaq.compiler_output.read_json_qscout(json_dict: dict[str, str | list[str]], circuits_is_list: bool) CompilerOutput

Reads out the returned JSON from Superstaq API’s QSCOUT compilation endpoint.

Parameters:
  • json_dict – A JSON dictionary matching the format returned by /qscout_compile endpoint.

  • circuits_is_list – Bool flag that controls whether the returned object has a .circuits attribute (if True) or a .circuit attribute (False).

Returns:

A CompilerOutput object with the compiled circuit(s) and a list of jaqal programs in a string representation.