comnum.NrPolar#
- class comnum.NrPolar(k, e, *, link='uplink', list_size=8)#
The polar code of the control channels of 5G NR (3GPP TS 38.212, Sec. 5.3.1, 5.4.1):
kpayload bits with their CRC rate-matched tonbits (puncturing, shortening or repetition by the sub-block interleaver), the frozen set of the polar sequence of Table 5.3.1.2-1; decoded by CRC-aided SC list."uplink": the uplink control information (CRC6 and 3 parity-check bits for 12 ≤ k ≤ 19, CRC11 above, the triangular interleaver of the coded bits)."downlink": the downlink control information and the broadcast channel (CRC24C, the input interleaver; the RNTI masking of a DCI is left to the caller).- Parameters:
- Raises:
ValueError – for an invalid parameter (the message names it).
Examples
>>> import comnum, numpy as np >>> code = comnum.NrPolar(30, 100, list_size=8) >>> code.mother_length 128 >>> b = comnum.bits(30, comnum.Rng(1)) >>> bool(np.array_equal(code.decode(3.0 - 6.0 * code.encode(b)), b)) True
- decode(llr)#
Decode whole blocks of LLRs (CRC-aided SC list).
- Parameters:
llr (array_like) – a multiple of
nLLRs (positive for a 0).- Returns:
kbits per block (uint8).- Return type:
- Raises:
ValueError – for an input that is not an array of numbers of the expected shape.
- encode(bits)#
Encode whole blocks.
- Parameters:
bits (array_like) – a multiple of
kbits.- Returns:
nbits per block (uint8).- Return type:
- Raises:
ValueError – for an input that is not an array of numbers of the expected shape.