Magic State Factory Catalog

[\![2813,\,1,\,3]\!] factory

\mathrm{T}_{0}

distance, proved here
3\le d\le 29 certified 29
error coefficient
—
\gamma_\rho
2.3586†
V_{\mathrm{ex}}
1
wires
N=711
Clifford correction
none with T powers
found by
pre-existing pure T

The circuit

The 711\times2813 matrix. Rows are wires and columns are rotations. A 1 means the wire takes part in the rotation, and the number beside each wire is its row weight.

  • output wires
  • check wires, measured and postselected

This matrix has 711 rows and 2,813 columns, 2,000,043 cells, too many to draw here. Download it as a CSV or copy the columns (see Download).

The gate is read off the output rows. An output row of odd weight gives a T, a pair of output rows with odd overlap gives a CS, and an odd triple overlap gives a CCZ. The circuit is a valid factory because every such parity that touches a check row is even.

Figures of merit

inputs n2813Noisy T states per run.
outputs k1
distance d≥ 3A lower bound proved here. Its source certifies d\ge 29, and a fault of weight 29 is shown below, so d=29.
error coefficient A_{3}not definedUndefined while the distance is only a lower bound.
wires N711
checks r710
V_{\mathrm{ex}}1T states per run. CCZ counts as two.
\gamma_\rho = \log(n/V_{\mathrm{ex}})/\log d7.2291Overhead per extractable T state. Lower is better. At the certified d=29: 2.3586.
\gamma = \log(n/k)/\log d7.2291Overhead per output qubit. At the certified d=29: 2.3586.
\gamma_T = \log(n/T)/\log d7.2291Overhead per unit of T-count. At the certified d=29: 2.3586.
T-count1Minimal T-count of the output gate.
phase-polynomial degree1Minimised over changes of output basis.
effective width1Rank of the output rows modulo the check rows.

Output gate

1 T0 CS0 CCZon 1 output wire

As gates: \mathrm{T}_{0}

As monomials: 0 (output wires per term, separated by +)

This row stands for every gate that a CNOT circuit and S, Z and CZ gates on the outputs can reach from this one. They all prepare the same magic state. The wires are shown in the S_k-canonical frame.

Clifford correction

With every rotation a \mathrm{T}=\mathrm{diag}(1,e^{i\pi/4}), the rotations deposit the gate above times a diagonal Clifford. Undo it after the rotations and before the checks are measured, with 63 single-wire gates and 64 \mathrm{CZ} gates: \mathrm{Z} on output 0, \mathrm{Z} on check 507, \mathrm{Z} on check 508, \mathrm{Z} on check 509, \mathrm{Z} on check 510, \mathrm{Z} on check 514, \mathrm{Z} on check 516, \mathrm{Z} on check 518, \mathrm{Z} on check 522, \mathrm{Z} on check 523, \mathrm{Z} on check 527, \mathrm{Z} on check 532, \mathrm{Z} on check 533, \mathrm{Z} on check 534, \mathrm{Z} on check 539, \mathrm{Z} on check 541, \mathrm{Z} on check 542, \mathrm{Z} on check 543, \mathrm{Z} on check 544, \mathrm{Z} on check 548, \mathrm{Z} on check 551, \mathrm{Z} on check 554, \mathrm{Z} on check 556, \mathrm{Z} on check 607 and 103 more (listed below). The circuit's action is then exactly the gate above, and an error-free run passes every check with certainty.

All 127 correction gates

