16#include <memory_resource>
18#include <nk/value/value.hpp>
73 std::pmr::memory_resource *mr =
nullptr);
97 std::pmr::memory_resource *mr =
nullptr);
128 const std::string &opt =
"system",
129 std::pmr::memory_resource *mr =
nullptr);
164 const std::string &method =
"hamming/binary",
166 std::pmr::memory_resource *mr =
nullptr);
197 const std::string &method =
"hamming/binary",
199 std::pmr::memory_resource *mr =
nullptr);
Core MATLAB-compatible multidimensional array and scalar value type.
static const Value Empty
MATLAB-style empty matrix sentinel — a 0×0 DOUBLE value.
Value syndtable(const Value &H, std::pmr::memory_resource *mr=nullptr)
Syndrome decoding table (coset-leader lookup) from a parity-check matrix (t = syndtable(H)).
DecodeResult decode(const Value &code, long long n, long long k, const std::string &method="hamming/binary", const Value &opt=Value::Empty, std::pmr::memory_resource *mr=nullptr)
Decode a linear block code ([msg, err] = decode(code, n, k, method, opt)).
CyclgenResult cyclgen(long long n, const Value &genpoly, const std::string &opt="system", std::pmr::memory_resource *mr=nullptr)
Parity-check and generator matrices for a cyclic code ([h, g, k] = cyclgen(n, genpoly) / cyclgen(n,...
Value cyclpoly(long long n, long long k, const std::string &opt="", std::pmr::memory_resource *mr=nullptr)
Generator polynomial(s) for an (n, k) cyclic code (p = cyclpoly(n, k) / cyclpoly(n,...
HammgenResult hammgen(long long m, const Value &primPoly=Value::Empty, std::pmr::memory_resource *mr=nullptr)
Parity-check and generator matrices for a Hamming code ([h, g, n, k] = hammgen(m)).
EncodeResult encode(const Value &msg, long long n, long long k, const std::string &method="hamming/binary", const Value &opt=Value::Empty, std::pmr::memory_resource *mr=nullptr)
Encode a message with a linear block code (code = encode(msg, n, k, method, opt)).
Value gen2par(const Value &mat, std::pmr::memory_resource *mr=nullptr)
Parity-check matrix from a generator matrix, or vice versa (h = gen2par(g)).
Result of cyclgen: parity-check / generator matrices and the message length.
Value h
Parity-check matrix, (n-k) × n.
long long k
Message length n - (deg genpoly).
Value g
Generator matrix, k × n.
Result of decode: the recovered message and error report.
Value msg
Decoded message words (same orientation as code).
Value err
Per-word number of errors corrected (-1 if a word could not be decoded), as a column/row to match msg...
Result of encode: the codeword stream and any zero-padding added.
Value code
Encoded codewords (same orientation as msg).
long long added
Number of zero message bits padded before coding.
Result of hammgen: parity-check / generator matrices and the code dimensions.
long long k
Message length n - m.
Value h
Parity-check matrix, m × n.
Value g
Generator matrix, k × n.
long long n
Codeword length 2^m - 1.