Skip to main content

An integrated software platform designed to handle the complexities of quantum error correction, seamlessly transforming applications into fault-tolerant, hardware-ready versions.

Project description

๐Ÿ“ฆ Loom

PyPI version Python versions

Loom is a Python library to create and run quantum error correction (QEC) experiments. It provides API that allows users to easily define custom stabilizer codes and corresponding lattice surgery operations. It also provides all tools required to convert any experiments to executables compatible with the most used backend (Stim, QASM, etc...).

Disclaimer: major breaking changes to be expected in the first month from release v0.1.0.

Loom is licensed under Apache 2.0.

โœจ Features

  • โœ… Build QEC experiments with lattice surgery, surface codes and more.
  • โšก Simulate circuits on multiple backends (Stim, QASM3, etc...)
  • ๐Ÿง  Analyze stabilizers, syndromes, and logical error rates
  • ๐Ÿงฐ Extensible API for custom experiments and backends

๐Ÿ“ฆ Installation

Install the latest release from PyPI:

pip install el-loom

Install the development version directly from GitHub:

pip install git+https://github.com/entropicalabs/el-loom.git

๐Ÿš€ Quick Start

Here's a simple example of an experiment designed with Eka. Have a look to the documentation for more information on the available features.

from loom.eka import Eka, Lattice
from loom.eka.operations import (
    ResetAllDataQubits, 
    Merge, 
    MeasureBlockSyndromes, 
    MeasureLogicalZ
)
from loom.interpreter import interpret_eka
from loom.executor import EkaToStimConverter
from loom_rotated_surface_code.code_factory import RotatedSurfaceCode

lattice = Lattice.square_2d((15, 15))

# Create rotated surface blocks on a lattice
rsc_block_1 = RotatedSurfaceCode.create(5, 5, lattice, unique_label="rsc_block_1")
rsc_block_2 = RotatedSurfaceCode.create(
    5, 5, lattice, unique_label="rsc_block_2", position=(6, 0)
)

# Define lattice surgery operations to process
operations = [
    ResetAllDataQubits(rsc_block_1.unique_label),
    Merge([rsc_block_1.unique_label, rsc_block_2.unique_label], "rsc_block_3"),
    MeasureBlockSyndromes("rsc_block_3", n_cycles=1),
    MeasureLogicalZ("rsc_block_3"),
]

# Interpret the operations on the rotated surface code blocks
eka_experiment = Eka(
    lattice, blocks=[rsc_block_1, rsc_block_2], operations=operations
)
# This will contain the circuit, syndromes and detectors of the system resulting from the operations.
final_state = interpret_eka(eka_experiment)

# Get the Stim code ready for simulation
stim_circuit = EkaToStimConverter().convert(final_state)

๐Ÿง‘โ€๐Ÿ’ป Development Setup

To contribute to Loom, set up a development environment using Poetry:

# Clone the repository
git clone https://github.com/entropicalabs/el-loom.git
cd el-loom

# Install Poetry if needed
curl -sSL https://install.python-poetry.org | python3 -

# Install dependencies including dev dependencies
poetry install --with dev

# Get the command to activate the virtual environment
poetry env activate     # or run all commands with "poetry run" prefix

# Run tests
pytest

# Run linting/formatting
poetry run black src tests

๐Ÿงฑ Project Structure

el-loom/
โ”œโ”€โ”€ .github/workflows/                  # CI/CD workflows
โ”œโ”€โ”€ docs/                               # Documentation
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ checkers/                       # Pylint checkers
โ”‚   โ”œโ”€โ”€ loom/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ eka/                        # Error correction algorithms
โ”‚   โ”‚   โ”œโ”€โ”€ executor/                   # Circuit execution and conversion
โ”‚   โ”‚   โ”œโ”€โ”€ interpreter/                # Syndrome interpretation
โ”‚   โ”‚   โ””โ”€โ”€ visualizer/                 # Plotting and visualization
โ”‚   โ”œโ”€โ”€ loom_five_qubit_perfect_code/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ selectors.py                    
โ”‚   โ”‚   โ”œโ”€โ”€ applicator/                 # Code-specific interpretation instructions
โ”‚   โ”‚   โ””โ”€โ”€ code_factory/               # Code-specific algorithmic instructions
โ”‚   โ”œโ”€โ”€ loom_repetition_code/
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ loom_rotated_surface_code/
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ loom_shor_code/
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ””โ”€โ”€ loom_steane_code/
โ”‚       โ””โ”€โ”€ ...
โ”œโ”€โ”€ tests
โ”œโ”€โ”€ poetry.lock
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md
 

๐Ÿชช License

Loom is licensed under Apache 2.0.


๐Ÿ“ฌ Contact

Created by Entropica Labs. Feel free to open issues, request features, or contribute via pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

el_loom-0.4.0.tar.gz (304.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

el_loom-0.4.0-cp312-cp312-manylinux_2_39_x86_64.whl (443.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

File details

Details for the file el_loom-0.4.0.tar.gz.

File metadata

  • Download URL: el_loom-0.4.0.tar.gz
  • Upload date:
  • Size: 304.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for el_loom-0.4.0.tar.gz
Algorithm Hash digest
SHA256 20b9f3d77cc0bdfdd310f91c6ad66c091c5f58667539beaa5fd4f2ed4e01100a
MD5 c89f97076663db67d98350aa204557f5
BLAKE2b-256 bcb6df67ee68f952ccf28b8d62881f3efde6054798ac1a49cf0b23055c36a772

See more details on using hashes here.

File details

Details for the file el_loom-0.4.0-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for el_loom-0.4.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 d8b88a120be21bfc6c59e02ac7c357a16369a0af98e14faf663fb0eb9f9bd806
MD5 1fe6ab48a9bb0bc361d83d1d4f19e4c8
BLAKE2b-256 6d10ea8d74b80c121c52a9fe94fdc1a948322266473c4a041f9be256d97f9796

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page