[][src]Struct believer::parity_check_matrix::Check

pub struct Check<'a> { /* fields omitted */ }

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 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]);

Trait Implementations

impl<'a> PartialEq<Check<'a>> for Check<'a>[src]

impl<'a> Debug for Check<'a>[src]

Auto Trait Implementations

impl<'a> Send for Check<'a>

impl<'a> Unpin for Check<'a>

impl<'a> Sync for Check<'a>

impl<'a> RefUnwindSafe for Check<'a>

impl<'a> UnwindSafe for Check<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,