Struct galois_field::Polynomial
source · [−]pub struct Polynomial {
pub coef: Vec<FiniteField>,
}
Expand description
Polynomial over FiniteField.
Either prime field F_p or Galois field GF(p^n) can be used as coefficients
Fields
coef: Vec<FiniteField>
Implementations
sourceimpl Polynomial
impl Polynomial
sourcepub fn get_primitive_polynomial(char: u32, n: i64) -> Polynomial
pub fn get_primitive_polynomial(char: u32, n: i64) -> Polynomial
get primitive polynomial of GF(q^n) examples: when char = 2, n = 2, return x^2 + x + 1 when char = 2, n = 4, return x^4 + x + 1
sourcepub fn assign_value(&mut self, value: FiniteField) -> FiniteField
pub fn assign_value(&mut self, value: FiniteField) -> FiniteField
Assign a value to the polynomial. The coefficients are in ascending order. Example: x^2 + 2x + 3 -> [3, 2, 1]
sourcepub fn gcd(&self, other: Polynomial) -> Polynomial
pub fn gcd(&self, other: Polynomial) -> Polynomial
get GCD of two polynomials examples: f.gcd(g) means GCD(f,g)
Trait Implementations
sourceimpl Add<Polynomial> for Polynomial
impl Add<Polynomial> for Polynomial
type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
+
operator.sourcefn add(self, other: Polynomial) -> Polynomial
fn add(self, other: Polynomial) -> Polynomial
Performs the
+
operation. Read moresourceimpl Clone for Polynomial
impl Clone for Polynomial
sourcefn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for Polynomial
impl Debug for Polynomial
sourceimpl Div<Polynomial> for Polynomial
impl Div<Polynomial> for Polynomial
type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
/
operator.sourcefn div(self, other: Polynomial) -> Polynomial
fn div(self, other: Polynomial) -> Polynomial
Performs the
/
operation. Read moresourceimpl Mul<Polynomial> for Polynomial
impl Mul<Polynomial> for Polynomial
type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
*
operator.sourcefn mul(self, other: Polynomial) -> Polynomial
fn mul(self, other: Polynomial) -> Polynomial
Performs the
*
operation. Read moresourceimpl Rem<Polynomial> for Polynomial
impl Rem<Polynomial> for Polynomial
type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
%
operator.sourcefn rem(self, other: Polynomial) -> Polynomial
fn rem(self, other: Polynomial) -> Polynomial
Performs the
%
operation. Read moresourceimpl Sub<Polynomial> for Polynomial
impl Sub<Polynomial> for Polynomial
type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
-
operator.sourcefn sub(self, other: Polynomial) -> Polynomial
fn sub(self, other: Polynomial) -> Polynomial
Performs the
-
operation. Read moreAuto Trait Implementations
impl RefUnwindSafe for Polynomial
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnwindSafe for Polynomial
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more