Skip to content

Commit 24ee5a1

Browse files
authored
Feat/qec polish (#225)
* refactor + guppy * remove redundant code
1 parent bedc24e commit 24ee5a1

File tree

334 files changed

+5579
-646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+5579
-646
lines changed

python/quantum-pecos/src/pecos/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,11 @@
191191
error_models,
192192
exceptions, # Exception classes
193193
graph,
194+
guppy, # Direct Guppy code generation for QEC - bypasses SLR
194195
misc,
195196
programs,
196197
protocols,
198+
qec, # Pure QEC geometry (surface, color codes) - no SLR dependencies
197199
qeccs,
198200
quantum, # Quantum types (DagCircuit, Gate, Pauli, etc.)
199201
simulators,
@@ -326,6 +328,7 @@
326328
"general_noise",
327329
"get_guppy_backends",
328330
"graph",
331+
"guppy", # Direct Guppy code generation
329332
"i8",
330333
"i16",
331334
"i32",
@@ -353,6 +356,7 @@
353356
"programs",
354357
"protocols",
355358
"qasm_engine",
359+
"qec", # Pure QEC geometry (no SLR dependencies)
356360
"qeccs",
357361
"qis_engine",
358362
"quantum",
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Copyright 2024 The PECOS Developers
2+
# Licensed under the Apache License, Version 2.0
3+
4+
"""Direct Guppy code generation for quantum error correction.
5+
6+
This module provides code generation utilities for creating Guppy
7+
quantum programs from QEC geometry definitions. It bypasses the SLR
8+
intermediate representation for faster direct Guppy generation.
9+
10+
Submodules:
11+
surface: Surface code generation
12+
color: Color code generation
13+
transversal: Transversal operations (CNOT for CSS codes)
14+
15+
Example:
16+
>>> from pecos.guppy import make_surface_code, get_num_qubits
17+
>>> prog = make_surface_code(distance=3, num_rounds=3, basis="Z")
18+
>>> num_qubits = get_num_qubits(3)
19+
>>> result = prog.emulator(num_qubits=num_qubits).stabilizer_sim().run()
20+
"""
21+
22+
from pecos.guppy.color import (
23+
generate_color_code_module,
24+
generate_color_code_source,
25+
get_color_code_module,
26+
get_num_qubits_color,
27+
make_color_code,
28+
)
29+
from pecos.guppy.surface import (
30+
generate_guppy_source,
31+
generate_memory_experiment,
32+
generate_surface_code_module,
33+
get_num_qubits,
34+
get_surface_code_module,
35+
make_surface_code,
36+
)
37+
from pecos.guppy.transversal import (
38+
CSSCodeType,
39+
get_transversal_num_qubits,
40+
make_color_transversal_cnot,
41+
make_color_transversal_cnot_d3,
42+
make_color_transversal_cnot_with_x,
43+
make_color_transversal_cnot_with_x_d3,
44+
make_css_transversal_cnot,
45+
make_css_transversal_cnot_with_x,
46+
make_surface_transversal_cnot,
47+
make_surface_transversal_cnot_with_x,
48+
)
49+
50+
__all__ = [ # noqa: RUF022
51+
# Surface code
52+
"generate_guppy_source",
53+
"generate_memory_experiment",
54+
"generate_surface_code_module",
55+
"get_num_qubits",
56+
"get_surface_code_module",
57+
"make_surface_code",
58+
# Color code
59+
"generate_color_code_module",
60+
"generate_color_code_source",
61+
"get_color_code_module",
62+
"get_num_qubits_color",
63+
"make_color_code",
64+
# Generic CSS transversal operations
65+
"CSSCodeType",
66+
"get_transversal_num_qubits",
67+
"make_css_transversal_cnot",
68+
"make_css_transversal_cnot_with_x",
69+
"make_color_transversal_cnot",
70+
"make_color_transversal_cnot_d3",
71+
"make_color_transversal_cnot_with_x",
72+
"make_color_transversal_cnot_with_x_d3",
73+
"make_surface_transversal_cnot",
74+
"make_surface_transversal_cnot_with_x",
75+
]

0 commit comments

Comments
 (0)