The circuit
The 707\times2797 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 707 rows and 2,797 columns, 1,977,479 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 28 single-wire gates and 31 \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 700 and 35 more (listed below). The circuit's action is then exactly the gate above, and an error-free run passes every check with certainty.
All 59 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 700, \mathrm{S} on check 702, \mathrm{Z} on check 703, \mathrm{S}^\dagger on check 704, \mathrm{S} on check 706, \mathrm{CZ} on output 0, check 702, \mathrm{CZ} on output 0, check 704, \mathrm{CZ} on output 0, check 706, \mathrm{CZ} on check 507, check 700, \mathrm{CZ} on check 508, check 700, \mathrm{CZ} on check 509, check 700, \mathrm{CZ} on check 510, check 700, \mathrm{CZ} on check 514, check 700, \mathrm{CZ} on check 516, check 700, \mathrm{CZ} on check 518, check 700, \mathrm{CZ} on check 522, check 700, \mathrm{CZ} on check 523, check 700, \mathrm{CZ} on check 527, check 700, \mathrm{CZ} on check 532, check 700, \mathrm{CZ} on check 533, check 700, \mathrm{CZ} on check 534, check 700, \mathrm{CZ} on check 539, check 700, \mathrm{CZ} on check 541, check 700, \mathrm{CZ} on check 542, check 700, \mathrm{CZ} on check 543, check 700, \mathrm{CZ} on check 544, check 700, \mathrm{CZ} on check 548, check 700, \mathrm{CZ} on check 551, check 700, \mathrm{CZ} on check 554, check 700, \mathrm{CZ} on check 556, check 700, \mathrm{CZ} on check 702, check 703, \mathrm{CZ} on check 702, check 704, \mathrm{CZ} on check 702, check 705, \mathrm{CZ} on check 702, check 706, \mathrm{CZ} on check 704, check 705, \mathrm{CZ} on check 704, check 706
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 828 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 852 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
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/2797.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-2797.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,2461,2526,2573,2620,2661,2702,2725,2748,2765,2782,2789,2796].
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: 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 [[2399,1,27]]; their doubling theorem (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) 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-2797",
"N": 707,
"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 [[2399,1,27]]: 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/2797.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[1459].