qxmt.devices.base module#
- class qxmt.devices.base.BaseDevice(platform, device_name, backend_name, n_qubits, shots, random_seed=None, logger=<Logger qxmt.devices.base (INFO)>)
Bases:
object
General-purpose device class for experiment. This class is abstracted to oversee multiple platforms. Provide a common interface within the QXMT library by absorbing differences between platforms.
Examples
>>> from qxmt.devices.base import BaseDevice >>> device = BaseDevice( ... platform="pennylane", ... device_name="default.qubit", ... backend_name=None, ... n_qubits=2, ... shots=100, ... random_seed=42, ... )
- Parameters:
platform (str)
device_name (str)
backend_name (str | None)
n_qubits (int)
shots (int | None)
random_seed (int | None)
logger (Logger)
- __init__(platform, device_name, backend_name, n_qubits, shots, random_seed=None, logger=<Logger qxmt.devices.base (INFO)>)
Initialize the quantum device.
- Parameters:
platform (str) – platform name (ex: pennylane, qulacs, etc.)
device_name (str) – device name provided by the platform (ex: default.qubit, default.tensor, etc.)
backend_name (Optional[str]) – backend name for the IBM Quantum real device
n_qubits (int) – number of qubits
shots (Optional[int]) – number of shots for the quantum circuit
random_seed (Optional[int]) – random seed for the quantum device
logger (Logger)
- Return type:
None
- get_backend()
Get the IBM Quantum real device backend.
- Returns:
IBM Quantum real device backend
- Return type:
IBMBackend | BackendV2
- get_backend_name()
Get the IBM Quantum real device backend name.
- Returns:
IBM Quantum real device backend name
- Return type:
str
- get_ibmq_job_ids(created_after=None, created_before=None)
Get the IBM Quantum job IDs.
- Returns:
IBM Quantum job IDs
- Return type:
list[str]
- Parameters:
created_after (datetime | None)
created_before (datetime | None)
- get_provider()
Get real machine provider name.
- Returns:
provider name
- Return type:
str
- get_service()
Get the IBM Quantum service.
- Returns:
IBM Quantum service
- Return type:
QiskitRuntimeService
- is_simulator()
Check the device is a simulator or real machine.
- Returns:
True if the device is a simulator, False otherwise
- Return type:
bool