comnum.CcsdsLdpc#
- class comnum.CcsdsLdpc(rate, k=None, *, rule=Ellipsis, alpha=Ellipsis, max_iterations=Ellipsis, layered=Ellipsis)#
An LDPC code of CCSDS 131.0-B-5, Sec. 7: the (8160, 7136) code of rate 223/255 (Sec. 7.3,
CcsdsLdpc("7/8")), or an AR4JA code ofk= 1024, 4096 or 16384 bits and rate 1/2, 2/3 or 4/5 (Sec. 7.4,CcsdsLdpc("1/2", 1024)), with the encoder of the standard (the circulants of Table C-1, the matrixCof Sec. 7.4.2), the virtual zeros and the punctured bits, decoded by belief propagation on the full parity-check matrix.Building the AR4JA code of
k = 16384and rate 1/2 inverts an 8192 × 8192 binary matrix: about a second.- Parameters:
rate (str) –
"7/8"(the (8160, 7136) code),"1/2","2/3"or"4/5".k (int | None) – the information bits of an AR4JA code (1024, 4096 or 16384).
rule (str) – the check-node rule (as
LdpcCode.set_decoder).alpha (float) – the scale or the offset of the min-sum rules.
max_iterations (int) – the maximum number of iterations.
layered (bool) – the layered schedule (default), or flooding (
False).
- Raises:
ValueError – for another rate or
k.
Examples
The lengths of Table 7-5 and a codeword decoded through a noisy channel:
>>> import comnum, numpy as np >>> code = comnum.CcsdsLdpc("2/3", 1024) >>> (code.k, code.n) (1024, 1536) >>> b = comnum.bits(1024, comnum.Rng(1)) >>> bool(np.array_equal(code.decode(4.0 - 8.0 * code.encode(b)), b)) True >>> comnum.CcsdsLdpc("7/8").n 8160
- app(llr)#
The a posteriori LLRs of the information bits of one codeword.
- Parameters:
llr (array_like) –
nLLRs.- Returns:
kLLRs (float64).- Return type:
- Raises:
ValueError – unless
llrhasnvalues.
- decode(llr)#
Decode whole codewords of LLRs.
- Parameters:
llr (array_like) – a multiple of
nLLRs (positive for a 0).- Returns:
kbits per codeword (uint8).- Return type:
- Raises:
ValueError – for an input that is not an array of numbers of the expected shape.
- encode(bits)#
Encode whole codewords.
- Parameters:
bits (array_like) – a multiple of
kbits.- Returns:
nbits per codeword (uint8).- Return type:
- Raises:
ValueError – for an input that is not an array of bits of the expected shape.
- full_codeword(info)#
The codeword of the full parity-check matrix: the 18 virtual zeros of the rate-7/8 code, the information and every parity bit, the punctured ones included.
- Parameters:
info (array_like) –
kbits.- Returns:
the bits (uint8), a codeword of
ldpc.- Return type:
- Raises:
ValueError – unless
infohaskbits.
- ldpc#
The code of the full parity-check matrix (the virtual and punctured bits included), a copy.
- Type: