-
Notifications
You must be signed in to change notification settings - Fork 0
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
Marlin refactoring #34
Conversation
Okey I left unresolved the comment related to stuff that should be addressed in the monorepo. |
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.
Most of my comments address outdated inline comments. However, two "major" findings:
- The
max_degree()
function, which is used in the setup, does not use the correct formula. - The prover third round for the inner sumcheck seems to do some computations twice.
Details are found below.
src/iop/sparse_linear_algebra.rs
Outdated
let dist = Bernoulli::new(fill_factor).unwrap(); | ||
let val: Vec<F> = (0..num_elems) | ||
.map(|_| match dist.sample(rng) { | ||
true => UniformRand::rand(rng), |
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.
Does UniformRand
sample from the entire field?
Besides the requested changes, I did an additional change. At matrix construction time I re-index the columns of the matrix to be coherent with the treatment of public input domain |
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 added minor comments, which are not mandatory for a merge.
src/iop/indexer.rs
Outdated
a_arith: a_star_arith, | ||
b_arith: b_star_arith, | ||
c_arith: c_star_arith, |
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 would have renamed also here the *_star_arith
to *_star
.
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.
Done
src/iop/indexer.rs
Outdated
) -> Option<(SparseMatrix<F>, SparseMatrix<F>, SparseMatrix<F>)> { | ||
balance_matrices(&mut cs.at, &mut cs.bt); |
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.
What is the reason for moving the balancer out of the function?
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.
Now function to_matrix_helper()
needs to take in input domain_h
and domain_x
, which are returned by function build_domains()
. And build_domains()
should be called after having called balance_matrices()
, because balancing the matrices could possibly affect the size of the domains (more precisely of domain_k
and domain_b
).
/// Lagrange domain `domain_h`. | ||
pub fn full_variable_vector(&self) -> Vec<F> { | ||
let domain_x_size = self.domain_x.size(); | ||
let mut padded_public_input = vec![F::zero(); self.domain_h.size()]; |
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.
Just a side question: Why don't we use slices in stead of vectors here? Do we really need the functionalities provided for vectors (such as appending/concatenating)?
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.
The reason is that slices are just a pointer (plus length) to a contiguous sequence of data. A function cannot return references to data allocated inside the function itself, because they would be dangling references after the function returns.
src/iop/prover.rs
Outdated
let c_scaled_val_row_col_on_b = compute_scaled_val_row_col(c_arith, scaled_eta_c); | ||
end_timer!(scale_val_row_col_time); | ||
|
||
let step = Self::get_subdomain_step(&domain_b, &domain_k)?; |
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 would move the declaration of step
after Line 701.
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.
Done
This pull request addresses Issue #27.
The high level changes are the following:
UnnormalizedBivariateLagrangePoly
is replaced with the normalizedLagrangeKernel
.LagrangeKernel
.