qrunch.quantum.backends.ibm.qiskit_backend
Module with implementation of a state vector calculation in qiskit.
Classes
Class for handling Qiskit's State Vector simulator or other qiskit-compatible backends. |
|
Job class for handling job on Qiskit's backend. |
|
Class for handling Qiskit's State Vector simulator. |
|
Class for handling Qiskit's State Vector simulator. |
- class QiskitBackend
Bases:
objectClass for handling Qiskit’s State Vector simulator or other qiskit-compatible backends.
- static __new__(cls, qiskit_provider_backend: BackendV2, transpiler: Transpiler[QuantumCircuit] | None = None, *, seed: int | None = None) QiskitRealBackend
- static __new__(cls, qiskit_provider_backend: None = None, transpiler: Transpiler[QuantumCircuit] | None = None, *, seed: int | None = None) QiskitFakeBackend
Initialize a State Vector Backend.
The backend calculates the full state vector of the given circuit, and uses this to find the probabilities for each possible state in the Hilbert space.
- Parameters:
qiskit_provider_backend (BackendV2 | None) – Qiskit backend to use. If None, the state vector simulator will be used. Defaults to None.
transpiler (Transpiler[QuantumCircuit] | None) – Transpiler for converting circuits into a format suitable for the backend.
seed (int | None) – Default seed for the simulator. Defaults to None
- Return type:
- class QiskitBackendJob
Bases:
BackendJobJob class for handling job on Qiskit’s backend.
- __init__(backend: QiskitRealBackend, job_id: str, qiskit_job: PrimitiveJob[PrimitiveResult[SamplerPubResult]]) None
Initialize a Qiskit job.
- Parameters:
backend (QiskitRealBackend) – Backend used for the job.
job_id (str) – id of the job.
qiskit_job (PrimitiveJob[PrimitiveResult[SamplerPubResult]]) – Qiskit job.
- Return type:
None
- property backend: QiskitRealBackend
Backend used for the job.
- cancel() None
Cancel the job.
- Return type:
None
- property job_id: str
ID of the job.
- result() BackendResult
Get the result of the job.
- Return type:
- status() BackendJobStatus
Get the status of the job.
- Return type:
- wait_for_final_state(timeout: float | None = None) None
Wait until the job status is in a final state, i.e.,
DONE,CANCELLED, orFAILED.- Parameters:
timeout (float | None) – Seconds to wait for the job. If
None, wait forever.- Raises:
TimeoutError – If the job does not reach a final state before the specified timeout.
- Return type:
None
- class QiskitFakeBackend
Bases:
BackendClass for handling Qiskit’s State Vector simulator.
- __init__(transpiler: Transpiler[QuantumCircuit] | None = None, *, seed: int | None = None) None
Initialize a State Vector Backend.
The backend calculates the full state vector of the given circuit, and uses this to find the probabilities for each possible state in the Hilbert space.
- Parameters:
transpiler (Transpiler[QuantumCircuit] | None) – Transpiler for converting circuits into a format suitable for the backend.
seed (int | None) – Default seed for the simulator. Defaults to None
- Return type:
None
- property name: str
Name of the backend.
- run(circuits: Circuit | Sequence[Circuit], shots: int | None) QiskitBackendJob | SimulatedJob
Run circuit on the backend.
- Parameters:
- Return type:
- validate_shots_type(shots_type: Type[int | None]) list[str]
Validate that the sampler supports the given shots type. Return a list of error messages if not supported.
- Parameters:
shots_type (Type[int | None])
- Return type:
list[str]
- class QiskitRealBackend
Bases:
HardwareBackendClass for handling Qiskit’s State Vector simulator.
- __init__(qiskit_provider_backend: BackendV2, transpiler: Transpiler[QuantumCircuit] | None = None, *, seed: int | None = None) None
Initialize a State Vector Backend.
The backend calculates the full state vector of the given circuit, and uses this to find the probabilities for each possible state in the Hilbert space.
- Parameters:
qiskit_provider_backend (BackendV2) – Qiskit backend to use.
transpiler (Transpiler[QuantumCircuit] | None) – Transpiler for converting circuits into a format suitable for the backend.
seed (int | None) – Default seed for the simulator. Not used in real backends.
- Return type:
None
- get_device_data() DeviceData
Get device data if available.
Device data is only available if a Qiskit provider backend is used.
- Return type:
- property name: str
Name of the backend.
- run(circuits: Circuit | Sequence[Circuit], shots: int | None) QiskitBackendJob | SimulatedJob
Run circuit on the backend.
- Parameters:
- Return type:
- validate_shots_type(shots_type: Type[int | None]) list[str]
Validate that the sampler supports the given shots type. Return a list of error messages if not supported.
- Parameters:
shots_type (Type[int | None])
- Return type:
list[str]
- verify_backend_works() None
Verify that the backend works by running a simple circuit.
The circuit is run on the actual hardware, so this requires a valid token and may take some time and cost a small number of credits.
- Return type:
None