pub trait _: Field {
    // Required methods
    fn legendre(&self) -> LegendreSymbol;
    fn sqrt(&self) -> Option<Self>;
    fn sqrt_in_place(&mut self) -> Option<&mut Self>;
}
Expand description

The interface for a field that supports an efficient square-root operation.

Required Methods§

source

fn legendre(&self) -> LegendreSymbol

Returns the Legendre symbol.

source

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

Returns the square root of self, if it exists.

source

fn sqrt_in_place(&mut self) -> Option<&mut Self>

Sets self to be the square root of self, if it exists.

Implementors§

Assign">DivAssign<&'a Self> + Sum<Self> + for<'a> Sum<&'a Self> + Product<Self> + for<'a> Product<&'a Self> + CanonicalSerialize + CanonicalSerializeWithFlags + CanonicalDeserialize + CanonicalDeserializeWithFlags + Serialize + for<'a> Deserialize<'a> { type BasePrimeField: PrimeField;
Show 14 methods // Required methods fn from_base_prime_field(other: Self::BasePrimeField) -> Self; fn characteristic<'a>() -> &'a [u64]; fn double(&self) -> Self; fn double_in_place(&mut self); fn square(&self) -> Self; fn square_in_place(&mut self) -> &mut Self; fn inverse(&self) -> Option<Self>; fn inverse_in_place(&mut self) -> Option<&mut Self>; fn frobenius_map(&mut self, power: usize); fn from_random_bytes_with_flags<F>(bytes: &[u8]) -> Option<(Self, F)> where F: Flags; // Provided methods fn half() -> Self { ... } fn sum_of_products<'a>( a: impl Iterator<Item = &'a Self> + Clone, b: impl Iterator<Item = &'a Self> + Clone ) -> Self { ... } fn pow<S>(&self, exp: S) -> Self where S: AsRef<[u64]> { ... } fn from_random_bytes(bytes: &[u8]) -> Option<Self> { ... }
}
Expand description

The interface for a generic field.

Required Associated Types§

source

type BasePrimeField: PrimeField

Required Methods§

source

fn from_base_prime_field(other: Self::BasePrimeField) -> Self

Constructs an element of Self from an element of the base prime field.

source

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

Returns the characteristic of the field.

source

fn double(&self) -> Self

Returns self + self.

source

fn double_in_place(&mut self)

Doubles self in place.

source

fn square(&self) -> Self

Returns self * self.

source

fn square_in_place(&mut self) -> &mut Self

Squares self in place.

source

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

Computes the multiplicative inverse of self if self is nonzero.

source

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

Sets self to self’s inverse if it exists. Otherwise it is a no-op.

source

fn frobenius_map(&mut self, power: usize)

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

source

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

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.

Provided Methods§

source

fn half() -> Self

Returns the constant 2^{-1}.

source

fn sum_of_products<'a>( a: impl Iterator<Item = &'a Self> + Clone, b: impl Iterator<Item = &'a Self> + Clone ) -> Self

source

fn pow<S>(&self, exp: S) -> Selfwhere S: AsRef<[u64]>,

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

source

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

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.

Implementors§

source§

impl<P> Field for Fp2<P>where P: Fp2Parameters,

source§

impl<P> Field for Fp6<P>where P: Fp6Parameters,

source§

impl<P> Field for Fp12<P>where P: Fp12Parameters,

source§

impl<P> Field for Fp256<P>where P: Fp256Parameters,

source§

impl<P> Field for Fp384<P>where P: Fp384Parameters,