This commit is contained in:
wborgeaud 2022-03-25 08:01:22 +01:00
parent 847565a8c3
commit 19cbbd4d12
2 changed files with 11 additions and 6 deletions

View File

@ -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<F: RichField + Extendable<D>, const D: usize>(
gates: Vec<GateRef<F, D>>,
gates: &[GateRef<F, D>],
instances: &[GateInstance<F, D>],
max_degree: usize,
) -> (Vec<PolynomialValues<F>>, SelectorsInfo) {

View File

@ -667,11 +667,8 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
let quotient_degree_factor = self.config.max_quotient_degree_factor;
let mut gates = self.gates.iter().cloned().collect::<Vec<_>>();
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();