[−][src]Struct believer::parity_check_matrix::check_view::CheckView
A view over a check of a parity check matrix.
Methods
impl<'a> CheckView<'a>
[src]
pub fn iter(&self) -> Iter<usize>
[src]
An iterator over the bits in self
.
pub fn compute_syndrome(&self, message: &[GF2]) -> GF2
[src]
Returns the syndrome of a given message
. That is, returns the dot product between
self
and message
.
Example
let parity_check = ParityCheckMatrix::with_n_bits(7) .with_checks(vec![ vec![0, 1, 2, 4], vec![0, 1, 3, 5], vec![0, 2, 3, 6], ]); let other = vec![GF2::B0, GF2::B1, GF2::B0, GF2::B1, GF2::B0, GF2::B1, GF2::B0]; assert_eq!(parity_check.get_check(0).unwrap().compute_syndrome(&other), GF2::B1); assert_eq!(parity_check.get_check(1).unwrap().compute_syndrome(&other), GF2::B1); assert_eq!(parity_check.get_check(2).unwrap().compute_syndrome(&other), GF2::B1);
pub fn has_non_zero_syndrome(&self, message: &[GF2]) -> bool
[src]
Returns true
if the syndrome of message
is GF2::B1
.
pub fn has_zero_syndrome(&self, message: &[GF2]) -> bool
[src]
Returns true
if the syndrome of message
is GF2::B0
.
pub fn get_n_bits(&self) -> usize
[src]
Returns the number of bits connected to self
.
pub fn spread(&self) -> usize
[src]
Returns the spread of self
.
Example
let parity_check = ParityCheckMatrix::with_n_bits(6).with_checks( vec![ vec![0, 1], vec![1, 2, 5], vec![3], vec![0, 4], ] ); assert_eq!(parity_check.get_check(0).unwrap().spread(), 2); assert_eq!(parity_check.get_check(1).unwrap().spread(), 5); assert_eq!(parity_check.get_check(2).unwrap().spread(), 1); assert_eq!(parity_check.get_check(3).unwrap().spread(), 5);
pub fn max(&self) -> usize
[src]
Returns the bit connected to self
with maximal index.
Example
let parity_check = ParityCheckMatrix::with_n_bits(6).with_checks( vec![ vec![0, 1], vec![1, 2, 5], vec![3], vec![0, 4], ] ); assert_eq!(parity_check.get_check(0).unwrap().max(), 1); assert_eq!(parity_check.get_check(1).unwrap().max(), 5); assert_eq!(parity_check.get_check(2).unwrap().max(), 3); assert_eq!(parity_check.get_check(3).unwrap().max(), 4);
pub fn min(&self) -> usize
[src]
Returns the bit connected to self
with minimal index if self
Example
let parity_check = ParityCheckMatrix::with_n_bits(6).with_checks( vec![ vec![0, 1], vec![1, 2, 5], vec![3], vec![0, 4], ] ); assert_eq!(parity_check.get_check(0).unwrap().min(), 0); assert_eq!(parity_check.get_check(1).unwrap().min(), 1); assert_eq!(parity_check.get_check(2).unwrap().min(), 3); assert_eq!(parity_check.get_check(3).unwrap().min(), 0);
pub fn to_vec(&self) -> Vec<usize>
[src]
Copies self
into a new Vec
.
Trait Implementations
impl<'a> AsRef<[usize]> for CheckView<'a>
[src]
impl<'a> PartialEq<CheckView<'a>> for CheckView<'a>
[src]
impl<'a> Debug for CheckView<'a>
[src]
impl<'a> StructuralPartialEq for CheckView<'a>
[src]
Auto Trait Implementations
impl<'a> Send for CheckView<'a>
impl<'a> Sync for CheckView<'a>
impl<'a> Unpin for CheckView<'a>
impl<'a> UnwindSafe for CheckView<'a>
impl<'a> RefUnwindSafe for CheckView<'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 = !
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>,