pub struct Ccdm { /* private fields */ }Expand description
A constant-composition distribution matcher (see the module).
Implementations§
Source§impl Ccdm
impl Ccdm
Sourcepub fn new(composition: Vec<usize>) -> Result<Ccdm>
pub fn new(composition: Vec<usize>) -> Result<Ccdm>
The matcher of a composition: composition[a] occurrences of symbol a.
§Errors
comnum_core::Error::Config for an empty composition or one that carries no bit.
Sourcepub fn from_distribution(p: &[f64], n: usize) -> Result<Ccdm>
pub fn from_distribution(p: &[f64], n: usize) -> Result<Ccdm>
The matcher of blocks of n symbols whose composition is the nearest to the
distribution p (largest remainders: ⌊n p_a⌋, then one more for the largest
remainders until the sum is n).
§Errors
comnum_core::Error::Config for probabilities that are not non-negative with a
positive sum, and as Ccdm::new.
Sourcepub fn composition(&self) -> &[usize]
pub fn composition(&self) -> &[usize]
The composition.
Sourcepub fn distribution(&self) -> Vec<f64>
pub fn distribution(&self) -> Vec<f64>
The distribution of the symbols, $n_{a}/n$.
Sourcepub fn match_bits(&self, bits: &[u8]) -> Result<Vec<usize>>
pub fn match_bits(&self, bits: &[u8]) -> Result<Vec<usize>>
The sequence of $n$ symbols of bits ($k$ bits, the rank, most significant
first).
§Errors
comnum_core::Error::Shape if bits does not have $k$ bits.
Trait Implementations§
impl Eq for Ccdm
impl StructuralPartialEq for Ccdm
Auto Trait Implementations§
impl Forget for Ccdm
impl Freeze for Ccdm
impl RefUnwindSafe for Ccdm
impl Send for Ccdm
impl Sync for Ccdm
impl Unpin for Ccdm
impl UnsafeUnpin for Ccdm
impl UnwindSafe for Ccdm
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