No project description provided
Project description
About
The Plaquette-UnionFind plugin extends the Plaquette error correction software, providing a fast unionfind decoder written in C++. See the Benchmarks section for a comparison to other known decoding packages.
Installation
The basic dependencies for installation are cmake and ninja.
The C++ tests/examples and python bindings can be built independently by
cmake -Bbuild -G Ninja -DPLAQUETTE_UNIONFIND_BUILD_TESTS=On -DPLAQUETTE_UNIONFIND_BUILD_BINDINGS=On
cmake --build ./build
You can run the C++ backend tests with
make test-cpp
You can install just the python interface with (this quietly builds the C++ backend):
pip install -r requirements.txt
pip install .
or get the latest stable release from PyPI
pip install plaquette_unionfind
You can run the python frontend tests with
make test-python
Usage
Python Frontend
import plaquette_unionfind as puf
import plaquette_graph as pg
vertex_boundary = [False] * 12 + [True] * 8
edges = [(0, 12), (0, 1), (1, 2), (2, 13), (0, 3), (1, 4), (2, 5), (3, 14), (3, 4),
(4, 5), (5, 15), (3, 6), (4, 7), (5, 8), (6, 16), (6, 7), (7, 8), (8, 17),
(6, 9), (7, 10), (8, 11), (9, 18), (9, 10), (10, 11), (11, 19)]
syndrome = [False, False, True, True, False, True, True, False, True, False, True,
False, False, False, False, False, False, False, False, False]
dg = pg.DecodingGraph(num_vertices, edges, vertex_boundary)
uf = puf.UnionFindDecoder(dg)
correction = uf.decode(syndrome)
C++ Backend
#include "DecodingGraph.hpp"
#include "UnionFindDecoder.hpp"
int main(int argc, char *argv[]) {
using namespace Plaquette;
//a vector storing a flag that is 1 if the vertex is on the boundary
std::vector<bool> vertex_boundary = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
std::vector<std::pair<size_t, size_t>> edges = {
{0, 12}, {0, 1}, {1, 2}, {2, 13}, {0, 3}, {1, 4}, {2, 5},
{3, 14}, {3, 4}, {4, 5}, {5, 15}, {3, 6}, {4, 7}, {5, 8},
{6, 16}, {6, 7}, {7, 8}, {8, 17}, {6, 9}, {7, 10}, {8, 11},
{9, 18}, {9, 10}, {10, 11}, {11, 19}};
std::vector<bool> syndrome = {false, false, true, true, false, true, true,
false, true, false, true, false, false, false,
false, false, false, false, false, false};
auto decoding_graph = DecodingGraph(vertex_boundary.size(),
edges, vertex_boundary);
UnionFindDecoder decoder(decoding_graph);
auto correction = decoder.Decode(syndrome);
}
Interface to Plaquette
Plaquette is undergoing heavy development, so this interface is likely to change. If you are benchmarking our decoder, please do not use the plaquette interface unless you know what you are doing. You will be timing other computations unrelated to the decoding.
from plaquette.codes import LatticeCode
import plaquette_unionfind
code = LatticeCode.make_planar(n_rounds=1, size=size)
qed = {
"pauli": {q.equbit_idx: {"x": error_rate} for q in code.lattice.dataqubits}
}
decoder = plaquette_unionfind.UnionFindDecoderInterface.from_code(code, qed, weighted=False)
Benchmarks
For our benchmarks, we have been careful to only time the intrinsic Pymatching-v2 and FusionBlossom decoding functions. We do not use the decode_batch function for Pymatching-v2 because this does not test the intrinsic speed of the decoder. We also set FusionBlossom to single-threaded mode since we are running both our code and Pymatching-v2 in that mode. All benchmarks are performed on a m6id.4xlarge AWS node. All benchmarks are reproducible (see below) using our scripts on a m6id.4xlarge.
For our first benchmark, we use the 2-D (perfect measurement) Planar Code with p = 0.05 depolarization error. We see around 8-10x speedup over competitors
For our second benchmark we use the 3-D (imperfect measurement) Rotated Planar Code with p = 0.01 depolarization error and p = 0.01 measurement error. We see that Pymatching-v2 is much more sensitive to the lattice size.
Finally we benchmark a 30x30 Rotated Planar Code (29 rounds of measurement) with varying probability. We see that fusion-blossom is heavily sensitive to the error probability.
To run all three benchmarks, use the following bash commands:
source benchmarks/run_perfect_planar_benchmark.sh 0.05
source benchmarks/run_imperfect_rotated_planar_benchmark.sh 0.01
source benchmarks/run_imperfect_rotated_planar_fixed_size_benchmark.sh
python plot_benchmark_1.py perfect_planar_0.05.dat perfect_planar_0.05.png "Surface Code Benchmark #1" 5
python plot_benchmark_2.py imperfect_rotated_planar_0.01.dat imperfect_rotated_planar_0.01.png "Surface Code Benchmark #2" 5
python plot_benchmark_3.py imperfect_rotated_planar_fixed_size.dat imperfect_rotated_planar_fixed_size.png "Surface Code Benchmark #3" 1
Documentation
To generate the documentation you will need to install graphviz and doxygen. Then run
pip install -r doc/requirements.txt
make docs
firefox ./doc/_build/html/index.html
Here is a live link to the documentation: https://docs.plaquette.design/projects/unionfind
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for plaquette_unionfind-0.0.1a1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce4a334fac5296bfacac1512e011d91e112875825f0ec77d10164b5dc3c15907 |
|
MD5 | 41453586fffbaa313bdbe3fa25fa2b2b |
|
BLAKE2b-256 | 2286895ef01b24f6d4084e7b96ab54121184c64c801d503dc1e3ab537d2342b0 |
Hashes for plaquette_unionfind-0.0.1a1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e62e8b410dcb7a53c2337ca4d30e07085646c2c66b6e62da445ae623486b57ac |
|
MD5 | 329057ad72e1a251ca70b53f0e87f927 |
|
BLAKE2b-256 | 1b5946e001b58e9b51551e97ab3bd2215bcf047ef61c905bb3f64c183ae7a1a8 |
Hashes for plaquette_unionfind-0.0.1a1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb1ca71ae19d7338fec67f49a442fc05b4eebb466a387e7c638d1f63df05922c |
|
MD5 | 5b070133a37522432531e787e1fc8d12 |
|
BLAKE2b-256 | a5cdd055f3d49c13f1d18db592586baf366126f7be816abcb3c226e5f3a440b2 |
Hashes for plaquette_unionfind-0.0.1a1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 006c8d1f0e9e1970e4e4a335695fc58d7148884bdd1b89ee58c90890a7b10564 |
|
MD5 | 8fe69e9f56e8fa51e829995e185f81b7 |
|
BLAKE2b-256 | fc97746d36d5640721d0823507af80ef206fdb088238fb3273f5ead2bf0a202e |
Hashes for plaquette_unionfind-0.0.1a1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14ac8c9b88278d97daf99c70233ff0fad486ddff79b4e36eca6771db081a64ea |
|
MD5 | 1addea3933b981ac1d3e75690e225bdc |
|
BLAKE2b-256 | 3929127a0bcb82de37dc214b69e819b357cf4cc05fd70f551f5a3e9ba9a1ebcc |
Hashes for plaquette_unionfind-0.0.1a1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd6328d905030357969b5c8bd378678df42a77420742eae328d5f509aff90460 |
|
MD5 | b0f5d1966e75689509b75122d1c49c43 |
|
BLAKE2b-256 | 49b9cea0f9a0b98e79d526c9aa05cd3b68ef19c93d496b3ff3eee48968f99824 |
Hashes for plaquette_unionfind-0.0.1a1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00b26bf116d8ee35c5e860e176c80460dd1f4170fb1410fe1f13ea74ddcbfa50 |
|
MD5 | f7a47a1eeb6e0415a1e33ff87c72d615 |
|
BLAKE2b-256 | e9b448c564a0ca4a50f4af651826d1e1a4bb13f61ef588b8e2c435221c01485a |
Hashes for plaquette_unionfind-0.0.1a1-cp310-cp310-macosx_13_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da4d5ef02e25bfda55715e402c355be323c45371d688e2b09d501abbc34c8539 |
|
MD5 | 2fe759a7506f9fb43124206c14876f49 |
|
BLAKE2b-256 | 63a0dd380f289d7c303955162970bb73b2ff7206635a517a883638c01323d88d |
Hashes for plaquette_unionfind-0.0.1a1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3688e1adbddef55831f03e1abd2ccea481e72ff1130639bf223969e59eb66a08 |
|
MD5 | 69a7edabe78e98f6f2eb41019f1f70fe |
|
BLAKE2b-256 | 9d2f179b99d55a713e329da6fb4e1603b5b0e6bf2ee041efe085f9d9aa118240 |