QuantumExpanders.jl

QuantumExpanders.jl is a Julia library for constructing quantum Tanner (QT) codes and explicit constructions of expander graphs. The package is built on Oscar, and QuantumClifford.

The library supports two complementary descriptions of QT codes:

It also implements explicit Morgenstern and Lubotzky-Phillips-Sarnak Ramanujan graph families.

Connection to the manuscript

The code instances from Quantum Tanner Codes at Moderate Blocklength are reconstructed in the package's tests. See Reproducing the manuscript instances for the mapping from published data to constructor inputs.

Start here

If this is your first visit, follow the pages in this order:

  1. Getting started to install the package, construct a small code, and inspect its CSS matrices.
  2. Quantum Tanner Codes to learn about the LRCC and the role of the local tensor codes.
  3. Quantum Tanner Codes via Left-Right Actions to learn the lifted construction and its three constructors.
  4. Reproducing the manuscript instances to reconstruct and validate the published moderate-blocklength examples.

Choose a workflow

If you have...Start with...Main requirement
An LRCC group and symmetric generating setsQuantumTannerCodeThe generating sets satisfy the LRCC conditions
Group elements that may repeat, or two unequal local-code lengthsQuantumTannerViaLeftRightActionsEach local parity-check/generator pair is dual
An even prime power and want explicit optimal expandersmorgenstern_generatorsThe extension degree is even
Suitable odd primes $p,q$LPS$p,q\equiv1\pmod4$ and $p\ne q$

All code constructors return an AbstractCSSCode. Once a code is constructed, the standard interface is available:

hx = parity_matrix_x(code)
hz = parity_matrix_z(code)
n = code_n(code)
k = code_k(code)

The resulting objects can be passed to QuantumClifford distance algorithm, decoders, and circuit tools without a package-specific conversion step.

Quantum Tanner code constructions

flowchart TD QT["Quantum Tanner Codes"] QT --> LRCC["LRCC construction"] QT --> Lifted["Lifted QT code via left-right actions"] QT --> Search["Randomized search helpers"] LRCC --> QTC["QuantumTannerCode"] Lifted --> LRA["QuantumTannerViaLeftRightActions"] Search --> RQTC["random_quantum_Tanner_code"]

QuantumTannerCode

Constructs a quantum Tanner code directly from the bipartite LRCC. This is the geometric square-complex description and requires symmetric generating sets satisfying the total non-conjugacy condition.

QuantumTannerViaLeftRightActions

Constructs the same QT-code framework from the lifted algebraic description, using commuting left and right regular actions of a finite group. This form is especially useful for explicit code searches, repeated group elements, and independent local-code lengths.

random_quantum_Tanner_code

Provides a convenient randomized interface for generating local codes and constructing LRCC-based quantum Tanner codes from a chosen group and generating sets.

LRCC quick example

The following example constructs a quantum Tanner code using explicit Morgenstern generators of $\mathrm{SL}_2(\mathbb{F}_4)$.

julia> using QuantumExpanders, Oscar, QECCore, QuantumClifford, QuantumClifford.ECC

julia> using Random: MersenneTwister

julia> l = 1; i = 2;

julia> SL₂, B = morgenstern_generators(l, i);

julia> A = alternative_morgenstern_generators(B, FirstOnly());

julia> rng = MersenneTwister(892529278);

julia> hx, hz = random_quantum_Tanner_code(0.75,SL₂,A,B;rng = rng,);

julia> c = CSS(hx, hz);

julia> code_n(c), code_k(c)
(360, 61)

The parity-check matrices can be passed directly to the rest of the QECCore / QuantumClifford.ECC ecosystem. For example, one may estimate or compute distances using any supported distance algorithm:

julia> import JuMP; import HiGHS

julia> dz = distance(c,DistanceMIPAlgorithm(solver = HiGHS.Optimizer,logical_operator_type = :Z,time_limit = 900,),);

