quaspy

The Quaspy library for Python for simulating and post-processing various quantum algorithms, including Shor's algorithms and Ekerå–Håstad's variations of Shor's algorithms.

https://github.com/ekera/quaspy

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 46 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.5%) to scientific vocabulary

Keywords

discrete-logarithms factoring-integers quantum-computer-simulator quantum-computing shors-algorithm
Last synced: 6 months ago · JSON representation ·

Repository

The Quaspy library for Python for simulating and post-processing various quantum algorithms, including Shor's algorithms and Ekerå–Håstad's variations of Shor's algorithms.

Basic Info
  • Host: GitHub
  • Owner: ekera
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 1.38 MB
Statistics
  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 5
Topics
discrete-logarithms factoring-integers quantum-computer-simulator quantum-computing shors-algorithm
Created over 2 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

Quaspy

The Quaspy library for Python

The Quaspy (Quantum algorithm simulations in Python) library for Python contains modules that implement:

  • Simulators for the quantum part of Shor's order-finding algorithm [Shor94], modified as in [E24], and the classical post-processing from [E24] that recovers the order in a single run with very high success probability.

Furthermore, these modules implement simulators for the quantum part of Seifert's variation [Seifert01] of Shor's order-finding algorithm [Shor94], as described as in [E24t] and [E21], and with the classical post-processing from [E24t] and [E21] with supporting functions from [E24] that efficiently recovers the order, or a positive integer multiple of the order, in multiple runs when making tradeoffs.

Examples | Documentation | Open In Colab

  • Simulators for factoring general integers via order-finding, and the classical post-processing from [E21b] and [E24] that factors any integer completely in a single order-finding run with very high success probability.

Examples | Documentation | Open In Colab

  • Simulators for the quantum part of Shor's algorithm for computing general discrete logarithms [Shor94], modified as in [E19p], and the classical post-processing from [E19p] that recovers the logarithm given the order in a single run with very high probability of success, and that also efficiently recovers the logarithm given the order when making tradeoffs.

Examples | Documentation | Open In Colab

  • Simulators for the quantum part of Ekerå–Håstad's algorithm for computing short discrete logarithms [EH17], modified as in [E20] and [E23p], and the classical post-processing from [E23p] that recovers the logarithm in a single run with very high probability of success. This algorithm does not require the order to be known.

Furthermore, these modules implement the classical post-processing from [E20] that efficiently recovers the logarithm in multiple runs of the quantum part of Ekerå–Håstad's algorithm when making tradeoffs.

Examples | Documentation | Open In Colab

  • Simulators for factoring RSA integers via short discrete logarithms, by using the reduction in [EH17], modified as in [E20] and [E23p], and the classical post-processing from [E23p] that factors random RSA integers in a single run of the quantum part of Ekerå–Håstad's algorithm with very high probability of success.

Furthermore, these modules implement the classical post-processing from [E20] that efficiently factors random RSA integers in multiple runs of the quantum part of Ekerå–Håstad's algorithm when making tradeoffs.

Examples | Documentation | Open In Colab

All modules, classes, methods and functions in Quaspy are documented using Python docstrings.

Note that Quaspy implements basic support for tradeoffs via a native Python implementation of LLL that is stable and reasonably efficient. See also the Qunundrum repository with its suite of MPI programs that implements support for tradeoffs via LLL and BKZ as implemented by fpLLL. Note furthermore that portions of Quaspy are inherited from the Factoritall repository.

Quaspy is a work in progress, and may be subject to major changes without prior notice. Quaspy was developed for academic research purposes. It grew out of our research project in an organic manner as research questions were posed and answered. It is distributed "as is" without warranty of any kind, either expressed or implied. For further details, see the license.

Notes on known memory leaks in gmpy2

Please note that Quaspy depends on GMP and MPFR via the gmpy2 wrapper for Python3, and that there is a memory leak issue in gmpy2 in versions earlier than 2.2.2a1. If you are experiencing memory leak issues when using Quaspy please make sure that you have version 2.2.2a1 or later of gmpy2 installed.

Prerequisites

To install Python under Ubuntu 24.04 LTS, along with required dependencies, execute:

console $ sudo apt install python3 python3-pip python3-venv $ sudo apt install libgmp-dev libmpfr-dev libmpc-dev

For other Linux and Unix distributions, or operating systems, you may need to download Python and install it manually along with the required dependencies.

Installing the library

To install the latest pre-release of Quaspy via Pip3, execute:

console $ pip3 install --pre quaspy

You may also install Quaspy directly from this repository, by executing:

console $ pip3 install dist/quaspy-1.0.0a1-py3-none-any.whl

If you get get an error message to the effect that the environment is externally managed, you first need to setup a virtual environment, by executing: console $ python3 -m venv quaspy You may then use quaspy/bin/pip3 and quaspy/bin/python3 to install and use Quaspy.

Examples

For examples that illustrate how to use Quaspy, please see the examples directory.

See also the documentation for Quaspy for help on how to use the library.

About and acknowledgments

The Quaspy library was developed by Martin Ekerå, in part at KTH, the Royal Institute of Technology, in Stockholm, Sweden. Valuable comments and advice were provided by Johan Håstad throughout the development process.

Funding and support was provided by the Swedish NCSA that is a part of the Swedish Armed Forces.

Owner

  • Name: Martin Ekerå
  • Login: ekera
  • Kind: user
  • Location: Stockholm, Sweden

Cryptographer with an interest in quantum algorithms.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you cite this software, please cite it as below."
authors:
- family-names: "Ekerå"
  given-names: "Martin"
  orcid: "https://orcid.org/0000-0002-7061-2374"
title: "The Quaspy library for Python"
version: 1.0.0a1
date-released: 2025-08-15
url: "https://github.com/ekera/quaspy"

GitHub Events

Total
  • Release event: 2
  • Watch event: 5
  • Delete event: 3
  • Push event: 21
  • Pull request event: 2
  • Fork event: 1
  • Create event: 4
Last Year
  • Release event: 2
  • Watch event: 5
  • Delete event: 3
  • Push event: 21
  • Pull request event: 2
  • Fork event: 1
  • Create event: 4

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 44 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 1
pypi.org: quaspy

The Quaspy library for Python for simulating and post-processing various quantum algorithms, including Shor's algorithms and Ekerå–Håstad's variations of Shor's algorithms.

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 44 Last month
Rankings
Dependent packages count: 9.5%
Average: 38.8%
Dependent repos count: 68.1%
Maintainers (1)
Last synced: 6 months ago