Skip to main content

This is a rapidly evolving project - documentation and materials from previous recordings may become outdated quickly. If you encounter any inconsistencies or have questions, please open an issue.


TQEC

Python build docs Stars Star History Chart Ethical Notice Licensed under the Apache 2.0 open-source license

TQEC (Topological Quantum Error Correction) is a design automation software for representing, constructing and compiling large-scale fault-tolerant quantum computations based on surface code and lattice surgery.

In the past decade, there have been significant advancements in surface code quantum computation based on lattice surgery. However, the circuits required to implement these protocols are highly complex. To combine these protocols for constructing larger-scale computation, a substantial amount of effort is needed to manually encode the circuits, and it is extremely challenging to ensure their correctness. As a result, many complex logical computations have not been practically simulated.

tqec provides numerous building blocks based on state-of-the-art protocols, with verified correct circuits implementation for each block. These blocks can then be combined to construct large-scale logical computations, enabling the automatic compilation of large-scale computational circuits.

NOTE: This project is under active development and provide no backwards compatibility at current stage.

Documentation

Documentation is available at https://tqec.github.io/tqec/index.html

Installation

Currently, you need to install tqec from source with pip or uv:

With pip:

python -m pip install git+https://github.com/tqec/tqec.git

With uv:

uv pip install git+https://github.com/tqec/tqec.git

For a more detailed installation guide and common troubleshooting tips, see the installation page in the documentation.

Basic Usage

Here we generate the circuits for a logical CNOT between two logical qubits to demonstrate how to use the tool. Refer to quick start in the documentation for more detailed explanation.

from pathlib import Path

from tqec import BlockGraph, compile_block_graph, NoiseModel

# 0. Path to the logical_cnot.dae file
cnot_dae_filepath = Path.cwd() / "assets" / "logical_cnot.dae"
if not cnot_dae_filepath.exists():
    print(f"The file '{cnot_dae_filepath}' does not exist.")

# 1. Construct the logical computation
block_graph = BlockGraph.from_dae_file(cnot_dae_filepath)

# 2. Get the correlation surfaces of interest and compile the computation
correlation_surfaces = block_graph.find_correlation_surfaces()
compiled_computation = compile_block_graph(block_graph, observables=[correlation_surfaces[1]])

# 3. Generate the `stim.Circuit` of target code distance
circuit = compiled_computation.generate_stim_circuit(
    # k = (d-1)/2 is the scale factor
    # Large values will take a lot of time.
    k=2,
    # The noise applied and noise levels can be changed.
    noise_model=NoiseModel.uniform_depolarizing(0.001),
)

See the user guide for more tutorials.

Contributing

Pull requests and issues are more than welcomed!

See the contributing page for for specific instructions to start contributing.

Community

Every Wednesday at 8:30am PST, we hold meetings to discuss project progress and conduct educational talks related to TQEC.

Here are some helpful links to learn more about the community:

  • Overview of state of the art 2D QEC: Slides/Video
  • Community questions and answers: Docs
  • Introduction to surface code quantum computation: Slides
  • Programming a quantum computer using SketchUp: Slides/Video

All the resources and group meeting recordings are available at this link.

Please join the Google group to receive more updates and information!


Ethical notice

This library is intended for academic, educational, and civilian research only, in the field of fault-tolerant quantum computing, particularly in surface code compilation and topological error correction.

It is made freely and publicly available without access restrictions, in the interest of advancing open scientific and academic collaboration.

The maintainers request that users and contributors refrain from engaging in, supporting, or facilitating military, surveillance, or dual-use applications.

Please, review the full ETHICAL_NOTICE.md for important terms regarding export control, ethical use, and contributor responsibilities.


Metadata

Release files for tqec 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tqec 0.2.0
File Size Uploaded Provenance
tqec-0.2.0.tar.gz 264.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tqec 0.2.0
File Interpreter ABI Platform
tqec-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 617.5 kB

Release files / tqec-0.2.0.tar.gz

Download URL tqec-0.2.0.tar.gz
Size 264.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a72af12e99c745b61c1e92e1afaf13d22adfc488a43f30f485702fbc1d220f93
BLAKE2b-256 checksum
How to use checksums
e7d270a9eb78cb74298bf1a0010ec4e07fe9fcd9dfe5d78d991159dbd1afd445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / tqec-0.2.0-py3-none-any.whl

Download URL tqec-0.2.0-py3-none-any.whl
Size 353.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f559d1172222f1669a94537d2acea800f7d8b772b7f35b7e5b37ab51135716ca
BLAKE2b-256 checksum
How to use checksums
43a3253be0d8a851168102f35e36f213c790a01a220e248a4fa2d04cd1fa8d57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for tqec 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page