Skip to main content

GenericPoseidon1LinearLayers

Trait GenericPoseidon1LinearLayers 

Source
pub trait GenericPoseidon1LinearLayers<F: Field, const WIDTH: usize>: Sync {
    // Provided methods
    fn mds_multiply<R: Algebra<F>>(
        state: &mut [R; WIDTH],
        mds: &[[F; WIDTH]; WIDTH],
    ) { ... }
    fn mds_permute<R: Algebra<F>>(
        state: &mut [R; WIDTH],
        mds: &impl Permutation<[R; WIDTH]>,
    ) { ... }
    fn cheap_matmul<R: Algebra<F>>(
        state: &mut [R; WIDTH],
        first_row: &[F; WIDTH],
        v: &[F; WIDTH],
    ) { ... }
}
Expand description

Generic linear layer trait for Poseidon1.

Provides default dense MDS multiplication and sparse matrix multiplication for use when no field-specific optimized implementation is available.

Provided Methods§

Source

fn mds_multiply<R: Algebra<F>>( state: &mut [R; WIDTH], mds: &[[F; WIDTH]; WIDTH], )

Dense MDS matrix-vector multiplication in O(t^2).

Used for the dense transition matrix in partial rounds.

Source

fn mds_permute<R: Algebra<F>>( state: &mut [R; WIDTH], mds: &impl Permutation<[R; WIDTH]>, )

MDS multiplication dispatched via a permutation trait.

Used in full rounds. Concrete fields can provide sub-O(t^2) implementations (e.g., Karatsuba convolution for circulant matrices).

Source

fn cheap_matmul<R: Algebra<F>>( state: &mut [R; WIDTH], first_row: &[F; WIDTH], v: &[F; WIDTH], )

Sparse matrix-vector multiplication for partial rounds in O(t).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§