twenty-first icon indicating copy to clipboard operation
twenty-first copied to clipboard

Rework `ntt` interface.

Open jan-ferdinand opened this issue 3 months ago • 0 comments

I think it's time we rework the ntt interface from its current

pub fn ntt<FF>(x: &mut [FF], omega: BFieldElement, log_2_of_n: u32) { /* … */ }

to be something like

pub fn ntt<FF>(mut x: Vec<FF>) -> Vec<FF> {/* … */}

The current interface feels quite clunky. For example, the passed-in primitive root of unity omega and the $\mathsf{log}_2(\mathtt{x.len()})$ have restrictions that are so tight that they might as well be computed inside the function.

Admittedly, the current signature seems to have some merit – sometimes, it is actually used on sub-slices. However, most of time, a mutable reference to an entire vector is passed in. Maybe the above suggestion is a wrapper for an internal fn ntt_mut_slice(…). Looking at how we use ntt, it seems that this wrapper would become the default use.

jan-ferdinand avatar May 13 '24 11:05 jan-ferdinand