pub struct Field { /* private fields */ }Expand description
The Galois field $\mathrm{GF}(2^{m})$ by exponential and logarithm tables.
Implementations§
Source§impl Field
impl Field
Sourcepub fn new(m: u32, poly: u32) -> Result<Field>
pub fn new(m: u32, poly: u32) -> Result<Field>
The field of degree m (2 to 20) generated by the primitive polynomial poly
(bit $i$ the coefficient of $x^{i}$).
§Errors
comnum_core::Error::Config for a degree outside 2 to 20, a polynomial of another
degree, or one that is not primitive (its powers of $x$ do not run through every
non-zero element).
Sourcepub fn log(&self, a: u32) -> usize
pub fn log(&self, a: u32) -> usize
The exponent $e$ of a non-zero element $\alpha^{e}$ (0 for the element 0).
Sourcepub fn div(&self, a: u32, b: u32) -> u32
pub fn div(&self, a: u32, b: u32) -> u32
The quotient $a / b$ of a non-zero b ($0 / b = 0$).
§Panics
In debug builds, for b = 0 (a division by zero is a broken invariant of the
caller: release builds return a meaningless element instead of checking it in the
inner loops of the decoders).
Trait Implementations§
impl Eq for Field
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
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