cirq_superstaq.compiler_output
Classes
A class that arranges compiled circuit information. |
Functions
|
Returns the indices of the non-idle qubits in a quantum circuit. |
|
Returns the indices of the measured qubits in a quantum circuit. |
|
Reads out returned JSON from Superstaq API's IBMQ compilation endpoint. |
|
Reads out returned JSON from Superstaq API's AQT compilation endpoint. |
|
Reads out returned JSON from Superstaq API's QSCOUT compilation endpoint. |
Module Contents
- class cirq_superstaq.compiler_output.CompilerOutput(circuits: cirq.Circuit | list[cirq.Circuit] | list[list[cirq.Circuit]], initial_logical_to_physicals: dict[cirq.Qid, cirq.Qid] | list[dict[cirq.Qid, cirq.Qid]] | list[list[dict[cirq.Qid, cirq.Qid]]], final_logical_to_physicals: dict[cirq.Qid, cirq.Qid] | list[dict[cirq.Qid, cirq.Qid]] | list[list[dict[cirq.Qid, cirq.Qid]]], pulse_gate_circuits: Any | None = None, seq: qtrl.sequencer.Sequence | None = None, jaqal_programs: list[str] | str | None = None)
A class that arranges compiled circuit information.
- 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:
True if this object represents multiple circuits; False otherwise.
- seq = None
- cirq_superstaq.compiler_output.active_qubit_indices(circuit: cirq.AbstractCircuit) list[int]
Returns the indices of the non-idle qubits in a quantum circuit.
Note
The “index” refers to the argument of a LineQubit (so e.g. cirq.LineQubit(5) has index 5 regardless of the total number of qubits in the circuit).
- Parameters:
circuit – The input quantum circuit.
- Returns:
A list of active qubit indicies.
- Raises:
ValueError – If qubit indices are requested for non-line qubits.
- cirq_superstaq.compiler_output.measured_qubit_indices(circuit: cirq.AbstractCircuit) list[int]
Returns the indices of the measured qubits in a quantum circuit.
Note
The “index” refers to the argument of a cirq.LineQubit (so e.g. cirq.LineQubit(5) has index 5 regardless of the total number of qubits in the circuit).
- Parameters:
circuit – The input quantum circuit.
- Returns:
A list of the measurement qubit indicies.
- Raises:
ValueError – If qubit indices are requested for non-line qubits.
- cirq_superstaq.compiler_output.read_json(json_dict: dict[str, Any], circuits_is_list: bool) CompilerOutput
Reads out returned JSON from Superstaq API’s IBMQ compilation endpoint.
- Parameters:
json_dict – A JSON dictionary matching the format returned by /ibmq_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).
- Returns:
A CompilerOutput object with the compiled circuit(s). If included in the server response, the returned object also stores the corresponding pulse gate circuit(s) in its .pulse_gate_circuit(s) attribute (provided qiskit-superstaq is available locally).
- cirq_superstaq.compiler_output.read_json_aqt(json_dict: dict[str, Any], circuits_is_list: bool, num_eca_circuits: int | None = None) CompilerOutput
Reads out 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 – A bool flag that controls whether the returned object has a .circuits attribute (if True) or a .circuit attribute (False).
num_eca_circuits – 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.
- cirq_superstaq.compiler_output.read_json_qscout(json_dict: dict[str, Any], circuits_is_list: bool) CompilerOutput
Reads out 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 – A 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 represented as strings.