The circuit
The 807\times3195 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.
This matrix has 807 rows and 3,195 columns, 2,578,365 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
Output gate
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 29 single-wire gates and 34 \mathrm{CZ} gates: \mathrm{S}^\dagger on output 0, \mathrm{Z} on check 606, \mathrm{Z} on check 607, \mathrm{Z} on check 608, \mathrm{Z} on check 609, \mathrm{Z} on check 613, \mathrm{Z} on check 615, \mathrm{Z} on check 617, \mathrm{Z} on check 621, \mathrm{Z} on check 622, \mathrm{Z} on check 626, \mathrm{Z} on check 631, \mathrm{Z} on check 632, \mathrm{Z} on check 633, \mathrm{Z} on check 638, \mathrm{Z} on check 640, \mathrm{Z} on check 641, \mathrm{Z} on check 642, \mathrm{Z} on check 643, \mathrm{Z} on check 647, \mathrm{Z} on check 650, \mathrm{Z} on check 653, \mathrm{Z} on check 655, \mathrm{Z} on check 799 and 39 more (listed below). The circuit's action is then exactly the gate above, and an error-free run passes every check with certainty.
All 63 correction gates
\mathrm{S}^\dagger on output 0, \mathrm{Z} on check 606, \mathrm{Z} on check 607, \mathrm{Z} on check 608, \mathrm{Z} on check 609, \mathrm{Z} on check 613, \mathrm{Z} on check 615, \mathrm{Z} on check 617, \mathrm{Z} on check 621, \mathrm{Z} on check 622, \mathrm{Z} on check 626, \mathrm{Z} on check 631, \mathrm{Z} on check 632, \mathrm{Z} on check 633, \mathrm{Z} on check 638, \mathrm{Z} on check 640, \mathrm{Z} on check 641, \mathrm{Z} on check 642, \mathrm{Z} on check 643, \mathrm{Z} on check 647, \mathrm{Z} on check 650, \mathrm{Z} on check 653, \mathrm{Z} on check 655, \mathrm{Z} on check 799, \mathrm{S} on check 801, \mathrm{Z} on check 802, \mathrm{S}^\dagger on check 803, \mathrm{S} on check 805, \mathrm{Z} on check 806, \mathrm{CZ} on output 0, check 801, \mathrm{CZ} on output 0, check 803, \mathrm{CZ} on output 0, check 805, \mathrm{CZ} on check 606, check 799, \mathrm{CZ} on check 607, check 799, \mathrm{CZ} on check 608, check 799, \mathrm{CZ} on check 609, check 799, \mathrm{CZ} on check 613, check 799, \mathrm{CZ} on check 615, check 799, \mathrm{CZ} on check 617, check 799, \mathrm{CZ} on check 621, check 799, \mathrm{CZ} on check 622, check 799, \mathrm{CZ} on check 626, check 799, \mathrm{CZ} on check 631, check 799, \mathrm{CZ} on check 632, check 799, \mathrm{CZ} on check 633, check 799, \mathrm{CZ} on check 638, check 799, \mathrm{CZ} on check 640, check 799, \mathrm{CZ} on check 641, check 799, \mathrm{CZ} on check 642, check 799, \mathrm{CZ} on check 643, check 799, \mathrm{CZ} on check 647, check 799, \mathrm{CZ} on check 650, check 799, \mathrm{CZ} on check 653, check 799, \mathrm{CZ} on check 655, check 799, \mathrm{CZ} on check 801, check 802, \mathrm{CZ} on check 801, check 803, \mathrm{CZ} on check 801, check 804, \mathrm{CZ} on check 801, check 805, \mathrm{CZ} on check 801, check 806, \mathrm{CZ} on check 803, check 804, \mathrm{CZ} on check 803, check 805, \mathrm{CZ} on check 803, check 806, \mathrm{CZ} on check 805, check 806
Or no Clifford gate at all: run \mathrm{T}^3 on rotations 201, 203, 206, 208, 210, 212, 214, 215, 217, 218, 219, 223, 224, 225, 227, 230, 233, 235, 237, 238, 243, 245, 246, 249 and 687 more (listed below); \mathrm{T}^5 on rotations 1369, 1894, 2061; \mathrm{T}^\dagger on rotations 0, 1, 3, 5, 6, 8, 10, 12, 14, 17, 21, 22, 23, 27, 29, 30, 32, 33, 35, 37, 40, 41, 42, 43 and 30 more (listed below), 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 711 rotations at T³
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, 400, 402, 403, 405, 407, 409, 411, 414, 418, 419, 420, 424, 426, 427, 429, 430, 432, 434, 437, 438, 439, 440, 442, 445, 446, 449, 451, 452, 453, 454, 456, 463, 464, 466, 468, 472, 473, 474, 476, 480, 484, 485, 486, 487, 488, 491, 493, 494, 496, 596, 599, 601, 602, 604, 606, 608, 610, 613, 617, 618, 619, 623, 625, 626, 628, 629, 631, 633, 636, 637, 638, 639, 641, 644, 645, 648, 650, 651, 652, 653, 655, 662, 663, 665, 667, 671, 672, 673, 675, 679, 683, 684, 685, 686, 687, 690, 692, 693, 695, 795, 1179, 1180, 1181, 1182, 1183, 1188, 1189, 1190, 1193, 1194, 1196, 1197, 1199, 1202, 1204, 1208, 1209, 1210, 1214, 1217, 1219, 1221, 1222, 1224, 1225, 1226, 1227, 1231, 1232, 1234, 1236, 1237, 1238, 1241, 1242, 1243, 1245, 1246, 1249, 1253, 1254, 1256, 1261, 1265, 1272, 1368, 1375, 1376, 1377, 1378, 1382, 1383, 1386, 1389, 1391, 1392, 1394, 1396, 1397, 1398, 1402, 1403, 1404, 1406, 1407, 1409, 1411, 1414, 1419, 1420, 1421, 1424, 1426, 1430, 1431, 1435, 1438, 1439, 1441, 1442, 1443, 1446, 1448, 1449, 1450, 1451, 1453, 1454, 1455, 1457, 1458, 1459, 1460, 1461, 1462, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1560, 1563, 1565, 1567, 1569, 1571, 1572, 1576, 1578, 1582, 1583, 1584, 1585, 1586, 1588, 1590, 1591, 1592, 1594, 1595, 1599, 1601, 1604, 1605, 1606, 1608, 1609, 1611, 1612, 1615, 1618, 1619, 1621, 1623, 1626, 1629, 1630, 1632, 1635, 1637, 1640, 1642, 1726, 1727, 1730, 1732, 1734, 1736, 1738, 1739, 1743, 1745, 1749, 1750, 1751, 1752, 1753, 1755, 1757, 1758, 1759, 1761, 1762, 1766, 1768, 1771, 1772, 1773, 1775, 1776, 1778, 1779, 1782, 1785, 1786, 1788, 1790, 1793, 1796, 1797, 1799, 1802, 1804, 1807, 1809, 1893, 2228, 2230, 2235, 2236, 2239, 2240, 2241, 2242, 2244, 2245, 2246, 2247, 2253, 2255, 2256, 2257, 2258, 2259, 2262, 2264, 2269, 2270, 2271, 2275, 2276, 2278, 2330, 2331, 2333, 2338, 2339, 2342, 2343, 2344, 2345, 2347, 2348, 2349, 2350, 2356, 2358, 2359, 2360, 2361, 2362, 2365, 2367, 2372, 2373, 2374, 2378, 2379, 2381, 2433, 2434, 2436, 2437, 2439, 2441, 2444, 2445, 2447, 2453, 2455, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2470, 2471, 2472, 2475, 2476, 2477, 2478, 2482, 2485, 2531, 2535, 2537, 2538, 2540, 2542, 2545, 2546, 2548, 2554, 2556, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2571, 2572, 2573, 2576, 2577, 2578, 2579, 2583, 2586, 2632, 2636, 2637, 2639, 2640, 2646, 2648, 2649, 2651, 2653, 2654, 2655, 2656, 2659, 2660, 2661, 2662, 2664, 2665, 2666, 2670, 2671, 2674, 2714, 2717, 2720, 2721, 2722, 2723, 2724, 2726, 2729, 2731, 2736, 2737, 2742, 2746, 2747, 2748, 2751, 2752, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792
All 54 rotations at T†
0, 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, 398, 597, 1178
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/3195.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-3195.1.3.a.txt", "w") as out:
out.write("\n".join(lines) + "\n")
Distance
3\le d\le 31. No fault of weight below 3 is both undetectable and damaging. None of weight 3 has been found, and one of weight 31 is, so the distance lies between the two.
A damaging fault of weight 31 sits on columns [0,199,398,597,796,987,1178,1369,1560,1727,1894,2061,2228,2331,2434,2535,2636,2715,2794,2859,2924,2971,3018,3059,3100,3123,3146,3163,3180,3187,3194].
Its source certifies d\ge 31, 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 31 above, it makes the distance exactly d=31. Source: built here by the doubling of Jain and Albert (arXiv:2408.12752) from A. Gong's [[559,1,15]] (github.com/gongaa/RM127, triply-even/): [[199,1,31]] quantum QR code (extended QR [200,100,32]) doubled onto [[2797,1,29]]; their doubling theorem (Sec. III) gives d >= min(d_sd, d_tri + 2) = 31, with d_sd at least the classical distance less one (their Lemma 2.4) and the distances of Gong's self-dual [[41,1,9]] and [[65,1,13]] codes proved here by enumerating every word of their stabiliser spaces.
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
- A. Gong, "On some K=1 codes admitting strongly transversal T," note in the RM127 repository, triply-even/ (2025). github.com/gongaa/RM127/tree/main/triply-even
Provenance
a code built here by the doubling method of Jain and Albert (arXiv:2408.12752) from the codes in A. Gong's repository (github.com/gongaa/RM127, triply-even/): her [[559,1,15]] doubled with the self-dual CSS codes of the paper's Table I from distance 17 on (transversal_t_codes/); a verified witness, not a maximum
Found by: Jain-Albert doubling of Gong's codes
Discovery: pre-existing
1 recorded source
[
{
"regime": "Jain-Albert doubling of Gong's codes",
"file": "transversal_t_codes/factories.json",
"label": "GJ-3195",
"N": 807,
"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; A. Gong, \"On some K=1 codes admitting strongly transversal T\", note in github.com/gongaa/RM127, triply-even/ (2025)",
"provenance": "[[199,1,31]] quantum QR code (extended QR [200,100,32]) doubled onto [[2797,1,29]]: the doubling method of Jain and Albert (arXiv:2408.12752) applied to the codes in A. Gong's repository (github.com/gongaa/RM127)"
}
]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/3195.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[1478].