From 19cbbd4d12667da75047913dda43416bd2a8e20c Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Fri, 25 Mar 2022 08:01:22 +0100 Subject: [PATCH] Minor --- plonky2/src/gates/selectors.rs | 10 +++++++++- plonky2/src/plonk/circuit_builder.rs | 7 ++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/plonky2/src/gates/selectors.rs b/plonky2/src/gates/selectors.rs index ed251237..a5d15f87 100644 --- a/plonky2/src/gates/selectors.rs +++ b/plonky2/src/gates/selectors.rs @@ -20,8 +20,16 @@ pub(crate) struct SelectorsInfo { /// Partition the gates into (the smallest amount of) groups `{ G_i }`, such that for each group `G` /// `|G| + max_{g in G} g.degree() <= max_degree`. These groups are constructed greedily from /// the list of gates sorted by degree. +/// We build a selector polynomial `S_i` for each group `G_i`, with +/// ``` +/// S_i[j] = +/// if j-th row gate=g_k in G_i +/// k +/// else +/// UNUSED_SELECTOR +/// ``` pub(crate) fn selector_polynomials, const D: usize>( - gates: Vec>, + gates: &[GateRef], instances: &[GateInstance], max_degree: usize, ) -> (Vec>, SelectorsInfo) { diff --git a/plonky2/src/plonk/circuit_builder.rs b/plonky2/src/plonk/circuit_builder.rs index 7fbc67f4..12180600 100644 --- a/plonky2/src/plonk/circuit_builder.rs +++ b/plonky2/src/plonk/circuit_builder.rs @@ -667,11 +667,8 @@ impl, const D: usize> CircuitBuilder { let quotient_degree_factor = self.config.max_quotient_degree_factor; let mut gates = self.gates.iter().cloned().collect::>(); gates.sort_unstable_by_key(|g| (g.0.degree(), g.0.id())); - let (mut constant_vecs, selectors_info) = selector_polynomials( - gates.clone(), - &self.gate_instances, - quotient_degree_factor + 1, - ); + let (mut constant_vecs, selectors_info) = + selector_polynomials(&gates, &self.gate_instances, quotient_degree_factor + 1); constant_vecs.extend(self.constant_polys()); let num_constants = constant_vecs.len();