Skip to content
Tushar Pandey

Tool

Bivariate bicycle code explorer

Everything is computed in your browser.

Explore

Bivariate bicycle codes are quantum low-density parity-check codes introduced by Bravyi, Cross, Gambetta, Maslov, Rall and Yoder. Each one is fixed by two whole numbers, l and m, and two polynomials, A and B, in the variables x and y. Type them below or pick a code from the paper’s table to see how many physical and logical qubits the code has, the weights of its checks and how the checks sit on a torus, and to search for a low-weight logical operator. You can copy a link that reproduces the code and download its check matrices.

The code

This tool needs JavaScript: it builds the check matrices and computes the parameters in your browser. The sections below define the codes and say how each number is computed.

The layout needs JavaScript.

Fig. 1The code on an l × m torus of cells. Cell (i, j) stands for the monomial xiyj and holds an X check, an L qubit, an R qubit and a Z check. Select a check to see the qubits it acts on, or a qubit to see its checks, by clicking it or with the controls above; the lines run to the cells they reach without wrapping around the torus, so long-range edges show as long lines. For large l and m the cells are drawn as plain dots.

The search needs JavaScript.

Fig. 2A randomized information-set search for low-weight logical operators, run in a background thread. The lowest weight found is an upper bound on the distance, not a proof of it. The same seed repeats the same sequence of trials. The search stops when you press Stop, after two minutes, or when it reaches the distance the paper gives for a code whose distance is known exactly.

How it works

A bivariate bicycle code is fixed by whole numbers l and m and two polynomials A and B with coefficients in F2, the field with two elements. Let Sl be the l × l cyclic shift matrix, whose row i has a single one, in column i + 1 mod l. Then x = Sl ⊗ Im and y = Il ⊗ Sm are lm × lm matrices with xy = yx and xl = ym = 1, so each monomial xayb is a permutation matrix and A and B are sums of them. The check matrices are HX = [A | B] and HZ = [BT | AT] on n = 2lm qubits: the first lm columns are the left (L) qubits, the rest the right (R) qubits. Since A and B commute, HXHZT = AB + BA = 0, so every X check commutes with every Z check; the tool also checks this directly.

The number of logical qubits is k = n − rank HX − rank HZ, with ranks over F2; the paper shows that it equals 2 dim(ker A ∩ ker B), and the tool computes both. A check has one qubit for each monomial of A and of B, so with three terms in each, as in every code of the paper’s table, every check has weight 6. The Tanner graph joins each check to the qubits it acts on, and the tool counts its connected pieces. The paper’s net encoding rate, r = k/2n, counts n check qubits as well as the n data qubits.

The distance d is the least weight of a logical operator that is not a product of checks; the paper shows that X-type and Z-type logical operators have the same least weight. Computing d exactly is hard in general. The search here repeatedly puts a basis of ker HX or ker HZ in reduced row echelon form, taking the columns in a random order, and tests each row and each sum of two rows. A candidate counts if it has odd overlap with a logical operator of the other type. The lowest weight found is an upper bound on d. For the codes from the table, d is quoted from Table 3 of the paper, where an entry written ≤ is itself an upper bound.

Source: S. Bravyi, A. W. Cross, J. M. Gambetta, D. Maslov, P. Rall and T. J. Yoder, “High-threshold and low-overhead fault-tolerant quantum memory,” Nature 627, 778 (2024), arXiv:2308.07915.

Limits

The tool does not compute the exact distance. The search gives an upper bound, it can miss the true value, and a value it finds proves nothing about lower weights. Nothing here models noise, circuits, decoders or the schedule of syndrome measurements: every number is a property of the check matrices alone. l and m are limited to 60 each and lm to 1,200, so n is at most 2,400; the parameters then still come back in a fraction of a second. The layout turns into plain dots when the cells get small, and the search slows as n grows.

Cite this tool T. Pandey, Bivariate bicycle code explorer (2026), https://pandey-tushar.com/tools/bb-codes.html