- Notifications
You must be signed in to change notification settings - Fork188
Fast C++ and Python library for state-vector simulation of quantum circuits.
License
quantumlib/qsim
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
High-performance quantum circuit simulator for C++ and Python.
qsim is a state-vector simulator for quantum circuits. Also known as aSchrödinger simulator, it represents a quantum state as a vector ofcomplex-valued amplitudes (astate vector) and applies matrix-vectormultiplication to simulate transformations that evolve the state over time.
qsim was used to produce landmark cross-entropy benchmark results publishedin 2019 (Arute et al., "Quantum Supremacy Using a Programmable SuperconductingProcessor",Naturevol. 574, 2019).
Being afull state-vector simulator means that qsim computes all the2 n amplitudes of the state vector, wheren is the number ofqubits. The total runtime is proportional tog2n, whereg is thenumber of 2-qubit gates.
To speed up simulation, qsim uses gate fusion (Smelyanskiy et al.,arXiv:1601.07195, 2016; Häner andSteiger,arXiv:1704.01127, 2017),single-precision arithmetic, AVX/FMA instructions for vectorization, andOpenMP for multithreading (on hardware that provides those features).
qsim is highly tuned to take advantage of vector arithmetic instruction setsand multithreading on computers that provide them, as well as GPUs whenavailable.
qsim includes aCirq interface (
qsimcirq)and can be used to simulate quantum circuits written in Cirq.
The code is designed as a library that can be included in users' applications.The sample applications provided in the qsimapps directory can be usedas starting points. More information about the sample applications can be foundin the qsimdocumentation.
The qsim-Cirq Python interface is calledqsimcirq and is available as a PyPIpackage for Linux, MacOS and Windows users. It can be installed by using thefollowing command:
pip install qsimcirq
Note: The core qsim library (located in the source repository under thelib/ subdirectory) canbe included directly in C++ programs without installing the Python interface.
Cirq is a framework for modeling andinvoking Noisy Intermediate-Scale Quantum (NISQ) circuits. Cirq can use qsimas its simulation library. To get started with simulating Cirq circuits usingqsim, please refer to thetutorial.
More detailed information about the qsim-Cirq API can be found in thedocs.
Unit tests for C++ libraries use theGoogleTest framework, and are located intests. Python tests usepytest, and are located inqsimcirq_tests.
To build and run all tests, run:
make run-tests
This will compile all test binaries to files with.x extensions, and run eachtest in series. Testing will stop early if a test fails. It will also run testsof theqsimcirq python interface. To run C++ or python tests only, runmake run-cxx-tests ormake run-py-tests, respectively.
To clean up generated test files, runmake clean from the test directory
Please visit theqsim documentation siteguides, tutorials, and API reference documentation.
When publishing articles or otherwise writing about qsim, please cite the qsimversion you use – it will help others reproduce your results. We use Zenodo topreserve releases. The following links let you download the bibliographicrecord for the latest stable release of qsim in some popular formats:
For formatted citations and records in other formats, as well as records for allreleases of qsim past and present, please visit theqsim page onZenodo.
For any questions or concerns not addressed here, please emailquantum-oss-maintainers@google.com.
This is not an officially supported Google product. This project is noteligible for theGoogle Open Source Software Vulnerability RewardsProgram.
Copyright 2019 Google LLC.
About
Fast C++ and Python library for state-vector simulation of quantum circuits.
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.