\mathrm{Z} on output 0, \mathrm{Z} on check 507, \mathrm{Z} on check 508, \mathrm{Z} on check 509, \mathrm{Z} on check 510, \mathrm{Z} on check 514, \mathrm{Z} on check 516, \mathrm{Z} on check 518, \mathrm{Z} on check 522, \mathrm{Z} on check 523, \mathrm{Z} on check 527, \mathrm{Z} on check 532, \mathrm{Z} on check 533, \mathrm{Z} on check 534, \mathrm{Z} on check 539, \mathrm{Z} on check 541, \mathrm{Z} on check 542, \mathrm{Z} on check 543, \mathrm{Z} on check 544, \mathrm{Z} on check 548, \mathrm{Z} on check 551, \mathrm{Z} on check 554, \mathrm{Z} on check 556, \mathrm{Z} on check 607, \mathrm{Z} on check 608, \mathrm{Z} on check 609, \mathrm{Z} on check 610, \mathrm{Z} on check 611, \mathrm{Z} on check 612, \mathrm{Z} on check 613, \mathrm{Z} on check 614, \mathrm{Z} on check 615, \mathrm{Z} on check 616, \mathrm{Z} on check 617, \mathrm{Z} on check 618, \mathrm{Z} on check 619, \mathrm{Z} on check 620, \mathrm{Z} on check 621, \mathrm{Z} on check 622, \mathrm{Z} on check 623, \mathrm{Z} on check 624, \mathrm{Z} on check 625, \mathrm{Z} on check 626, \mathrm{Z} on check 627, \mathrm{Z} on check 628, \mathrm{Z} on check 629, \mathrm{Z} on check 653, \mathrm{Z} on check 656, \mathrm{Z} on check 657, \mathrm{Z} on check 660, \mathrm{Z} on check 661, \mathrm{Z} on check 663, \mathrm{Z} on check 664, \mathrm{Z} on check 667, \mathrm{Z} on check 670, \mathrm{Z} on check 672, \mathrm{Z} on check 700, \mathrm{Z} on check 702, \mathrm{Z} on check 704, \mathrm{S} on check 706, \mathrm{Z} on check 707, \mathrm{S}^\dagger on check 708, \mathrm{S} on check 710, \mathrm{CZ} on output 0, check 706, \mathrm{CZ} on output 0, check 708, \mathrm{CZ} on output 0, check 710, \mathrm{CZ} on check 507, check 704, \mathrm{CZ} on check 508, check 704, \mathrm{CZ} on check 509, check 704, \mathrm{CZ} on check 510, check 704, \mathrm{CZ} on check 514, check 704, \mathrm{CZ} on check 516, check 704, \mathrm{CZ} on check 518, check 704, \mathrm{CZ} on check 522, check 704, \mathrm{CZ} on check 523, check 704, \mathrm{CZ} on check 527, check 704, \mathrm{CZ} on check 532, check 704, \mathrm{CZ} on check 533, check 704, \mathrm{CZ} on check 534, check 704, \mathrm{CZ} on check 539, check 704, \mathrm{CZ} on check 541, check 704, \mathrm{CZ} on check 542, check 704, \mathrm{CZ} on check 543, check 704, \mathrm{CZ} on check 544, check 704, \mathrm{CZ} on check 548, check 704, \mathrm{CZ} on check 551, check 704, \mathrm{CZ} on check 554, check 704, \mathrm{CZ} on check 556, check 704, \mathrm{CZ} on check 607, check 702, \mathrm{CZ} on check 608, check 702, \mathrm{CZ} on check 609, check 702, \mathrm{CZ} on check 610, check 702, \mathrm{CZ} on check 611, check 702, \mathrm{CZ} on check 612, check 702, \mathrm{CZ} on check 613, check 702, \mathrm{CZ} on check 614, check 702, \mathrm{CZ} on check 615, check 702, \mathrm{CZ} on check 616, check 702, \mathrm{CZ} on check 617, check 702, \mathrm{CZ} on check 618, check 702, \mathrm{CZ} on check 619, check 702, \mathrm{CZ} on check 620, check 702, \mathrm{CZ} on check 621, check 702, \mathrm{CZ} on check 622, check 702, \mathrm{CZ} on check 623, check 702, \mathrm{CZ} on check 624, check 702, \mathrm{CZ} on check 625, check 702, \mathrm{CZ} on check 626, check 702, \mathrm{CZ} on check 627, check 702, \mathrm{CZ} on check 628, check 702, \mathrm{CZ} on check 629, check 702, \mathrm{CZ} on check 653, check 700, \mathrm{CZ} on check 656, check 700, \mathrm{CZ} on check 657, check 700, \mathrm{CZ} on check 660, check 700, \mathrm{CZ} on check 661, check 700, \mathrm{CZ} on check 663, check 700, \mathrm{CZ} on check 664, check 700, \mathrm{CZ} on check 667, check 700, \mathrm{CZ} on check 670, check 700, \mathrm{CZ} on check 672, check 700, \mathrm{CZ} on check 706, check 707, \mathrm{CZ} on check 706, check 708, \mathrm{CZ} on check 706, check 709, \mathrm{CZ} on check 706, check 710, \mathrm{CZ} on check 708, check 709, \mathrm{CZ} on check 708, check 710

