Qiskit
The in-app starter (Bell state — runnable as-is):
from qiskit import QuantumCircuit
# Create a Bell Stateqc = QuantumCircuit(2, 2)qc.h(0)qc.cx(0, 1)qc.measure([0, 1], [0, 1])What the adapter does
Section titled “What the adapter does”| Stage | Behavior |
|---|---|
| Discovery | After exec(), the last QuantumCircuit instance in the namespace wins — define two circuits and the most recently assigned one is rendered/simulated. |
| Gate names | Three-tier mapping: gate class name via GATE_NAME_MAP (HGate → H, CXGate → CNOT, CCXGate → Toffoli, …) → lowercase op.name fallback (cx → CNOT, …) → unknown gates pass through as op.name.upper(). |
| Layering | Shared greedy algorithm: each gate lands in the earliest layer where all of its qubits are free. |
classical_bit_count | The circuit’s num_clbits. |
Canonical gate vocabulary (incl. the Qiskit-only U1/U2/U3) is on the
schemas page.
Simulation
Section titled “Simulation”Two separate AerSimulator passes per execute:
- Exact statevector — a copy of the circuit with
remove_final_measurements()+save_statevector(), run once onAerSimulator(method="statevector"). Producesstate_vector, exactprobabilities, and per-qubit Bloch coordinates via partial trace. - Sampled counts — the original circuit (measurements intact) on a
default
AerSimulatorwith the requestedshots. Producesmeasurements.
Bitstring keys follow Qiskit’s little-endian convention — qubit 0 is the rightmost character. See bitstring-key conventions.
Gotchas
Section titled “Gotchas”- Symbolic
Parameters raise. Snapshot extraction callsfloat()on every gate parameter, so an unboundParameterfails the parse — surfaced asadapter_error. Callassign_parameters(...)with concrete values first. - Measurement-less circuits fail on execute. The sampled pass calls
get_counts(), which Aer rejects when the circuit has no measurements — surfaced assimulation_error(the snapshot still arrives, so the diagram renders; live-typingparseis unaffected). Addqc.measure(...)orqc.measure_all(). - No transpilation locally. The local simulation runs your circuit verbatim; transpilation to a basis gate set only happens on hardware submission (e.g. IBM transpiles against the selected backend).
- Mid-circuit measurements are kept in the sampled pass but stripped
only as final measurements in the statevector pass —
remove_final_measurements()does not remove mid-circuit ones, and Aer’s statevector method will then sample them, makingstate_vectorshot-dependent for such circuits.