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.BackendV2

A Qiskit BackendV2 adapter for QDMI devices.

This backend provides program submission to QDMI devices. It automatically introspects device capabilities and constructs a Target object with supported operations.

Use from_device_id() to open one client-visible device. Use QDMIProvider to 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.

last_job: QDMIJob | None = None
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.

property device: Device

The QDMI device the backend runs on.

property device_id: str | None

Stable QDMI device ID, if known.

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.

property target: Target

The Target describing the capabilities of the backend.

property provider: Any | None

The provider that created the backend.

property max_circuits: int | None

The maximum number of circuits that can be run in a single job.

property options: Options

The backend options.

run(run_input: QuantumCircuit | Sequence[QuantumCircuit], parameter_values: Sequence[ParametersType] | None = None, **options: Any) → QDMIJob

Execute one or more QuantumCircuit instances 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 shots and max_retries, and boolean memory. 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:

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}])