Skip to content
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

Merge dense MLEs & update documentation #763

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

mmagician
Copy link
Member

@mmagician mmagician commented Jan 23, 2024

Description

Adapted from https://github.com/a16z/Lasso/blob/570831e6d9347c500e8397227647c4d71190ceaa/jolt-core/src/poly/dense_mlpoly.rs#L401


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

@mmagician mmagician requested review from a team as code owners January 23, 2024 13:43
@mmagician mmagician requested review from z-tech, Pratyush and weikengchen and removed request for a team January 23, 2024 13:43
let num_vars = log2(next_pow_of_two);
let mut evaluations: Vec<F> = Vec::with_capacity(next_pow_of_two);

for poly in polys {
Copy link

@autquis autquis Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to limit ourselves to merging $2^r$ polynomials that all have an evaluation table of size $s$ where $2^{x-1} &lt; s &lt;= 2^x$?
This way, evaluating the merged polynomial at $r+x$ variables is equal to the linear combination of evaluation of each at $x$ variables.
Now, we cannot guarantee such meaning for the merged polynomial.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior is well defined when you pad with zeros, see the test case for unequal polys.

Copy link

@autquis autquis Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it is well-defined in code, I see. I mean what is the meaning of the unequal case?

EDIT: Maybe the question is not relevant here. Never mind.

/// let eval_combined = mle.evaluate(&point);
///
/// assert_eq!(eval_combined, (Fr::one() - point[2]) * eval_1 + point[2] * eval_2);
pub fn merge(polys: impl IntoIterator<Item = impl AsRef<Self>> + Clone) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use case for this function? When would I want to concatenate two polynomials?

Copy link

@autquis autquis Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example in the case of committing to polynomials, instead of committing to 2^r different x-variate polynomials, one can commit to their merged polynomial which is (r+x)-variate polynomial (which can be faster depending on the scheme).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something we could also use in our ark-spartan repo: https://github.com/arkworks-rs/spartan/blob/762fc57774fe70386532199911dd0955d58109e2/src/sparse_mlpoly.rs#L58

(will ofc require a larger refactor to switch from a custom DensePoly to one from ark-poly)

@sjudson sjudson mentioned this pull request Feb 8, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants