Reads and writes file formats for storing sparse matrices containing only zeros and ones. Intended for use with low density parity check (LDPC) matrices. Also supports efficient storage for quasi-cyclic LDPC codes.
Run Julia, enter ] to bring up Julia's package manager, and add the package:
julia> ]
(v1.9) pkg> add LDPCStorage
alist
(by David MacKay et al., see http://www.inference.org.uk/mackay/codes/alist.html)cscmat
(our custom format) DEPRECATEDbincsc.json
(Based on compressed sparse column (CSC). Validjson
.)qccsc.json
(Based on compressed sparse column (CSC). Validjson
. Store exponents of quasi-cyclic LDPC matrices)hpp (C++ header)
CSC of matrix as static data (write-only, reading not supported!)
using SparseArrays
using LDPCStorage
H = sparse(Int8[
0 0 1 1 0 0 0 0 1 0 0 1 1 0
1 0 0 1 1 0 0 0 0 0 1 0 0 1
0 1 0 1 0 1 1 0 1 0 0 1 1 0
1 0 0 1 0 0 0 1 0 1 0 1 0 1
])
save_to_alist("./ldpc.alist", H)
H_alist = load_alist("./ldpc.alist")
H == H_alist || warn("Failure")
save_to_bincscjson("./ldpc.bincsc.json", H)
H_csc = load_ldpc_from_json("./ldpc.bincsc.json")
H == H_csc || warn("Failure")
open("./autogen_ldpc.hpp", "w+") do io
print_cpp_header(io, H)
end
There also are methods accepting an IO
object: print_alist
, print_bincscjson
, etc.
Some methods support outputting quasi-cyclic exponents directly, e.g., print_cpp_header_QC
outputs a C++ header.
Contributions, feature requests and suggestions are welcome. Open an issue or contact us directly.