qoqo_aqt
AQT backend for the qoqo quantum toolkit.
Allows the user to run qoqo Circuits on AQT simulators and AQT hardware (soon). Note that a valid AQT access token is required to run circuits.
|
AQT backend |
AQT Devices |
Classes
|
AQT backend |
- class qoqo_aqt.Backend(device, access_token=None)
AQT backend
provides functions to run circuits and measurements on AQT devices.
- static from_bincode(input)
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.
- static from_json(input)
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.
- run_circuit(circuit)
Run a circuit with the AQT 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]]).
- 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 AQT 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 -- Circuit argument cannot be converted to qoqo Circuit
RuntimeError -- Running Circuit failed
- to_aqt_json(circuit)
Create an AQT json represenstaion of a Circuit.
- Parameters:
circuit (Circuit) -- The circuit that is translated to a AQT json.
- Returns:
The output registers written by the evaluated circuits.
- Return type:
str
- Raises:
TypeError -- Circuit argument cannot be converted to qoqo Circuit
RuntimeError -- Translating Circuit failed
- 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.