mqt.core.qdmi¶
QDMI entities and access to MQT Core’s QDMI driver.
Submodules¶
Package Contents¶
- class Job¶
A job represents a submitted quantum program execution.
- wait(timeout: int = 0) bool¶
Waits for the job to complete.
- Parameters:
timeout – The maximum time to wait in seconds. If 0, waits indefinitely.
- Returns:
True if the job completed within the timeout, False otherwise.
- get_dense_statevector() list[complex]¶
Returns the dense statevector from the job (typically only available from simulator devices).
- get_dense_probabilities() list[float]¶
Returns the dense probabilities from the job (typically only available from simulator devices).
- get_sparse_statevector() dict[str, complex]¶
Returns the sparse statevector from the job (typically only available from simulator devices).
- get_sparse_probabilities() dict[str, float]¶
Returns the sparse probabilities from the job (typically only available from simulator devices).
- query_custom_property(custom_property: CustomProperty, value_type: type[str]) str | None¶
- query_custom_property(custom_property: CustomProperty, value_type: type[bool]) bool | None
- query_custom_property(custom_property: CustomProperty, value_type: type[int]) int | None
- query_custom_property(custom_property: CustomProperty, value_type: type[float]) float | None
- query_custom_property(custom_property: CustomProperty, value_type: type[bytes]) bytes | None
- query_custom_property(custom_property: CustomProperty, value_type: type[str | bool | int | float | bytes]) str | bool | int | float | bytes | None
Query an implementation-defined custom job property.
The caller must provide the type documented by the device implementation. Use
bytesto retrieve the value without interpretation. ReturnsNonewhen the custom slot is unsupported.
- get_custom_result(custom_property: CustomProperty, value_type: type[str]) str | None¶
- get_custom_result(custom_property: CustomProperty, value_type: type[bool]) bool | None
- get_custom_result(custom_property: CustomProperty, value_type: type[int]) int | None
- get_custom_result(custom_property: CustomProperty, value_type: type[float]) float | None
- get_custom_result(custom_property: CustomProperty, value_type: type[bytes]) bytes | None
- get_custom_result(custom_property: CustomProperty, value_type: type[str | bool | int | float | bytes]) str | bool | int | float | bytes | None
Return an implementation-defined custom job result.
The caller must provide the type documented by the device implementation. Use
bytesto retrieve the value without interpretation. ReturnsNonewhen the custom slot is unsupported.
- property program_format: ProgramFormat¶
The format of the submitted program.
- class ProgramFormat¶
Bases:
enum.EnumEnumeration of program formats.
- QASM2 = 0¶
- QASM3 = 1¶
- QIR_BASE_STRING = 2¶
- QIR_BASE_MODULE = 3¶
- QIR_ADAPTIVE_STRING = 4¶
- QIR_ADAPTIVE_MODULE = 5¶
- CALIBRATION = 6¶
- QPY = 7¶
- IQM_JSON = 8¶
- BATCH_JOB = 9¶
- CUSTOM1 = 999999995¶
- CUSTOM2 = 999999996¶
- CUSTOM3 = 999999997¶
- CUSTOM4 = 999999998¶
- CUSTOM5 = 999999999¶
- class CustomProperty¶
Bases:
enum.EnumAn implementation-defined custom property or result slot.
- CUSTOM1 = 1¶
- CUSTOM2 = 2¶
- CUSTOM3 = 3¶
- CUSTOM4 = 4¶
- CUSTOM5 = 5¶
- class Device¶
A device represents a quantum device with its properties and capabilities.
- class Status¶
Bases:
enum.EnumEnumeration of device status.
- OFFLINE = 0¶
- IDLE = 1¶
- BUSY = 2¶
- ERROR = 3¶
- MAINTENANCE = 4¶
- CALIBRATION = 5¶
- regular_sites() list[Site]¶
Returns the list of regular sites (without zone sites) available on the device.
- coupling_map() list[tuple[Site, Site]] | None¶
Returns the coupling map of the device as a list of site pairs.
- supported_program_formats() list[ProgramFormat]¶
Returns the list of program formats supported by the device.
- query_custom_operations(custom_property: CustomProperty) list[Operation] | None¶
Query a custom device property that contains operation handles.
Returns normal
Device.Operationobjects, orNonewhen the custom slot is unsupported. A supported empty list is returned as an empty list.
- query_custom_property(custom_property: CustomProperty, value_type: type[str]) str | None¶
- query_custom_property(custom_property: CustomProperty, value_type: type[bool]) bool | None
- query_custom_property(custom_property: CustomProperty, value_type: type[int]) int | None
- query_custom_property(custom_property: CustomProperty, value_type: type[float]) float | None
- query_custom_property(custom_property: CustomProperty, value_type: type[bytes]) bytes | None
- query_custom_property(custom_property: CustomProperty, value_type: type[str | bool | int | float | bytes]) str | bool | int | float | bytes | None
Query an implementation-defined custom device property.
The caller must provide the type documented by the device implementation. Use
bytesto retrieve the value without interpretation. ReturnsNonewhen the custom slot is unsupported.
- submit_job(program: str, program_format: ProgramFormat, num_shots: int, *, custom1: str | bool | float | None = None, custom2: str | bool | float | None = None, custom3: str | bool | float | None = None, custom4: str | bool | float | None = None, custom5: str | bool | float | None = None) Job¶
- submit_job(program: bytes, program_format: ProgramFormat, num_shots: int, *, custom1: str | bool | float | None = None, custom2: str | bool | float | None = None, custom3: str | bool | float | None = None, custom4: str | bool | float | None = None, custom5: str | bool | float | None = None) Job
Submits an exact byte payload to the device.
- submit_calibration_job(program: str | bytes | None = None, *, custom1: str | bool | float | None = None, custom2: str | bool | float | None = None, custom3: str | bool | float | None = None, custom4: str | bool | float | None = None, custom5: str | bool | float | None = None) Job¶
Triggers a calibration run on the device.
QDMI does not require a program for a calibration run, so
programis optional and may be a string or bytes. When it is given, the device defines what it means, which is usually a configuration for the run. A calibration run executes no circuit, so it takes no shot count.
- class Site¶
A site represents a potential qubit location on a quantum device.
- query_custom_property(custom_property: CustomProperty, value_type: type[str]) str | None¶
- query_custom_property(custom_property: CustomProperty, value_type: type[bool]) bool | None
- query_custom_property(custom_property: CustomProperty, value_type: type[int]) int | None
- query_custom_property(custom_property: CustomProperty, value_type: type[float]) float | None
- query_custom_property(custom_property: CustomProperty, value_type: type[bytes]) bytes | None
- query_custom_property(custom_property: CustomProperty, value_type: type[str | bool | int | float | bytes]) str | bool | int | float | bytes | None
Query an implementation-defined custom site property.
The caller must provide the type documented by the device implementation. Use
bytesto retrieve the value without interpretation. ReturnsNonewhen the custom slot is unsupported.
- class Operation¶
An operation represents a quantum operation that can be performed on a quantum device.
- name(sites: Sequence[Device] = ..., params: Sequence[float] = ...) str¶
Returns the name of the operation.
- qubits_num(sites: Sequence[Device] = ..., params: Sequence[float] = ...) int | None¶
Returns the number of qubits the operation acts on.
- parameters_num(sites: Sequence[Device] = ..., params: Sequence[float] = ...) int¶
Returns the number of parameters the operation has.
- duration(sites: Sequence[Device] = ..., params: Sequence[float] = ...) int | None¶
Returns the duration of the operation.
- fidelity(sites: Sequence[Device] = ..., params: Sequence[float] = ...) float | None¶
Returns the fidelity of the operation.
- interaction_radius(sites: Sequence[Device] = ..., params: Sequence[float] = ...) int | None¶
Returns the interaction radius of the operation.
- blocking_radius(sites: Sequence[Device] = ..., params: Sequence[float] = ...) int | None¶
Returns the blocking radius of the operation.
- idling_fidelity(sites: Sequence[Device] = ..., params: Sequence[float] = ...) float | None¶
Returns the idling fidelity of the operation.
- site_pairs() list[tuple[Device, Device]] | None¶
Returns the list of site pairs the local 2-qubit operation can be performed on.
- mean_shuttling_speed(sites: Sequence[Device] = ..., params: Sequence[float] = ...) int | None¶
Returns the mean shuttling speed of the operation.
- query_custom_property(custom_property: CustomProperty, value_type: type[str], sites: Sequence[Device] = ..., params: Sequence[float] = ...) str | None¶
- query_custom_property(custom_property: CustomProperty, value_type: type[bool], sites: Sequence[Device] = ..., params: Sequence[float] = ...) bool | None
- query_custom_property(custom_property: CustomProperty, value_type: type[int], sites: Sequence[Device] = ..., params: Sequence[float] = ...) int | None
- query_custom_property(custom_property: CustomProperty, value_type: type[float], sites: Sequence[Device] = ..., params: Sequence[float] = ...) float | None
- query_custom_property(custom_property: CustomProperty, value_type: type[bytes], sites: Sequence[Device] = ..., params: Sequence[float] = ...) bytes | None
- query_custom_property(custom_property: CustomProperty, value_type: type[str | bool | int | float | bytes], sites: Sequence[Device] = ..., params: Sequence[float] = ...) str | bool | int | float | bytes | None
Query an implementation-defined custom operation property.
The caller must provide the type documented by the device implementation. Use
bytesto retrieve the value without interpretation. ReturnsNonewhen the custom slot is unsupported.