pub struct PolarCode { /* private fields */ }Expand description
A polar code of length $N$ with $K$ information bits.
Implementations§
Source§impl PolarCode
impl PolarCode
Sourcepub fn new(n: usize, k: usize, design_ebn0_db: f64) -> Result<PolarCode>
pub fn new(n: usize, k: usize, design_ebn0_db: f64) -> Result<PolarCode>
The code of length n (a power of two) with k information bits, built by the
Gaussian approximation at the design $E_{b}/N_{0}$ design_ebn0_db.
§Errors
comnum_core::Error::Config unless $N$ is a power of two, $0 < K \le N$ and the
design $E_{b}/N_{0}$ is finite.
Sourcepub fn with_crc(self, crc: Crc) -> Result<PolarCode>
pub fn with_crc(self, crc: Crc) -> Result<PolarCode>
The same code with a CRC appended to the information bits (the information set grows by its degree, $K$ is kept; CA-SCL keeps the path that passes it). A second call replaces the CRC of the first.
§Errors
comnum_core::Error::Config if the information bits and the CRC exceed the block,
or for a code built by PolarCode::with_positions, whose information set is
fixed by its table (a standard with a CRC checks it outside the code, as
crate::nr::NrPolar with PolarCode::decode_list).
Sourcepub fn with_list(self, list: usize) -> Result<PolarCode>
pub fn with_list(self, list: usize) -> Result<PolarCode>
The same code decoded by SC list with list paths (1: successive
cancellation).
§Errors
comnum_core::Error::Config for list = 0.
Sourcepub fn crc(&self) -> Option<&Crc>
pub fn crc(&self) -> Option<&Crc>
The CRC appended to the information bits (CA-SCL), if any (PolarCode::with_crc).
Sourcepub fn with_positions(
n: usize,
info_positions: &[usize],
pc_positions: &[usize],
) -> Result<PolarCode>
pub fn with_positions( n: usize, info_positions: &[usize], pc_positions: &[usize], ) -> Result<PolarCode>
The code of length n (a power of two) whose information (and CRC) bits sit at
info_positions and parity-check bits at pc_positions, all other positions
frozen to zero: the codes of a standard whose construction is a table (5G NR,
crate::nr::NrPolar). A parity-check bit is the first cell of a cyclic
register of length 5 that every information bit before it updates (TS 38.212,
Sec. 5.3.1.2); the list decoder sets it from the decisions of its path.
§Errors
comnum_core::Error::Config unless $N$ is a power of two and the positions are
distinct and below $N$.
Sourcepub fn info_positions(&self) -> &[usize]
pub fn info_positions(&self) -> &[usize]
The positions carrying information and CRC bits.
Sourcepub fn pc_positions(&self) -> &[usize]
pub fn pc_positions(&self) -> &[usize]
The parity-check positions (empty but for PolarCode::with_positions).
Sourcepub fn decode_list(&self, llr: &[f64]) -> Result<Vec<Vec<u8>>>
pub fn decode_list(&self, llr: &[f64]) -> Result<Vec<Vec<u8>>>
The information (and CRC) bits of the surviving paths of the list decoder, the most likely first, for a CRC checked outside the code (after a deinterleaver).
§Errors
comnum_core::Error::Shape if llr does not have $N$ values.
Trait Implementations§
Source§impl BlockCode for PolarCode
impl BlockCode for PolarCode
Source§fn encode_block(&self, info: &[u8]) -> Result<Vec<u8>>
fn encode_block(&self, info: &[u8]) -> Result<Vec<u8>>
Source§fn decode_block(&self, llr: &[f64]) -> Result<Vec<u8>>
fn decode_block(&self, llr: &[f64]) -> Result<Vec<u8>>
Source§fn encode_block_into(&self, info: &[u8], out: &mut [u8]) -> Result<()>
fn encode_block_into(&self, info: &[u8], out: &mut [u8]) -> Result<()>
out (ADR 0011: the default
copies BlockCode::encode_block; a code overrides it when a profile shows the
copy). Read moreSource§fn decode_block_into(&self, llr: &[f64], out: &mut [u8]) -> Result<()>
fn decode_block_into(&self, llr: &[f64], out: &mut [u8]) -> Result<()>
out (as
BlockCode::encode_block_into). Read more