Struct Codeword

Source
pub struct Codeword<F: GaloisField> { /* private fields */ }
Expand description

Codeword in a Galois field.

Implementations§

Source§

impl<F: GaloisField> Codeword<F>

Source

pub fn new(bits: u8) -> Codeword<F>

Construct a new Codeword αi from the given bit pattern. Panic if the pattern is invalid in the field.

Source

pub fn for_power(power: usize) -> Codeword<F>

Construct a new Codeword αm ≡ αi (modulo the field) for the given power i.

Source

pub fn bits(&self) -> u8

Retrieve the bit pattern of the codeword.

Source

pub fn zero(&self) -> bool

Check if the codeword is zero.

Source

pub fn power(&self) -> Option<usize>

Retrieve the power i of the current codeword αi. Return Some(i) if the power is defined and None if the codeword is zero.

Source

pub fn invert(self) -> Codeword<F>

Find 1/αi for the current codeword αi. Panic if the codeword is zero.

Source

pub fn pow(&self, pow: usize) -> Codeword<F>

Compute (αi)p for the current codeword αi and given power p.

Trait Implementations§

Source§

impl<F: GaloisField> Add for Codeword<F>

Add codewords using Galois addition.

Source§

type Output = Codeword<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Codeword<F>) -> Self::Output

Performs the + operation. Read more
Source§

impl<F: Clone + GaloisField> Clone for Codeword<F>

Source§

fn clone(&self) -> Codeword<F>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: GaloisField> Debug for Codeword<F>

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<F: GaloisField> Default for Codeword<F>

Source§

fn default() -> Self

Construct the additive identity codeword α0 = 1.

Source§

impl<F: GaloisField> Div for Codeword<F>

Divide codewords using Galois division. Panic if the divisor is zero.

Source§

type Output = Codeword<F>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Codeword<F>) -> Self::Output

Performs the / operation. Read more
Source§

impl<P: PolynomialCoefs> Mul<Codeword<P25Field>> for Polynomial<P>

Scale polynomial by a codeword.

Source§

type Output = Polynomial<P>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: P25Codeword) -> Self::Output

Performs the * operation. Read more
Source§

impl<F: GaloisField> Mul for Codeword<F>

Mutiply codewords using Galois multiplication.

Source§

type Output = Codeword<F>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Codeword<F>) -> Self::Output

Performs the * operation. Read more
Source§

impl<F: GaloisField> PartialEq<u8> for Codeword<F>

Check equality of the codeword’s bit pattern with raw bits.

Source§

fn eq(&self, other: &u8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F: GaloisField> PartialEq for Codeword<F>

Check equality of two codewords.

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F: GaloisField> Sub for Codeword<F>

“Subtract” codewords, which is equivalent to addition.

Source§

type Output = Codeword<F>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Codeword<F>) -> Self::Output

Performs the - operation. Read more
Source§

impl<F: Copy + GaloisField> Copy for Codeword<F>

Source§

impl<F: GaloisField> Eq for Codeword<F>

Auto Trait Implementations§

§

impl<F> Freeze for Codeword<F>

§

impl<F> RefUnwindSafe for Codeword<F>
where F: RefUnwindSafe,

§

impl<F> Send for Codeword<F>
where F: Send,

§

impl<F> Sync for Codeword<F>
where F: Sync,

§

impl<F> Unpin for Codeword<F>
where F: Unpin,

§

impl<F> UnwindSafe for Codeword<F>
where F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.