pub fn in_place_nr_2radix_fft<F, E>(input: &mut [FieldElement<E>], twiddles: &[FieldElement<F>])
where
    F: IsFFTField + IsSubFieldOf<E>,
    E: IsField,
{
    // divide input in groups, starting with 1, duplicating the number of groups in each stage.
    let mut group_count = 1;
    let mut group_size = input.len();

    // for each group, there'll be group_size / 2 butterflies.
    // a butterfly is the atomic operation of a FFT, e.g: (a, b) = (a + wb, a - wb).
    // The 0.5 factor is what gives FFT its performance, it recursively halves the problem size
    // (group size).

    while group_count < input.len() {
        #[allow(clippy::needless_range_loop)] // the suggestion would obfuscate a bit the algorithm
        for group in 0..group_count {
            let first_in_group = group * group_size;
            let first_in_next_group = first_in_group + group_size / 2;

            let w = &twiddles[group]; // a twiddle factor is used per group

            for i in first_in_group..first_in_next_group {
                let wi = w * &input[i + group_size / 2];

                let y0 = &input[i] + &wi;
                let y1 = &input[i] - &wi;

                input[i] = y0;
                input[i + group_size / 2] = y1;
            }
        }
        group_count *= 2;
        group_size /= 2;
    }
}
In-Place Radix-2 NR DIT FFT algorithm over a slice of two-adic field elements.
It's required that the twiddle factors are in bit-reverse order. Else this function will not
return fourier transformed values.
Also the input size needs to be a power of two.
It's recommended to use the current safe abstractions instead of this function.

Performs a fast fourier transform with the next attributes:
- In-Place: an auxiliary vector of data isn't needed for the algorithm.
- Radix-2: the algorithm halves the problem size log(n) times.
- NR: natural to reverse order, meaning that the input is naturally ordered and the output will
be bit-reversed ordered.
- DIT: decimation in time

It supports values in a field E and domain in a subfield F.
crates/math/src/fft/cpu/fft.rs