mirror of
https://github.com/arnaucube/hyperplonk.git
synced 2026-01-10 16:11:29 +01:00
batch inversion
This commit is contained in:
@@ -238,8 +238,8 @@ mod test {
|
|||||||
MultilinearKzgPCS::<Bls12_381>::gen_srs_for_testing(&mut rng, SUPPORTED_SIZE)?;
|
MultilinearKzgPCS::<Bls12_381>::gen_srs_for_testing(&mut rng, SUPPORTED_SIZE)?;
|
||||||
let nv = MAX_NUM_VARS;
|
let nv = MAX_NUM_VARS;
|
||||||
|
|
||||||
let vanilla_gate = CustomizedGates::vanilla_plonk_gate();
|
let turboplonk_gate = CustomizedGates::jellyfish_turbo_plonk_gate();
|
||||||
test_mock_circuit_zkp_helper(nv, &vanilla_gate, &pcs_srs)?;
|
test_mock_circuit_zkp_helper(nv, &turboplonk_gate, &pcs_srs)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use crate::poly_iop::{errors::PolyIOPErrors, structs::IOPProof, zero_check::ZeroCheck, PolyIOP};
|
use crate::poly_iop::{errors::PolyIOPErrors, structs::IOPProof, zero_check::ZeroCheck, PolyIOP};
|
||||||
use arithmetic::{get_index, VirtualPolynomial};
|
use arithmetic::{get_index, VirtualPolynomial};
|
||||||
use ark_ff::PrimeField;
|
use ark_ff::{batch_inversion, PrimeField};
|
||||||
use ark_poly::DenseMultilinearExtension;
|
use ark_poly::DenseMultilinearExtension;
|
||||||
use ark_std::{end_timer, start_timer};
|
use ark_std::{end_timer, start_timer};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@@ -31,13 +31,15 @@ pub(super) fn compute_frac_poly<F: PrimeField>(
|
|||||||
*g_eval *= gi;
|
*g_eval *= gi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
batch_inversion(&mut g_evals[..]);
|
||||||
|
|
||||||
for (f_eval, g_eval) in f_evals.iter_mut().zip(g_evals.iter()) {
|
for (f_eval, g_eval) in f_evals.iter_mut().zip(g_evals.iter()) {
|
||||||
if *g_eval == F::zero() {
|
if *g_eval == F::zero() {
|
||||||
return Err(PolyIOPErrors::InvalidParameters(
|
return Err(PolyIOPErrors::InvalidParameters(
|
||||||
"gxs has zero entries in the boolean hypercube".to_string(),
|
"gxs has zero entries in the boolean hypercube".to_string(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
*f_eval /= g_eval;
|
*f_eval *= g_eval;
|
||||||
}
|
}
|
||||||
|
|
||||||
end_timer!(start);
|
end_timer!(start);
|
||||||
|
|||||||
Reference in New Issue
Block a user