Skip to content

Commit

Permalink
Fix default check combinations (#123)
Browse files Browse the repository at this point in the history
* temp: remove default impl of open/check combinations from marlin_pc

* fix check_combinations

fix combinations

remove prints

remove old comments

* Revert "temp: remove default impl of open/check combinations from marlin_pc"

This reverts commit 25d4c8c.

* remove deprecated deny

* Apply suggestions from code review

Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>

* apply suggestions from code review

iter -> into_iter

* format after fixes

---------

Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
  • Loading branch information
mmagician and Pratyush authored Sep 29, 2023
1 parent 3864531 commit 0e9d907
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,20 @@ pub trait PolynomialCommitment<F: PrimeField, P: Polynomial<F>, S: Cryptographic
Self::Commitment: 'a,
{
let BatchLCProof { proof, evals } = proof;

let lc_s = BTreeMap::from_iter(linear_combinations.into_iter().map(|lc| (lc.label(), lc)));

let poly_query_set = lc_query_set_to_poly_query_set(lc_s.values().copied(), eqn_query_set);
let sorted_by_poly_and_query_label: BTreeSet<_> = poly_query_set
.clone()
.into_iter()
.map(|(poly_label, v)| ((poly_label.clone(), v.1), v.0))
.collect();

let poly_evals = Evaluations::from_iter(
poly_query_set
.iter()
.map(|(_, point)| point)
.cloned()
.zip(evals.clone().unwrap()),
sorted_by_poly_and_query_label
.into_iter()
.zip(evals.clone().unwrap())
.map(|(((poly_label, point), _query_label), eval)| ((poly_label, point), eval)),
);

for &(ref lc_label, (_, ref point)) in eqn_query_set {
Expand All @@ -381,7 +385,9 @@ pub trait PolynomialCommitment<F: PrimeField, P: Polynomial<F>, S: Cryptographic
LCTerm::One => F::one(),
LCTerm::PolyLabel(l) => *poly_evals
.get(&(l.clone().into(), point.clone()))
.ok_or(Error::MissingEvaluation { label: l.clone() })?,
.ok_or(Error::MissingEvaluation {
label: format!("{}-{:?}", l.clone(), point.clone()),
})?,
};

actual_rhs += &(*coeff * eval);
Expand Down

0 comments on commit 0e9d907

Please sign in to comment.