Skip to main content

Python tools for the study of quantum information.

Project description

|toqito⟩: Theory of Quantum Information Toolkit

build status doc status codecov DOI Downloads

The |toqito⟩ package is an open-source Python library for studying various objects in quantum information, namely, states, channels, and measurements.

Documentation

|toqito⟩ focuses on providing numerical tools to study problems about entanglement theory, nonlocal games, matrix analysis, and other aspects of quantum information that are often associated with computer science.

|toqito⟩ aims to fill the needs of quantum information researchers who want numerical and computational tools for manipulating quantum states, measurements, and channels. It can also be used as a tool to enhance the experience of students and instructors in classes about quantum information.

Installing

|toqito⟩ is available via PyPi for Linux and macOS, with support for Python 3.12 to 3.14.

pip install toqito

Examples

For the full documentation, please consult: Documentation | Examples

Example: Nonlocal games

Nonlocal games are a mathematical framework that abstractly models a physical system. The CHSH game is a subtype of nonlocal game referred to as an XOR game that characterizes the seminal CHSH inequality.

For XOR games, there exist optimization problems (that are provided via |toqito⟩) that one can compute to attain the optimal values of such games when the players use either a classical or quantum strategy.

# Calculate the classical and quantum value of the CHSH game.
import numpy as np
from toqito.nonlocal_games.xor_game import XORGame

# The probability matrix.
prob_mat = np.array([[1/4, 1/4], [1/4, 1/4]])

# The predicate matrix.
pred_mat = np.array([[0, 0], [0, 1]])

# Define CHSH game from matrices.
chsh = XORGame(prob_mat, pred_mat)

chsh.classical_value()
# 0.75
chsh.quantum_value()
# 0.8535533

Indeed, using a quantum strategy for the CHSH game gives the known optimal result of $\frac{1}{4}\left(2 + \sqrt{2}\right) \approx 0.8535...$

Example: Quantum state distinguishability

Quantum state distinguishability is a fundamental task in quantum information theory. Consider the set of four Bell states:

$$ \begin{equation} \begin{aligned} |\psi_0\rangle = \frac{1}{\sqrt{2}} \left(|00\rangle + |11\rangle\right), \quad |\psi_1\rangle = \frac{1}{\sqrt{2}} \left(|00\rangle - |11\rangle\right), \ |\psi_2\rangle = \frac{1}{\sqrt{2}} \left(|01\rangle + |10\rangle\right), \quad |\psi_3\rangle = \frac{1}{\sqrt{2}} \left(|01\rangle - |10\rangle\right). \end{aligned} \end{equation} $$

The optimal probability of globally distinguishing the four Bell states (assuming an equal weighting of probability) is 1 (i.e., it can be performed perfectly). However, under a more restrictive set of measurements (such as PPT measurement operators), the optimal probability of distinguishing the four Bell states using PPT operators is 1/2.

|toqito⟩ offers a wide suite of functionality for computing the distinguishability of quantum states:

from toqito.states import bell
from toqito.state_opt import state_distinguishability

# Define the set of states as the four Bell states:
states = [bell(0), bell(1), bell(2), bell(3)]

# Distinguishing four Bell states (global measurements): 0.9999999999767388
pos_res, _ = state_distinguishability(states)
print(f"Distinguishing four Bell states (global measurements): {pos_res}")

# Distinguishing four Bell states (PPT measurements): 0.5000000000098367
ppt_res, _ = state_distinguishability(states, measurement="ppt", subsystems=[0], dimensions=[2, 2])
print(f"Distinguishing four Bell states (PPT measurements): {ppt_res}")

Consult the quantum state tutorials for additional examples and information about quantum states within the context of |toqito⟩.

Testing

The pytest module is used for testing. To run the suite of tests for |toqito⟩, run the following command in the root directory of this project.

pytest --cov-report term-missing --cov=toqito

Citing

You can cite |toqito⟩ using the following DOI: 10.5281/zenodo.4743211

If you are using the |toqito⟩ software package in research work, please include an explicit mention of |toqito⟩ in your publication. Something along the lines of:

To solve problem "X", we used |toqito⟩; a package for studying certain
aspects of quantum information.

A BibTeX entry that you can use to cite |toqito⟩ is provided here:

