Code Monkey home page Code Monkey logo

golaycode's Introduction

GolayCode

Simple 24-12 extended binary golay code implementation in javascript.

You can check out a live demo at demo

Code

There are several classes involed,

  1. Matrix.js contains a class for a generic matrix.
  2. BinaryMatrix is a class for binary matrices derived from Matrix
  3. GolaryCode.js is a class with static members which handles all golay code related things, like encoding or decoding.

Encoding

In order to encode a binary array call GolayCode.encode(array).

Array's length must be 12.

Decoding

Decoding works the same way GolayCode.decode(array).

Array's length must be 24.

Logging

GolayCode class has its own logging mechanism. If you want to see logs from decoing/encoding you can add your logging function using GolayCode.addLogHandler()

Example usage

GolayCode.addLogHandler(console.log);
const encodedMessage = GolayCode.encode([0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0]);
// transmit your message however you need
// ...

On the recieving end

const decodedMessage = GolayCode.decode(transmittedMessage);
// ...

Status

This is still a work in progress, and is mainly made for educational purposes. It might contain bugs or unexpected behaviours.

The code is documented fairly well, but if you have any questions please feel free to contact me at [email protected]

golaycode's People

Contributors

serghov avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

ohc192 hildakar

golaycode's Issues

Issue in step 6

Hi,
Thanks for the code, but I think there is an issue in step 6
You swapped the concat order between step3 and 5
but the concat order between step 2 and 6 are the same.
u = cur.concat(eyeVector(12, i));
this should be
u = (eyeVector(12, i)).concat(cur);
for step 6.

[BUGFIX] Error in golayCode.js B matrix

There is an error in the GolayCode.B

The last row reads:
GolayCode.B.addRow([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]);

It should read:
GolayCode.B.addRow([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]);

This change makes it consistent with the generator and parity check matrices.

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.