A Julia package for generating Bivariate Bicycle (BB) codes — quantum low-density parity-check (LDPC) codes whose distance and encoding rate both grow with the number of physical qubits.
We follow the construction in Bravyi et al. (2024), High-threshold and low-overhead fault-tolerant quantum memory to build the X- and Z-type stabilizers of these CSS codes, and use Gaussian elimination over GF(2) to compute a canonical set of logical operators
All codes in Table 6 of the supplementary material and in Table 3 of arXiv:2308.07915 can be generated directly with this package.
- Install Julia if you haven't already.
- Clone the repository:
git clone git@github.com:paviudes/BicycleBivariateCodes.git - Enter the repo:
cd BicycleBivariateCodes - Start the Julia REPL, then activate and instantiate the package environment:
julia> ]activate . (BicycleBivariateCodes) pkg> instantiate (BicycleBivariateCodes) pkg> resolve
- Press Backspace to leave the package mode, then
exit()to quit the REPL.
- Change into the
expts/directory and start Julia:cd expts/ julia - Activate the package and import it:
julia> ]activate ./../ julia> using BicycleBivariateCodes
- Call the appropriate code-generation function, supplying an output directory via
prefix:Replacejulia> include("generate_bb_codes.jl") julia> bb_code_72(; prefix="./../data/72q_BB_code")
72with anynvalue from Table 3 (e.g.bb_code_90,bb_code_108,bb_code_144,bb_code_288,bb_code_360,bb_code_756).
The output directory will contain:
| File | Contents |
|---|---|
HX.txt |
X-type stabilizers (binary matrix, one row per stabilizer) |
HZ.txt |
Z-type stabilizers |
LX.txt |
X-type logical operators |
LZ.txt |
Z-type logical operators |
parameters.txt |
Code parameters n, k, d |
hyperparameters.txt |
Generation parameters: l, m, polynomials A(x,y) and B(x,y) |
gen_bb_code(l, m, A_monomials, B_monomials; distance) constructs a BB code from the ring parameters l, m and the monomial lists of the polynomials A(x,y) and B(x,y) from Section 4 of the paper. It returns a BBCode struct containing the stabilizers, logical operators, and code parameters.
# [[72, 12, 6]] BB code
bbc = gen_bb_code(6, 6, [(3, 0), (0, 1), (0, 2)], [(0, 3), (1, 0), (2, 0)]; distance=6)save_bb_code(bbc; prefix) writes the stabilizers, logical operators, and parameter files to the given directory:
save_bb_code(bbc; prefix="./../data/72q_BB_code")compute_logical_operators(HX, HZ) accepts the binary parity-check matrices of any CSS code (rows = stabilizers) and returns a canonical pair (LX, LZ) satisfying the symplectic commutation relations — see Wilde (2009) for the algorithm:
LX, LZ = compute_logical_operators(HX, HZ)verify_canonical_commutations(HX, HZ, LX, LZ) checks the canonical commutation relations (Section 3.1 of Gottesman (2013)):
- every X-stabilizer commutes with every logical Z operator,
- every Z-stabilizer commutes with every logical X operator,
-
$\bar{X}_i$ anticommutes with$\bar{Z}_i$ and commutes with$\bar{Z}_j$ for$j \neq i$ .
verify_canonical_commutations(HX, HZ, LX, LZ)