diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3f5842a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,34 @@ +# EditorConfig helps maintain consistent coding styles across editors and IDEs +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.py] +indent_style = space +indent_size = 4 +max_line_length = 100 + +[*.{yaml,yml}] +indent_style = space +indent_size = 2 + +[*.{json,json5}] +indent_style = space +indent_size = 2 + +[*.toml] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false +max_line_length = off + +[Makefile] +indent_style = tab diff --git a/.gitignore b/.gitignore index 471c41e..5c6f167 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,16 @@ uv.lock *.fdb_latexmk *.synctex.gz note/belief_propagation_qec_plan.pdf.claude/settings.local.json + +# Development tools +.ruff_cache/ +.mypy_cache/ + +# Binary files in docs (prevent future additions) +# Note: note/ directory is allowed to contain PDFs/Typst files +docs/*.pdf +docs/*.typ + +# Dataset-specific +*.npz.tmp +*.stim.bak diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1234e61 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,27 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-toml + - id: check-added-large-files + args: ['--maxkb=500'] + - id: check-merge-conflict + - id: check-case-conflict + - id: mixed-line-ending + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.8.4 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format + + - repo: https://github.com/PyCQA/bandit + rev: 1.7.10 + hooks: + - id: bandit + args: ['-c', 'pyproject.toml'] + additional_dependencies: ['bandit[toml]'] diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a1d29e6 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,51 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Changed +- Reorganized dataset structure to single-source flat layout in `datasets/` directory +- Updated CLI default dataset path from `datasets/noisy_circuits` to `datasets` +- Moved all visualization images to `datasets/visualizations/` subdirectory +- Updated package metadata in `pyproject.toml` with project URLs and maintainers +- Updated README.md to focus on Python implementation +- Updated dataset documentation to reflect new structure + +### Added +- LICENSE file (MIT License) +- CONTRIBUTING.md with development guidelines +- Project URLs in package metadata (Homepage, Documentation, Repository, Issues, Changelog) +- Maintainers field in package metadata + +### Removed +- Duplicate dataset files from subdirectories (`circuits/`, `dems/`, `uais/`, `syndromes/`, `noisy_circuits/`) +- Julia code examples and references from README +- Winter school training references from project description + +## [0.1.0] - 2025-01-20 + +### Added +- Initial release of BPDecoderPlus +- Noisy circuit generation for surface codes using Stim +- Belief propagation decoder implementation using PyTorch +- CLI tool for generating noisy circuits and detector error models +- Support for surface code distances 3, 5, 7, 9 +- Syndrome database generation and storage +- UAI format export for inference problems +- PyTorch-based BP solver with customizable iterations +- GitHub Pages documentation with MkDocs +- Comprehensive test suite with pytest +- CI/CD pipeline with GitHub Actions +- Example datasets for d=3 surface codes with varying rounds + +### Features +- Circuit-level surface code simulation +- Detector error model (DEM) generation +- Syndrome extraction and database management +- Multiple output formats: Stim circuits, DEM files, UAI files, NPZ syndrome databases +- Configurable physical error rates and code parameters +- Integration with Stim for fast quantum circuit simulation diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2157fcf --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,275 @@ +# Contributing to BPDecoderPlus + +Thank you for your interest in contributing to BPDecoderPlus! This document provides guidelines and instructions for contributing. + +## Development Setup + +### Prerequisites + +- Python 3.10 or higher +- [uv](https://github.com/astral-sh/uv) package manager (recommended) or pip + +### Setup Development Environment + +```bash +# Clone the repository +git clone https://github.com/GiggleLiu/BPDecoderPlus.git +cd BPDecoderPlus + +# Install dependencies with uv (recommended) +uv sync --dev + +# Or with pip +pip install -e .[dev,docs] + +# Install pre-commit hooks +uv run pre-commit install +``` + +## Running Tests + +```bash +# Run all tests +uv run pytest + +# Run with coverage +uv run pytest --cov=bpdecoderplus --cov-report=html + +# Run specific test file +uv run pytest tests/test_circuit.py + +# Run specific test +uv run pytest tests/test_circuit.py::TestCircuitGeneration::test_basic_circuit +``` + +## Code Style + +This project uses: + +- **Ruff** for linting and formatting (replaces black, flake8, isort) +- **Type hints** for public APIs +- **pytest** for testing +- **Google-style docstrings** + +### Before Submitting + +```bash +# Format code with ruff +uv run ruff format . + +# Check linting +uv run ruff check . + +# Fix linting issues automatically +uv run ruff check --fix . + +# Run pre-commit hooks on all files +uv run pre-commit run --all-files +``` + +## Pull Request Process + +1. **Fork** the repository and create a feature branch from `main` + ```bash + git checkout -b feature/my-new-feature + ``` + +2. **Write tests** for your changes + - Add tests in the `tests/` directory + - Maintain or improve code coverage + +3. **Update documentation** if needed + - Update docstrings for modified functions + - Update `docs/` if adding new features + - Update README.md if changing user-facing behavior + +4. **Run the test suite** and ensure all tests pass + ```bash + uv run pytest + ``` + +5. **Run pre-commit hooks** to ensure code quality + ```bash + uv run pre-commit run --all-files + ``` + +6. **Submit a Pull Request** with: + - Clear description of changes + - Link to related issues (if any) + - Screenshots/examples for UI changes + +### Commit Message Format + +Follow [Conventional Commits](https://www.conventionalcommits.org/): + +``` +type(scope): brief description + +Longer description if needed, explaining what changed and why. + +Fixes #123 +``` + +**Types:** +- `feat`: New feature +- `fix`: Bug fix +- `docs`: Documentation changes +- `test`: Adding or updating tests +- `refactor`: Code refactoring (no functional changes) +- `perf`: Performance improvements +- `chore`: Maintenance tasks +- `ci`: CI/CD changes + +**Examples:** +``` +feat(circuit): add support for code distance 9 + +fix(dem): correct parity check matrix generation for edge cases + +docs(readme): update installation instructions for uv + +test(syndrome): add tests for large syndrome databases +``` + +## Development Guidelines + +### Adding New Features + +1. **Discuss first** for major features + - Open an issue to discuss the design + - Get feedback before implementing + +2. **Write tests** before implementation (TDD encouraged) + - Unit tests for individual functions + - Integration tests for workflows + +3. **Update documentation** + - Add docstrings with examples + - Update `docs/` guides + - Add usage examples if helpful + +4. **Keep it simple** + - Follow existing patterns in the codebase + - Don't over-engineer solutions + - Prefer clarity over cleverness + +### Project Structure + +``` +BPDecoderPlus/ +├── src/bpdecoderplus/ # Main package code +│ ├── circuit.py # Circuit generation with Stim +│ ├── dem.py # Detector error model export +│ ├── syndrome.py # Syndrome sampling +│ ├── cli.py # Command-line interface +│ └── pytorch_bp/ # Belief propagation module +│ ├── belief_propagation.py +│ └── uai_parser.py +├── tests/ # Test suite +│ ├── test_circuit.py +│ ├── test_dem.py +│ ├── test_syndrome.py +│ ├── test_bp_basic.py +│ └── test_integration.py +├── docs/ # MkDocs documentation +│ ├── getting_started.md +│ ├── usage_guide.md +│ └── api_reference.md +├── examples/ # Usage examples +│ ├── simple_example.py +│ └── evidence_example.py +└── datasets/ # Sample datasets +``` + +### Testing Guidelines + +- **Write unit tests** for new functions + - Test happy path and edge cases + - Test error conditions + +- **Use pytest fixtures** for common setups + - Add fixtures to `tests/conftest.py` + +- **Aim for >80% code coverage** + - Check coverage with `pytest --cov` + +- **Test documentation examples** + - Ensure code examples in docs actually work + +### Documentation Guidelines + +- **Use Google-style docstrings** + ```python + def generate_circuit(distance: int, rounds: int) -> stim.Circuit: + """Generate a noisy surface code circuit. + + Args: + distance: Code distance (odd integer >= 3) + rounds: Number of measurement rounds + + Returns: + Stim circuit with noise model applied + + Raises: + ValueError: If distance is invalid + + Example: + >>> circuit = generate_circuit(distance=3, rounds=5) + >>> print(circuit.num_qubits) + 17 + """ + ``` + +- **Include type hints** in function signatures +- **Add usage examples** for public APIs +- **Update `docs/`** for major features + +## Release Process + +Releases are managed by project maintainers: + +1. Update `CHANGELOG.md` with changes +2. Bump version in `src/bpdecoderplus/__init__.py` +3. Create git tag: `git tag -a v0.2.0 -m "Release v0.2.0"` +4. Push tag: `git push origin v0.2.0` +5. GitHub Actions automatically publishes to PyPI + +## Reporting Issues + +### Bug Reports + +Please include: + +- **Description** of the bug +- **Steps to reproduce** +- **Expected behavior** +- **Actual behavior** +- **Environment** (OS, Python version) +- **Code sample** or error message + +### Feature Requests + +Please include: + +- **Use case** - what problem does this solve? +- **Proposed solution** - how should it work? +- **Alternatives** - other approaches considered + +## Getting Help + +- **Issues**: [GitHub Issues](https://github.com/GiggleLiu/BPDecoderPlus/issues) +- **Discussions**: Use GitHub Discussions for questions +- **Documentation**: [Online Docs](https://giggleliu.github.io/BPDecoderPlus/) + +## Code of Conduct + +This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). +Please read and follow it in all interactions. + +## License + +By contributing, you agree that your contributions will be licensed under the MIT License. + +--- + +Thank you for contributing to BPDecoderPlus! 🎉 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5addb66 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 BPDecoderPlus Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile index 1bf95bb..f7ed5ec 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,21 @@ -.PHONY: help install setup test test-cov generate-dataset generate-dem generate-syndromes docs docs-serve clean +.PHONY: help install setup dev-setup test test-cov generate-dataset generate-dem generate-syndromes docs docs-serve clean format lint lint-fix type-check pre-commit check help: @echo "Available targets:" @echo " install - Install uv package manager" @echo " setup - Set up development environment with uv" + @echo " dev-setup - Set up development environment and install pre-commit hooks" @echo " generate-dataset - Generate noisy circuit dataset" @echo " generate-dem - Generate detector error models" @echo " generate-syndromes - Generate syndrome database (1000 shots)" @echo " test - Run tests" @echo " test-cov - Run tests with coverage report" + @echo " format - Format code with ruff" + @echo " lint - Run ruff linting" + @echo " lint-fix - Run ruff linting with auto-fix" + @echo " type-check - Run mypy type checking" + @echo " pre-commit - Run pre-commit on all files" + @echo " check - Run all checks (lint, type-check, test)" @echo " docs - Build documentation" @echo " docs-serve - Serve documentation locally" @echo " clean - Remove generated files and caches" @@ -22,14 +29,18 @@ install: setup: install uv sync --dev +dev-setup: setup + uv run pre-commit install + @echo "Development environment ready!" + generate-dataset: - uv run generate-noisy-circuits --distance 3 --p 0.01 --rounds 3 5 7 --task z --output datasets/noisy_circuits + uv run generate-noisy-circuits --distance 3 --p 0.01 --rounds 3 5 7 --task z --output datasets generate-dem: - uv run generate-noisy-circuits --distance 3 --p 0.01 --rounds 3 5 7 --task z --output datasets/noisy_circuits --generate-dem + uv run generate-noisy-circuits --distance 3 --p 0.01 --rounds 3 5 7 --task z --output datasets --generate-dem generate-syndromes: - uv run generate-noisy-circuits --distance 3 --p 0.01 --rounds 3 5 7 --task z --output datasets/noisy_circuits --generate-syndromes 1000 + uv run generate-noisy-circuits --distance 3 --p 0.01 --rounds 3 5 7 --task z --output datasets --generate-syndromes 1000 test: uv run pytest @@ -37,6 +48,24 @@ test: test-cov: uv run pytest --cov=bpdecoderplus --cov-report=html --cov-report=term +format: + uv run ruff format . + +lint: + uv run ruff check . + +lint-fix: + uv run ruff check --fix . + +type-check: + uv run mypy src/bpdecoderplus + +pre-commit: + uv run pre-commit run --all-files + +check: lint type-check test + @echo "All checks passed!" + docs: pip install mkdocs-material mkdocstrings[python] pymdown-extensions mkdocs build diff --git a/README.md b/README.md index 12408a8..43d3605 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,25 @@ # BPDecoderPlus: Quantum Error Correction with Belief Propagation -Note: This WIP project is for AI + Quantum winter school training. - [![Tests](https://github.com/GiggleLiu/BPDecoderPlus/actions/workflows/test.yml/badge.svg)](https://github.com/GiggleLiu/BPDecoderPlus/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/GiggleLiu/BPDecoderPlus/branch/main/graph/badge.svg)](https://codecov.io/gh/GiggleLiu/BPDecoderPlus) [![Documentation](https://img.shields.io/badge/docs-online-blue.svg)](https://giggleliu.github.io/BPDecoderPlus/) +[![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/) +[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) -A winter school project on circuit-level decoding of surface codes using belief propagation and integer programming decoders, with extensions for atom loss in neutral atom quantum computers. - -## Project Goals - -| Level | Task | Description | -|-------|------|-------------| -| **Basic** | MLE Decoder | Reproduce the integer programming (MLE) decoder as the baseline | -| **Challenge** | Atom Loss | Handle atom loss errors in neutral atom systems | -| **Extension** | QEC Visualization | https://github.com/nzy1997/qec-thrust | +A Python package for circuit-level decoding of surface codes using belief propagation decoders. -Note: we also want to explore the boundary of vibe coding, which may lead to a scipost paper. +## Features -## Learning Objectives - -After completing this project, students will: -- Understand surface code structure and syndrome extraction -- Implement and compare different decoding algorithms -- Analyze decoder performance through threshold plots -- Learn about practical QEC challenges (atom loss, circuit-level noise) +- **Noisy Circuit Generation**: Generate rotated surface-code memory circuits with Stim +- **Detector Error Models**: Export detector error models (DEMs) for decoder development +- **Syndrome Sampling**: Pre-generate syndrome databases for training and testing +- **PyTorch BP Module**: Belief propagation on factor graphs with PyTorch backend +- **CLI Tools**: Command-line interface for dataset generation +- **Production Ready**: Modern Python packaging, CI/CD, comprehensive tests ## Prerequisites -- **Programming**: Julia basics, familiarity with Python for plotting +- **Programming**: Python 3.10+, familiarity with NumPy and PyTorch - **Mathematics**: Linear algebra, probability theory - **QEC Background**: Stabilizer formalism, surface codes (helpful but not required) @@ -118,89 +109,39 @@ Before starting, please read these foundational papers: - Comprehensive review of all surface code decoders - [Quantum 8:1498](https://quantum-journal.org/papers/q-2024-10-10-1498/) -## Getting Started - -### 1. Clone the Repository +## Installation -```bash -git clone -cd BPDecoderPlus -``` - -### 2. Install Dependencies +### With uv (recommended) ```bash -# Install Julia dependencies -make setup-julia - -# Install Python dependencies (for visualization) -make setup-python +# Install the package +uv pip install bpdecoderplus -# Or install both at once -make setup -``` - -### 3. Run Tests - -```bash -make test +# For development +git clone https://github.com/GiggleLiu/BPDecoderPlus.git +cd BPDecoderPlus +uv sync --dev ``` -### 4. Quick Demo +### With pip ```bash -# Run a quick benchmark to verify everything works -make quick -``` - -Or interactively in Julia: -```julia -using BPDecoderPlus - -# Quick benchmark with IP decoder -result = quick_benchmark(distance=5, p=0.05, n_trials=100) -println("Logical error rate: ", result["logical_error_rate"]) - -# Compare decoders -compare_decoders([3, 5], [0.02, 0.05, 0.08], 100) -``` - -## Project Structure - -``` -BPDecoderPlus/ -├── README.md # This file -├── Makefile # Build automation -├── Project.toml # Julia dependencies -├── src/ -│ └── BPDecoderPlus.jl # Main module (uses TensorQEC.jl) -├── benchmark/ -│ ├── generate_data.jl # Generate benchmark data -│ ├── run_benchmarks.jl # Run decoder timing tests -│ └── data/ # Output data (JSON) -├── python/ -│ ├── requirements.txt # Python dependencies -│ └── visualize.py # Plotting scripts -├── results/ -│ └── plots/ # Generated plots -├── test/ -│ └── runtests.jl # Unit tests -└── note/ - └── belief_propagation_qec_plan.tex +# Install from source +git clone https://github.com/GiggleLiu/BPDecoderPlus.git +cd BPDecoderPlus +pip install -e .[dev,docs] ``` -## PyTorch BP Module (UAI) - -This repository also includes a PyTorch implementation of belief propagation for -UAI factor graphs under `src/bpdecoderplus/pytorch_bp`. +## Quick Start -### Python Setup +### Generate Noisy Circuits ```bash -pip install -e . +# Generate surface code circuits with noise +generate-noisy-circuits --distance 3 5 7 --p 0.01 --rounds 3 5 7 --task z ``` -### Quick Example +### Python API ```python from bpdecoderplus.pytorch_bp import ( @@ -210,186 +151,203 @@ from bpdecoderplus.pytorch_bp import ( compute_marginals, ) +# Load UAI model model = read_model_file("examples/simple_model.uai") + +# Run belief propagation bp = BeliefPropagation(model) state, info = belief_propagate(bp) -print(info) -print(compute_marginals(state, bp)) + +# Get marginals +marginals = compute_marginals(state, bp) +print(marginals) ``` -### Examples and Tests +### Run Examples ```bash python examples/simple_example.py python examples/evidence_example.py -pytest tests/test_bp_basic.py tests/test_uai_parser.py tests/test_integration.py tests/testcase.py +python examples/minimal_example.py ``` -## Available Decoders - -| Decoder | Symbol | Description | -|---------|--------|-------------| -| IP (MLE) | `:IP` | Integer programming decoder - finds minimum weight error | -| BP | `:BP` | Belief propagation without post-processing | -| BP+OSD | `:BPOSD` | BP with Ordered Statistics Decoding post-processing | -| Matching | `:Matching` | Minimum weight perfect matching (via TensorQEC) | - -## Tasks - -### Basic Task: Reproduce MLE Decoder - -1. Understand how surface codes work using TensorQEC -2. Run the IP decoder on different code distances -3. Generate threshold plots (logical vs physical error rate) -4. Analyze how performance scales with code distance - -```julia -using BPDecoderPlus - -# Create surface code -code = SurfaceCode(5, 5) -tanner = CSSTannerGraph(code) - -# Create error model -em = iid_error(0.03, 0.03, 0.03, 25) +## Project Structure -# Decode with IP -decoder = IPDecoder() -compiled = compile(decoder, tanner) +``` +BPDecoderPlus/ +├── README.md # This file +├── LICENSE # MIT License +├── pyproject.toml # Package configuration +├── Makefile # Build automation +├── src/bpdecoderplus/ # Main package +│ ├── __init__.py +│ ├── circuit.py # Circuit generation with Stim +│ ├── dem.py # Detector error model export +│ ├── syndrome.py # Syndrome sampling +│ ├── cli.py # Command-line interface +│ └── pytorch_bp/ # PyTorch BP module +│ ├── belief_propagation.py +│ └── uai_parser.py +├── datasets/ # Sample datasets +│ ├── README.md +│ └── *.stim, *.dem, *.uai # Generated data +├── docs/ # MkDocs documentation +│ ├── index.md +│ ├── getting_started.md +│ ├── usage_guide.md +│ └── api_reference.md +├── examples/ # Example scripts +│ ├── simple_example.py +│ ├── evidence_example.py +│ └── minimal_example.py +├── tests/ # Test suite +│ ├── test_circuit.py +│ ├── test_dem.py +│ ├── test_syndrome.py +│ ├── test_bp_basic.py +│ └── test_integration.py +└── .github/workflows/ # CI/CD + ├── test.yml + └── docs.yml +``` -ep = random_error_pattern(em) -syn = syndrome_extraction(ep, tanner) -result = decode(compiled, syn) +## Command-Line Interface -# Check for logical error -x_err, z_err, y_err = check_logical_error(tanner, ep, result.error_pattern) -``` +The `generate-noisy-circuits` command generates surface code datasets: -### Challenge Task: Implement and Compare BP Decoder +```bash +# Basic usage +generate-noisy-circuits --distance 3 --p 0.01 --rounds 3 5 --task z -1. Run the BP decoder and compare with IP -2. Understand when BP fails and when OSD helps -3. Compare threshold performance -4. Analyze timing differences +# Multiple distances and error rates +generate-noisy-circuits --distance 3 5 7 --p 0.005 0.01 0.015 --rounds 3 5 7 --task z -```julia -# Compare decoders -results = compare_decoders( - [3, 5, 7], # distances - 0.01:0.02:0.15, # error rates - 1000; # trials - decoders=[:IP, :BP, :BPOSD] -) +# Specify output directory +generate-noisy-circuits --distance 5 --p 0.01 --rounds 5 --task z --output datasets/ ``` -### Extension: Handle Atom Loss +## Running Tests -1. Understand the atom loss model -2. Compare naive vs loss-aware decoding -3. Analyze threshold degradation with loss +```bash +# Run all tests +uv run pytest -```julia -# Simulate atom loss -loss_model = AtomLossModel(0.02) # 2% loss rate -tanner, lost_qubits = apply_atom_loss(tanner, loss_model) +# Run with coverage +uv run pytest --cov=bpdecoderplus --cov-report=html -# Decode with loss information -result = decode_with_atom_loss(tanner, syn, decoder, lost_qubits) +# Run specific test file +uv run pytest tests/test_circuit.py ``` -## Running Benchmarks +## Building Documentation -### Full Benchmark (takes longer, more accurate) ```bash -make benchmark -make visualize -``` +# Serve documentation locally +make docs-serve -### Quick Benchmark (for testing) -```bash -make quick -``` - -### Individual Decoder Test -```bash -make benchmark-ip -make benchmark-bp -make benchmark-bposd +# Build documentation +make docs ``` ## Makefile Targets | Target | Description | |--------|-------------| -| `make setup` | Install all dependencies | +| `make setup` | Install dependencies with uv | | `make test` | Run unit tests | -| `make benchmark` | Generate full benchmark data | -| `make quick` | Quick benchmark (fewer trials) | -| `make visualize` | Generate plots from data | -| `make all` | Full pipeline: test -> benchmark -> visualize | +| `make docs` | Build documentation | +| `make docs-serve` | Serve documentation locally | | `make clean` | Remove generated files | | `make help` | Show available targets | -## Output Plots +## Development + +### Setting Up Development Environment -After running benchmarks and visualization, you'll find: +```bash +# Clone repository +git clone https://github.com/GiggleLiu/BPDecoderPlus.git +cd BPDecoderPlus -- `results/plots/threshold_ip.png` - IP decoder threshold curve -- `results/plots/threshold_bp.png` - BP decoder threshold curve -- `results/plots/threshold_bposd.png` - BP+OSD decoder threshold curve -- `results/plots/decoder_comparison.png` - Side-by-side comparison -- `results/plots/timing_comparison.png` - Decoding speed comparison -- `results/plots/atom_loss.png` - Effect of atom loss -- `results/plots/scalability.png` - Scalability analysis +# Install with development dependencies +uv sync --dev -## Evaluation Criteria +# Install pre-commit hooks (if configured) +uv run pre-commit install +``` -Your submission will be evaluated on: +### Code Style -1. **Correctness** (40%): Do your decoders produce valid corrections? -2. **Analysis** (30%): Quality of threshold plots and performance analysis -3. **Code Quality** (20%): Clean, documented, well-tested code -4. **Extension** (10%): Atom loss handling or other improvements +This project uses: +- **Ruff** for linting and formatting +- **pytest** for testing +- **Type hints** for public APIs ## Resources -### Core Library -- [TensorQEC.jl](https://github.com/nzy1997/TensorQEC.jl) - QEC library we build on - ### Reference Implementations +- [Stim](https://github.com/quantumlib/Stim) - Fast stabilizer circuit simulator (used by this package) - [bp_osd](https://github.com/quantumgizmos/bp_osd) - Python BP+OSD implementation - [ldpc](https://github.com/quantumgizmos/ldpc) - LDPC decoder library +- [TensorQEC.jl](https://github.com/nzy1997/TensorQEC.jl) - Julia quantum error correction library ### Documentation -- [TensorQEC Documentation](https://nzy1997.github.io/TensorQEC.jl/dev/) +- [Stim Documentation](https://github.com/quantumlib/Stim/blob/main/doc/index.md) - [Error Correction Zoo](https://errorcorrectionzoo.org/) +- [BPDecoderPlus Documentation](https://giggleliu.github.io/BPDecoderPlus/) ## Troubleshooting -### TensorQEC fails to precompile -This is a known issue with YaoSym. It still works at runtime: -```julia -# Ignore precompilation warnings and proceed -using TensorQEC -``` - ### Out of memory on large codes -Reduce code distance or number of trials: -```julia + +Reduce code distance or number of samples: + +```bash # Use smaller codes for testing -results = quick_benchmark(distance=3, n_trials=100) +generate-noisy-circuits --distance 3 --rounds 3 5 --p 0.01 --task z ``` -### Visualization fails -Ensure Python dependencies are installed: +### Import errors + +Ensure the package is installed correctly: + ```bash -pip install -r python/requirements.txt +# Reinstall in development mode +uv pip install -e . + +# Or with pip +pip install -e . +``` + +## Contributing + +Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. + +## Citation + +If you use BPDecoderPlus in your research, please cite: + +```bibtex +@software{bpdecoderplus2025, + title = {BPDecoderPlus: Belief Propagation Decoders for Surface Codes}, + author = {Liu, Jinguo and Contributors}, + year = {2025}, + url = {https://github.com/GiggleLiu/BPDecoderPlus} +} ``` ## License -MIT License - See LICENSE file for details. +MIT License - See [LICENSE](LICENSE) file for details. ## Acknowledgments -This project is built on [TensorQEC.jl](https://github.com/nzy1997/TensorQEC.jl) by nzy1997. +This project uses: +- [Stim](https://github.com/quantumlib/Stim) for efficient quantum circuit simulation +- [PyTorch](https://pytorch.org/) for the belief propagation implementation +- [uv](https://github.com/astral-sh/uv) for fast Python package management + +## Related Projects + +- [TensorQEC.jl](https://github.com/nzy1997/TensorQEC.jl) - Julia quantum error correction library +- [QEC Visualization](https://github.com/nzy1997/qec-thrust) - Quantum error correction visualization tools diff --git a/datasets/README.md b/datasets/README.md index 169848f..7c696eb 100644 --- a/datasets/README.md +++ b/datasets/README.md @@ -4,14 +4,28 @@ Circuit-level surface-code memory experiments generated with Stim for **Belief P ## Dataset Organization -The dataset is organized into subdirectories by file type: +All dataset files are in the root `datasets/` directory, organized by filename: ``` datasets/ -├── circuits/ # Noisy quantum circuits (.stim) -├── dems/ # Detector error models (.dem) -├── uais/ # UAI format for probabilistic inference (.uai) -└── syndromes/ # Syndrome databases (.npz) +├── README.md # This file +├── sc_d3_r3_p0010_z.stim # Noisy quantum circuits +├── sc_d3_r5_p0010_z.stim +├── sc_d3_r7_p0010_z.stim +├── sc_d3_r3_p0010_z.dem # Detector error models +├── sc_d3_r5_p0010_z.dem +├── sc_d3_r7_p0010_z.dem +├── sc_d3_r3_p0010_z.uai # UAI format for probabilistic inference +├── sc_d3_r5_p0010_z.uai +├── sc_d3_r7_p0010_z.uai +├── sc_d3_r3_p0010_z.npz # Syndrome databases +├── sc_d3_r5_p0010_z.npz +├── sc_d3_r7_p0010_z.npz +└── visualizations/ # Visualization files + ├── sc_d3_layout.png # Qubit layout + ├── parity_check_matrix.png # BP parity check matrix + ├── syndrome_stats.png # Detection event statistics + └── single_syndrome.png # Example syndrome pattern ``` ## Overview @@ -35,9 +49,28 @@ datasets/ | File | Description | |------|-------------| -| `sc_d3_r3_p0010_z.stim` | 3 rounds, p=0.01, Z-memory | -| `sc_d3_r5_p0010_z.stim` | 5 rounds, p=0.01, Z-memory | -| `sc_d3_r7_p0010_z.stim` | 7 rounds, p=0.01, Z-memory | +| `sc_d3_r3_p0010_z.stim` | 3 rounds, p=0.01, Z-memory circuit | +| `sc_d3_r5_p0010_z.stim` | 5 rounds, p=0.01, Z-memory circuit | +| `sc_d3_r7_p0010_z.stim` | 7 rounds, p=0.01, Z-memory circuit | +| `sc_d3_r3_p0010_z.dem` | DEM for 3 rounds | +| `sc_d3_r5_p0010_z.dem` | DEM for 5 rounds | +| `sc_d3_r7_p0010_z.dem` | DEM for 7 rounds | +| `sc_d3_r3_p0010_z.uai` | UAI format for 3 rounds | +| `sc_d3_r5_p0010_z.uai` | UAI format for 5 rounds | +| `sc_d3_r7_p0010_z.uai` | UAI format for 7 rounds | +| `sc_d3_r3_p0010_z.npz` | Syndrome database for 3 rounds | +| `sc_d3_r5_p0010_z.npz` | Syndrome database for 5 rounds | +| `sc_d3_r7_p0010_z.npz` | Syndrome database for 7 rounds | +| `visualizations/sc_d3_layout.png` | Qubit layout visualization | +| `visualizations/parity_check_matrix.png` | BP parity check matrix H | +| `visualizations/syndrome_stats.png` | Detection event statistics | +| `visualizations/single_syndrome.png` | Example syndrome pattern | + +## Qubit Layout + +The surface code layout showing qubit positions (data + ancilla): + +![Qubit Layout](visualizations/sc_d3_layout.png) ## Using This Dataset for BP Decoding @@ -50,7 +83,7 @@ import stim import numpy as np # Load circuit -circuit = stim.Circuit.from_file("datasets/circuits/sc_d3_r3_p0010_z.stim") +circuit = stim.Circuit.from_file("datasets/sc_d3_r3_p0010_z.stim") # Extract DEM - this is what BP needs dem = circuit.detector_error_model(decompose_errors=True) @@ -73,30 +106,34 @@ def build_parity_check_matrix(dem): dets = [t.val for t in inst.targets_copy() if t.is_relative_detector_id()] obs = [t.val for t in inst.targets_copy() if t.is_logical_observable_id()] errors.append({'prob': prob, 'detectors': dets, 'observables': obs}) - + n_detectors = dem.num_detectors n_errors = len(errors) - + # Parity check matrix H = np.zeros((n_detectors, n_errors), dtype=np.uint8) # Prior error probabilities (for BP initialization) priors = np.zeros(n_errors) # Which errors flip the logical observable obs_flip = np.zeros(n_errors, dtype=np.uint8) - + for j, e in enumerate(errors): priors[j] = e['prob'] for d in e['detectors']: H[d, j] = 1 if e['observables']: obs_flip[j] = 1 - + return H, priors, obs_flip H, priors, obs_flip = build_parity_check_matrix(dem) print(f"H shape: {H.shape}") # (24, 286) ``` +The parity check matrix structure: + +![Parity Check Matrix](visualizations/parity_check_matrix.png) + ### Step 3: Sample Syndromes (Detection Events) ```python @@ -121,39 +158,39 @@ print(f"Example syndrome: {syndromes[0]}") def bp_decode(H, syndrome, priors, max_iter=50, damping=0.5): """ Belief Propagation decoder (min-sum variant). - + Args: H: Parity check matrix (n_detectors, n_errors) syndrome: Detection events (n_detectors,) priors: Prior error probabilities (n_errors,) max_iter: Maximum BP iterations damping: Message damping factor - + Returns: estimated_errors: Most likely error pattern (n_errors,) soft_output: Log-likelihood ratios (n_errors,) """ n_checks, n_vars = H.shape - + # Initialize LLRs from priors: LLR = log((1-p)/p) llr_prior = np.log((1 - priors) / priors) - + # Messages: check-to-variable and variable-to-check # ... BP message passing iterations ... - + # Hard decision estimated_errors = (soft_output < 0).astype(int) - + return estimated_errors, soft_output # Decode each syndrome for i in range(n_shots): syndrome = syndromes[i] estimated_errors, _ = bp_decode(H, syndrome, priors) - + # Predict observable flip predicted_obs_flip = np.dot(estimated_errors, obs_flip) % 2 - + # Check if decoding succeeded success = (predicted_obs_flip == actual_obs_flips[i]) ``` @@ -167,24 +204,36 @@ def evaluate_decoder(decoder_fn, circuit, n_shots=10000): """Evaluate decoder logical error rate.""" dem = circuit.detector_error_model(decompose_errors=True) H, priors, obs_flip = build_parity_check_matrix(dem) - + sampler = circuit.compile_detector_sampler() samples = sampler.sample(n_shots, append_observables=True) syndromes = samples[:, :-1] actual_obs = samples[:, -1] - + errors = 0 for i in range(n_shots): est_errors, _ = decoder_fn(H, syndromes[i], priors) pred_obs = np.dot(est_errors, obs_flip) % 2 if pred_obs != actual_obs[i]: errors += 1 - + return errors / n_shots # logical_error_rate = evaluate_decoder(bp_decode, circuit) ``` +## Syndrome Statistics + +Detection event frequencies across 1000 shots (left) and baseline observable flip rate without decoding (right): + +![Syndrome Statistics](visualizations/syndrome_stats.png) + +## Example Syndrome + +A single syndrome sample showing which detectors fired (red = triggered): + +![Single Syndrome](visualizations/single_syndrome.png) + ## Regenerating the Dataset ```bash @@ -192,27 +241,25 @@ def evaluate_decoder(decoder_fn, circuit, n_shots=10000): uv sync # Generate circuits using the CLI -python -m bpdecoderplus.cli \ +uv run generate-noisy-circuits \ --distance 3 \ --p 0.01 \ --rounds 3 5 7 \ --task z \ - --generate-dem \ - --generate-uai \ - --generate-syndromes 10000 + --output datasets ``` ## Extending the Dataset ```bash # Different error rates -python -m bpdecoderplus.cli --p 0.005 --rounds 3 5 7 --generate-dem --generate-uai +uv run generate-noisy-circuits --distance 3 --p 0.005 --rounds 3 5 7 --task z # Different distances -python -m bpdecoderplus.cli --distance 5 --rounds 5 7 9 --generate-dem --generate-uai +uv run generate-noisy-circuits --distance 5 --p 0.01 --rounds 5 7 9 --task z # X-memory experiment -python -m bpdecoderplus.cli --task x --rounds 3 5 7 --generate-dem --generate-uai +uv run generate-noisy-circuits --distance 3 --p 0.01 --task x --rounds 3 5 7 ``` ## References diff --git a/datasets/dems/test.dem b/datasets/dems/test.dem new file mode 100644 index 0000000..3f050b2 --- /dev/null +++ b/datasets/dems/test.dem @@ -0,0 +1,245 @@ +error(0.01911873511075362) D0 +error(0.01911873511075362) D0 D1 +error(0.02492213333333331) D0 D8 +error(0.01911873511075362) D1 D2 +error(0.004005357180252828) D1 D4 D5 +error(0.001338700097173321) D1 D4 D8 +error(0.00797862858822285) D1 D4 L0 +error(0.02619410690587643) D1 D5 +error(0.004005357180252828) D1 D8 +error(0.03997966359665833) D1 L0 +error(0.03936259494598386) D2 +error(0.02169031111111104) D2 D3 +error(0.005333333333333312) D2 D3 D6 +error(0.005995987492949032) D2 D5 +error(0.002006705456917236) D2 D5 D6 +error(0.002006705456917236) D2 D5 D6 D9 +error(0.0006697986788568588) D2 D5 D9 +error(0.0006697986788568588) D2 D6 +error(0.0006697986788568588) D2 D6 D8 +error(0.0006697986788568588) D2 D6 D8 D9 +error(0.0006697986788568588) D2 D6 D9 +error(0.002006705456917236) D2 D6 D9 D10 +error(0.002006705456917236) D2 D6 D10 +error(0.002006705456917236) D2 D8 +error(0.002006705456917236) D2 D8 D9 +error(0.004669790293214321) D2 D9 +error(0.0006697986788568588) D2 D9 D10 +error(0.02555854638822825) D2 D10 +error(0.002673815958446298) D3 D5 +error(0.002673815958446298) D3 D5 D6 +error(0.002673815958446298) D3 D6 D7 +error(0.002673815958446298) D3 D6 D10 +error(0.002673815958446298) D3 D6 L0 +error(0.02236793284649183) D3 D7 +error(0.002673815958446298) D3 D10 +error(0.01911873511075362) D3 L0 +error(0.04671719903466118) D4 +error(0.006000449842759885) D4 D5 D6 L0 +error(0.001338700097173321) D4 D5 D8 +error(0.002673815958446298) D4 D5 D12 L0 +error(0.008642177604111326) D4 D5 L0 +error(0.006000449842759885) D4 D6 +error(0.03501987560309133) D4 D12 +error(0.0006697986788568588) D5 D6 D8 +error(0.0006697986788568588) D5 D6 D8 D9 +error(0.006000449842759885) D5 D6 D9 D10 +error(0.002006705456917236) D5 D6 D9 D13 +error(0.0006697986788568588) D5 D6 D9 L0 +error(0.0006697986788568588) D5 D6 D12 D13 +error(0.002006705456917236) D5 D6 D12 L0 +error(0.002673815958446298) D5 D6 L0 +error(0.009300399244684825) D5 D8 +error(0.007983073028790271) D5 D8 D9 +error(0.001338700097173321) D5 D9 D12 D13 +error(0.0006697986788568588) D5 D9 D12 D16 +error(0.0006697986788568588) D5 D9 D12 L0 +error(0.0006697986788568588) D5 D9 D13 +error(0.002006705456917236) D5 D9 D16 +error(0.006000449842759885) D5 D10 +error(0.002006705456917236) D5 D12 D13 +error(0.0006697986788568588) D5 D12 D16 +error(0.002673815958446298) D5 D12 L0 +error(0.02364674503591482) D5 D13 +error(0.002006705456917236) D5 D16 +error(0.01648726836301881) D5 L0 +error(0.05155626641762742) D6 +error(0.0006697986788568588) D6 D7 D9 D10 +error(0.0006697986788568588) D6 D7 D9 D13 +error(0.006000449842759885) D6 D7 D10 +error(0.002006705456917236) D6 D7 D10 D14 +error(0.0006697986788568588) D6 D7 D13 +error(0.001338700097173321) D6 D7 D13 D14 +error(0.0006697986788568588) D6 D7 D14 L0 +error(0.005337801668914704) D6 D7 L0 +error(0.008642177604111326) D6 D9 +error(0.0006697986788568588) D6 D9 D10 +error(0.002006705456917236) D6 D9 D10 D13 +error(0.0006697986788568588) D6 D9 D13 L0 +error(0.0006697986788568588) D6 D10 +error(0.0006697986788568588) D6 D10 D13 D14 +error(0.00334003280051021) D6 D12 +error(0.002006705456917236) D6 D12 D13 L0 +error(0.002006705456917236) D6 D13 D14 L0 +error(0.0006697986788568588) D6 D13 L0 +error(0.03626481347851893) D6 D14 +error(0.0006697986788568588) D7 D9 D10 D14 +error(0.0006697986788568588) D7 D9 D13 D14 +error(0.007323084334358033) D7 D10 +error(0.0006697986788568588) D7 D10 D11 +error(0.0006697986788568588) D7 D10 D11 D14 +error(0.002006705456917236) D7 D10 D14 +error(0.0006697986788568588) D7 D11 D14 D18 +error(0.0006697986788568588) D7 D11 D18 +error(0.001338700097173321) D7 D13 +error(0.0006697986788568588) D7 D13 D14 +error(0.002673815958446298) D7 D14 D15 +error(0.002006705456917236) D7 D14 D18 +error(0.002006705456917236) D7 D14 L0 +error(0.02236793284649183) D7 D15 +error(0.002006705456917236) D7 D18 +error(0.006662210334862288) D7 L0 +error(0.008642177604111326) D8 +error(0.006000449842759885) D8 D9 +error(0.002673815958446298) D8 D9 D16 +error(0.02236793284649183) D8 D16 +error(0.05215700045821763) D9 +error(0.002673815958446298) D9 D10 +error(0.006000449842759885) D9 D10 D11 +error(0.001338700097173321) D9 D10 D13 D14 +error(0.0006697986788568588) D9 D10 D13 D17 +error(0.0006697986788568588) D9 D10 D14 D16 +error(0.0006697986788568588) D9 D10 D16 +error(0.001338700097173321) D9 D10 D16 D17 +error(0.002006705456917236) D9 D10 D17 +error(0.006000449842759885) D9 D11 +error(0.001338700097173321) D9 D12 +error(0.0006697986788568588) D9 D12 D13 D16 +error(0.0006697986788568588) D9 D12 D13 L0 +error(0.0006697986788568588) D9 D13 D14 D16 +error(0.002006705456917236) D9 D13 D16 +error(0.002006705456917236) D9 D13 D16 D17 +error(0.001338700097173321) D9 D14 +error(0.002006705456917236) D9 D16 +error(0.0006697986788568588) D9 D16 D17 +error(0.03626481347851893) D9 D17 +error(0.01778182544467273) D10 +error(0.008642177604111326) D10 D11 +error(0.0006697986788568588) D10 D11 D14 +error(0.001338700097173321) D10 D11 D14 D18 +error(0.002006705456917236) D10 D11 D17 +error(0.0006697986788568588) D10 D11 D17 D18 +error(0.002006705456917236) D10 D11 D18 +error(0.004005357180252828) D10 D13 +error(0.002006705456917236) D10 D13 D14 D17 +error(0.0006697986788568588) D10 D14 D16 D17 +error(0.0006697986788568588) D10 D14 D17 +error(0.002006705456917236) D10 D14 D17 D18 +error(0.0006697986788568588) D10 D14 D18 +error(0.001338700097173321) D10 D16 +error(0.0006697986788568588) D10 D16 D17 +error(0.0006697986788568588) D10 D17 +error(0.02364674503591482) D10 D18 +error(0.04244381618308433) D11 +error(0.001338700097173321) D11 D14 +error(0.0006697986788568588) D11 D14 D18 +error(0.00334003280051021) D11 D17 +error(0.002006705456917236) D11 D17 D18 +error(0.002673815958446298) D11 D18 +error(0.002673815958446298) D11 D18 D19 +error(0.03501987560309133) D11 D19 +error(0.04244381618308433) D12 +error(0.006000449842759885) D12 D13 D14 L0 +error(0.0006697986788568588) D12 D13 D16 +error(0.008642177604111326) D12 D13 L0 +error(0.006000449842759885) D12 D14 +error(0.0006697986788568588) D13 D14 D16 D17 +error(0.006000449842759885) D13 D14 D17 D18 +error(0.002006705456917236) D13 D14 D17 D21 +error(0.0006697986788568588) D13 D14 D17 L0 +error(0.0006697986788568588) D13 D14 D21 +error(0.002673815958446298) D13 D14 L0 +error(0.007323084334358033) D13 D16 +error(0.006000449842759885) D13 D16 D17 +error(0.002673815958446298) D13 D17 D20 +error(0.002006705456917236) D13 D17 D21 +error(0.0006697986788568588) D13 D17 L0 +error(0.006000449842759885) D13 D18 +error(0.002673815958446298) D13 D20 +error(0.02555854638822825) D13 D21 +error(0.01778182544467273) D13 L0 +error(0.05215700045821762) D14 +error(0.0006697986788568588) D14 D15 D17 D18 +error(0.0006697986788568588) D14 D15 D17 D21 +error(0.007983073028790271) D14 D15 D18 +error(0.002006705456917236) D14 D15 D21 +error(0.006000449842759885) D14 D15 L0 +error(0.008642177604111326) D14 D17 +error(0.0006697986788568588) D14 D17 D18 +error(0.002006705456917236) D14 D17 D18 D21 +error(0.0006697986788568588) D14 D17 D21 L0 +error(0.0006697986788568588) D14 D18 D21 +error(0.004669790293214321) D14 D21 L0 +error(0.0006697986788568588) D15 D17 D18 +error(0.0006697986788568588) D15 D17 D21 +error(0.009300399244684827) D15 D18 +error(0.001338700097173321) D15 D18 D19 +error(0.001338700097173321) D15 D19 D22 +error(0.002006705456917236) D15 D21 +error(0.004005357180252828) D15 D22 +error(0.02492213333333331) D15 D23 +error(0.008642177604111326) D15 L0 +error(0.006662210334862289) D16 +error(0.005337801668914705) D16 D17 +error(0.002673815958446298) D16 D17 D20 +error(0.02236793284649183) D16 D20 +error(0.05155626641762741) D17 +error(0.002673815958446298) D17 D18 +error(0.006000449842759885) D17 D18 D19 +error(0.002673815958446298) D17 D18 D20 +error(0.002006705456917236) D17 D18 D21 +error(0.006000449842759885) D17 D19 +error(0.002673815958446298) D17 D20 +error(0.005333333333333312) D17 D20 D21 +error(0.0006697986788568588) D17 D21 L0 +error(0.01648726836301881) D18 +error(0.008642177604111326) D18 D19 +error(0.004005357180252828) D18 D19 D22 +error(0.002673815958446298) D18 D20 +error(0.005995987492949032) D18 D21 +error(0.02619410690587643) D18 D22 +error(0.04671719903466118) D19 +error(0.00797862858822285) D19 D22 +error(0.01262033963927737) D20 +error(0.01522666666666665) D20 D21 +error(0.01262033963927737) D21 D22 +error(0.02682881602833452) D21 L0 +error(0.02746267489612923) D22 +error(0.01262033963927737) D22 D23 +error(0.01262033963927737) D23 L0 +detector(0, 4, 0) D0 +detector(2, 2, 0) D1 +detector(4, 4, 0) D2 +detector(6, 2, 0) D3 +shift_detectors(0, 0, 1) 0 +detector(2, 0, 0) D4 +detector(2, 2, 0) D5 +detector(4, 2, 0) D6 +detector(6, 2, 0) D7 +detector(0, 4, 0) D8 +detector(2, 4, 0) D9 +detector(4, 4, 0) D10 +detector(4, 6, 0) D11 +shift_detectors(0, 0, 1) 0 +detector(2, 0, 0) D12 +detector(2, 2, 0) D13 +detector(4, 2, 0) D14 +detector(6, 2, 0) D15 +detector(0, 4, 0) D16 +detector(2, 4, 0) D17 +detector(4, 4, 0) D18 +detector(4, 6, 0) D19 +detector(0, 4, 1) D20 +detector(2, 2, 1) D21 +detector(4, 4, 1) D22 +detector(6, 2, 1) D23 \ No newline at end of file diff --git a/datasets/noisy_circuits/README.md b/datasets/noisy_circuits/README.md deleted file mode 100644 index 9bd1385..0000000 --- a/datasets/noisy_circuits/README.md +++ /dev/null @@ -1,234 +0,0 @@ -# Noisy Circuit Dataset (Surface Code, d=3) - -Circuit-level surface-code memory experiments generated with Stim for **Belief Propagation (BP) decoding** demonstrations. - -## Overview - -| Parameter | Value | -|-----------|-------| -| Code | Rotated surface code | -| Distance | d = 3 | -| Noise model | i.i.d. depolarizing | -| Error rate | p = 0.01 | -| Task | Z-memory experiment | -| Rounds | 3, 5, 7 | - -### Noise Application Points -- Clifford gates (`after_clifford_depolarization`) -- Data qubits between rounds (`before_round_data_depolarization`) -- Resets (`after_reset_flip_probability`) -- Measurements (`before_measure_flip_probability`) - -## Files - -| File | Description | -|------|-------------| -| `sc_d3_r3_p0010_z.stim` | 3 rounds, p=0.01, Z-memory | -| `sc_d3_r5_p0010_z.stim` | 5 rounds, p=0.01, Z-memory | -| `sc_d3_r7_p0010_z.stim` | 7 rounds, p=0.01, Z-memory | -| `sc_d3_layout.png` | Qubit layout visualization | -| `parity_check_matrix.png` | BP parity check matrix H | -| `syndrome_stats.png` | Detection event statistics | -| `single_syndrome.png` | Example syndrome pattern | - -## Qubit Layout - -The surface code layout showing qubit positions (data + ancilla): - -![Qubit Layout](sc_d3_layout.png) - -## Using This Dataset for BP Decoding - -### Step 1: Load Circuit and Extract Detector Error Model (DEM) - -The Detector Error Model is the key input for BP decoding. It describes which errors trigger which detectors. - -```python -import stim -import numpy as np - -# Load circuit -circuit = stim.Circuit.from_file("datasets/noisy_circuits/sc_d3_r3_p0010_z.stim") - -# Extract DEM - this is what BP needs -dem = circuit.detector_error_model(decompose_errors=True) -print(f"Detectors: {dem.num_detectors}") # 24 -print(f"Error mechanisms: {dem.num_errors}") # 286 -print(f"Observables: {dem.num_observables}") # 1 -``` - -### Step 2: Build Parity Check Matrix H - -BP operates on the parity check matrix where `H[i,j] = 1` means error `j` triggers detector `i`. - -```python -def build_parity_check_matrix(dem): - """Convert DEM to parity check matrix H and prior probabilities.""" - errors = [] - for inst in dem.flattened(): - if inst.type == 'error': - prob = inst.args_copy()[0] - dets = [t.val for t in inst.targets_copy() if t.is_relative_detector_id()] - obs = [t.val for t in inst.targets_copy() if t.is_logical_observable_id()] - errors.append({'prob': prob, 'detectors': dets, 'observables': obs}) - - n_detectors = dem.num_detectors - n_errors = len(errors) - - # Parity check matrix - H = np.zeros((n_detectors, n_errors), dtype=np.uint8) - # Prior error probabilities (for BP initialization) - priors = np.zeros(n_errors) - # Which errors flip the logical observable - obs_flip = np.zeros(n_errors, dtype=np.uint8) - - for j, e in enumerate(errors): - priors[j] = e['prob'] - for d in e['detectors']: - H[d, j] = 1 - if e['observables']: - obs_flip[j] = 1 - - return H, priors, obs_flip - -H, priors, obs_flip = build_parity_check_matrix(dem) -print(f"H shape: {H.shape}") # (24, 286) -``` - -The parity check matrix structure: - -![Parity Check Matrix](parity_check_matrix.png) - -### Step 3: Sample Syndromes (Detection Events) - -```python -# Compile sampler -sampler = circuit.compile_detector_sampler() - -# Sample detection events + observable flip -n_shots = 1000 -samples = sampler.sample(n_shots, append_observables=True) - -# Split into syndrome and observable -syndromes = samples[:, :-1] # shape: (n_shots, n_detectors) -actual_obs_flips = samples[:, -1] # shape: (n_shots,) - -print(f"Syndrome shape: {syndromes.shape}") -print(f"Example syndrome: {syndromes[0]}") -``` - -### Step 4: BP Decoding (Pseudocode) - -```python -def bp_decode(H, syndrome, priors, max_iter=50, damping=0.5): - """ - Belief Propagation decoder (min-sum variant). - - Args: - H: Parity check matrix (n_detectors, n_errors) - syndrome: Detection events (n_detectors,) - priors: Prior error probabilities (n_errors,) - max_iter: Maximum BP iterations - damping: Message damping factor - - Returns: - estimated_errors: Most likely error pattern (n_errors,) - soft_output: Log-likelihood ratios (n_errors,) - """ - n_checks, n_vars = H.shape - - # Initialize LLRs from priors: LLR = log((1-p)/p) - llr_prior = np.log((1 - priors) / priors) - - # Messages: check-to-variable and variable-to-check - # ... BP message passing iterations ... - - # Hard decision - estimated_errors = (soft_output < 0).astype(int) - - return estimated_errors, soft_output - -# Decode each syndrome -for i in range(n_shots): - syndrome = syndromes[i] - estimated_errors, _ = bp_decode(H, syndrome, priors) - - # Predict observable flip - predicted_obs_flip = np.dot(estimated_errors, obs_flip) % 2 - - # Check if decoding succeeded - success = (predicted_obs_flip == actual_obs_flips[i]) -``` - -### Step 5: Evaluate Decoder Performance - -After decoding, compare predicted vs actual observable flips to measure logical error rate. - -```python -def evaluate_decoder(decoder_fn, circuit, n_shots=10000): - """Evaluate decoder logical error rate.""" - dem = circuit.detector_error_model(decompose_errors=True) - H, priors, obs_flip = build_parity_check_matrix(dem) - - sampler = circuit.compile_detector_sampler() - samples = sampler.sample(n_shots, append_observables=True) - syndromes = samples[:, :-1] - actual_obs = samples[:, -1] - - errors = 0 - for i in range(n_shots): - est_errors, _ = decoder_fn(H, syndromes[i], priors) - pred_obs = np.dot(est_errors, obs_flip) % 2 - if pred_obs != actual_obs[i]: - errors += 1 - - return errors / n_shots - -# logical_error_rate = evaluate_decoder(bp_decode, circuit) -``` - -## Syndrome Statistics - -Detection event frequencies across 1000 shots (left) and baseline observable flip rate without decoding (right): - -![Syndrome Statistics](syndrome_stats.png) - -## Example Syndrome - -A single syndrome sample showing which detectors fired (red = triggered): - -![Single Syndrome](single_syndrome.png) - -## Regenerating the Dataset - -```bash -# Install the package with uv -uv sync - -# Generate circuits using the CLI -uv run generate-noisy-circuits \ - --distance 3 \ - --p 0.01 \ - --rounds 3 5 7 \ - --task z \ - --output datasets/noisy_circuits -``` - -## Extending the Dataset - -```bash -# Different error rates -uv run generate-noisy-circuits --p 0.005 --rounds 3 5 7 - -# Different distances -uv run generate-noisy-circuits --distance 5 --rounds 5 7 9 - -# X-memory experiment -uv run generate-noisy-circuits --task x --rounds 3 5 7 -``` - -## References - -- [Stim Documentation](https://github.com/quantumlib/Stim) -- [BP+OSD Decoder Paper](https://arxiv.org/abs/2005.07016) -- [Surface Code Decoding Review](https://quantum-journal.org/papers/q-2024-10-10-1498/) diff --git a/datasets/noisy_circuits/sc_d3_r3_p0010_z.stim b/datasets/noisy_circuits/sc_d3_r3_p0010_z.stim deleted file mode 100644 index 187876d..0000000 --- a/datasets/noisy_circuits/sc_d3_r3_p0010_z.stim +++ /dev/null @@ -1,89 +0,0 @@ -QUBIT_COORDS(1, 1) 1 -QUBIT_COORDS(2, 0) 2 -QUBIT_COORDS(3, 1) 3 -QUBIT_COORDS(5, 1) 5 -QUBIT_COORDS(1, 3) 8 -QUBIT_COORDS(2, 2) 9 -QUBIT_COORDS(3, 3) 10 -QUBIT_COORDS(4, 2) 11 -QUBIT_COORDS(5, 3) 12 -QUBIT_COORDS(6, 2) 13 -QUBIT_COORDS(0, 4) 14 -QUBIT_COORDS(1, 5) 15 -QUBIT_COORDS(2, 4) 16 -QUBIT_COORDS(3, 5) 17 -QUBIT_COORDS(4, 4) 18 -QUBIT_COORDS(5, 5) 19 -QUBIT_COORDS(4, 6) 25 -R 1 3 5 8 10 12 15 17 19 -X_ERROR(0.01) 1 3 5 8 10 12 15 17 19 -R 2 9 11 13 14 16 18 25 -X_ERROR(0.01) 2 9 11 13 14 16 18 25 -TICK -DEPOLARIZE1(0.01) 1 3 5 8 10 12 15 17 19 -H 2 11 16 25 -DEPOLARIZE1(0.01) 2 11 16 25 -TICK -CX 2 3 16 17 11 12 15 14 10 9 19 18 -DEPOLARIZE2(0.01) 2 3 16 17 11 12 15 14 10 9 19 18 -TICK -CX 2 1 16 15 11 10 8 14 3 9 12 18 -DEPOLARIZE2(0.01) 2 1 16 15 11 10 8 14 3 9 12 18 -TICK -CX 16 10 11 5 25 19 8 9 17 18 12 13 -DEPOLARIZE2(0.01) 16 10 11 5 25 19 8 9 17 18 12 13 -TICK -CX 16 8 11 3 25 17 1 9 10 18 5 13 -DEPOLARIZE2(0.01) 16 8 11 3 25 17 1 9 10 18 5 13 -TICK -H 2 11 16 25 -DEPOLARIZE1(0.01) 2 11 16 25 -TICK -X_ERROR(0.01) 2 9 11 13 14 16 18 25 -MR 2 9 11 13 14 16 18 25 -X_ERROR(0.01) 2 9 11 13 14 16 18 25 -DETECTOR(0, 4, 0) rec[-4] -DETECTOR(2, 2, 0) rec[-7] -DETECTOR(4, 4, 0) rec[-2] -DETECTOR(6, 2, 0) rec[-5] -REPEAT 2 { - TICK - DEPOLARIZE1(0.01) 1 3 5 8 10 12 15 17 19 - H 2 11 16 25 - DEPOLARIZE1(0.01) 2 11 16 25 - TICK - CX 2 3 16 17 11 12 15 14 10 9 19 18 - DEPOLARIZE2(0.01) 2 3 16 17 11 12 15 14 10 9 19 18 - TICK - CX 2 1 16 15 11 10 8 14 3 9 12 18 - DEPOLARIZE2(0.01) 2 1 16 15 11 10 8 14 3 9 12 18 - TICK - CX 16 10 11 5 25 19 8 9 17 18 12 13 - DEPOLARIZE2(0.01) 16 10 11 5 25 19 8 9 17 18 12 13 - TICK - CX 16 8 11 3 25 17 1 9 10 18 5 13 - DEPOLARIZE2(0.01) 16 8 11 3 25 17 1 9 10 18 5 13 - TICK - H 2 11 16 25 - DEPOLARIZE1(0.01) 2 11 16 25 - TICK - X_ERROR(0.01) 2 9 11 13 14 16 18 25 - MR 2 9 11 13 14 16 18 25 - X_ERROR(0.01) 2 9 11 13 14 16 18 25 - SHIFT_COORDS(0, 0, 1) - DETECTOR(2, 0, 0) rec[-8] rec[-16] - DETECTOR(2, 2, 0) rec[-7] rec[-15] - DETECTOR(4, 2, 0) rec[-6] rec[-14] - DETECTOR(6, 2, 0) rec[-5] rec[-13] - DETECTOR(0, 4, 0) rec[-4] rec[-12] - DETECTOR(2, 4, 0) rec[-3] rec[-11] - DETECTOR(4, 4, 0) rec[-2] rec[-10] - DETECTOR(4, 6, 0) rec[-1] rec[-9] -} -X_ERROR(0.01) 1 3 5 8 10 12 15 17 19 -M 1 3 5 8 10 12 15 17 19 -DETECTOR(0, 4, 1) rec[-3] rec[-6] rec[-13] -DETECTOR(2, 2, 1) rec[-5] rec[-6] rec[-8] rec[-9] rec[-16] -DETECTOR(4, 4, 1) rec[-1] rec[-2] rec[-4] rec[-5] rec[-11] -DETECTOR(6, 2, 1) rec[-4] rec[-7] rec[-14] -OBSERVABLE_INCLUDE(0) rec[-7] rec[-8] rec[-9] \ No newline at end of file diff --git a/datasets/noisy_circuits/sc_d3_r5_p0010_z.stim b/datasets/noisy_circuits/sc_d3_r5_p0010_z.stim deleted file mode 100644 index 79afc47..0000000 --- a/datasets/noisy_circuits/sc_d3_r5_p0010_z.stim +++ /dev/null @@ -1,89 +0,0 @@ -QUBIT_COORDS(1, 1) 1 -QUBIT_COORDS(2, 0) 2 -QUBIT_COORDS(3, 1) 3 -QUBIT_COORDS(5, 1) 5 -QUBIT_COORDS(1, 3) 8 -QUBIT_COORDS(2, 2) 9 -QUBIT_COORDS(3, 3) 10 -QUBIT_COORDS(4, 2) 11 -QUBIT_COORDS(5, 3) 12 -QUBIT_COORDS(6, 2) 13 -QUBIT_COORDS(0, 4) 14 -QUBIT_COORDS(1, 5) 15 -QUBIT_COORDS(2, 4) 16 -QUBIT_COORDS(3, 5) 17 -QUBIT_COORDS(4, 4) 18 -QUBIT_COORDS(5, 5) 19 -QUBIT_COORDS(4, 6) 25 -R 1 3 5 8 10 12 15 17 19 -X_ERROR(0.01) 1 3 5 8 10 12 15 17 19 -R 2 9 11 13 14 16 18 25 -X_ERROR(0.01) 2 9 11 13 14 16 18 25 -TICK -DEPOLARIZE1(0.01) 1 3 5 8 10 12 15 17 19 -H 2 11 16 25 -DEPOLARIZE1(0.01) 2 11 16 25 -TICK -CX 2 3 16 17 11 12 15 14 10 9 19 18 -DEPOLARIZE2(0.01) 2 3 16 17 11 12 15 14 10 9 19 18 -TICK -CX 2 1 16 15 11 10 8 14 3 9 12 18 -DEPOLARIZE2(0.01) 2 1 16 15 11 10 8 14 3 9 12 18 -TICK -CX 16 10 11 5 25 19 8 9 17 18 12 13 -DEPOLARIZE2(0.01) 16 10 11 5 25 19 8 9 17 18 12 13 -TICK -CX 16 8 11 3 25 17 1 9 10 18 5 13 -DEPOLARIZE2(0.01) 16 8 11 3 25 17 1 9 10 18 5 13 -TICK -H 2 11 16 25 -DEPOLARIZE1(0.01) 2 11 16 25 -TICK -X_ERROR(0.01) 2 9 11 13 14 16 18 25 -MR 2 9 11 13 14 16 18 25 -X_ERROR(0.01) 2 9 11 13 14 16 18 25 -DETECTOR(0, 4, 0) rec[-4] -DETECTOR(2, 2, 0) rec[-7] -DETECTOR(4, 4, 0) rec[-2] -DETECTOR(6, 2, 0) rec[-5] -REPEAT 4 { - TICK - DEPOLARIZE1(0.01) 1 3 5 8 10 12 15 17 19 - H 2 11 16 25 - DEPOLARIZE1(0.01) 2 11 16 25 - TICK - CX 2 3 16 17 11 12 15 14 10 9 19 18 - DEPOLARIZE2(0.01) 2 3 16 17 11 12 15 14 10 9 19 18 - TICK - CX 2 1 16 15 11 10 8 14 3 9 12 18 - DEPOLARIZE2(0.01) 2 1 16 15 11 10 8 14 3 9 12 18 - TICK - CX 16 10 11 5 25 19 8 9 17 18 12 13 - DEPOLARIZE2(0.01) 16 10 11 5 25 19 8 9 17 18 12 13 - TICK - CX 16 8 11 3 25 17 1 9 10 18 5 13 - DEPOLARIZE2(0.01) 16 8 11 3 25 17 1 9 10 18 5 13 - TICK - H 2 11 16 25 - DEPOLARIZE1(0.01) 2 11 16 25 - TICK - X_ERROR(0.01) 2 9 11 13 14 16 18 25 - MR 2 9 11 13 14 16 18 25 - X_ERROR(0.01) 2 9 11 13 14 16 18 25 - SHIFT_COORDS(0, 0, 1) - DETECTOR(2, 0, 0) rec[-8] rec[-16] - DETECTOR(2, 2, 0) rec[-7] rec[-15] - DETECTOR(4, 2, 0) rec[-6] rec[-14] - DETECTOR(6, 2, 0) rec[-5] rec[-13] - DETECTOR(0, 4, 0) rec[-4] rec[-12] - DETECTOR(2, 4, 0) rec[-3] rec[-11] - DETECTOR(4, 4, 0) rec[-2] rec[-10] - DETECTOR(4, 6, 0) rec[-1] rec[-9] -} -X_ERROR(0.01) 1 3 5 8 10 12 15 17 19 -M 1 3 5 8 10 12 15 17 19 -DETECTOR(0, 4, 1) rec[-3] rec[-6] rec[-13] -DETECTOR(2, 2, 1) rec[-5] rec[-6] rec[-8] rec[-9] rec[-16] -DETECTOR(4, 4, 1) rec[-1] rec[-2] rec[-4] rec[-5] rec[-11] -DETECTOR(6, 2, 1) rec[-4] rec[-7] rec[-14] -OBSERVABLE_INCLUDE(0) rec[-7] rec[-8] rec[-9] \ No newline at end of file diff --git a/datasets/noisy_circuits/sc_d3_r7_p0010_z.stim b/datasets/noisy_circuits/sc_d3_r7_p0010_z.stim deleted file mode 100644 index c79fed7..0000000 --- a/datasets/noisy_circuits/sc_d3_r7_p0010_z.stim +++ /dev/null @@ -1,89 +0,0 @@ -QUBIT_COORDS(1, 1) 1 -QUBIT_COORDS(2, 0) 2 -QUBIT_COORDS(3, 1) 3 -QUBIT_COORDS(5, 1) 5 -QUBIT_COORDS(1, 3) 8 -QUBIT_COORDS(2, 2) 9 -QUBIT_COORDS(3, 3) 10 -QUBIT_COORDS(4, 2) 11 -QUBIT_COORDS(5, 3) 12 -QUBIT_COORDS(6, 2) 13 -QUBIT_COORDS(0, 4) 14 -QUBIT_COORDS(1, 5) 15 -QUBIT_COORDS(2, 4) 16 -QUBIT_COORDS(3, 5) 17 -QUBIT_COORDS(4, 4) 18 -QUBIT_COORDS(5, 5) 19 -QUBIT_COORDS(4, 6) 25 -R 1 3 5 8 10 12 15 17 19 -X_ERROR(0.01) 1 3 5 8 10 12 15 17 19 -R 2 9 11 13 14 16 18 25 -X_ERROR(0.01) 2 9 11 13 14 16 18 25 -TICK -DEPOLARIZE1(0.01) 1 3 5 8 10 12 15 17 19 -H 2 11 16 25 -DEPOLARIZE1(0.01) 2 11 16 25 -TICK -CX 2 3 16 17 11 12 15 14 10 9 19 18 -DEPOLARIZE2(0.01) 2 3 16 17 11 12 15 14 10 9 19 18 -TICK -CX 2 1 16 15 11 10 8 14 3 9 12 18 -DEPOLARIZE2(0.01) 2 1 16 15 11 10 8 14 3 9 12 18 -TICK -CX 16 10 11 5 25 19 8 9 17 18 12 13 -DEPOLARIZE2(0.01) 16 10 11 5 25 19 8 9 17 18 12 13 -TICK -CX 16 8 11 3 25 17 1 9 10 18 5 13 -DEPOLARIZE2(0.01) 16 8 11 3 25 17 1 9 10 18 5 13 -TICK -H 2 11 16 25 -DEPOLARIZE1(0.01) 2 11 16 25 -TICK -X_ERROR(0.01) 2 9 11 13 14 16 18 25 -MR 2 9 11 13 14 16 18 25 -X_ERROR(0.01) 2 9 11 13 14 16 18 25 -DETECTOR(0, 4, 0) rec[-4] -DETECTOR(2, 2, 0) rec[-7] -DETECTOR(4, 4, 0) rec[-2] -DETECTOR(6, 2, 0) rec[-5] -REPEAT 6 { - TICK - DEPOLARIZE1(0.01) 1 3 5 8 10 12 15 17 19 - H 2 11 16 25 - DEPOLARIZE1(0.01) 2 11 16 25 - TICK - CX 2 3 16 17 11 12 15 14 10 9 19 18 - DEPOLARIZE2(0.01) 2 3 16 17 11 12 15 14 10 9 19 18 - TICK - CX 2 1 16 15 11 10 8 14 3 9 12 18 - DEPOLARIZE2(0.01) 2 1 16 15 11 10 8 14 3 9 12 18 - TICK - CX 16 10 11 5 25 19 8 9 17 18 12 13 - DEPOLARIZE2(0.01) 16 10 11 5 25 19 8 9 17 18 12 13 - TICK - CX 16 8 11 3 25 17 1 9 10 18 5 13 - DEPOLARIZE2(0.01) 16 8 11 3 25 17 1 9 10 18 5 13 - TICK - H 2 11 16 25 - DEPOLARIZE1(0.01) 2 11 16 25 - TICK - X_ERROR(0.01) 2 9 11 13 14 16 18 25 - MR 2 9 11 13 14 16 18 25 - X_ERROR(0.01) 2 9 11 13 14 16 18 25 - SHIFT_COORDS(0, 0, 1) - DETECTOR(2, 0, 0) rec[-8] rec[-16] - DETECTOR(2, 2, 0) rec[-7] rec[-15] - DETECTOR(4, 2, 0) rec[-6] rec[-14] - DETECTOR(6, 2, 0) rec[-5] rec[-13] - DETECTOR(0, 4, 0) rec[-4] rec[-12] - DETECTOR(2, 4, 0) rec[-3] rec[-11] - DETECTOR(4, 4, 0) rec[-2] rec[-10] - DETECTOR(4, 6, 0) rec[-1] rec[-9] -} -X_ERROR(0.01) 1 3 5 8 10 12 15 17 19 -M 1 3 5 8 10 12 15 17 19 -DETECTOR(0, 4, 1) rec[-3] rec[-6] rec[-13] -DETECTOR(2, 2, 1) rec[-5] rec[-6] rec[-8] rec[-9] rec[-16] -DETECTOR(4, 4, 1) rec[-1] rec[-2] rec[-4] rec[-5] rec[-11] -DETECTOR(6, 2, 1) rec[-4] rec[-7] rec[-14] -OBSERVABLE_INCLUDE(0) rec[-7] rec[-8] rec[-9] \ No newline at end of file diff --git a/datasets/dems/sc_d3_r3_p0010_z.dem b/datasets/sc_d3_r3_p0010_z.dem similarity index 100% rename from datasets/dems/sc_d3_r3_p0010_z.dem rename to datasets/sc_d3_r3_p0010_z.dem diff --git a/datasets/syndromes/sc_d3_r3_p0010_z.npz b/datasets/sc_d3_r3_p0010_z.npz similarity index 100% rename from datasets/syndromes/sc_d3_r3_p0010_z.npz rename to datasets/sc_d3_r3_p0010_z.npz diff --git a/datasets/circuits/sc_d3_r3_p0010_z.stim b/datasets/sc_d3_r3_p0010_z.stim similarity index 100% rename from datasets/circuits/sc_d3_r3_p0010_z.stim rename to datasets/sc_d3_r3_p0010_z.stim diff --git a/datasets/uais/sc_d3_r3_p0010_z.uai b/datasets/sc_d3_r3_p0010_z.uai similarity index 100% rename from datasets/uais/sc_d3_r3_p0010_z.uai rename to datasets/sc_d3_r3_p0010_z.uai diff --git a/datasets/dems/sc_d3_r5_p0010_z.dem b/datasets/sc_d3_r5_p0010_z.dem similarity index 100% rename from datasets/dems/sc_d3_r5_p0010_z.dem rename to datasets/sc_d3_r5_p0010_z.dem diff --git a/datasets/syndromes/sc_d3_r5_p0010_z.npz b/datasets/sc_d3_r5_p0010_z.npz similarity index 100% rename from datasets/syndromes/sc_d3_r5_p0010_z.npz rename to datasets/sc_d3_r5_p0010_z.npz diff --git a/datasets/circuits/sc_d3_r5_p0010_z.stim b/datasets/sc_d3_r5_p0010_z.stim similarity index 100% rename from datasets/circuits/sc_d3_r5_p0010_z.stim rename to datasets/sc_d3_r5_p0010_z.stim diff --git a/datasets/uais/sc_d3_r5_p0010_z.uai b/datasets/sc_d3_r5_p0010_z.uai similarity index 100% rename from datasets/uais/sc_d3_r5_p0010_z.uai rename to datasets/sc_d3_r5_p0010_z.uai diff --git a/datasets/dems/sc_d3_r7_p0010_z.dem b/datasets/sc_d3_r7_p0010_z.dem similarity index 100% rename from datasets/dems/sc_d3_r7_p0010_z.dem rename to datasets/sc_d3_r7_p0010_z.dem diff --git a/datasets/syndromes/sc_d3_r7_p0010_z.npz b/datasets/sc_d3_r7_p0010_z.npz similarity index 100% rename from datasets/syndromes/sc_d3_r7_p0010_z.npz rename to datasets/sc_d3_r7_p0010_z.npz diff --git a/datasets/circuits/sc_d3_r7_p0010_z.stim b/datasets/sc_d3_r7_p0010_z.stim similarity index 100% rename from datasets/circuits/sc_d3_r7_p0010_z.stim rename to datasets/sc_d3_r7_p0010_z.stim diff --git a/datasets/uais/sc_d3_r7_p0010_z.uai b/datasets/sc_d3_r7_p0010_z.uai similarity index 100% rename from datasets/uais/sc_d3_r7_p0010_z.uai rename to datasets/sc_d3_r7_p0010_z.uai diff --git a/datasets/syndromes/test.npz b/datasets/syndromes/test.npz new file mode 100644 index 0000000..549f93c Binary files /dev/null and b/datasets/syndromes/test.npz differ diff --git a/datasets/uais/test.uai b/datasets/uais/test.uai new file mode 100644 index 0000000..d0bede6 --- /dev/null +++ b/datasets/uais/test.uai @@ -0,0 +1,2938 @@ +MARKOV +24 +2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 +286 +1 0 +2 0 1 +2 0 8 +2 1 2 +2 1 5 +3 1 5 4 +2 1 8 +3 1 8 4 +1 1 +1 2 +2 2 3 +3 2 3 6 +2 2 5 +3 2 5 6 +4 2 5 6 9 +3 2 5 9 +4 2 5 9 6 +2 2 8 +3 2 8 6 +3 2 8 9 +4 2 8 9 6 +2 2 10 +3 2 10 6 +4 2 10 6 9 +2 3 5 +3 3 5 6 +2 3 7 +3 3 7 6 +2 3 10 +3 3 10 6 +1 3 +1 4 +2 4 6 +3 4 6 5 +2 4 12 +3 4 12 5 +2 4 1 +2 4 5 +3 4 5 1 +2 5 8 +3 5 8 4 +3 5 8 6 +3 5 8 9 +4 5 8 9 6 +2 5 10 +4 5 10 6 9 +2 5 13 +4 5 13 6 9 +3 5 13 9 +4 5 13 9 12 +3 5 13 12 +2 5 16 +3 5 16 9 +4 5 16 9 12 +3 5 16 12 +1 5 +2 5 1 +2 5 3 +1 6 +2 6 9 +3 6 9 5 +4 6 9 7 10 +4 6 9 7 13 +4 6 9 10 13 +3 6 9 13 +4 6 9 13 5 +2 6 12 +3 6 12 5 +3 6 12 13 +4 6 12 13 5 +2 6 14 +4 6 14 7 10 +4 6 14 7 13 +4 6 14 10 13 +3 6 14 13 +2 6 2 +2 6 3 +2 6 4 +3 6 4 5 +2 6 5 +3 6 5 3 +2 6 7 +3 6 7 3 +2 7 10 +3 7 10 6 +4 7 10 9 14 +3 7 10 11 +3 7 10 14 +4 7 10 14 6 +4 7 10 14 11 +2 7 13 +4 7 13 9 14 +2 7 15 +3 7 15 14 +2 7 18 +3 7 18 11 +3 7 18 14 +4 7 18 14 11 +1 7 +2 7 3 +1 8 +2 8 16 +3 8 16 9 +2 8 0 +2 8 2 +1 9 +2 9 11 +3 9 11 10 +2 9 12 +3 9 12 5 +3 9 12 13 +4 9 12 13 5 +2 9 14 +4 9 14 10 13 +4 9 14 10 16 +4 9 14 13 16 +2 9 17 +3 9 17 10 +4 9 17 10 13 +4 9 17 10 16 +4 9 17 13 16 +2 9 2 +2 9 6 +3 9 6 2 +2 9 8 +3 9 8 2 +2 9 10 +3 9 10 2 +3 9 10 6 +4 9 10 6 2 +2 9 12 +2 9 16 +3 9 16 8 +3 9 16 10 +1 10 +2 10 13 +4 10 13 14 17 +2 10 16 +4 10 16 14 17 +2 10 18 +3 10 18 11 +3 10 18 14 +4 10 18 14 17 +4 10 18 14 11 +2 10 2 +2 10 6 +3 10 6 2 +1 11 +2 11 14 +3 11 14 10 +3 11 14 18 +4 11 14 18 10 +2 11 17 +3 11 17 10 +3 11 17 18 +4 11 17 18 10 +2 11 19 +3 11 19 18 +2 11 9 +3 11 9 10 +2 11 10 +2 11 18 +3 11 18 10 +1 12 +2 12 14 +3 12 14 13 +2 12 4 +3 12 4 5 +2 12 5 +2 12 13 +3 12 13 5 +3 12 13 14 +2 12 14 +2 13 16 +3 13 16 9 +4 13 16 9 12 +3 13 16 12 +4 13 16 14 17 +3 13 16 17 +4 13 16 17 9 +2 13 18 +4 13 18 14 17 +2 13 20 +3 13 20 17 +2 13 21 +4 13 21 14 17 +3 13 21 17 +1 13 +2 13 5 +2 13 6 +3 13 6 7 +2 13 7 +2 13 14 +3 13 14 6 +4 13 14 6 7 +3 13 14 7 +1 14 +2 14 17 +3 14 17 10 +3 14 17 18 +4 14 17 18 21 +4 14 17 18 10 +2 14 6 +3 14 6 7 +2 14 7 +2 14 11 +2 14 13 +2 14 15 +3 14 15 7 +2 14 17 +3 14 17 13 +2 14 21 +3 14 21 13 +3 14 21 15 +3 14 21 17 +4 14 21 17 13 +2 15 18 +3 15 18 14 +4 15 18 14 17 +3 15 18 17 +3 15 18 19 +2 15 21 +3 15 21 14 +4 15 21 14 17 +3 15 21 17 +2 15 22 +3 15 22 19 +2 15 23 +1 15 +2 15 7 +1 16 +2 16 20 +3 16 20 17 +2 16 8 +2 16 10 +1 17 +2 17 19 +3 17 19 18 +2 17 9 +3 17 9 10 +3 17 9 16 +4 17 9 16 10 +2 17 10 +2 17 13 +2 17 16 +3 17 16 10 +2 17 18 +3 17 18 19 +2 17 19 +2 17 20 +3 17 20 16 +3 17 20 18 +1 18 +2 18 20 +3 18 20 17 +2 18 21 +3 18 21 14 +4 18 21 14 17 +3 18 21 17 +2 18 22 +3 18 22 19 +2 18 10 +2 18 11 +2 18 19 +3 18 19 11 +1 19 +2 19 11 +2 19 18 +2 19 22 +3 19 22 18 +1 20 +2 20 21 +3 20 21 17 +2 20 16 +2 20 18 +2 21 22 +1 21 +2 21 13 +2 21 15 +2 21 17 +3 21 17 13 +1 22 +2 22 23 +2 22 18 +1 23 +2 23 15 + +2 +0.9808812648892464 +0.019118735110753623 + +4 +0.9808812648892464 +0.019118735110753623 +0.019118735110753623 +0.9808812648892464 + +4 +0.9776320671535081 +0.022367932846491828 +0.022367932846491828 +0.9776320671535081 + +4 +0.9808812648892464 +0.019118735110753623 +0.019118735110753623 +0.9808812648892464 + +4 +0.9763532549640852 +0.023646745035914817 +0.023646745035914817 +0.9763532549640852 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9959946428197471 +0.0040053571802528285 +0.0040053571802528285 +0.9959946428197471 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +2 +0.9600203364033417 +0.039979663596658326 + +2 +0.9606374050540162 +0.03936259494598386 + +4 +0.9783096888888889 +0.021690311111111037 +0.021690311111111037 +0.9783096888888889 + +8 +0.9946666666666667 +0.005333333333333312 +0.005333333333333312 +0.9946666666666667 +0.005333333333333312 +0.9946666666666667 +0.9946666666666667 +0.005333333333333312 + +4 +0.994004012507051 +0.005995987492949032 +0.005995987492949032 +0.994004012507051 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +16 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9776320671535081 +0.022367932846491828 +0.022367932846491828 +0.9776320671535081 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +16 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9789143124266747 +0.021085687573325258 +0.021085687573325258 +0.9789143124266747 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +8 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 +0.0026738159584462984 +0.9973261840415537 +0.9973261840415537 +0.0026738159584462984 + +2 +0.9808812648892464 +0.019118735110753623 + +2 +0.9532828009653388 +0.04671719903466118 + +4 +0.9953257353774044 +0.004674264622595529 +0.004674264622595529 +0.9953257353774044 + +8 +0.9953257353774044 +0.004674264622595529 +0.004674264622595529 +0.9953257353774044 +0.004674264622595529 +0.9953257353774044 +0.9953257353774044 +0.004674264622595529 + +4 +0.966228404417506 +0.033771595582493964 +0.033771595582493964 +0.966228404417506 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9920213714117772 +0.00797862858822285 +0.00797862858822285 +0.9920213714117772 + +4 +0.9913578223958887 +0.008642177604111326 +0.008642177604111326 +0.9913578223958887 + +8 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 +0.0026738159584462984 +0.9973261840415537 +0.9973261840415537 +0.0026738159584462984 + +4 +0.9906996007553152 +0.009300399244684825 +0.009300399244684825 +0.9906996007553152 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9920169269712097 +0.00798307302879027 +0.00798307302879027 +0.9920169269712097 +0.00798307302879027 +0.9920169269712097 +0.9920169269712097 +0.00798307302879027 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 + +16 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 +0.006000449842759885 +0.9939995501572401 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 +0.9939995501572401 +0.006000449842759885 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 + +4 +0.9782727600791767 +0.021727239920823312 +0.021727239920823312 +0.9782727600791767 + +16 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +4 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +2 +0.9835127316369812 +0.016487268363018805 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +2 +0.9484437335823726 +0.05155626641762742 + +4 +0.992676915665642 +0.007323084334358033 +0.007323084334358033 +0.992676915665642 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +16 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9966599671994898 +0.00334003280051021 +0.00334003280051021 +0.9966599671994898 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9656038460788573 +0.03439615392114274 +0.03439615392114274 +0.9656038460788573 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9946621983310853 +0.005337801668914704 +0.005337801668914704 +0.9946621983310853 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.992676915665642 +0.007323084334358033 +0.007323084334358033 +0.992676915665642 + +8 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 +0.006000449842759885 +0.9939995501572401 +0.9939995501572401 +0.006000449842759885 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +16 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9789143124266747 +0.021085687573325258 +0.021085687573325258 +0.9789143124266747 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +2 +0.9933377896651377 +0.006662210334862288 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +2 +0.9913578223958887 +0.008642177604111326 + +4 +0.9789143124266747 +0.021085687573325258 +0.021085687573325258 +0.9789143124266747 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +2 +0.9478429995417824 +0.052157000458217626 + +4 +0.9953257353774044 +0.004674264622595529 +0.004674264622595529 +0.9953257353774044 + +8 +0.9953257353774044 +0.004674264622595529 +0.004674264622595529 +0.9953257353774044 +0.004674264622595529 +0.9953257353774044 +0.9953257353774044 +0.004674264622595529 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +16 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9656038460788573 +0.03439615392114274 +0.03439615392114274 +0.9656038460788573 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9953302097067857 +0.004669790293214321 +0.004669790293214321 +0.9953302097067857 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +4 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +2 +0.9822181745553272 +0.01778182544467273 + +4 +0.9959946428197471 +0.0040053571802528285 +0.0040053571802528285 +0.9959946428197471 + +16 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9782727600791767 +0.021727239920823312 +0.021727239920823312 +0.9782727600791767 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9966599671994898 +0.00334003280051021 +0.00334003280051021 +0.9966599671994898 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +2 +0.9575561838169157 +0.042443816183084335 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9966599671994898 +0.00334003280051021 +0.00334003280051021 +0.9966599671994898 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.966228404417506 +0.033771595582493964 +0.033771595582493964 +0.966228404417506 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9913578223958887 +0.008642177604111326 +0.008642177604111326 +0.9913578223958887 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +2 +0.9575561838169157 +0.042443816183084335 + +4 +0.9953257353774044 +0.004674264622595528 +0.004674264622595528 +0.9953257353774044 + +8 +0.9953257353774044 +0.004674264622595528 +0.004674264622595528 +0.9953257353774044 +0.004674264622595528 +0.9953257353774044 +0.9953257353774044 +0.004674264622595528 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +4 +0.9913578223958887 +0.008642177604111326 +0.008642177604111326 +0.9913578223958887 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.992676915665642 +0.007323084334358033 +0.007323084334358033 +0.992676915665642 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 +0.006000449842759885 +0.9939995501572401 +0.9939995501572401 +0.006000449842759885 + +16 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 + +16 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 +0.006000449842759885 +0.9939995501572401 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 +0.9939995501572401 +0.006000449842759885 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +8 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 +0.0026738159584462984 +0.9973261840415537 +0.9973261840415537 +0.0026738159584462984 + +4 +0.9776320671535081 +0.022367932846491828 +0.022367932846491828 +0.9776320671535081 + +16 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +2 +0.9822181745553272 +0.017781825444672734 + +4 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +2 +0.9478429995417824 +0.05215700045821762 + +4 +0.992676915665642 +0.007323084334358033 +0.007323084334358033 +0.992676915665642 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +4 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +4 +0.9953302097067857 +0.004669790293214321 +0.004669790293214321 +0.9953302097067857 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9906996007553152 +0.009300399244684827 +0.009300399244684827 +0.9906996007553152 + +8 +0.9920169269712097 +0.00798307302879027 +0.00798307302879027 +0.9920169269712097 +0.00798307302879027 +0.9920169269712097 +0.9920169269712097 +0.00798307302879027 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +4 +0.9959946428197471 +0.0040053571802528285 +0.0040053571802528285 +0.9959946428197471 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9776320671535081 +0.022367932846491828 +0.022367932846491828 +0.9776320671535081 + +2 +0.9913578223958887 +0.008642177604111326 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +2 +0.9933377896651377 +0.006662210334862289 + +4 +0.9789143124266747 +0.021085687573325258 +0.021085687573325258 +0.9789143124266747 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +2 +0.9484437335823726 +0.05155626641762741 + +4 +0.9953257353774044 +0.004674264622595528 +0.004674264622595528 +0.9953257353774044 + +8 +0.9953257353774044 +0.004674264622595528 +0.004674264622595528 +0.9953257353774044 +0.004674264622595528 +0.9953257353774044 +0.9953257353774044 +0.004674264622595528 + +4 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +4 +0.9946621983310853 +0.0053378016689147045 +0.0053378016689147045 +0.9946621983310853 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +2 +0.9835127316369812 +0.016487268363018805 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.994004012507051 +0.005995987492949032 +0.005995987492949032 +0.994004012507051 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +16 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 +0.0020067054569172355 +0.9979932945430827 +0.9979932945430827 +0.0020067054569172355 + +4 +0.9763532549640852 +0.023646745035914817 +0.023646745035914817 +0.9763532549640852 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +4 +0.9979932945430827 +0.0020067054569172355 +0.0020067054569172355 +0.9979932945430827 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +8 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 +0.001338700097173321 +0.9986612999028267 +0.9986612999028267 +0.001338700097173321 + +2 +0.9532828009653388 +0.04671719903466118 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.9939995501572401 +0.006000449842759885 +0.006000449842759885 +0.9939995501572401 + +4 +0.9920213714117772 +0.00797862858822285 +0.00797862858822285 +0.9920213714117772 + +8 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 +0.0026738159584462984 +0.9973261840415537 +0.9973261840415537 +0.0026738159584462984 + +2 +0.9873796603607227 +0.012620339639277374 + +4 +0.9847733333333334 +0.015226666666666649 +0.015226666666666649 +0.9847733333333334 + +8 +0.9946666666666667 +0.005333333333333312 +0.005333333333333312 +0.9946666666666667 +0.005333333333333312 +0.9946666666666667 +0.9946666666666667 +0.005333333333333312 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.9873796603607227 +0.012620339639277374 +0.012620339639277374 +0.9873796603607227 + +2 +0.9731711839716655 +0.026828816028334517 + +4 +0.9966599671994898 +0.00334003280051021 +0.00334003280051021 +0.9966599671994898 + +4 +0.9986612999028267 +0.001338700097173321 +0.001338700097173321 +0.9986612999028267 + +4 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 + +8 +0.9993302013211431 +0.0006697986788568588 +0.0006697986788568588 +0.9993302013211431 +0.0006697986788568588 +0.9993302013211431 +0.9993302013211431 +0.0006697986788568588 + +2 +0.9725373251038708 +0.027462674896129233 + +4 +0.9873796603607227 +0.012620339639277374 +0.012620339639277374 +0.9873796603607227 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 + +2 +0.9873796603607227 +0.012620339639277374 + +4 +0.9973261840415537 +0.0026738159584462984 +0.0026738159584462984 +0.9973261840415537 diff --git a/datasets/noisy_circuits/parity_check_matrix.png b/datasets/visualizations/parity_check_matrix.png similarity index 100% rename from datasets/noisy_circuits/parity_check_matrix.png rename to datasets/visualizations/parity_check_matrix.png diff --git a/datasets/noisy_circuits/sc_d3_layout.png b/datasets/visualizations/sc_d3_layout.png similarity index 100% rename from datasets/noisy_circuits/sc_d3_layout.png rename to datasets/visualizations/sc_d3_layout.png diff --git a/datasets/noisy_circuits/single_syndrome.png b/datasets/visualizations/single_syndrome.png similarity index 100% rename from datasets/noisy_circuits/single_syndrome.png rename to datasets/visualizations/single_syndrome.png diff --git a/datasets/noisy_circuits/syndrome_stats.png b/datasets/visualizations/syndrome_stats.png similarity index 100% rename from datasets/noisy_circuits/syndrome_stats.png rename to datasets/visualizations/syndrome_stats.png diff --git a/docs/lecture_note.pdf b/note/lecture_note.pdf similarity index 100% rename from docs/lecture_note.pdf rename to note/lecture_note.pdf diff --git a/docs/lecture_note.typ b/note/lecture_note.typ similarity index 100% rename from docs/lecture_note.typ rename to note/lecture_note.typ diff --git a/pyproject.toml b/pyproject.toml index b8bb1d7..8491a2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,8 +6,12 @@ readme = "README.md" requires-python = ">=3.10" license = { text = "MIT" } authors = [ + { name = "Jinguo Liu", email = "cacate0129@gmail.com" }, { name = "BPDecoderPlus Contributors" } ] +maintainers = [ + { name = "Jinguo Liu", email = "cacate0129@gmail.com" } +] keywords = ["quantum", "error-correction", "surface-code", "belief-propagation", "stim"] classifiers = [ "Development Status :: 3 - Alpha", @@ -19,17 +23,26 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Physics", ] - dependencies = [ "stim>=1.12.0", "numpy>=1.24.0", "torch>=2.0.0", ] +[project.urls] +Homepage = "https://github.com/GiggleLiu/BPDecoderPlus" +Documentation = "https://giggleliu.github.io/BPDecoderPlus/" +Repository = "https://github.com/GiggleLiu/BPDecoderPlus" +Issues = "https://github.com/GiggleLiu/BPDecoderPlus/issues" +Changelog = "https://github.com/GiggleLiu/BPDecoderPlus/blob/main/CHANGELOG.md" + [project.optional-dependencies] dev = [ "pytest>=7.0.0", "pytest-cov>=4.0.0", + "ruff>=0.8.0", + "pre-commit>=3.0.0", + "mypy>=1.0.0", ] docs = [ "mkdocs-material>=9.0.0", @@ -52,8 +65,28 @@ packages = ["src/bpdecoderplus"] testpaths = ["tests"] pythonpath = ["src"] -[tool.uv] -dev-dependencies = [ +[dependency-groups] +dev = [ "pytest>=7.0.0", "pytest-cov>=4.0.0", + "ruff>=0.8.0", + "pre-commit>=3.0.0", + "mypy>=1.0.0", ] + +[tool.ruff] +target-version = "py310" +line-length = 100 +indent-width = 4 + +[tool.ruff.lint] +select = ["E", "W", "F", "I", "N", "UP", "B", "C4", "SIM", "RUF"] +ignore = ["E501"] # Line too long (handled by formatter) +fixable = ["ALL"] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" + +[tool.ruff.lint.isort] +known-first-party = ["bpdecoderplus"] diff --git a/src/bpdecoderplus/cli.py b/src/bpdecoderplus/cli.py index c99ca94..fc92b1c 100644 --- a/src/bpdecoderplus/cli.py +++ b/src/bpdecoderplus/cli.py @@ -29,7 +29,7 @@ def create_parser() -> argparse.ArgumentParser: "-o", "--output", type=pathlib.Path, - default=pathlib.Path("datasets/noisy_circuits"), + default=pathlib.Path("datasets"), help="Output directory for .stim circuits", ) parser.add_argument( diff --git a/tests/test_cli.py b/tests/test_cli.py index fa13a45..0817a10 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -18,7 +18,7 @@ def test_parser_defaults(self): parser = create_parser() args = parser.parse_args([]) - assert args.output == pathlib.Path("datasets/noisy_circuits") + assert args.output == pathlib.Path("datasets") assert args.distance == 3 assert args.rounds == [3, 5, 7] assert args.p == 0.01