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.3.0.tar.gz (299.5 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.3.0-cp312-cp312-manylinux_2_39_x86_64.whl (436.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

File details

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

File metadata

  • Download URL: el_loom-0.3.0.tar.gz
  • Upload date:
  • Size: 299.5 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.3.0.tar.gz
Algorithm Hash digest
SHA256 18fefb22a1753204929b83e961d7417ad0a7b32ffb1fd0e97dba5d41081e29b4
MD5 492cccd111153f5e59b108161eb3786f
BLAKE2b-256 90026c867ccd98a196ef99ab44c09ae7bcdbc7ebcfc768aeabe3625af842c52a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for el_loom-0.3.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 9752eabf2efb64ecb9769b8407c72e214f2de8a6f292fb237d93a595ab184560
MD5 7371eaa1ab7a91c6ec1e70437a01fd48
BLAKE2b-256 2070645d6432cb3adcb77c46247f1d76d299e9429102e2b36bf6b10798772a1f

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