Trait AbstractField

Source
pub trait AbstractField:
    Sized
    + Default
    + Clone
    + Add<Output = Self>
    + AddAssign
    + Sub<Output = Self>
    + SubAssign
    + Neg<Output = Self>
    + Mul<Output = Self>
    + MulAssign
    + Sum
    + Product
    + Debug {
    type F: Field;

Show 26 methods // Required methods fn zero() -> Self; fn one() -> Self; fn two() -> Self; fn neg_one() -> Self; fn from_f(f: Self::F) -> Self; fn from_bool(b: bool) -> Self; fn from_canonical_u8(n: u8) -> Self; fn from_canonical_u16(n: u16) -> Self; fn from_canonical_u32(n: u32) -> Self; fn from_canonical_u64(n: u64) -> Self; fn from_canonical_usize(n: usize) -> Self; fn from_wrapped_u32(n: u32) -> Self; fn from_wrapped_u64(n: u64) -> Self; fn generator() -> Self; // Provided methods fn double(&self) -> Self { ... } fn square(&self) -> Self { ... } fn cube(&self) -> Self { ... } fn exp_u64(&self, power: u64) -> Self { ... } fn exp_const_u64<const POWER: u64>(&self) -> Self { ... } fn exp_power_of_2(&self, power_log: usize) -> Self { ... } fn powers(&self) -> Powers<Self> { ... } fn shifted_powers(&self, start: Self) -> Powers<Self> { ... } fn powers_packed<P: PackedField<Scalar = Self>>( &self, ) -> PackedPowers<Self, P> { ... } fn shifted_powers_packed<P: PackedField<Scalar = Self>>( &self, start: Self, ) -> PackedPowers<Self, P> { ... } fn dot_product<const N: usize>(u: &[Self; N], v: &[Self; N]) -> Self { ... } fn try_div<Rhs>(self, rhs: Rhs) -> Option<<Self as Mul<Rhs>>::Output> where Rhs: Field, Self: Mul<Rhs> { ... }
}
Expand description

A generalization of Field which permits things like

  • an actual field element
  • a symbolic expression which would evaluate to a field element
  • a vector of field elements

Required Associated Types§

Required Methods§

Source

fn zero() -> Self

Source

fn one() -> Self

Source

fn two() -> Self

Source

fn neg_one() -> Self

Source

fn from_f(f: Self::F) -> Self

Source

fn from_bool(b: bool) -> Self

Source

fn from_canonical_u8(n: u8) -> Self

Source

fn from_canonical_u16(n: u16) -> Self

Source

fn from_canonical_u32(n: u32) -> Self

Source

fn from_canonical_u64(n: u64) -> Self

Source

fn from_canonical_usize(n: usize) -> Self

Source

fn from_wrapped_u32(n: u32) -> Self

Source

fn from_wrapped_u64(n: u64) -> Self

Source

fn generator() -> Self

A generator of this field’s entire multiplicative group.

Provided Methods§

Source

fn double(&self) -> Self

Source

fn square(&self) -> Self

Source

fn cube(&self) -> Self

Source

fn exp_u64(&self, power: u64) -> Self

Exponentiation by a u64 power.

The default implementation calls exp_u64_generic, which by default performs exponentiation by squaring. Rather than override this method, it is generally recommended to have the concrete field type override exp_u64_generic, so that any optimizations will apply to all abstract fields.

Source

fn exp_const_u64<const POWER: u64>(&self) -> Self

Source

fn exp_power_of_2(&self, power_log: usize) -> Self

Source

fn powers(&self) -> Powers<Self>

Source

fn shifted_powers(&self, start: Self) -> Powers<Self>

Source

fn powers_packed<P: PackedField<Scalar = Self>>(&self) -> PackedPowers<Self, P>

Source

fn shifted_powers_packed<P: PackedField<Scalar = Self>>( &self, start: Self, ) -> PackedPowers<Self, P>

Source

fn dot_product<const N: usize>(u: &[Self; N], v: &[Self; N]) -> Self

Source

fn try_div<Rhs>(self, rhs: Rhs) -> Option<<Self as Mul<Rhs>>::Output>
where Rhs: Field, Self: Mul<Rhs>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<AF, const D: usize> AbstractField for BinomialExtensionField<AF, D>

Source§

impl<F: Field, const N: usize> AbstractField for FieldArray<F, N>

Source§

type F = F