Or no Clifford gate at all: run \mathrm{T}^3 on rotations 1, 3, 5, 6, 8, 10, 12, 14, 17, 21, 22, 23, 27, 29, 30, 32, 33, 35, 37, 40, 41, 42, 43, 45 and 940 more (listed below); \mathrm{T}^5 on rotations 199, 971, 1496, 1663; \mathrm{T}^\dagger on rotations 0, 780, and \mathrm{T} on the rest. A power of \mathrm{T} costs one magic state, like \mathrm{T} itself. For a code this is a transversal \mathrm{T} gate, \mathrm{T}^j on each qubit.

All 964 rotations at T³

1, 3, 5, 6, 8, 10, 12, 14, 17, 21, 22, 23, 27, 29, 30, 32, 33, 35, 37, 40, 41, 42, 43, 45, 48, 49, 52, 54, 55, 56, 57, 59, 66, 67, 69, 71, 75, 76, 77, 79, 83, 87, 88, 89, 90, 91, 94, 96, 97, 99, 201, 203, 206, 208, 210, 212, 214, 215, 217, 218, 219, 223, 224, 225, 227, 230, 233, 235, 237, 238, 243, 245, 246, 249, 250, 252, 257, 259, 260, 261, 262, 263, 264, 267, 269, 271, 272, 273, 277, 279, 280, 281, 283, 284, 285, 291, 292, 294, 297, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 408, 409, 410, 413, 414, 416, 417, 419, 422, 424, 428, 429, 430, 434, 437, 439, 441, 442, 444, 445, 446, 447, 451, 452, 454, 456, 457, 458, 461, 462, 463, 465, 466, 469, 473, 474, 476, 481, 485, 492, 588, 595, 596, 597, 598, 602, 603, 606, 609, 611, 612, 614, 616, 617, 618, 622, 623, 624, 626, 627, 629, 631, 634, 639, 640, 641, 644, 646, 650, 651, 655, 658, 659, 661, 662, 663, 666, 668, 669, 670, 671, 673, 674, 675, 677, 678, 679, 680, 681, 682, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 781, 782, 783, 784, 785, 790, 791, 792, 795, 796, 798, 799, 801, 804, 806, 810, 811, 812, 816, 819, 821, 823, 824, 826, 827, 828, 829, 833, 834, 836, 838, 839, 840, 843, 844, 845, 847, 848, 851, 855, 856, 858, 863, 867, 874, 970, 977, 978, 979, 980, 984, 985, 988, 991, 993, 994, 996, 998, 999, 1000, 1004, 1005, 1006, 1008, 1009, 1011, 1013, 1016, 1021, 1022, 1023, 1026, 1028, 1032, 1033, 1037, 1040, 1041, 1043, 1044, 1045, 1048, 1050, 1051, 1052, 1053, 1055, 1056, 1057, 1059, 1060, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1162, 1165, 1167, 1169, 1171, 1173, 1174, 1178, 1180, 1184, 1185, 1186, 1187, 1188, 1190, 1192, 1193, 1194, 1196, 1197, 1201, 1203, 1206, 1207, 1208, 1210, 1211, 1213, 1214, 1217, 1220, 1221, 1223, 1225, 1228, 1231, 1232, 1234, 1237, 1239, 1242, 1244, 1328, 1329, 1332, 1334, 1336, 1338, 1340, 1341, 1345, 1347, 1351, 1352, 1353, 1354, 1355, 1357, 1359, 1360, 1361, 1363, 1364, 1368, 1370, 1373, 1374, 1375, 1377, 1378, 1380, 1381, 1384, 1387, 1388, 1390, 1392, 1395, 1398, 1399, 1401, 1404, 1406, 1409, 1411, 1495, 1830, 1832, 1837, 1838, 1841, 1842, 1843, 1844, 1846, 1847, 1848, 1849, 1855, 1857, 1858, 1859, 1860, 1861, 1864, 1866, 1871, 1872, 1873, 1877, 1878, 1880, 1932, 1933, 1935, 1940, 1941, 1944, 1945, 1946, 1947, 1949, 1950, 1951, 1952, 1958, 1960, 1961, 1962, 1963, 1964, 1967, 1969, 1974, 1975, 1976, 1980, 1981, 1983, 2035, 2036, 2038, 2039, 2041, 2043, 2046, 2047, 2049, 2055, 2057, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2072, 2073, 2074, 2077, 2078, 2079, 2080, 2084, 2087, 2133, 2137, 2139, 2140, 2142, 2144, 2147, 2148, 2150, 2156, 2158, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2173, 2174, 2175, 2178, 2179, 2180, 2181, 2185, 2188, 2234, 2238, 2239, 2241, 2242, 2248, 2250, 2251, 2253, 2255, 2256, 2257, 2258, 2261, 2262, 2263, 2264, 2266, 2267, 2268, 2272, 2273, 2276, 2316, 2319, 2322, 2323, 2324, 2325, 2326, 2328, 2331, 2333, 2338, 2339, 2344, 2348, 2349, 2350, 2353, 2354, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2398, 2399, 2400, 2401, 2402, 2403, 2407, 2409, 2410, 2413, 2414, 2419, 2421, 2423, 2424, 2425, 2429, 2430, 2467, 2468, 2469, 2470, 2471, 2472, 2476, 2478, 2479, 2482, 2483, 2488, 2490, 2492, 2493, 2494, 2498, 2499, 2629, 2632, 2633, 2639, 2640, 2641, 2642, 2643, 2644, 2646, 2647, 2648, 2651, 2672, 2673, 2675, 2676, 2679, 2680, 2681, 2682, 2683, 2690, 2694, 2695, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715, 2716, 2718, 2722, 2723, 2724, 2726, 2728, 2740, 2741, 2745, 2746, 2747, 2749, 2751, 2763, 2765, 2766, 2768, 2774, 2780, 2781, 2784, 2786, 2787, 2788, 2789, 2790, 2792, 2793, 2794, 2795, 2796

