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.1.tar.gz (298.8 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.1-py3-none-any.whl (435.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: el_loom-0.3.1.tar.gz
  • Upload date:
  • Size: 298.8 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.1.tar.gz
Algorithm Hash digest
SHA256 92c6c888d9ace5356686118d4a7f4344d8a441e9b306983132dc9df3c9416436
MD5 96ee36cff2a6d7f494bf7a3df781d4d0
BLAKE2b-256 bd8799df8225f26dc342527d6bf718c6df85f9776fb23f1a570309efcef9abff

See more details on using hashes here.

File details

Details for the file el_loom-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: el_loom-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 435.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for el_loom-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26b6187caf52741c25c47fa5c34c45c2852c0d04873fcf5a81d6c7dd45337c5e
MD5 f4825b64ff28f604465231899ac20b74
BLAKE2b-256 1a776598047013d9aea4ae6745e9502672847326115daaeeb1e9e65ff27cad18

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