mqt.core.plugins.qiskit.backend¶
QDMI Qiskit Backend.
Provides a Qiskit BackendV2-compatible interface to QDMI devices.
Module Contents¶
- class QDMIBackend(device: Device, provider: QDMIProvider | None = None, *, device_id: str | None = None)¶
Bases:
qiskit.providers.BackendV2A Qiskit BackendV2 adapter for QDMI devices.
This backend provides program submission to QDMI devices. It automatically introspects device capabilities and constructs a
Targetobject with supported operations.Use
from_device_id()to open one client-visible device. UseQDMIProviderto enumerate client-visible devices.- Parameters:
device – QDMI device wrapper.
provider – The provider instance that created this backend.
Examples
Open a backend by stable device ID:
>>> backend = QDMIBackend.from_device_id("mqt.ddsim.default")
- static is_convertible(device: Device) bool¶
Returns whether a device can be represented in Qiskit’s Target model.
- classmethod __init_subclass__(**kwargs: Any) None¶
Rebuild the gate mappings so a subclass sees its own aliases and gates.
- Parameters:
**kwargs – Keyword arguments for the base implementation.
- classmethod from_device_id(device_id: str, *, provider: QDMIProvider | None = None, **session_parameters: Unpack[QDMISessionParameters]) QDMIBackend¶
Open a client-visible QDMI device and adapt it for Qiskit.
- Parameters:
device_id – Stable ID reported by the QDMI driver.
provider – Provider to associate with the backend.
session_parameters – Optional device-session parameters for the MQT Core QDMI driver.
- Returns:
A Qiskit backend for a fresh QDMI device session.
- sampler(**options: Unpack[QiskitSamplerOptions]) BackendSamplerV2¶
Construct Qiskit’s native sampler with typed keyword options.
- Returns:
A sampler that executes on this backend.
- estimator(**options: Unpack[QiskitEstimatorOptions]) BackendEstimatorV2¶
Construct Qiskit’s native estimator with typed keyword options.
- Returns:
An estimator that executes on this backend.
- run(run_input: QuantumCircuit | Sequence[QuantumCircuit], parameter_values: Sequence[ParametersType] | None = None, **options: Any) QDMIJob¶
Execute one or more
QuantumCircuitinstances on the backend.- Parameters:
run_input – A single quantum circuit or a sequence of quantum circuits to execute.
parameter_values – Optional parameter values to bind to the circuits. If provided, must be a sequence with one entry per circuit. Each entry can be either a dictionary mapping parameters to values, or a sequence of values in the order of circuit.parameters.
**options – Execution options: nonnegative integer
shotsandmax_retries, and booleanmemory. Memory requires genuine QDMI SHOTS results. Simulator seeds are unsupported. Subclasses may declare additional options and encode them in_job_parameters.
- Returns:
Job handle for the execution. For multiple circuits, the job aggregates results from all circuits.
- Raises:
CircuitValidationError – If circuit validation fails (e.g., invalid shots, unbound parameters, parameter_values length mismatch).
UnsupportedOperationError – If a circuit contains unsupported operations.
JobSubmissionError – If job submission to the device fails.
Examples
Run a single circuit with parameter values:
>>> from qiskit.circuit import Parameter, QuantumCircuit >>> theta = Parameter("theta") >>> qc = QuantumCircuit(1) >>> qc.ry(theta, 0) >>> qc.measure_all() >>> job = backend.run(qc, parameter_values=[{theta: 1.5708}])
Run multiple circuits with different parameter values:
>>> qc1 = QuantumCircuit(1) >>> qc1.ry(theta, 0) >>> qc1.measure_all() >>> qc2 = QuantumCircuit(1) >>> qc2.ry(theta, 0) >>> qc2.measure_all() >>> job = backend.run([qc1, qc2], parameter_values=[{theta: 0.5}, {theta: 1.5}])