Giter Site home page Giter Site logo

alexandrupaler / bp_osd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from quantumgizmos/bp_osd

0.0 1.0 0.0 4.61 MB

BP+OSD: Belief propagation with ordered statistics post-processing for decoding quantum LDPC codes

License: MIT License

CMake 0.22% C++ 65.20% C 20.03% Shell 1.38% HTML 13.00% Python 0.17%

bp_osd's Introduction

BP+OSD: A decoder for sparse quantum codes

A C library implementing belief propagation with ordered statistics post-processing for decoding sparse quantum codes as described in arXiv:2005.07016.

Build

To build, run the following commands from the repository root.

mkdir build
cd build
cmake ../
make
cd ..

Alist files

This library uses the alist sparse format for storing parity check matrices. A python script for converting Numpy matrices to alist files can be found in "src_python" directory. Example alist files for various quantum codes can be found in the "codes" directory.

Running the BP+OSD Sim

The C++ source file for the BP+OSD sim script can be found at "sim_scripts/bp_osd_decode.cpp". The example program to decode a [[400,16,6]] random QLDPC code can be run (from the repository root) with the following command

build/bp_osd_decode sim_scripts/mkmn_input_test.json sim_scripts/output

The general syntax for running the sim script is as follows

./build/bp_osd_decode <path_to_input_file.json> <path_to_output_directory>

Input file structure

The bp_osd_decode script takes JSON files as input. An example input file is shown below:

{
  "hx_filename": "codes/random/mkmn/hgp_mkmn_16_4_6_hx.alist",
  "hz_filename": "codes/random/mkmn/hgp_mkmn_16_4_6_hz.alist",
  "lx_filename": "codes/random/mkmn/hgp_mkmn_16_4_6_lx.alist",
  "code_label": "hgp_mkmn_16_4_6",
  "logical_check_method": "hz",
  "input_seed": 149,
  "bit_error_rate": 0.05,
  "target_runs": 1000,
  "osd_order": 40,
  "max_iter": 50,
  "osd_method": "combination_sweep"
}

Where

  • "hx_filename": path to hx parity check alist file
  • "hz_filename": path to hz parity check alist file
  • "lx_filename": path to lx logical matrix alist file. Only necessary if "logical_check_method" is set to "lx"
  • "code_label": whatever you like
  • "logical_check_method": "hz" or "lx". See notes below.
  • "input_seed": the input seed for the Mersenne twister random number generator. Note if >0 that seed is used, otherwise the seed is generated from the current time.
  • "bit_error_rate": the bit error rate
  • "target_runs": the number of runs you would like to simulate
  • "osd_order": the osd order parameter
  • "max_iter": the iterations depth for BP. If this is set to 0, then the value is set to N, where N is the code block length.
  • "osd_method": Currenlty three options are available: 1) "combination_sweep"; 2) "exhaustive"; 3) "osd_0". The details of these techniques are described in arXiv:2005.07016.

Output

The output is saved to the directory specified in the second command line argument. The output file format is JSON and the filename is autogenerated.

"lx" vs. "hz" logical error check methods

Many thanks to @Magalame for contributing the 'hz' method for checking for logical failures. The two options are now as follows:

  1. "lx" method: the matrix of logical Lx operators is used to check whether an error has occurred. This method method is fast, but requires knowledge of the logical operators of the code. If you select this option, you must specify a location for the lx alist file in the "lx_filename" field in the input file.
  2. "hz" method: the hz matrix is used to check for logical failures. This method takes more time, but does not require knowledge of the logical operators. If you select this option, you must specify a location for the hz alist file in the "hz_filename" field in the input file.

Using this library in another project

To use this library in another project copy and paste the repository into your project root. The library can then be imported by adding the followig to your cmake file:

project(import_example)
add_subdirectory(bp_osd_c)
add_executable(import_example main.cpp)
target_link_libraries(import_example bp_osd)

Software

This library makes use of the following software:

Licence

MIT License

Copyright (c) 2020 Joschka Roffe

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.

bp_osd's People

Contributors

quantumgizmos avatar mikevasmer avatar alexandrupaler avatar magalame avatar sbates130272 avatar lingr7 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.