Browse Source

batch inversion

main
Charles Chen 2 years ago
parent
commit
81073dfee1
2 changed files with 6 additions and 4 deletions
  1. +2
    -2
      hyperplonk/src/mock.rs
  2. +4
    -2
      subroutines/src/poly_iop/prod_check/util.rs

+ 2
- 2
hyperplonk/src/mock.rs

@ -238,8 +238,8 @@ mod test {
MultilinearKzgPCS::<Bls12_381>::gen_srs_for_testing(&mut rng, SUPPORTED_SIZE)?;
let nv = MAX_NUM_VARS;
let vanilla_gate = CustomizedGates::vanilla_plonk_gate();
test_mock_circuit_zkp_helper(nv, &vanilla_gate, &pcs_srs)?;
let turboplonk_gate = CustomizedGates::jellyfish_turbo_plonk_gate();
test_mock_circuit_zkp_helper(nv, &turboplonk_gate, &pcs_srs)?;
Ok(())
}

+ 4
- 2
subroutines/src/poly_iop/prod_check/util.rs

@ -2,7 +2,7 @@
use crate::poly_iop::{errors::PolyIOPErrors, structs::IOPProof, zero_check::ZeroCheck, PolyIOP};
use arithmetic::{get_index, VirtualPolynomial};
use ark_ff::PrimeField;
use ark_ff::{batch_inversion, PrimeField};
use ark_poly::DenseMultilinearExtension;
use ark_std::{end_timer, start_timer};
use std::sync::Arc;
@ -31,13 +31,15 @@ pub(super) fn compute_frac_poly(
*g_eval *= gi;
}
}
batch_inversion(&mut g_evals[..]);
for (f_eval, g_eval) in f_evals.iter_mut().zip(g_evals.iter()) {
if *g_eval == F::zero() {
return Err(PolyIOPErrors::InvalidParameters(
"gxs has zero entries in the boolean hypercube".to_string(),
));
}
*f_eval /= g_eval;
*f_eval *= g_eval;
}
end_timer!(start);

Loading…
Cancel
Save