julia> dx = distance(c,DistanceMIPAlgorithm(solver = HiGHS.Optimizer,logical_operator_type = :X,time_limit = 900,),);

julia> (dx, dz)
(10, 3)

Lifted quantum Tanner code example

The lifted construction works directly with commuting left and right actions of a finite group. For example, the following reconstructs a $[[288, 8, (≤ 15, ≤ 15)]]$ quantum Tanner code over $S_3$:

julia> using QuantumExpanders, Oscar, QECCore

julia> G = codomain(isomorphism(PermGroup, small_group(6, 1)));

julia> A = [one(G), one(G), cperm(G, [2,3]), cperm(G, [2,3]), cperm(G, [1,2,3]), cperm(G, [1,2]), cperm(G, [1,2]), cperm(G, [1,3,2]),];

julia> B = [one(G), one(G), cperm(G, [2,3]), cperm(G, [1,2,3]), cperm(G, [1,2]), cperm(G, [1,3,2]),];

julia> H844 = [1 0 0 0 0 1 1 1;
               0 1 0 0 1 0 1 1;
               0 0 1 0 1 1 0 1;
               0 0 0 1 1 1 1 0];

julia> G844 = [0 1 1 1 1 0 0 0;
               1 0 1 1 0 1 0 0;
               1 1 0 1 0 0 1 0;
               1 1 1 0 0 0 0 1];

julia> H633 = [1 0 0 0 1 1;
               0 1 0 1 0 1;
               0 0 1 1 1 0];

julia> G633 = [0 1 1 1 0 0;
               1 0 1 0 1 0;
               1 1 0 0 0 1];

julia> c = QuantumTannerViaLeftRightActions(G,A,B,H844,G844,H633,G633;p1 = 1:8,p2 = [1,2,4,3,6,5],);

julia> code_n(c), code_k(c)
(288, 8)

The corresponding CSS parity-check matrices are available through

julia> hx, hz = parity_matrix_xz(c);

For the construction itself, see Quantum Tanner Codes via Left-Right Actions, which explains the multisets $A,B$, the column permutations $p1,p2$, and the commuting left/right regular actions.

Explicit Ramanujan graph constructions

QuantumExpanders.jl also implements two explicit families of Ramanujan graphs:

flowchart TB R["Ramanujan Graphs"] R --> LPS["Lubotzky–Phillips–Sarnak<br/>odd prime-power setting"] R --> Morgenstern["Morgenstern<br/>even prime-power setting"]

These graph constructions can be used independently of the quantum Tanner code routines.

The corresponding documentation pages include worked examples and utilities for studying spectral expansion, girth, diameter, chromatic number, and independence properties.

Package overview

The main workflows are:

  • construct QT codes directly from LRCC data with QuantumTannerCode;
  • construct lifted QT codes with QuantumTannerViaLeftRightActions;
  • generate candidate QT codes with random_quantum_Tanner_code;
  • construct explicit LPS and Morgenstern Ramanujan graphs;
  • pass the resulting CSS parity-check matrices to QECCore and QuantumClifford.ECC for code analysis and decoding workflows.

Research and citation

The moderate-blocklength constructions are described in (Mian et al., 2026). The LRCC construction originates with (Leverrier and Zémor, Apr 2022), and the lifted QT code formulation used by QuantumTannerViaLeftRightActions follows (Leverrier et al., 2025).

References

  • Leverrier, A.; Rozendaal, W. and Zémor, G. (2025). Small quantum Tanner codes from left–right Cayley complexes, arXiv preprint arXiv:2512.20532.
  • Leverrier, A. and Zémor, G. (Apr 2022). Quantum Tanner Codes, arXiv:2202.13641 [quant-ph].
  • Mian, F. A.; Addala, V. L.; Meraj, A.; Chadha, A. and Krastanov, S. (2026). Quantum Tanner Codes at Moderate Blocklength, arXiv preprint arXiv:2608.12509.