CCSDS 131.4-B short block-length LDPC codes
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+29 -11
+22 -11
README.md
··· 12 12 13 13 ## Installation 14 14 15 + Install with opam: 16 + 17 + ```sh 18 + $ opam install short-ldpc 15 19 ``` 16 - opam install short-ldpc 20 + 21 + If opam cannot find the package, it may not yet be released in the public 22 + `opam-repository`. Add the overlay repository, then install it: 23 + 24 + ```sh 25 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 26 + $ opam update 27 + $ opam install short-ldpc 17 28 ``` 18 29 19 30 ## Usage 20 31 21 32 ```ocaml 22 33 (* Pick a code: 256-bit information block, rate 1/2 *) 23 - let code = Short_ldpc.ccsds_256 in 24 - Printf.printf "Code rate: %.2f\n" (Short_ldpc.rate code); 34 + let code = Short_ldpc.ccsds_256 25 35 26 - (* Encode 32 bytes of data *) 27 - let data = Bytes.make 32 '\xAB' in 28 - let codeword = Short_ldpc.encode code data in 29 - (* codeword is 64 bytes: 32 data + 32 parity *) 36 + (* Encode 32 bytes: codeword is 64 bytes (32 data + 32 parity) *) 37 + let data = Bytes.make 32 '\xAB' 38 + let codeword = Short_ldpc.encode code data 30 39 31 - (* Decode (with up to 50 BP iterations) *) 32 - match Short_ldpc.decode ~max_iter:50 code codeword with 33 - | Ok recovered -> assert (recovered = data) 34 - | Error msg -> Printf.eprintf "decode failed: %s\n" msg 40 + let () = 41 + Printf.printf "Code rate: %.2f\n" (Short_ldpc.rate code); 42 + (* Decode with up to 50 BP iterations *) 43 + match Short_ldpc.decode ~max_iter:50 code codeword with 44 + | Ok recovered -> assert (recovered = data) 45 + | Error msg -> Printf.eprintf "decode failed: %s\n" msg 35 46 ``` 36 47 37 48 ## API Overview
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries short-ldpc))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 (name short-ldpc) 3 4 (generate_opam_files true) 4 5 (license ISC) ··· 16 17 (ocaml (>= 5.1)) 17 18 (alcotest :with-test) 18 19 (alcobar :with-test) 20 + (mdx :with-test) 19 21 fmt))
+1
short-ldpc.opam
··· 14 14 "ocaml" {>= "5.1"} 15 15 "alcotest" {with-test} 16 16 "alcobar" {with-test} 17 + "mdx" {with-test} 17 18 "fmt" 18 19 "odoc" {with-doc} 19 20 ]