Trait ark_ff::fields::Field[][src]

pub trait Field: ToBytes + 'static + FromBytes + Copy + Clone + Debug + Display + Default + Send + Sync + Eq + Zero + One + Ord + Neg<Output = Self> + UniformRand + Zeroize + Sized + Hash + CanonicalSerialize + CanonicalSerializeWithFlags + CanonicalDeserialize + CanonicalDeserializeWithFlags + Add<Self, Output = Self> + Sub<Self, Output = Self> + Mul<Self, Output = Self> + Div<Self, Output = Self> + AddAssign<Self> + SubAssign<Self> + MulAssign<Self> + DivAssign<Self> + for<'a> Add<&'a Self, Output = Self> + for<'a> Sub<&'a Self, Output = Self> + for<'a> Mul<&'a Self, Output = Self> + for<'a> Div<&'a Self, Output = Self> + for<'a> AddAssign<&'a Self> + for<'a> SubAssign<&'a Self> + for<'a> MulAssign<&'a Self> + for<'a> DivAssign<&'a Self> + Sum<Self> + for<'a> Sum<&'a Self> + Product<Self> + for<'a> Product<&'a Self> + From<u128> + From<u64> + From<u32> + From<u16> + From<u8> + From<bool> {
    type BasePrimeField: PrimeField;
Show methods fn extension_degree() -> u64;
fn from_base_prime_field_elems(
        elems: &[Self::BasePrimeField]
    ) -> Option<Self>;
#[must_use] fn double(&self) -> Self;
fn double_in_place(&mut self) -> &mut Self;
fn from_random_bytes_with_flags<F: Flags>(bytes: &[u8]) -> Option<(Self, F)>;
#[must_use] fn square(&self) -> Self;
fn square_in_place(&mut self) -> &mut Self;
#[must_use] fn inverse(&self) -> Option<Self>;
fn inverse_in_place(&mut self) -> Option<&mut Self>;
fn frobenius_map(&mut self, power: usize); fn characteristic() -> &'static [u64] { ... }
fn from_random_bytes(bytes: &[u8]) -> Option<Self> { ... }
#[must_use] fn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self { ... }
fn pow_with_table<S: AsRef<[u64]>>(
        powers_of_2: &[Self],
        exp: S
    ) -> Option<Self> { ... }
}
Expand description

The interface for a generic field.

Associated Types

Required methods

Returns the extension degree of this field with respect to Self::BasePrimeField.

Convert a slice of base prime field elements into a field element. If the slice length != Self::extension_degree(), must return None.

Returns self + self.

Doubles self in place.

Returns a field element with an extra sign bit used for group parsing if the set of bytes forms a valid field element, otherwise returns None. This function is primarily intended for sampling random field elements from a hash-function or RNG output.

Returns self * self.

Squares self in place.

Computes the multiplicative inverse of self if self is nonzero.

Exponentiates this element by a power of the base prime modulus via the Frobenius automorphism.

Provided methods

Returns the characteristic of the field, in little-endian representation.

Returns a field element if the set of bytes forms a valid field element, otherwise returns None. This function is primarily intended for sampling random field elements from a hash-function or RNG output.

Exponentiates this element by a number represented with u64 limbs, least significant limb first.

Exponentiates a field element f by a number represented with u64 limbs, using a precomputed table containing as many powers of 2 of f as the 1 + the floor of log2 of the exponent exp, starting from the 1st power. That is, powers_of_2 should equal &[p, p^2, p^4, ..., p^(2^n)] when exp has at most n bits.

This returns None when a power is missing from the table.

Implementors

The Frobenius map has no effect in a prime field.

The Frobenius map has no effect in a prime field.

The Frobenius map has no effect in a prime field.

The Frobenius map has no effect in a prime field.

The Frobenius map has no effect in a prime field.

The Frobenius map has no effect in a prime field.

The Frobenius map has no effect in a prime field.