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;
    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<'a>() -> &'a [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> { ... } }

The interface for a generic field.

Associated Types

Loading content...

Required methods

fn extension_degree() -> u64[src]

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

fn from_base_prime_field_elems(elems: &[Self::BasePrimeField]) -> Option<Self>[src]

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

#[must_use]fn double(&self) -> Self[src]

Returns self + self.

fn double_in_place(&mut self) -> &mut Self[src]

Doubles self in place.

fn from_random_bytes_with_flags<F: Flags>(bytes: &[u8]) -> Option<(Self, F)>[src]

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.

#[must_use]fn square(&self) -> Self[src]

Returns self * self.

fn square_in_place(&mut self) -> &mut Self[src]

Squares self in place.

#[must_use]fn inverse(&self) -> Option<Self>[src]

Computes the multiplicative inverse of self if self is nonzero.

fn inverse_in_place(&mut self) -> Option<&mut Self>[src]

fn frobenius_map(&mut self, power: usize)[src]

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

Loading content...

Provided methods

fn characteristic<'a>() -> &'a [u64][src]

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

fn from_random_bytes(bytes: &[u8]) -> Option<Self>[src]

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.

#[must_use]fn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self[src]

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

fn pow_with_table<S: AsRef<[u64]>>(powers_of_2: &[Self], exp: S) -> Option<Self>[src]

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.

Loading content...

Implementors

impl<P: CubicExtParameters> Field for CubicExtField<P>[src]

type BasePrimeField = P::BasePrimeField

impl<P: QuadExtParameters> Field for QuadExtField<P>[src]

type BasePrimeField = P::BasePrimeField

impl<P: Fp64Parameters> Field for Fp64<P>[src]

type BasePrimeField = Self

impl<P: Fp256Parameters> Field for Fp256<P>[src]

type BasePrimeField = Self

impl<P: Fp320Parameters> Field for Fp320<P>[src]

type BasePrimeField = Self

impl<P: Fp384Parameters> Field for Fp384<P>[src]

type BasePrimeField = Self

impl<P: Fp768Parameters> Field for Fp768<P>[src]

type BasePrimeField = Self

impl<P: Fp832Parameters> Field for Fp832<P>[src]

type BasePrimeField = Self

Loading content...