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 a 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 EkaCircuitToStimConverter
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 = EkaCircuitToStimConverter().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 command 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.1.3.tar.gz (282.9 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.1.3-py3-none-any.whl (402.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: el_loom-0.1.3.tar.gz
  • Upload date:
  • Size: 282.9 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.1.3.tar.gz
Algorithm Hash digest
SHA256 318d62abd70dd19deaa86d52a6d1fb1580f9e9bab6f14c77bc3af9462acb8c28
MD5 97e30c915e6d39efd4d06cb21c369dc3
BLAKE2b-256 c83d0f644dfbc345d7f46e771c01c24891843e2114eae66d945a6a52f58390e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: el_loom-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 402.9 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.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0de0509da00a8280581681dcc5eb53184db7666a896f3b2dba1c0bbe0d0262dc
MD5 55229c93918d550fb860bf7863210fc3
BLAKE2b-256 f10f4f196cdd0dc3e956a226c45f75ffdd8c1c9ac96864574fc4e1908daef648

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