Skip to content

Commit

Permalink
commit suggestion: compute scaled h poly
Browse files Browse the repository at this point in the history
  • Loading branch information
kilic committed Sep 27, 2023
1 parent 9128f5e commit c862fad
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions plonkish_backend/src/pcs/multilinear/ipa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,9 @@ where
xi_invs.iter_mut().batch_invert();
xi_invs
};
let h = MultilinearPolynomial::new(h_coeffs(&xis));
let hc = h.evals().iter().map(|h| *h * neg_c).collect_vec();
let u = &(xi_0 * (neg_c * h.evaluate(point) + eval));
let scalars = chain![&xi_invs, &xis, &hc, Some(u)];
let neg_c_h = MultilinearPolynomial::new(h_coeffs(neg_c, &xis));
let u = &(xi_0 * (neg_c_h.evaluate(point) + eval));
let scalars = chain![&xi_invs, &xis, neg_c_h.evals(), Some(u)];
let bases = chain![&ls, &rs, vp.g(), Some(vp.h())];
bool::from((variable_base_msm(scalars, bases) + comm.0).is_identity())
.then_some(())
Expand All @@ -317,11 +316,11 @@ where
}
}

fn h_coeffs<F: Field>(xi: &[F]) -> Vec<F> {
fn h_coeffs<F: Field>(scalar: F, xi: &[F]) -> Vec<F> {
assert!(!xi.is_empty());

let mut coeffs = vec![F::ZERO; 1 << xi.len()];
coeffs[0] = F::ONE;
coeffs[0] = scalar;

for (len, xi) in xi.iter().rev().enumerate().map(|(i, xi)| (1 << i, xi)) {
let (left, right) = coeffs.split_at_mut(len);
Expand Down

0 comments on commit c862fad

Please sign in to comment.