p3_monty_31

Trait InternalLayerBaseParameters

Source
pub trait InternalLayerBaseParameters<MP: MontyParameters, const WIDTH: usize>: Clone + Sync {
    type ArrayLike: AsRef<[MontyField31<MP>]> + Sized;

    const INTERNAL_DIAG_MONTY: [MontyField31<MP>; WIDTH];

    // Required methods
    fn internal_layer_mat_mul(
        state: &mut [MontyField31<MP>; WIDTH],
        sum: MontyField31<MP>,
    );
    fn generic_internal_linear_layer<AF: AbstractField + Mul<MontyField31<MP>, Output = AF>>(
        state: &mut [AF; WIDTH],
    );
}
Expand description

Trait which handles the Poseidon2 internal layers.

Everything needed to compute multiplication by a WIDTH x WIDTH diffusion matrix whose monty form is 1 + Diag(vec). vec is assumed to be of the form [-2, ...] with all entries after the first being small powers of 2.

Required Associated Constants§

Required Associated Types§

Required Methods§

Source

fn internal_layer_mat_mul( state: &mut [MontyField31<MP>; WIDTH], sum: MontyField31<MP>, )

Perform the internal matrix multiplication: s -> (1 + Diag(V))s. We ignore state[0] as it is handled separately.

Source

fn generic_internal_linear_layer<AF: AbstractField + Mul<MontyField31<MP>, Output = AF>>( state: &mut [AF; WIDTH], )

Perform the internal matrix multiplication for any Abstract field which implements multiplication by MontyField31 elements.

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§