Fix coset [i]fft

This commit is contained in:
Daniel Lubarov 2021-03-30 11:46:58 -07:00
parent 69b98623a1
commit 07718397ea
2 changed files with 18 additions and 8 deletions

View File

@ -122,10 +122,13 @@ pub fn fft_with_precomputation_power_of_2<F: Field>(
}
pub fn coset_fft<F: Field>(coefficients: Vec<F>, shift: F) -> Vec<F> {
fft(coefficients)
.into_iter()
.map(|x| x * shift)
.collect()
let mut points = fft(coefficients);
let mut shift_exp_i = F::ONE;
for p in points.iter_mut() {
*p *= shift_exp_i;
shift_exp_i *= shift;
}
points
}
pub fn ifft<F: Field>(points: Vec<F>) -> Vec<F> {
@ -135,10 +138,13 @@ pub fn ifft<F: Field>(points: Vec<F>) -> Vec<F> {
pub fn coset_ifft<F: Field>(points: Vec<F>, shift: F) -> Vec<F> {
let shift_inv = shift.inverse();
ifft(points)
.into_iter()
.map(|x| x * shift_inv)
.collect()
let mut shift_inv_exp_i = F::ONE;
let mut coeffs = ifft(points);
for c in coeffs.iter_mut() {
*c *= shift_inv_exp_i;
shift_inv_exp_i *= shift_inv;
}
coeffs
}
pub fn lde_multiple<F: Field>(points: Vec<Vec<F>>, rate_bits: usize) -> Vec<Vec<F>> {

View File

@ -61,6 +61,10 @@ pub(crate) fn prove<F: Field>(
common_data, prover_data, wire_ldes_t, plonk_z_ldes_t, alpha);
info!("Computing vanishing poly took {}s", start_vanishing_poly.elapsed().as_secs_f32());
let div_z_h_start = Instant::now();
// TODO
info!("Division by Z_H took {}s", div_z_h_start.elapsed().as_secs_f32());
let plonk_t: Vec<F> = todo!(); // vanishing_poly / Z_H
// Need to convert to coeff form and back?
let plonk_t_parts = todo!();