Rotations are numbered by matrix column, from 0. The correction comes from the columns by the weight expansion of Bravyi and Haah (2012). verify_catalog.py re-derives it, checks the corrected circuit's phase input by input against the gate, and on small circuits simulates it gate by gate.

Convert the output with CNOT and S

A CNOT circuit on the outputs, followed by S, Z and CZ gates, turns this factory's gate into other gates that prepare the same magic state. Type a target gate to check whether it is reachable. If it is, you get the circuit, checked on every basis state.

Or list every gate it reaches. The list is built in your browser and saved as a text file, one gate per line.

Python code that writes the same list
import json, urllib.request

NAMES = {1: "T", 2: "CS", 3: "CCZ"}


def equivalent_gates(k, terms, limit=1_000_000):
    """Every gate a CNOT circuit and S, Z, CZ gates reach from this one.

    A gate is its set of terms mod Clifford: {a} is T, {a,b} is CS and
    {a,b,c} is CCZ on those outputs. CNOT c->t sends x_t to
    x_c + x_t - 2 x_c x_t, so a term on t but not c adds the term with t
    replaced by c, and, below CCZ, the term with c added.
    """
    start = frozenset(frozenset(m) for m in terms)
    seen, queue = {start}, [start]
    for gate in queue:
        for c in range(k):
            for t in range(k):
                if c == t:
                    continue
                new = set(gate)
                for m in gate:
                    if t in m and c not in m:
                        new ^= {(m - {t}) | {c}}
                        if len(m) < 3:
                            new ^= {m | {c}}
                new = frozenset(new)
                if new not in seen:
                    seen.add(new)
                    queue.append(new)
                    if len(seen) > limit:
                        raise RuntimeError(f"more than {limit} equivalent gates")
    return seen


