p3_field

Trait AbstractExtensionField

Source
pub trait AbstractExtensionField<Base: AbstractField>:
    AbstractField
    + From<Base>
    + Add<Base, Output = Self>
    + AddAssign<Base>
    + Sub<Base, Output = Self>
    + SubAssign<Base>
    + Mul<Base, Output = Self>
    + MulAssign<Base> {
    const D: usize;

    // Required methods
    fn from_base(b: Base) -> Self;
    fn from_base_slice(bs: &[Base]) -> Self;
    fn from_base_fn<F: FnMut(usize) -> Base>(f: F) -> Self;
    fn from_base_iter<I: Iterator<Item = Base>>(iter: I) -> Self;
    fn as_base_slice(&self) -> &[Base];

    // Provided method
    fn monomial(exponent: usize) -> Self { ... }
}

Required Associated Constants§

Source

const D: usize

Required Methods§

Source

fn from_base(b: Base) -> Self

Source

fn from_base_slice(bs: &[Base]) -> Self

Suppose this field extension is represented by the quotient ring B[X]/(f(X)) where B is Base and f is an irreducible polynomial of degree D. This function takes a slice bs of length at exactly D, and constructs the field element \sum_i bs[i] * X^i.

NB: The value produced by this function fundamentally depends on the choice of irreducible polynomial f. Care must be taken to ensure portability if these values might ever be passed to (or rederived within) another compilation environment where a different f might have been used.

Source

fn from_base_fn<F: FnMut(usize) -> Base>(f: F) -> Self

Similar to core:array::from_fn, with the same caveats as from_base_slice.

Source

fn from_base_iter<I: Iterator<Item = Base>>(iter: I) -> Self

Source

fn as_base_slice(&self) -> &[Base]

Suppose this field extension is represented by the quotient ring B[X]/(f(X)) where B is Base and f is an irreducible polynomial of degree D. This function takes a field element \sum_i bs[i] * X^i and returns the coefficients as a slice bs of length at most D containing, from lowest degree to highest.

NB: The value produced by this function fundamentally depends on the choice of irreducible polynomial f. Care must be taken to ensure portability if these values might ever be passed to (or rederived within) another compilation environment where a different f might have been used.

Provided Methods§

Source

fn monomial(exponent: usize) -> Self

Suppose this field extension is represented by the quotient ring B[X]/(f(X)) where B is Base and f is an irreducible polynomial of degree D. This function returns the field element X^exponent if exponent < D and panics otherwise. (The fact that f is not known at the point that this function is defined prevents implementing exponentiation of higher powers since the reduction cannot be performed.)

NB: The value produced by this function fundamentally depends on the choice of irreducible polynomial f. Care must be taken to ensure portability if these values might ever be passed to (or rederived within) another compilation environment where a different f might have been used.

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> AbstractExtensionField<AF> for BinomialExtensionField<AF, D>

Source§

const D: usize = D

Source§

impl<AF: AbstractField> AbstractExtensionField<AF> for AF

Source§

const D: usize = 1usize