pub struct BitSelection { /* private fields */ }Expand description
The bits of a word of full_len bits that a rate matching transmits: output bit $t$
carries bit positions()[t] of the word (a bit may be sent several times, or never).
§Examples
use comnum_fec::puncture::BitSelection;
// a word of 4 bits, bit 3 dropped, bit 0 repeated
let sel = BitSelection::new(vec![0, 1, 2, 0], 4)?;
assert_eq!(sel.select(&[1u8, 0, 1, 1])?, [1, 0, 1, 1]);
let mut full = [0.0; 4];
sel.accumulate_into(&[2.0, -1.0, 0.5, 3.0], &mut full)?;
assert_eq!(full, [5.0, -1.0, 0.5, 0.0]);Implementations§
Source§impl BitSelection
impl BitSelection
Sourcepub fn new(positions: Vec<usize>, full_len: usize) -> Result<BitSelection>
pub fn new(positions: Vec<usize>, full_len: usize) -> Result<BitSelection>
The selection of the bits positions of a word of full_len bits.
§Errors
comnum_core::Error::Config for a position beyond the word.
Sourcepub fn select<T: Copy>(&self, word: &[T]) -> Result<Vec<T>>
pub fn select<T: Copy>(&self, word: &[T]) -> Result<Vec<T>>
The transmitted bits of a word.
§Errors
comnum_core::Error::Shape if word does not have BitSelection::full_len values.
Sourcepub fn accumulate_into(&self, llr: &[f64], out: &mut [f64]) -> Result<()>
pub fn accumulate_into(&self, llr: &[f64], out: &mut [f64]) -> Result<()>
The LLRs of the bits of the word from the LLRs of the transmitted bits into
out: the sum over the copies of every bit, zero for a bit never sent.
§Errors
comnum_core::Error::Shape if llr does not have BitSelection::len values or
out BitSelection::full_len.
Trait Implementations§
Source§impl Clone for BitSelection
impl Clone for BitSelection
Source§impl Debug for BitSelection
impl Debug for BitSelection
impl Eq for BitSelection
Source§impl PartialEq for BitSelection
impl PartialEq for BitSelection
impl StructuralPartialEq for BitSelection
Auto Trait Implementations§
impl Forget for BitSelection
impl Freeze for BitSelection
impl RefUnwindSafe for BitSelection
impl Send for BitSelection
impl Sync for BitSelection
impl Unpin for BitSelection
impl UnsafeUnpin for BitSelection
impl UnwindSafe for BitSelection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more