qoqo_qryd

QRydDemo support for the qoqo quantum toolkit.

qryd_devices

Prototype qoqo devices for Rydberg hardware

api_devices

Devices available on the QRydDemo WebAPI.

pragma_operations

QRyd specific PragmaOperations that support changing the QRyd device during a circuit evaluation

SimulatorBackend(device, /)

Local simulator backend for Rydberg devices.

APIBackend(device, access_token, timeout, ...)

Qoqo backend interfacing QRydDemo WebAPI.

Classes

APIBackend(device, access_token, timeout, ...)

Qoqo backend interfacing QRydDemo WebAPI.

SimulatorBackend(device, /)

Local simulator backend for Rydberg devices.

class qoqo_qryd.APIBackend(device, access_token, timeout, mock_port)

Qoqo backend interfacing QRydDemo WebAPI.

The WebAPI Backend implements methods available in the QRyd Web API. Furthermore, QRyd quantum computer only allows gate operations that are available on a device model of a QRyd device (stored in a [crate::QRydDevice]). This limitation is introduced by design to check the compatability of quantum programs with a model of the QRyd hardware. For simulations of the QRyd quantum computer use the Backend simulator [crate::Backend].

delete_job(job_location, /)

Delete a posted WebAPI job

Parameters:

job_location (str) -- location (url) of the job one is interested in.

Raises:

RuntimeError -- Could not delete job.

static from_bincode(input, /)

Convert the bincode representation of the APIBackend to a APIBackend using the bincode crate.

Parameters:

input (ByteArray) -- The serialized APIBackend (in bincode form).

Returns:

The deserialized APIBackend.

Return type:

APIBackend

Raises:
  • TypeError -- Input cannot be converted to byte array.

  • ValueError -- Input cannot be deserialized to APIBackend.

static from_json(input, /)

Convert the json representation of a APIBackend to a APIBackend.

Parameters:

input (str) -- The serialized APIBackend in json form.

Returns:

The deserialized APIBackend.

Return type:

APIBackend

Raises:

ValueError -- Input cannot be deserialized to APIBackend.

get_job_result(job_location, /)

Get status of a completed WebAPI job.

Parameters:

job_location (str) -- location (url) of the job one is interested in.

Returns

dict: Result of the job.

get_job_status(job_location, /)

Get status of a posted WebAPI job.

Parameters:

job_location (str) -- location (url) of the job one is interested in.

Returns:

status and message of the job.

Return type:

QRydJobStatus(dict)

post_job(quantumprogram, /)

Post to add a new job to be run on the backend and return the location of the job.

Other free parameters of the job (seed, pcz_theta etc.) are provided by the device given during the initializing of the backend.

The returned location is the URL of the job in String form that can be used to query the job status and result or to delete the job.

Parameters:

quantumprogram (qoqo.QuantumProgram) -- qoqo QuantumProgram to be executed.

Returns:

URL of the location of the job.

Return type:

str

run_circuit(circuit, /)

Run a circuit with the QRyd APIBackend.

A circuit is passed to the APIBackend 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 APIBackend.

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 APIBackend.

Parameters:

measurement (Measurement) -- The measurement that is run on the APIBackend.

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 QRyd APIBackend.

An expectation value measurement in general involves several circuits. Each circuit is passed to the APIBackend and executed separately. 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 APIBackend.

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_bincode()

Return the bincode representation of the APIBackend using the bincode crate.

Returns:

The serialized APIBackend (in bincode form).

Return type:

ByteArray

Raises:

ValueError -- Cannot serialize APIBackend to bytes.

to_json()

Return the json representation of the APIBackend.

Returns:

The serialized form of APIBackend.

Return type:

str

Raises:

ValueError -- Cannot serialize APIBackend to json.

class qoqo_qryd.SimulatorBackend(device, /)

Local simulator backend for Rydberg devices.

The QRyd simulator backend applies each operation in a circuit to a quantum register. The underlying simulator uses the QuEST library. Although the underlying simulator supports arbitrary unitary gates, the QRyd simulator only allows operations that are available on a device model of a QRyd device. This limitation is introduced by design to check the compatibility of circuits with a model of the QRyd hardware. For unrestricted simulations use the backend simulator of the roqoqo-quest crate.

The simulator backend implements the qoqo EvaluatingBackend interface and is compatible with running single circuits, running and evaluating measurements and running QuantumPrograms on simulated QRyd devices.

Parameters:

device (Device) -- QRyd device providing information about the available operations.

Raises:

TypeError -- Device Parameter is not QRydDevice

from_bincode()

Convert the bincode representation of the SimulatorBackend to a SimulatorBackend using the bincode crate.

Parameters:

input (ByteArray) -- The serialized SimulatorBackend (in bincode form).

Returns:

The deserialized SimulatorBackend.

Return type:

SimulatorBackend

Raises:
  • TypeError -- Input cannot be converted to byte array.

  • ValueError -- Input cannot be deserialized to SimulatorBackend.

from_json()

Convert the json representation of a SimulatorBackend to a SimulatorBackend.

Parameters:

input (str) -- The serialized SimulatorBackend in json form.

Returns:

The deserialized SimulatorBackend.

Return type:

SimulatorBackend

Raises:

ValueError -- Input cannot be deserialized to SimulatorBackend.

run_circuit()

Run a circuit with the QRyd 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()

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()

Run all circuits corresponding to one measurement with the QRyd backend.

An expectation value measurement in general involves several circuits. Each circuit is passed to the backend and executed separately. 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_bincode()

Return the bincode representation of the SimulatorBackend using the bincode crate.

Returns:

The serialized SimulatorBackend (in bincode form).

Return type:

ByteArray

Raises:

ValueError -- Cannot serialize SimulatorBackend to bytes.

to_json()

Return the json representation of the SimulatorBackend.

Returns:

The serialized form of SimulatorBackend.

Return type:

str

Raises:

ValueError -- Cannot serialize SimulatorBackend to json.