Skip to main content

PackedField

Trait PackedField 

Source
pub unsafe trait PackedField:
    Algebra<Self::Scalar>
    + PackedValue<Value = Self::Scalar>
    + Div<Self, Output = Self>
    + Div<Self::Scalar, Output = Self>
    + DivAssign<Self>
    + DivAssign<Self::Scalar>
    + Sum<Self::Scalar>
    + Product<Self::Scalar> {
    type Scalar: Field;

    // Provided methods
    fn packed_powers(base: Self::Scalar) -> Powers<Self>  { ... }
    fn packed_shifted_powers(
        base: Self::Scalar,
        start: Self::Scalar,
    ) -> Powers<Self>  { ... }
    fn coeffwise_dot_product<'a, I>(d: usize, pairs: I) -> [Self; 8]
       where Self: 'a,
             I: Iterator<Item = (&'a [Self], Self)> { ... }
}
Expand description

An array of field elements which can be packed into a vector for SIMD operations.

§Safety

  • See PackedValue above.

Required Associated Types§

Provided Methods§

Source

fn packed_powers(base: Self::Scalar) -> Powers<Self>

Construct an iterator which returns powers of base packed into packed field elements.

E.g. if Self::WIDTH = 4, returns: [base^0, base^1, base^2, base^3], [base^4, base^5, base^6, base^7], ....

Source

fn packed_shifted_powers( base: Self::Scalar, start: Self::Scalar, ) -> Powers<Self>

Construct an iterator which returns powers of base multiplied by start and packed into packed field elements.

E.g. if Self::WIDTH = 4, returns: [start, start*base, start*base^2, start*base^3], [start*base^4, start*base^5, start*base^6, start*base^7], ....

Source

fn coeffwise_dot_product<'a, I>(d: usize, pairs: I) -> [Self; 8]
where Self: 'a, I: Iterator<Item = (&'a [Self], Self)>,

Accumulate the products of d coefficient streams against a shared stream of packed base values.

For each (coeffs, base) pair produced by the iterator, performs acc[k] += coeffs[k] * base for all k < d, and returns the accumulators (entries at d.. are zero). Coefficient slices shorter than d only contribute their available entries.

This is the inner kernel of mixed base-times-extension dot products, where each extension element contributes d base-field coefficient words. Implementations may override it to defer modular reductions across iterations.

§Panics

Debug builds panic if d > 8.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§