qoqo_quest
QuEST backend for the qoqo quantum toolkit.
Allows the user to run qoqo Circuits on with the help of the QuEST simulator.
|
QuEST backend |
Classes
|
QuEST backend |
- class qoqo_quest.Backend(number_qubits)
QuEST backend
provides functions to run circuits and measurements on with the QuEST quantum simulator.
If different instances of the backend are running in parallel, the results won't be deterministic, even with a random_seed set.
- from_bincode()
Convert the bincode representation of the Backend to a Backend using the [bincode] crate.
- Parameters:
input (ByteArray) -- The serialized Backend (in [bincode] form).
- Returns:
The deserialized Backend.
- Return type:
- Raises:
TypeError -- Input cannot be converted to byte array.
ValueError -- Input cannot be deserialized to Backend.
- from_json()
Convert the json representation of a Backend to a Backend.
- Parameters:
input (str) -- The serialized Backend in json form.
- Returns:
The deserialized Backend.
- Return type:
- Raises:
ValueError -- Input cannot be deserialized to Backend.
- get_imperfect_readout_model()
Get the current imperfect readout model set for the backend.
- Returns:
The current imperfect readout model
- Return type:
ImperfectReadoutModel
- get_random_seed()
Get the current random seed set for the backend.
- Returns:
The current random seed
- Return type:
List[int]
- run_circuit(circuit)
Run a circuit with the QuEST backend.
A circuit is passed to the backend and executed. During execution values are written to and read from classical registers (List[bool], List[float], List[complex]). To produce sufficient statistics for evaluating expectation values, circuits have to be run multiple times. The results of each repetition are concatenated in OutputRegisters (List[List[bool]], List[List[float]], List[List[complex]]). As a simulater Backend the QuEST backend also allows to direclty read out the statevector, density matrix or the expectation values of products of PauliOperators
- Parameters:
circuit (Circuit) -- The circuit that is run on the backend.
- Returns:
The output registers written by the evaluated circuits.
- Return type:
Tuple[Dict[str, List[List[bool]]], Dict[str, List[List[float]]]], Dict[str, List[List[complex]]]]
- Raises:
TypeError -- Circuit argument cannot be converted to qoqo Circuit
RuntimeError -- Running Circuit failed
- run_measurement(measurement)
Evaluates expectation values of a measurement with the backend.
- Parameters:
measurement (Measurement) -- The measurement that is run on the backend.
- Returns:
The dictionary of expectation values.
- Return type:
Optional[Dict[str, float]]
- Raises:
TypeError -- Measurement evaluate function could not be used
RuntimeError -- Internal error measurement.evaluation returned unknown type
- run_measurement_registers(measurement)
Run all circuits corresponding to one measurement with the QuEST backend.
An expectation value measurement in general involves several circuits. Each circuit is passes to the backend and executed separately. A circuit is passed to the backend and executed. During execution values are written to and read from classical registers (List[bool], List[float], List[complex]). To produce sufficient statistics for evaluating expectation values, circuits have to be run multiple times. The results of each repetition are concatenated in OutputRegisters (List[List[bool]], List[List[float]], List[List[complex]]).
- Parameters:
measurement (Measurement) -- The measurement that is run on the backend.
- Returns:
The output registers written by the evaluated circuits.
- Return type:
Tuple[Dict[str, List[List[bool]]], Dict[str, List[List[float]]]], Dict[str, List[List[complex]]]]
- Raises:
TypeError -- Cannot extract constant circuit from measurement
RuntimeError -- Running Circuit failed
- run_program(program, parameters)
Runs a QuantumProgram with the backend.
- Parameters:
program (QuantumProgram) -- The quantum program that is run on the backend.
parameters (List[float]) -- The free parameter inputs for the quantum program.
- Returns:
The dictionary of expectation values.
- Return type:
Optional[Dict[str, float]]
- Raises:
TypeError -- Measurement evaluate function could not be used
RuntimeError -- Internal error measurement.evaluation returned unknown type
- set_imperfect_readout_model(imperfect_readout_model)
Set the imperfect readout model used by the backend. If it is set, the backend will apply the imperfect readout model to the output registers after each run of a circuit.
- Parameters:
imperfect_readout_model (ImperfectReadoutModel) -- The imperfect readout model to use.
- Raises:
TypeError -- ImperfectReadoutModel argument cannot be converted to qoqo ImperfectReadoutModel
- set_random_seed(random_seed)
Set the random seed used by the backend. If different instances of the backend are running in parallel, the results won't be deterministic, even with a random_seed set.
- Parameters:
random_seed (List[int]) -- The random seed to use
- to_bincode()
Return the bincode representation of the Backend using the [bincode] crate.
- Returns:
The serialized Backend (in [bincode] form).
- Return type:
ByteArray
- Raises:
ValueError -- Cannot serialize Backend to bytes.
- to_json()
Return the json representation of the Backend.
- Returns:
The serialized form of Backend.
- Return type:
str
- Raises:
ValueError -- Cannot serialize Backend to json.