@misc{toqito,
   author       = {Vincent Russo},
   title        = {toqito: A {P}ython toolkit for quantum information},
   howpublished = {\url{https://github.com/vprusso/toqito}},
   month        = May,
   year         = 2021,
   doi          = {10.5281/zenodo.4743211}
 }

Research

The |toqito⟩ project is, first and foremost, a quantum information theory research tool. Consult the following open problems wiki page for a list of certain solved and unsolved problems in quantum information theory in which |toqito⟩ could be potentially helpful in probing. Feel free to add to this list and/or contribute solutions!

The |toqito⟩ project has been used or referenced in the following works:

  • a Johnston, Nathaniel and Russo, Vincent "Distinguishability of locally diagonal orthogonally invariant quantum states", arXiv:2606.12808, (2026).

  • a Gupta, Tathagata and Mohan, Ankith and Murshid, Shayeef and Russo, Vincent and Sikora, Jamie and Zeng, Alice "Local strategies are pretty good at computing Boolean properties of quantum sequences", arXiv:2603.05452, (2026).

  • a Arun, Venkat, Vijay Chidambaram, and Scott Aaronson "Faster-than-light coordination for networked systems with quantum non-local games", Proceedings of the 24th ACM Workshop on Hot Topics in Networks, (2025).

  • a Lovitz, Benjamin and Johnston, Nathaniel and Russo, Vincent and Sikora, Jamie "The complexity of perfect quantum state classification", arXiv:2510.20789, (2025).

  • a Johnston, Nathaniel and Russo, Vincent and Sikora, Jamie "Tight bounds for antidistinguishability and circulant sets of pure quantum states", Quantum 9, 1622, (2025).

  • a Philip, Aby "On Multipartite Entanglement and Its Use", (2024).

  • a Almasi, Ali "Quantum Guessing Games", (2024).

  • a Gupta, Tathagata and Mushid, Shayeef and Russo, Vincent and Bandyopadhyay, Somshubhro "Optimal discrimination of quantum sequences", Physical Review A, 110, 062426, (2024).

  • a Bandyopadhyay, Somshubhro and Russo, Vincent "Distinguishing a maximally entangled basis using LOCC and shared entanglement", Physical Review A 110, 042406, (2024).

  • a Tavakoli, Armin and Pozas-Kerstjens, Alejandro and Brown, Peter and Araújo, Mateus "Semidefinite programming relaxations for quantum correlations", Reviews of Modern Physics, Volume 96, (2024).

  • a Pelofske, Elijah and Bartschi, Andreas and Eidenbenz, Stephan and Garcia, Bryan and Kiefer, Boris "Probing Quantum Telecloning on Superconducting Quantum Processors", IEEE Transactions on Quantum Engineering, (2024).

  • a Philip, Aby and Rethinasamy, Soorya and Russo, Vincent and Wilde, Mark. "Quantum Steering Algorithm for Estimating Fidelity of Separability", Quantum 8, 1366, (2023).

  • a Miszczak, Jarosław Adam. "Symbolic quantum programming for supporting applications of quantum computing technologies", Companion Proceedings of the 7th International Conference on the Art, Science, and Engineering of Programming, (2023).

  • a Casalé, Balthazar and Di Molfetta, Giuseppe and Anthoine, Sandrine and Kadri, Hachem. "Large-Scale Quantum Separability Through a Reproducible Machine Learning Lens", (2023).

  • a Russo, Vincent and Sikora, Jamie "Inner products of pure states and their antidistinguishability", Physical Review A, Vol. 107, No. 3, (2023).

Contributing

All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.

A detailed overview of how to contribute can be found in the contributing guide.

Chat with us in our |toqito⟩ channel on Discord.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toqito-1.2.0.tar.gz (449.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toqito-1.2.0-py3-none-any.whl (680.0 kB view details)

Uploaded Python 3

File details

Details for the file toqito-1.2.0.tar.gz.

File metadata

  • Download URL: toqito-1.2.0.tar.gz
  • Upload date:
  • Size: 449.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for toqito-1.2.0.tar.gz
Algorithm Hash digest
SHA256 2f7f7df756d78eda1da1c040abea096c515b28dc0ddef70cc3674d919a092e2b
MD5 a183ce297b6cf630ec359353e2ddcce6
BLAKE2b-256 56e7b86c475d97f3efac75022b5aca23ad6ef78b4186b5601f23f68e0e2ba09a

See more details on using hashes here.

Provenance

The following attestation bundles were made for toqito-1.2.0.tar.gz:

Publisher: publish-release.yml on vprusso/toqito

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file toqito-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: toqito-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 680.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for toqito-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c9d1aea7fda25e9faa408cc0c9652aa0ddf2f6278e83ba9470c4e931aef8076
MD5 17d34b845d0b35fa761f06393e84a760
BLAKE2b-256 113237d13f54f25f2897fa6d31f1200def3d931f7bd5c9ae0dc0a4ff3f85ea61

See more details on using hashes here.

Provenance

The following attestation bundles were made for toqito-1.2.0-py3-none-any.whl:

Publisher: publish-release.yml on vprusso/toqito

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page