Skip to content

BaseFold: all open functions accept Arc instead of DenseMultilinearExtension #563

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

Closed
wants to merge 23 commits into from

Conversation

yczhangsjtu
Copy link
Collaborator

@yczhangsjtu yczhangsjtu commented Nov 6, 2024

Extracted from #294

Currently, only simple_batch_open is requiring Arc for polys in API while other open functions are accepting DenseMultilinearExtension. This PR unifies them.

@yczhangsjtu yczhangsjtu marked this pull request as draft November 6, 2024 08:28
Copy link
Contributor

@matthiasgoergens matthiasgoergens left a comment

Choose a reason for hiding this comment

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

The unification looks like a reasonable thing to do.

Though I wonder if it's possible to break the PR into even more manageable chunks? (It's good you broke this one out at all, it's already pretty beefy on its own!)

@@ -143,10 +144,14 @@ fn bench_batch_commit_open_verify_goldilocks<Pcs: PolynomialCommitmentScheme<E>>
let values: Vec<E> = evals
.iter()
.map(Evaluation::value)
.map(|x| *x)
.copied()
Copy link
Contributor

Choose a reason for hiding this comment

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

That's an unrelated improvement, isn't it? (It's small enough that we can leave it in this PR, however.)

@@ -182,7 +187,7 @@ fn bench_batch_commit_open_verify_goldilocks<Pcs: PolynomialCommitmentScheme<E>>
let values: Vec<E> = evals
.iter()
.map(Evaluation::value)
.map(|x| *x)
.copied()
.collect::<Vec<E>>();
Copy link
Contributor

Choose a reason for hiding this comment

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

(Not part of your PR: if we specify the type in line 187 (on the let), we don't need to also specify it here, too.)

Base automatically changed from feat/basefold-refactor-extract-1 to master November 28, 2024 06:06
@yczhangsjtu yczhangsjtu marked this pull request as ready for review November 28, 2024 06:28
* E::from(1 << (num_vars - poly.num_vars))
inner_product(poly, build_eq_x_r_vec(point).iter())
* scalar
* E::from(1 << (num_vars - log2_strict(poly.len())))
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems almost like an unrelated change?

Copy link
Contributor

@matthiasgoergens matthiasgoergens left a comment

Choose a reason for hiding this comment

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

Looks mostly ok. I left a question about the change to logarithms.

Also a small suggestion:

diff --git a/mpcs/benches/basefold.rs b/mpcs/benches/basefold.rs
index 1aa55ddb..4b37d729 100644
--- a/mpcs/benches/basefold.rs
+++ b/mpcs/benches/basefold.rs
@@ -166,8 +166,8 @@ fn bench_batch_commit_open_verify_goldilocks<Pcs: PolynomialCommitmentScheme<E>>
             transcript.append_field_element_exts(values.as_slice());
             let transcript_for_bench = transcript.clone();
             let polys = polys
-                .iter()
-                .map(|poly| ArcMultilinearExtension::from(poly.clone()))
+                .into_iter()
+                .map(ArcMultilinearExtension::from)
                 .collect::<Vec<_>>();
             let proof =
                 Pcs::batch_open(&pp, &polys, &comms, &points, &evals, &mut transcript).unwrap();
diff --git a/mpcs/src/lib.rs b/mpcs/src/lib.rs
index ac1690e7..438101c4 100644
--- a/mpcs/src/lib.rs
+++ b/mpcs/src/lib.rs
@@ -531,8 +531,8 @@ pub mod test_util {
                 transcript.append_field_element_exts(values.as_slice());
 
                 let polys = polys
-                    .iter()
-                    .map(|poly| ArcMultilinearExtension::from(poly.clone()))
+                    .into_iter()
+                    .map(ArcMultilinearExtension::from)
                     .collect_vec();
 
                 let proof =

@hero78119
Copy link
Collaborator

Covered in #843 #894

@hero78119 hero78119 closed this Apr 16, 2025
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.

3 participants