-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements over plonk #671
Conversation
Codecov Report
@@ Coverage Diff @@
## main #671 +/- ##
=======================================
Coverage 96.77% 96.77%
=======================================
Files 118 118
Lines 28454 28461 +7
=======================================
+ Hits 27536 27543 +7
Misses 918 918
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
let new_factor = num / den; | ||
let new_term = coefficients.last().unwrap() * &new_factor; | ||
coefficients.push(new_term); | ||
z_evaluations.push(z_evaluations.last().unwrap() * (&z_nums[i] * &z_denoms[i])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be done better using a scan iterator. That avoids pushing every evaluation into the vector, which is not super efficient
.collect(); | ||
let powers_main_group: Vec<G1Point> = | ||
core::iter::successors(Some(FieldElement::from(1)), |acc| Some(acc * &s)) | ||
.take(n + 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for two maps; we can just fuse them into a single one with g1.operate_with_self(power.representative()).
Yet another version could use successors starting from the generator and having s directly as representative, so at every step we have s*previous
let z_nums: Vec<_> = (0..&cpi.n - 1) | ||
.map(|i| { | ||
lp(&witness.a[i], &cpi.domain[i]) | ||
* lp(&witness.b[i], &(&cpi.domain[i] * &cpi.k1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be more efficient just by just iterating over cpi.domain zipped with witness.a, witness.b, witness.c
result | ||
let u_powers = [&FieldElement::one(), &u, &(u * u)]; | ||
|
||
(0..=2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to start from zero if it is just multiplying with one
Description