Skip to main content

Gf

Struct Gf 

Source
pub struct Gf<const P: u64>(/* private fields */);
Expand description

An element of GF(P) for a prime P fixed at compile time.

Implementations§

Source§

impl<const P: u64> Gf<P>

Source

pub const fn new(v: u64) -> Gf<P>

Source

pub const fn from_i64(x: i64) -> Gf<P>

Source

pub const fn value(self) -> u64

Source

pub const fn modulus(self) -> u64

Trait Implementations§

Source§

impl<const P: u64> Add for Gf<P>

Source§

type Output = Gf<P>

The resulting type after applying the + operator.
Source§

fn add(self, o: Gf<P>) -> Gf<P>

Performs the + operation. Read more
Source§

impl<const P: u64> Clone for Gf<P>

Source§

fn clone(&self) -> Gf<P>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const P: u64> Copy for Gf<P>

Source§

impl<const P: u64> Debug for Gf<P>

Source§

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

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

impl<const P: u64> Default for Gf<P>

Source§

fn default() -> Gf<P>

Returns the “default value” for a type. Read more
Source§

impl<const P: u64> Display for Gf<P>

Source§

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

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

impl<const P: u64> Div for Gf<P>

Source§

type Output = Gf<P>

The resulting type after applying the / operator.
Source§

fn div(self, o: Gf<P>) -> Gf<P>

Performs the / operation. Read more
Source§

impl<const P: u64> Eq for Gf<P>

Source§

impl<const P: u64> F4Field for PrimeField<P>

Source§

fn echelonize_traced( pivots: &Reducers<Self>, rows: &[SparseRow<Self>], ncols: usize, ) -> (Vec<SparseRow<Self>>, Vec<usize>)

Echelon form and indices of independent input rows, used when learning a trace.
Source§

fn echelonize( pivots: &Reducers<Self>, rows: &[SparseRow<Self>], ncols: usize, ) -> Vec<SparseRow<Self>>

Reduce rows modulo the monic pivots (distinct leading columns), then echelonize and interreduce the remainders, returning the nonzero monic rows.
Source§

fn reduce_rows( pivots: &Reducers<Self>, rows: &[SparseRow<Self>], ncols: usize, ) -> Vec<SparseRow<Self>>

Fully reduce each row modulo the monic pivots (distinct leading columns).
Source§

fn modular( _polynomials: &[Polynomial<Self>], _canonicalize: bool, ) -> Option<Result<Vec<Polynomial<Self>>, GroebnerError>>

Optional multi-modular backend. Return None to use direct F4.
Source§

impl<const P: u64> From<i32> for Gf<P>

Source§

fn from(x: i32) -> Gf<P>

Converts to this type from the input type.
Source§

impl<const P: u64> From<u32> for Gf<P>

Source§

fn from(v: u32) -> Gf<P>

Converts to this type from the input type.
Source§

impl<const P: u64> From<u64> for Gf<P>

Source§

fn from(v: u64) -> Gf<P>

Converts to this type from the input type.
Source§

impl<const P: u64> FromStr for Gf<P>

Reduces as it reads, so any number of digits is accepted.

Source§

type Err = ParseFpError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Gf<P>, ParseFpError>

Parses a string s to return a value of this type. Read more
Source§

impl<const P: u64> Hash for Gf<P>

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<const P: u64> Modular for Gf<P>

Source§

fn modulus(&self) -> u64

The prime, or 0 for a constant not yet bound to one.
Source§

fn residue(&self) -> u64

The stored residue; a signed integer in two’s complement while unbound.
Source§

fn from_residue(v: u64, _: u64) -> Gf<P>

Source§

fn residue_mod(&self, p: u64) -> u64

The residue in [0, p), binding an unbound constant to p.
Source§

impl<const P: u64> Mul for Gf<P>

Source§

type Output = Gf<P>

The resulting type after applying the * operator.
Source§

fn mul(self, o: Gf<P>) -> Gf<P>

Performs the * operation. Read more
Source§

impl<const P: u64> Neg for Gf<P>

Source§

type Output = Gf<P>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Gf<P>

Performs the unary - operation. Read more
Source§

impl<const P: u64> One for Gf<P>

Source§

fn one() -> Gf<P>

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

impl<const P: u64> Ord for Gf<P>

Source§

fn cmp(&self, other: &Gf<P>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl<const P: u64> ParseCoefficient for PrimeField<P>

Source§

fn parse_coefficient( numerator: &str, denominator: Option<&str>, _modulus: Option<u64>, ) -> Result<Self, ParsePolynomialError>

Source§

fn parameter_power(_exponent: u32) -> Option<Self>

The ring parameter raised to exponent, for fields with a parameter.
Source§

fn parameter(index: usize, count: usize) -> Option<Self>

Parameter index of count, for fields with parameters. The default is Self::parameter_power for a single parameter.
Source§

fn format_coefficient_in(&self, parameters: &[String]) -> String

Text for this coefficient as a factor of a term, with the parameters named parameters.
Source§

fn format_coefficient_latex_in(&self, parameters: &[String]) -> String

LaTeX for this coefficient, with the parameters already in LaTeX.
Source§

fn format_coefficient(&self, _parameter: &str) -> String

Text for this coefficient as a factor of a term, with the parameter named parameter.
Source§

fn format_coefficient_latex(&self, parameter: &str) -> String

Source§

fn minus_one() -> Self

Source§

fn bind_modulus(self, _modulus: Option<u64>) -> Self

Source§

impl<const P: u64> PartialEq for Gf<P>

Source§

fn eq(&self, other: &Gf<P>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<const P: u64> PartialOrd for Gf<P>

Source§

fn partial_cmp(&self, other: &Gf<P>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<const P: u64> StructuralPartialEq for Gf<P>

Source§

impl<const P: u64> Sub for Gf<P>

Source§

type Output = Gf<P>

The resulting type after applying the - operator.
Source§

fn sub(self, o: Gf<P>) -> Gf<P>

Performs the - operation. Read more
Source§

impl<const P: u64> Zero for Gf<P>

Source§

fn zero() -> Gf<P>

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.

Auto Trait Implementations§

§

impl<const P: u64> Freeze for Gf<P>

§

impl<const P: u64> RefUnwindSafe for Gf<P>

§

impl<const P: u64> Send for Gf<P>

§

impl<const P: u64> Sync for Gf<P>

§

impl<const P: u64> Unpin for Gf<P>

§

impl<const P: u64> UnsafeUnpin for Gf<P>

§

impl<const P: u64> UnwindSafe for Gf<P>

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<F> Field for F
where F: Debug + Zero + One + Neg<Output = F> + Sub<Output = F> + Clone + Div<Output = F> + PartialEq,

Source§

fn inverse(&self) -> Option<Self>

The multiplicative inverse, or None for zero.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.