18 releases (7 breaking)

Uses new Rust 2021

new 1.0.0-alpha.1 May 18, 2022
0.11.3 Apr 11, 2022
0.10.0 Feb 11, 2022
0.9.0 Nov 24, 2021
0.5.1 Jul 29, 2021

#1 in Simulation

Download history 26/week @ 2022-01-27 778/week @ 2022-02-03 753/week @ 2022-02-10 474/week @ 2022-02-17 388/week @ 2022-02-24 36/week @ 2022-03-03 64/week @ 2022-03-10 429/week @ 2022-03-17 359/week @ 2022-03-24 77/week @ 2022-03-31 645/week @ 2022-04-07 32/week @ 2022-04-14 190/week @ 2022-04-21 281/week @ 2022-04-28 138/week @ 2022-05-05 324/week @ 2022-05-12

951 downloads per month
Used in 2 crates

Apache-2.0

675KB
9K SLoC

qoqo logo

qoqo

Quantum Operation Quantum Operation
Yes we use reduplication

qoqo is a toolkit to represent quantum circuits by HQS Quantum Simulations.

This repository contains two components:

  • roqoqo: the core rust library
  • qoqo: the python interface to roqoqo

What roqoqo/qoqo is:

  • A toolkit to represent quantum operations and circuits
  • 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_mock, qoqo_qasm)

What roqoqo/qoqo is not:

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

roqoqo

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

roqoqo provides:

  • A circuit struct to represent quantum programs
  • Single-Qubit, Two-Qubit and Multi-Qubit Operations that can be executed (decomposed) on any universal quantum computer
  • PRAGMA Operations that only apply to certain hardware, simulators or annotate circuits with additional information
  • Classical Registers and Measurement operations to use with a quantum program
  • Measurement structs for evaluating observable measurements based on projective measurements from quantum hardware or simulator readouts
  • A Backend trait defining a standard for interfacing from qoqo to other toolkits, hardware and simulators that can return measured values
  • Serialize and deserialize support for circuits and measurement information via the serde crate.

Installation

To use roqoqo in a Rust project simply add

roqoqo = {version="0.8"}

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

qoqo

Documentation Status GitHub Workflow Status PyPI PyPI - Format Crates.io Crates.io

qoqo provides a full python interface to the underlying roqoqo library, including:

  • A circuit class to represent quantum programs
  • Single-Qubit, Two-Qubit and Multi-Qubit Operations that can be executed (decomposed) on any universal quantum computer
  • PRAGMA Operations that only apply to certain hardware, simulators or annotate circuits with additional information
  • Classical Register and Measurement operations to use with a quantum program
  • Measurement structs for evaluating observable measurements based on projective measurements from quantum hardware or simulator readouts
  • A QuantumProgram class combining circuits and measurement information in complete quantum programms with a simple interface
  • Serialization to json and deserialization from json for circuits and measurement information. Serialization support can easily be expanded to other targets with the help of the serde crate.

Installation

On Linux and macOS on x86 precompiled packages can be found on PyPi and installed via

pip install qoqo

For other platforms we recommend using the source distribution from PyPi to build a python package for qoqo locally via pip. The install requires the maturin tool (also available via pip) and a working rust toolchain. Specifically for macOS on Apple Silicon the following build command should be used:

RUSTFLAGS="-C link-arg=-undefined -C link-arg=dynamic_lookup" pip install qoqo

Alternatively one can check out the latest tagged version from github and use the maturin tool to build a python package for qoqo locally and install it via pip. Please note that the package should be built from the top level directory of the workspace selecting the qoqo package with the -m qoqo/Cargo.toml option. Specifically for macOS on Apple Silicon the following build command should be used.

RUSTFLAGS="-C link-arg=-undefined -C link-arg=dynamic_lookup" maturin build -m qoqo/Cargo.toml  --release
pip install target/wheels/$NAME_OF_WHEEL

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

qoqo = {version="0.9", 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.47 and a maturin version { >= 0.12, <0.13 } in order to be built.

Examples

Since qoqo provides a full python interface to the underlying roqoqo library, there are examples for python users and for Rust users.

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

Contributing

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

Dependencies

~8–13MB
~256K SLoC