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, *, seed: int | None = None, compiler: Compiler | None = None, translator: Translator[QuantumCircuit] | None = None) QiskitRealBackend
- static __new__(cls, qiskit_provider_backend: None = None, *, seed: int | None = None, compiler: Compiler | None = None, translator: Translator[QuantumCircuit] | 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.
seed (int | None) – Default seed for the simulator. Defaults to None
compiler (Compiler | None) – Compiler for changing into universal gates. the compiler must implement the to_universal_gates method. Defaults to
PerGateCompiler.translator (Translator[QuantumCircuit] | None) – Translator for translating universal gates to Qiskit format. Defaults to
QiskitTranslator.
- 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__(*, seed: int | None = None, compiler: Compiler | None = None, translator: Translator[QuantumCircuit] | 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:
seed (int | None) – Default seed for the simulator. Defaults to None
compiler (Compiler | None) – Compiler for changing into universal gates. the compiler must implement the to_universal_gates method. Defaults to
PerGateCompiler.translator (Translator[QuantumCircuit] | None) – Translator for translating universal gates to Qiskit format. Defaults to
QiskitTranslator.
- 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:
- supports_shots_equals_none() bool
Return whether the backend supports shots = None.
- Return type:
bool
- class QiskitRealBackend
Bases:
BackendClass for handling Qiskit’s State Vector simulator.
- __init__(qiskit_provider_backend: BackendV2, *, seed: int | None = None, compiler: Compiler | None = None, translator: Translator[QuantumCircuit] | 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.
seed (int | None) – Default seed for the simulator. Not used in real backends.
compiler (Compiler | None) – Compiler for changing into universal gates. the compiler must implement the to_universal_gates method. Defaults to
PerGateCompiler.translator (Translator[QuantumCircuit] | None) – Translator for translating universal gates to Qiskit format. Defaults to
QiskitTranslator.
- 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:
- supports_shots_equals_none() bool
Return whether the backend supports shots = None.
Qiskit’s backends requires a positive number of shots.
- Return type:
bool