This repository provides source code for Stabilizer Extent calculation, Stabilizer Fidelity calculation, and generating all the pure Stabilizer States in computational basis.
This is also the supplemental material for our paper, "Faster computation of nonstabilizerness"(2025).
https://journals-aps-org.utokyo.idm.oclc.org/prapplied/abstract/10.1103/PhysRevApplied.23.014069
We require three setups to run the code.
It is recommended that you prepare a new virtual Python environment and run
pip install -r requirement.txt
to ensure that libraries are compatible.
Or, if you could not build the virtual environment successfully, you can use the following command to install the required libraries:
pip install -e .
pip install tqdm
pip install scipy
pip install numpy
pip install numba
pip install mosek
pip install qutip
pip install cvxopt
pip install qiskit
pip install seaborn
pip install matplotlib
pip install openfermion
Although you can partially run the tutorial.ipynb without this step, but we highly recommended to install MOSEK to accelerate the computation.
We use MOSEK to solve SOCP. You can download the MOSEK software from the MOSEK website. Please get a license file according to the instructions on the website.
Although you can partially run the tutorial.ipynb without this step, but we highly recommended to compile the C++ code to accelerate the computation.
The only file you have to compile is exputils/cpp/calc_dot.cpp
.
You can compile the C++ code by running the following command:
pwd # check the current directory is path to stabilizer_extent
g++ exputils/cpp/calc_dot.cpp -o exputils/cpp/calc_dot.exe -std=c++17 -O2 -mtune=native -march=native -fopenmp -lz
The meaning of each option is as follows:
option | meaning |
---|---|
-o | output file name |
-std=c++17 | use C++17 |
-lz | use zlib (to use npz files in C++) |
-O2 | optimization level 2 (-O3 might be worse than -O2) |
-DNDEBUG | disable assertions (if you want to debug, remove this option) |
-mtune=native | optimize for the machine you are using |
-march=native | optimize for the machine you are using |
-fopenmp | use OpenMP (for parallelization) |
The tutorial notebook is available at tutorial.ipynb.
Copyright (c) 2024 Nobuyuki Yoshioka
This project is licensed under the MIT License - see the LICENSE file for details.
If you have trouble, please feel free to contact us.