This repo contains the code and data for the paper Reducing T Gates with Unitary Synthesis. We are actively preparing our method to be a user-friendly package.
Install the dependencies in requirements.txt
. Download the gridsynth binary and put it in src/
. Optionally, install cupy
to enable GPU acceleration. For the best performance, please export CUPY_ACCELERATORS=cub
if cub
is not the default.
-
src/unique_matrices.py
generates the unique matrices and corresponding gate sequences inassets/
. -
src/benchmark_random_unitary.py
synthesizes random single-qubit unitaries. The random unitaries are indata/random_1q/
, and the results are indata/random_unitary/
. -
data/qasm/
contains raw qasm files we perform our circuit experiments on.src/generate_qaoa.py
generates the QAOA qasm files with the gate ordering that maximizes rotation merging. -
src/count_nontrivial_rotations.py
transpiles the raw qasm files with inqiskit
using 16 settings as desribed in the paper and counts the number of nontrivial rotations in the transpiled circuits for each setting. The transpiled circuits with the least rotations for the$R_z$ and$U3$ intermediate representations are stored indata/qasm_transpiled_rz/
anddata/qasm_transpiled_u3/
, respectively. -
src/benchmark_circuits.py
synthesizes the$R_z$ or$U3$ in the transpiled circuits. The results and the synthesized qasm files are indata/circuit_benchmark/
. -
src/pyzx_opt.py
optimizes the synthesized circuits withpyzx
. The data after optimization is updated indata/circuit_benchmark/
. -
src/1q_errors_tradeoff.py
computes the process fidelity of synthesized single-qubit$R_z$ gates under varying logical error rates and synthesis error thresholds to study their tradeoff. The results are indata/logical_error/
.
Install matplotlib
, pandas
, and scipy
. Run src/plot_performance.ipynb
.