QMBackend¶
- class QMBackend(machine: QuamRoot, channel_mapping: Dict[QiskitChannel, QuAMChannel] | None = None, init_macro: Callable | None = None, qmm: QuantumMachinesManager | CloudQuantumMachinesManager | None = None, name: str | None = None, **fields)[source][source]¶
Bases:
BackendV2Qiskit backend for Quantum Machines (QuAM).
Represents at the Qiskit level all available operations and qubit properties of a Quantum Abstract Machine (QuAM) instance. The QuAM instance must expose
active_qubits,active_qubit_pairs, and per-qubit/pairmacros.Initialize the QM backend.
- Parameters:
machine – The QuAM instance to wrap.
channel_mapping – Optional mapping from Qiskit Pulse channels (
DriveChannel,ControlChannel,MeasureChannel, …) to QuAM channels. Required for converting Pulse schedules into parametric QUA macros (Qiskit < 2.0; schedules must have fixed durations).init_macro – Optional QUA macro invoked at the start of each program to initialize the QPU.
qmm – Optional
QuantumMachinesManagerorCloudQuantumMachinesManager. Inferred from the machine when omitted.name – Optional backend name. Defaults to the network backend name or
"QMBackend".fields – Optional keyword overrides for default run options:
shots(1024),compiler_options,simulate,memory(False),skip_reset(False),meas_level(MeasLevel.CLASSIFIED),meas_return(MeasReturnType.AVERAGE),timeout(60 seconds), andmax_circuits(30).
- property target: Target¶
A
qiskit.transpiler.Targetobject for the backend.- Return type:
Target
- property custom_instructions: Dict[str, Instruction]¶
Get the custom instructions for the backend (those that are part of the target but not in the standard Qiskit gate set, inferred from the available macros)
- get_qubit_index(qubit: str | Qubit) int[source][source]¶
Get the index of the given qubit or qubit name in Quam.
- Parameters:
qubit – The qubit or qubit name
- Returns:
The index of the given qubit or qubit name in Quam
- get_qubit_pair_indices(qubit_pair: str | QubitPair) Tuple[int, int][source][source]¶
Get the indices of the given qubit pair or qubit pair name in Quam.
- Parameters:
qubit_pair – The qubit pair or qubit pair name
- Returns:
The indices of the given qubit pair or qubit pair name in Quam
- get_qubit(qubit: int | str) Qubit[source][source]¶
Get the Qubit object for a qubit index or name.
- Parameters:
qubit – Qubit index or name.
- Returns:
The corresponding
Qubit.
- get_qubit_pair(qubits: Tuple[int | str | Qubit, int | str | Qubit]) QubitPair[source][source]¶
Get the QubitPair for two qubit indices or names.
- property qubit_mapping: QubitsMapping¶
Build the qubit to quantum elements mapping for the backend. Should be of the form {qubit_index: (quantum_element1, quantum_element2, …)}
- property qubit_index_dict¶
Returns a dictionary mapping qubit indices (Qiskit numbering) to corresponding Qubit objects (based on the active_qubits attribute of QuAM instance)
- property qmm: QuantumMachinesManager | CloudQuantumMachinesManager¶
Returns the QuantumMachinesManager instance. Gets a new QuantumMachinesManager instance if none is already set.
- property qm: QuantumMachine | CloudQuantumMachine¶
Returns the QuantumMachine instance. Gets a new QuantumMachine instance if none is already set, using the current QM config.
- property qm_config: FullQuaConfig¶
Returns the QUA configuration for the backend
- property max_circuits¶
Maximum number of circuits (or PUBs for Primitives) packed into a single QUA program.
backend.run,QMSamplerV2, andQMEstimatorV2all split larger batches into several queued QUA programs whose results are stitched back transparently.Must be a positive integer (>= 1). Defaults to 30. Can be updated at any time via
backend.set_options(max_circuits=N).
- run(run_input: QuantumCircuit | List[QuantumCircuit], **options) QMJob[source][source]¶
Run one or more
QuantumCircuitobjects on the QM backend.This method now delegates the heavy lifting (circuit validation, compilation to QUA, job submission and result assembly) to the
QMJobinterface, keeping the public behaviour identical while centralising execution logic in the job layer.- Parameters:
run_input – The
QuantumCircuit(or list thereof) to run on the backend.options – Backend run options (shots, simulate, compiler options, etc.).
- Returns:
A
QMJob(orIQCCJobfor cloud backends) instance.
- update_target(input_type: InputType | None = None)[source][source]¶
Synchronize Target object with
_operation_mapping_QUA.This method performs a one-way sync from Target to
_operation_mapping_QUA:Updates
_operation_mapping_QUAfrom machine macros (incrementally).Syncs operations from Target to
_operation_mapping_QUA, overwriting entries for the sameOperationIdentifier.Updates the calibration mapping.
The sync is additive (never removes operations) and Target entries take precedence over machine macros for the same identifier.
- Parameters:
input_type – Input type for converting parameterized instructions to QUA variables. Required when the Target contains parameterized pulse schedules.
- quantum_circuit_to_qua(qc: QuantumCircuit, param_table: ParameterTable | Sequence[ParameterTable | Parameter] | Dict[str | QiskitParameter | Var, Scalar] | None = None) QuaCircuitCompilation[source][source]¶
Convert a
QuantumCircuitto a QUA program fragment.Can be called inside an existing
with program():block or standalone. When called standalone, access the generated program viaresult.qua_programorresult.result_program.dsl_program.- Parameters:
qc – The circuit to compile.
param_table – Parameter mapping for real-time QUA variables. Required when the circuit contains symbolic parameters or classical inputs that must be streamed during execution.
- Returns:
QuaCircuitCompilationwrapping the compilation result and wired measurement outputs.
- property compiler: Compiler¶
The OpenQASM to QUA compiler.