Giter VIP home page Giter VIP logo

js-ldpc's Introduction

js-ldpc

A JavaScript implementation of a Low-Density Parity-Check code.

The goal of this project is to create an implementation of an LDPC (https://en.wikipedia.org/wiki/Low-density_parity-check_code) because an existing one doesn't seem readily available.

Robert Gallager's original paper on the topic can be found here: http://www.rle.mit.edu/rgallager/documents/ldpc.pdf

API

var ldpc = new LDPC(options);

options is an object that can have these properties:

  • n the number of symbols in an encoded message
  • k the number of non-redundant symbols (number of symbols in unencoded message)
  • modulo e.g. 2 for binary digits, 256 for bytes, etc
  • randomSeed value to which to initialize an internal random number generator, which is used to build the parity-check and generator matrices. Defaults to Date.now()
Encoding
var encoded = ldpc.encode(message);
console.log(encoded.join()); // Prints the encoded message

message is an array options.k in length of numbers that are less than options.modulo

Decoding
var result = ldpc.decode(encoded);
if (result.decoded) {
  // result should have all-positive and non-null numbers
} else {
  // You need more symbols. result may have more decoded symbols than you started with, but it's unlikely
  // Also see result.all, which has all the encoded symbols including any additional which were deduced. Note that the first k symbols are the same as result
}

encoded is an array options.n in length of numbers that are less than options.modulo. Use negative numbers or null to indicate a missing symbol (we're targeting an erasure channel)

Contribute

  • fork & clone repo.
  • npm install
  • code code code
  • gulp lint
  • npm test
  • submit PR

js-ldpc's People

Contributors

matthew-a-thomas avatar jakehp avatar

Watchers

James Cloos avatar  avatar  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.