def name(gate, k):
    sep = "," if k > 10 else ""
    terms = sorted((sorted(m) for m in gate), key=lambda m: (len(m), m))
    return "·".join(NAMES[len(m)] + sep.join(map(str, m)) for m in terms) or "I"


url = "https://shubhamj810.github.io/magic-state-factory-repo/data/factories/2813.1.3.a.json"
record = json.load(urllib.request.urlopen(url))
k = record["parameters"]["k"]
gates = equivalent_gates(k, record["gate"]["monomials"])
lines = sorted(name(g, k) for g in gates)
print(len(lines), "equivalent gates")
with open("equivalent-gates-2813.1.3.a.txt", "w") as out:
    out.write("\n".join(lines) + "\n")

Distance

3\le d\le 29. No fault of weight below 3 is both undetectable and damaging. None of weight 3 has been found, and one of weight 29 is, so the distance lies between the two.

A damaging fault of weight 29 sits on columns [0,199,398,589,780,971,1162,1329,1496,1663,1830,1933,2036,2137,2238,2317,2396,2465,2534,2581,2628,2673,2718,2741,2764,2781,2798,2805,2812].

Its source certifies d\ge 29, as a lower bound. That certificate is not re-checked here, but rankings on this site may use it. With the damaging fault of weight 29 above, it makes the distance exactly d=29. Source: Jain and Albert (arXiv:2408.12752), Table I: [[199,1,31]] quantum QR code (extended QR [200,100,32]) doubled onto [[2415,1,27]]; the doubling theorem of their Sec. III gives d >= min(d_sd, d_tri + 2) = 29, with d_sd at least the classical distance less one (their Lemma 2.4); the [[69,1,13]] input's distance is proved here by enumerating every word of SD70 through the punctured coordinate.

A fault is a set of faulty columns. It is undetectable when their check parts cancel, and damaging when their output parts do not.

Original source

S. P. Jain and V. V. Albert, "Transversal Clifford and T-gate codes of short length and high distance," IEEE J. Sel. Areas Inf. Theory 6, 127-137 (2025); arXiv:2408.12752. doi.org/10.1109/JSAIT.2025.3570832

Provenance

a code of the triorthogonal family of Jain and Albert (arXiv:2408.12752, Table I; transversal_t_codes/), self-dual CSS codes doubled onto [[95,1,7]], rebuilt here from the paper's construction; a verified witness, not a maximum

Found by: Jain-Albert doubling: triorthogonal family

Discovery: pre-existing

1 recorded source
[
 {
  "regime": "Jain-Albert doubling: triorthogonal family",
  "file": "transversal_t_codes/factories.json",
  "label": "JA-2813",
  "N": 711,
  "d": 3,
  "d_is_exact": false,
  "origin": "S. P. Jain and V. V. Albert, \"Transversal Clifford and T-gate codes of short length and high distance\", IEEE J. Sel. Areas Inf. Theory 6, 127 (2025), arXiv:2408.12752",
  "provenance": "[[199,1,31]] quantum QR code (extended QR [200,100,32]) doubled onto [[2415,1,27]] (Table I)",
  "notes": "its [[69,1,13]] input is the self-dual [70,35,12] code found by transversal_t_codes/search_sd70.py, whose words through the punctured coordinate all weigh at least 14, in place of the paper's [70,35,14] code, which is only formally self-dual"
 }
]

Use it in code

Load this factory and re-derive every number from its circuit with the catalogue's own verifier.

# git clone https://github.com/shubhamj810/magic-state-factory-repo
# cd magic-state-factory-repo/master_catalog
import json, urllib.request
import verify_catalog as VC

url = "https://shubhamj810.github.io/magic-state-factory-repo/data/factories/2813.1.3.a.json"
record = json.load(urllib.request.urlopen(url))
columns = record["circuit"]["columns"]
k, N = record["parameters"]["k"], record["parameters"]["N"]

facts, problems = VC.derive(columns, k, N)    # gate, T-count, degree, ...
distance = VC.measure_distance(columns, k, N)  # exhaustive fault search
print(facts["gate_human"], distance["d_exact"] or distance["d_at_least"],
      problems or "verified")

Raw record

Show the JSON this page is built from

Source: master_catalog.json, factories[1464].