Struct ldpc_toolbox::simulation::puncturing::Puncturer
source · pub struct Puncturer { /* private fields */ }
Expand description
Puncturer.
This struct is used to perform puncturing on codewords to be transmitted, and “depuncturing” on demodulated LLRs.
Implementations§
source§impl Puncturer
impl Puncturer
sourcepub fn new(pattern: &[bool]) -> Puncturer
pub fn new(pattern: &[bool]) -> Puncturer
Creates a new puncturer.
The puncturing pattern is defined by blocks. For example [true, true, true, false]
means that the first 3/4 of the codeword bits are
preserved, and the last 1/4 is punctured.
Panics
This function panics if the pattern is empty.
sourcepub fn puncture<S, A>(
&self,
codeword: &ArrayBase<S, Ix1>
) -> Result<Array1<A>, Error>where
S: Data<Elem = A>,
A: Clone,
pub fn puncture<S, A>( &self, codeword: &ArrayBase<S, Ix1> ) -> Result<Array1<A>, Error>where S: Data<Elem = A>, A: Clone,
Puncture a codeword.
Given a codeword, returns the punctured codeword. An error is returned if the length of the codeword is not divisible by the length of the puncturing pattern.
sourcepub fn depuncture<T: Copy + Default>(&self, llrs: &[T]) -> Result<Vec<T>, Error>
pub fn depuncture<T: Copy + Default>(&self, llrs: &[T]) -> Result<Vec<T>, Error>
Depuncture LLRs.
This function depunctures demodulated LLRs by inserting zeros (which
indicate erasures) in the positions of the codeword that were
punctured. The input length must correspond to the punctured codeword,
while the output length is equal to the codeword length. An error is
returned if the length of input is not divisible by the number of true
elements in the pattern.