[−][src]Struct believer::parity_check_matrix::Check
A wrapper over a check. It contains the positions of the bits in the check.
Methods
impl<'a> Check<'a>
[src]
pub fn dot(&self, other: &[GF2]) -> GF2
[src]
Returns the dot product between self
and other
. In that case, it corresponds to the
parity of the overlap.
Example
let parity_check = ParityCheckMatrix::new( vec![ vec![0, 1, 2, 4], vec![0, 1, 3, 5], vec![0, 2, 3, 6], ], 7 ); let other = vec![GF2::B0, GF2::B1, GF2::B0, GF2::B1, GF2::B0, GF2::B1, GF2::B0]; assert_eq!(parity_check.check(0).unwrap().dot(&other), GF2::B1); assert_eq!(parity_check.check(1).unwrap().dot(&other), GF2::B1); assert_eq!(parity_check.check(2).unwrap().dot(&other), GF2::B1);
pub fn len(&self) -> usize
[src]
Returns the number of positions in self
.
pub fn positions(&self) -> &[usize]
[src]
Returns the positions of the bits in self
.
Example
let parity_check = ParityCheckMatrix::new( vec![ vec![0, 1], vec![1, 2], ], 3 ); assert_eq!(parity_check.check(0).unwrap().positions(), &[0, 1]); assert_eq!(parity_check.check(1).unwrap().positions(), &[1, 2]);
pub fn spread(&self) -> usize
[src]
Returns the spread of self
, that is `max(self) - min(self) + 1'.
Example
let parity_check = ParityCheckMatrix::new( vec![ vec![0, 1], vec![1, 2, 5], vec![3], vec![0, 4], vec![], ], 6 ); assert_eq!(parity_check.check(0).unwrap().spread(), 2); assert_eq!(parity_check.check(1).unwrap().spread(), 5); assert_eq!(parity_check.check(2).unwrap().spread(), 1); assert_eq!(parity_check.check(3).unwrap().spread(), 5); assert_eq!(parity_check.check(4).unwrap().spread(), 0);
Trait Implementations
Auto Trait Implementations
impl<'a> Send for Check<'a>
impl<'a> Sync for Check<'a>
impl<'a> Unpin for Check<'a>
impl<'a> UnwindSafe for Check<'a>
impl<'a> RefUnwindSafe for Check<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,