qsim

Fast C++ and Python library for state-vector simulation of quantum circuits.

https://github.com/quantumlib/qsim

Science Score: 77.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 8 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, nature.com, zenodo.org
  • Committers with academic emails
    3 of 40 committers (7.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.9%) to scientific vocabulary

Keywords

algorithms api cirq cpp google-quantum nisq python quantum quantum-algorithms quantum-circuit quantum-circuit-simulator quantum-computing quantum-information quantum-programming quantum-simulation quantum-simulator schrodinger-equation sdk simulation

Keywords from Contributors

distributed deep-neural-networks agents unit-test unitaryhack
Last synced: 4 months ago · JSON representation ·

Repository

Fast C++ and Python library for state-vector simulation of quantum circuits.

Basic Info
Statistics
  • Stars: 597
  • Watchers: 27
  • Forks: 181
  • Open Issues: 65
  • Releases: 54
Topics
algorithms api cirq cpp google-quantum nisq python quantum quantum-algorithms quantum-circuit quantum-circuit-simulator quantum-computing quantum-information quantum-programming quantum-simulation quantum-simulator schrodinger-equation sdk simulation
Created almost 6 years ago · Last pushed 4 months ago
Metadata Files
Readme Contributing License Code of conduct Citation Security Support Zenodo

README.md

# qsim High-performance quantum circuit simulator for C++ and Python. [![Licensed under the Apache 2.0 license](https://img.shields.io/badge/License-Apache%202.0-3c60b1.svg?logo=opensourceinitiative&logoColor=white&style=flat-square)](https://github.com/quantumlib/qsim/blob/main/LICENSE) ![C++](https://img.shields.io/badge/C%2B%2B17-fcbc2c.svg?logo=c%2B%2B&logoColor=white&style=flat-square&label=C%2B%2B) [![qsim project on PyPI](https://img.shields.io/pypi/v/qsim.svg?logo=python&logoColor=white&label=PyPI&style=flat-square&color=e57430)](https://pypi.org/project/qsim) [![Compatible with Python versions 3.10 and higher](https://img.shields.io/badge/Python-3.10+-fcbc2c.svg?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/) [![Archived in Zenodo](https://img.shields.io/badge/10.5281%2Fzenodo.4023103-gray.svg?label=DOI&logo=doi&logoColor=white&style=flat-square&colorA=gray&colorB=3c60b1)](https://doi.org/10.5281/zenodo.4023103) [Features](#features) – [Usage](#usage) – [Documentation](#cirq-documentation) – [Citing qsim](#citing-qsim) – [Contact](#contact)

qsim is a state-vector simulator for quantum circuits. It is highly tuned to take advantage of vector arithmetic instruction sets and multithreading on computers that provide them, as well as GPUs when available. qsim also provides a Cirq interface (qsimcirq) and can be used to simulate quantum circuits written in Cirq.

Introduction

qsim is a Schrödinger full state-vector simulator: it models quantum computations by representing the quantum state of a system as a vector of complex numbers (a state vector) and evolving it through the application of quantum gates. One matrix-vector multiplication corresponds to the application of one gate. Essentially, the simulator performs matrix-vector multiplications repeatedly.

Being a full state-vector simulator means that qsim computes all the 2 n amplitudes of the state vector, where n is the number of qubits. The total runtime is proportional to g2 n, where g is the number of 2-qubit gates. To speed up simulation, qsim uses gate fusion (Smelyanskiy et al., arXiv:1601.07195, 2016; Häner and Steiger, arXiv:1704.01127, 2017), single-precision arithmetic, AVX/FMA instructions for vectorization, and OpenMP for multithreading (on hardware that provides those features).

qsim was used to produce landmark cross-entropy benchmarking results published in 2019 (Arute et al., "Quantum Supremacy Using a Programmable Superconducting Processor", Nature vol. 574, 2019).

Usage

C++ usage

The code is basically designed as a library. The user can modify sample applications in apps to meet their own needs. The usage of sample applications is described in the docs.

Python usage

The qsim-Cirq Python interface is called qsimcirq and is available as a PyPI package for Linux, MacOS and Windows users. It can be installed by using the following command:

shell pip install qsimcirq

qsimcirq is also available for Conda for Linux and MacOS. To install it from conda-forge, you can use the following command:

shell conda install -c conda-forge qsimcirq

Note: The core qsim library (located in the source repository under the lib/ subdirectory) can be included directly in C++ programs without installing the Python interface.

Cirq usage

Cirq is a framework for modeling and invoking Noisy Intermediate-Scale Quantum (NISQ) circuits. Cirq can use qsim as its simulation library. To get started with simulating Cirq circuits using qsim, please refer to the tutorial.

More detailed information about the qsim-Cirq API can be found in the docs.

Input format

[!WARNING] This format is deprecated, and no longer actively maintained.

The circuit input format is described in the docs.

Sample circuits

A number of sample circuits are provided in circuits.

Unit tests

Unit tests for C++ libraries use the GoogleTest framework, and are located in tests. Python tests use pytest, and are located in qsimcirq_tests.

To build and run all tests, run:

shell make run-tests

This will compile all test binaries to files with .x extensions, and run each test in series. Testing will stop early if a test fails. It will also run tests of the qsimcirq python interface. To run C++ or python tests only, run make run-cxx-tests or make run-py-tests, respectively.

To clean up generated test files, run make clean from the test directory

qsim documentation

Please visit the qsim documentation site guides, tutorials, and API reference documentation.

How to cite qsim

Qsim is uploaded to Zenodo automatically. Click on this badge DOI to see all the citation formats for all versions.

An equivalent BibTeX format reference is below for all the versions:

bibtex @software{quantum_ai_team_and_collaborators_2020_4023103, author = {Quantum AI team and collaborators}, title = {qsim}, month = Sep, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4023103}, url = {https://doi.org/10.5281/zenodo.4023103} }

Contact

For any questions or concerns not addressed here, please email quantum-oss-maintainers@google.com.

Disclaimer

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.

Copyright 2019 Google LLC.

Google Quantum AI

Owner

  • Name: quantumlib
  • Login: quantumlib
  • Kind: organization

Google's open source code library for the quantum world

Citation (CITATION.cff)

# Citation information for this repository.                         -*- yaml -*-
#
# CITATION.cff provide human- & machine-readable citation info for software and
# datasets. GitHub, Zenodo, and the Zotero browser plugin all use CFF files
# automatically. Tools exist to generate CITATION.cff files from other formats
# such as BibTeX. For more info, visit https://citation-file-format.github.io/.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cff-version: 1.2.0
message: >-
  Please cite your use of qsim using the reference metadata provided here.

# If preferred-citation is present, GitHub uses its value for the "cite this
# repository" button and ignores the rest of this file; conversely, the Zenodo-
# GitHub integration ignores this field when archiving a new software release
# and uses the metadata in the rest of this file.
preferred-citation:
  type: generic
  authors:
    - family-names: Isakov
      given-names: Sergei V.
      affiliation: Google LLC
    - family-names: Kafri
      given-names: Dvir
      affiliation: Google LLC
    - family-names: Martin
      given-names: Orion
      affiliation: Google LLC
    - family-names: Vollgraff Heidweiller
      given-names: Catherine
      affiliation: Google LLC
    - family-names: Mruczkiewicz
      given-names: Wojciech
      affiliation: Google LLC
    - family-names: Harrigan
      given-names: Matthew P.
      affiliation: Google LLC
    - family-names: Rubin
      given-names: Nicholas C.
      affiliation: Google LLC
    - family-names: Thomson
      given-names: Ross
      affiliation: Google LLC
    - family-names: Broughton
      given-names: Michael B.
      affiliation: Google LLC
    - family-names: Kissell
      given-names: Kevin
      affiliation: Google LLC
    - family-names: Peters
      given-names: Evan
      affiliation: Fermi National Accelerator Laboratory
    - family-names: Gustafson
      given-names: Erik
      affiliation: Fermi National Accelerator Laboratory
    - family-names: Li
      given-names: Andy C. Y.
      affiliation: Fermi National Accelerator Laboratory
    - family-names: Lamm
      given-names: Henry
      affiliation: Fermi National Accelerator Laboratory
    - family-names: Perdue
      given-names: Gabriel
      affiliation: Fermi National Accelerator Laboratory
    - family-names: Ho
      given-names: Alan K.
      affiliation: Google LLC
    - family-names: Strain
      given-names: Doug
      affiliation: Google LLC
    - family-names: Boixo
      given-names: Sergio
      affiliation: Google LLC
  title: >-
    Simulations of Quantum Circuits with Approximate Noise using qsim and Cirq
  year: 2021
  date-published: 2021-11-03
  doi: 10.48550/arXiv.2111.02396
  url: https://arxiv.org/abs/2111.02396

# The remaining metadata in this file describes the current software release.

title: qsim
authors:
  - name: Quantum AI team and collaborators
    website: https://github.com/quantumlib/qsim/graphs/contributors
abstract: High-performance quantum circuit simulator for C++ and Python.
version: 0.22.0
date-released: 2025-06-24
url: https://github.com/quantumlib/qsim
repository-code: https://github.com/quantumlib/qsim
license: Apache-2.0
type: software
identifiers:
  - description: The home page for qsim
    value: https://quantumai.google/qsim
    type: url
  - description: GitHub repository for qsim
    value: https://github.com/quantumlib/qsim
    type: url
  - description: Archival DOI for qsim software releases
    value: 10.5281/zenodo.4067237
    type: doi
  - description: Publication about qsim
    value: 10.48550/arXiv.2111.02396
    type: doi
keywords:
  - algorithms
  - API
  - C++
  - Cirq
  - CUDA
  - gate fusion
  - GPU
  - NISQ
  - noise modeling
  - Noisy Intermediate-Scale Quantum
  - Python
  - quantum
  - quantum circuit
  - quantum computing
  - quantum information
  - quantum programming
  - quantum simulation
  - quantum trajectories
  - research
  - Schrödinger equation
  - science
  - SDK
  - simulation
  - software

GitHub Events

Total
  • Create event: 66
  • Issues event: 64
  • Watch event: 143
  • Delete event: 66
  • Member event: 2
  • Issue comment event: 63
  • Push event: 255
  • Pull request review event: 88
  • Pull request review comment event: 40
  • Pull request event: 154
  • Fork event: 35
Last Year
  • Create event: 66
  • Issues event: 64
  • Watch event: 143
  • Delete event: 66
  • Member event: 2
  • Issue comment event: 63
  • Push event: 255
  • Pull request review event: 88
  • Pull request review comment event: 40
  • Pull request event: 154
  • Fork event: 35

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 1,168
  • Total Committers: 40
  • Avg Commits per committer: 29.2
  • Development Distribution Score (DDS): 0.636
Past Year
  • Commits: 22
  • Committers: 3
  • Avg Commits per committer: 7.333
  • Development Distribution Score (DDS): 0.227
Top Committers
Name Email Commits
Orion Martin 4****n 425
Sergei Isakov i****e@g****m 215
Michael Broughton m****h@g****m 70
Nour Yosri n****i@g****m 66
Ross Thomson j****n@g****m 59
Jae Yoo j****o@g****m 56
Bas Nijholt b****s@n****t 31
eliottrosenberg 6****g 28
Laurynas Tamulevicius l****t@g****m 24
Matthew Neeley m****o@g****m 18
Billy Lamberta b****b@g****m 18
Michael Hucka m****a@g****m 17
Ricardo Olenewa r****a@g****m 15
Jakub Kurzak j****k@a****m 15
Vamsi Krishna Devabathini 4****d 15
Ross Thomson j****n@g****m 12
gecrooks g****c@t****m 12
Ryan LaRose r****e@u****u 9
hosseinberg h****y@g****m 6
Bálint Pató b****p@g****m 6
Bernardo Meurer b****o@m****g 6
Yipeng Huang y****g@c****u 5
vtomole v****2@g****m 5
Pavol Juhas j****s@g****m 5
jlow2397 5****7 4
Jan Hosang h****g 4
Dave Bacon d****n@g****m 3
Douglas Thor d****r@g****m 3
Kevin J. Sung k****g@g****m 3
Burt Holzman b****t@f****v 2
and 10 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 123
  • Total pull requests: 305
  • Average time to close issues: 7 months
  • Average time to close pull requests: 9 days
  • Total issue authors: 42
  • Total pull request authors: 21
  • Average comments per issue: 2.07
  • Average comments per pull request: 0.65
  • Merged pull requests: 223
  • Bot issues: 0
  • Bot pull requests: 13
Past Year
  • Issues: 41
  • Pull requests: 182
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 7 days
  • Issue authors: 10
  • Pull request authors: 7
  • Average comments per issue: 0.34
  • Average comments per pull request: 0.17
  • Merged pull requests: 119
  • Bot issues: 0
  • Bot pull requests: 13
Top Authors
Issue Authors
  • mhucka (31)
  • 95-martin-orion (29)
  • rht (7)
  • MichaelBroughton (5)
  • maffoo (3)
  • richrines1 (3)
  • NoureldinYosri (3)
  • vtomole (2)
  • ochapman-dphil (2)
  • Hosseinberg (2)
  • laurynasas (2)
  • jaeyoo (2)
  • kevinsung (2)
  • honamnguyen (1)
  • hthayko (1)
Pull Request Authors
  • mhucka (155)
  • 95-martin-orion (45)
  • NoureldinYosri (14)
  • dependabot[bot] (13)
  • basnijholt (11)
  • eliottrosenberg (10)
  • sergeisakov (10)
  • jaeyoo (9)
  • pavoljuhas (8)
  • maffoo (5)
  • vtomole (4)
  • angelo-laskaris (2)
  • dougthor42 (2)
  • google-admin (2)
  • lexi-nadia (2)
Top Labels
Issue Labels
area/devops (12) area/health (8) area/gpu (7) area/docs (5) area/tests (3) area/circuits (2) area/c++ (2) platform/windows (2) area/performance (1) area/qsimcirq (1) platform/mac (1) bug (1) qsimcirq (1) dependencies (1)
Pull Request Labels
area/health (37) area/devops (24) area/dependencies (12) area/python (7) area/docs (4) size: L (4) size: S (4) size: M (4) Size: XS (4) cla: yes (3) dependencies (3) kokoro:run (2) github_actions (2) area/tests (2) python (1)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 10,375 last-month
  • Total docker downloads: 62
  • Total dependent packages: 2
    (may contain duplicates)
  • Total dependent repositories: 5
    (may contain duplicates)
  • Total versions: 93
  • Total maintainers: 2
pypi.org: qsimcirq

Schrödinger and Schrödinger-Feynman simulators for quantum circuits.

  • Versions: 45
  • Dependent Packages: 2
  • Dependent Repositories: 4
  • Downloads: 9,620 Last month
  • Docker Downloads: 62
Rankings
Docker downloads count: 3.0%
Dependent packages count: 3.2%
Downloads: 3.2%
Stargazers count: 3.3%
Average: 4.0%
Forks count: 4.2%
Dependent repos count: 7.5%
Maintainers (2)
Last synced: 4 months ago
proxy.golang.org: github.com/quantumlib/qsim
  • Versions: 44
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.6%
Average: 6.8%
Dependent repos count: 7.0%
Last synced: 4 months ago
pypi.org: qsim

High-performance quantum circuit simulation library

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 755 Last month
Rankings
Dependent packages count: 10.1%
Dependent repos count: 21.5%
Average: 23.0%
Stargazers count: 25.1%
Downloads: 28.4%
Forks count: 29.8%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/bazeltest.yml actions
  • actions/checkout v2 composite
.github/workflows/cirq_compatibility.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v1 composite
.github/workflows/dockertest.yml actions
  • actions/checkout v2 composite
.github/workflows/python_format.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v1 composite
.github/workflows/release_wheels.yml actions
  • actions/checkout v2 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v2 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/testing_wheels.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v2 composite
Dockerfile docker
  • debian latest build
docker-compose.yml docker
  • qsim latest
  • qsim-cxx-tests latest
  • qsim-py-tests latest
install/tests/Dockerfile docker
  • debian latest build
install/tests/docker-compose.yml docker
  • qsim-install latest
jupyter/Dockerfile docker
  • debian bullseye build
pybind_interface/Dockerfile docker
  • qsim latest build
tests/Dockerfile docker
  • qsim latest build
dev-requirements.txt pypi
  • black * development
  • flynt * development
  • pytest * development
requirements.txt pypi
  • absl-py *
  • cirq-core *
  • numpy *
  • pybind11 *
  • typing_extensions *
setup.py pypi