{"id":17281038,"url":"https://github.com/wchresta/linear-code","last_synced_at":"2025-07-29T07:33:23.173Z","repository":{"id":56845888,"uuid":"138297153","full_name":"wchresta/linear-code","owner":"wchresta","description":"Haskell library for linear codes from coding theory","archived":false,"fork":false,"pushed_at":"2018-08-30T06:26:33.000Z","size":75,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-23T15:54:56.783Z","etag":null,"topics":["algebra","coding-theory","linear-codes","math","mathematics"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wchresta.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-22T11:53:43.000Z","updated_at":"2021-10-23T21:18:21.000Z","dependencies_parsed_at":"2022-09-17T21:55:15.552Z","dependency_job_id":null,"html_url":"https://github.com/wchresta/linear-code","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wchresta/linear-code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wchresta%2Flinear-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wchresta%2Flinear-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wchresta%2Flinear-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wchresta%2Flinear-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wchresta","download_url":"https://codeload.github.com/wchresta/linear-code/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wchresta%2Flinear-code/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267645965,"owners_count":24120904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algebra","coding-theory","linear-codes","math","mathematics"],"created_at":"2024-10-15T09:22:56.346Z","updated_at":"2025-07-29T07:33:23.143Z","avatar_url":"https://github.com/wchresta.png","language":"Haskell","readme":"[![Build Status](https://travis-ci.com/wchresta/linear-code.svg?branch=master)](https://travis-ci.com/wchresta/linear-code)\n[![Hackage](https://img.shields.io/hackage/v/linear-code.svg)](https://hackage.haskell.org/package/linear-code)\n[![Hackage Deps](https://img.shields.io/hackage-deps/v/linear-code.svg)](http://packdeps.haskellers.com/reverse/linear-code)\n\n# linear-code\nLibrary to handle linear codes from coding theory.\n\nThe library is designed to carry the most important bits of information in the\ntype system while still keeping the types sane.\n\nThis library is based roughly on [_Introduction to Coding Theory_ by _Yehuda Lindell_](http://u.cs.biu.ac.il/~lindell/89-662/coding_theory-lecture-notes.pdf)\n\n# Usage example\n## Working with random codes\n```Haskell\n\u003e :m + Math.Code.Linear System.Random\n\u003e :set -XDataKinds\n\u003e c \u003c- randomIO :: IO (LinearCode 7 4 F5)\n\u003e c\n[7,4]_5-Code\n\u003e generatorMatrix c\n( 1 0 1 0 0 2 0 )\n( 0 2 0 0 1 2 0 )\n( 0 1 0 1 0 1 0 )\n( 1 0 0 0 0 1 1 )\n\u003e e1 :: Vector 4 F5\n( 1 0 0 0 )\n\u003e v = encode c e1\n\u003e v\n( 1 0 1 0 0 2 0 )\n\u003e 2 ^* e4 :: Vector 7 F3\n( 0 0 0 2 0 0 0 )\n\u003e vWithError = v + 2 ^* e4\n\u003e vWithError\n( 1 0 1 2 0 2 0 )\n\u003e isCodeword c v\nTrue\n\u003e isCodeword c vWithError\nFalse\n\u003e decode c vWithError\nJust ( 1 0 2 2 2 2 0 )\n```\nNotice, the returned vector is NOT the one without error. The reason for this\nis that a random code most likely does not have a distance \u003e2 which would be\nneeded to correct one error. Let's try with a hamming code\n\n## Correcting errors with hamming codes\n```Haskell\n\u003e c = hamming :: BinaryCode 7 4\n\u003e generatorMatrix c\n( 1 1 0 1 0 0 0 )\n( 1 0 1 0 1 0 0 )\n( 0 1 1 0 0 1 0 )\n( 1 1 1 0 0 0 1 )\n\u003e v = encode c e2\n\u003e vWithError = v + e3\n\u003e Just v' = decode c vWithError\n\u003e v' == v\nTrue\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwchresta%2Flinear-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwchresta%2Flinear-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwchresta%2Flinear-code/lists"}