|
| 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