Module backend_qx
- class QuantumInspireBackend(api, provider, configuration=None)[source]
Bases:
BackendV1
Python implementation of a quantum simulator using Quantum Inspire API.
- Parameters:
api (QuantumInspireAPI) – The interface instance to the Quantum Inspire API.
provider (QuantumInspireProvider) – Provider for this backend.
configuration (Optional[QasmBackendConfiguration]) –
The configuration of the Quantum Inspire backend. The configuration must implement the fields given by the QiSimulatorPy.DEFAULT_CONFIGURATION. All configuration fields are listed in the table below. The table rows with an asterisk specify fields which can have a custom value and are allowed to be changed according to the description column.
Key
Type
Description
backend_name
*str
The name of the Quantum Inspire backend. The API can list the name of each available backend using the function api.list_backend_types(). One of the listed names must be used.
backend_version
str
Backend version in the form X.Y.Z.
n_qubits
int
Number of qubits.
basis_gates
list[str]
A list of basis gates to compile to.
gates
GateConfig
List of basis gates on the backend. Not used.
local
bool
Indicates whether the system is running locally or remotely.
simulator
bool
Specifies whether the backend is a simulator or a quantum system.
conditional
bool
Backend supports conditional operations.
open_pulse
bool
Backend supports open pulse. False.
memory
bool
Backend supports memory. True.
max_shots
int
Maximum number of shots supported.
max_experiments
int
Optional: Maximum number of experiments (circuits) per job.
coupling_map
list[list]
Define the edges.
- static strtobool(value)[source]
Convert a string representation of truth to true (1) or false (0). True values are ‘y’, ‘yes’, ‘t’, ‘true’, ‘on’, and ‘1’; false values are ‘n’, ‘no’, ‘f’, ‘false’, ‘off’, and ‘0’. Raises ValueError if ‘val’ is anything else. From source code python 3.11.2 (distutils/util.py) which is deprecated from 3.12
- Parameters:
value (str) –
- Return type:
bool
- run(run_input, shots=None, memory=None, allow_fsp=True, **run_config)[source]
Submits a quantum job to the Quantum Inspire platform.
The execution is asynchronous, and a handle to a job instance is returned.
- Parameters:
run_input (QasmQobj | QuantumCircuit | List[QuantumCircuit]) – An individual or a list of
QuantumCircuit
objects to run on the backend. AQasmQobj
object is also supported but is deprecated.shots (int | None) – Number of repetitions of each circuit, for sampling. Default: 1024 or
max_shots
from the backend configuration, whichever is smaller.memory (bool | None) – If
True
, per-shot measurement bitstrings are returned.allow_fsp (bool) – When
False
, never submit as full_state_projection. This means: turn off possible optimization when running a deterministic circuit on a simulator backend.run_config (Dict[str, Any]) – Extra arguments used to configure the run.
- Returns:
A job that has been submitted.
- Raises:
ApiError – If an unexpected error occurred while submitting the job to the backend.
QiskitBackendError – If the circuit is invalid for the Quantum Inspire backend.
- Return type:
- status()[source]
Return the backend status. Pending jobs is always 0. This information is currently not known.
- Returns:
the status of the backend. Pending jobs is always 0.
- Return type:
BackendStatus
- retrieve_job(job_id)[source]
Retrieve a specified job by its job_id.
- Parameters:
job_id (str) – The job id.
- Returns:
The job that has been retrieved.
- Raises:
QiskitBackendError – If job not found or error occurs during retrieval of the job.
- Return type:
- generate_user_data(experiment, measurements)[source]
Generates the user_data for this experiment. The user_data is saved together with the job and consists of data that is necessary to process the result of the experiment correctly.
- Parameters:
experiment (QasmQobjExperiment) – The experiment that contains the header information to save in the user data.
measurements (Measurements) – The measurement instance containing measurement information and measurement functionality.
- Returns:
A structure with user data that is needed to process the result of the experiment.
- Return type:
Dict[str, Any]
- get_experiment_results_from_latest_run(qi_job)[source]
- Parameters:
qi_job (QIJob) – A job that has already been submitted and which execution is completed.
- Returns:
A list of experiment results; containing the data, execution time, status, etc. for the experiments in the latest job run in the Quantum Inspire project.
- Return type:
List[ExperimentResult]
- get_experiment_results_from_all_jobs(qi_job)[source]
- Parameters:
qi_job (QIJob) – A job that has already been submitted and which execution is completed.
- Returns:
A list of experiment results; containing the data, execution time, status, etc. for all the experiments in all the job runs of the Quantum Inspire project.
- Return type:
List[ExperimentResult]