87 releases (41 stable)

1.19.2 Mar 11, 2025
1.18.1 Jan 29, 2025
1.16.1 Nov 7, 2024
1.15.2-alpha.1 Jul 25, 2024
0.5.1 Jul 29, 2021

#181 in Simulation

Download history 521/week @ 2024-12-01 532/week @ 2024-12-08 934/week @ 2024-12-15 88/week @ 2024-12-22 36/week @ 2024-12-29 189/week @ 2025-01-05 299/week @ 2025-01-12 519/week @ 2025-01-19 1261/week @ 2025-01-26 1386/week @ 2025-02-02 1393/week @ 2025-02-09 666/week @ 2025-02-16 362/week @ 2025-02-23 1201/week @ 2025-03-02 960/week @ 2025-03-09 2296/week @ 2025-03-16

4,977 downloads per month
Used in 21 crates

Apache-2.0

770KB
13K SLoC

roqoqo

Crates.io GitHub Workflow Status docs.rs Crates.io codecov

roqoqo is the core rust library for qoqo - a toolkit to represent quantum circuits by HQS Quantum Simulations.

For a detailed introduction see the user documentation and the qoqo examples repository.

What roqoqo is:

  • A toolkit to represent quantum programs including circuits and measurement information
  • A thin runtime to run quantum measurements
  • A way to serialize quantum circuits and measurement information
  • A set of optional interfaces to devices, simulators and toolkits (e.g. qoqo_quest, qoqo_qiskit, qoqo_for_braket, qoqo_iqm)

What roqoqo is not:

  • A decomposer translating circuits to a specific set of gates
  • A quantum circuit optimizer
  • A collection of quantum algorithms

If you are looking for a comprehensive package that integrates all these features, we invite you to explore our HQStage software.

Installation

To use roqoqo in a Rust project simply add

roqoqo = {version="1.0"}

to the [dependencies] section of the project Cargo.toml.

When using qoqo in a rust project providing a python interface add

qoqo = {version="1.0", default-features=false}

to the [dependencies] section of the project Cargo.toml.

A source distribution now exists but requires a Rust install with a rust version > 1.76 and a maturin version { >=1.0 } in order to be built.

Examples

For an expanded collection of examples please see the jupyter notebooks in the qoqo_examples repository. The qoqo examples require the qoqo_quest and qoqo_mock interfaces.

The jupyter notebooks in Rust can be found in qoqo_examples/roqoqo/notebooks/. Alternatively, you can also find pure Rust versions of the examples in qoqo_examples/roqoqo/standalone/

Features

roqoqo provides:

  • A Circuit struct to represent quantum circuits
  • A QuantumProgram enum to represent quantum programs using different measurement methods
  • Structs representing single-qubit, two-qubit, multi-qubit and measurement operations that can be executed (decomposed) on any universal quantum computer
  • Structs representing so-called PRAGMA operations that only apply to certain hardware, simulators or annotate circuits with additional information
  • Enums that group operations based on the properties of operations (e.g. Operation for all operations or SingleQubitGateOperation for all unitary operations acting on a single qubit)
  • Support for symbolic variables
  • Readout based on classical registers
  • Measurement structs for evaluating observable measurements based on raw readout date returned by quantum computer backends
  • An EvaluatingBackend trait defining a standard for interfacing from qoqo to hardware and simulators that can return measured values
  • A Device trait defining a standard to obtain connectivity information and a noise model for quantum computing devices
  • Serialize and deserialize support for Circuit and QuantumProgram via the serde crate.

Please refer to the API documentation for technical details on roqoqo functionalities.

Support

This project has been partly supported by PlanQK and is partially supported by QSolid and PhoQuant.

Contribution

We welcome contributions to the project. If you want to contribute code, please have a look at CONTRIBUTE.md for our code contribution guidelines.

In order to facilitate the contribution of the addition of a new gate, please also have a look at add_new_gate.md to read a quick explanation of the main steps necessary.

Citation

If you use qoqo, please cite it by including the URL of this github repository, or using the provided BibTeX entry:

@misc{qoqo2021,
      title={qoqo - toolkit to represent quantum circuits},
      author={HQS Quantum Simulations GmbH},
      year={2021},
      url={https://github.com/HQSquantumsimulations/qoqo},
}

Dependencies

~8–16MB
~222K SLoC