message: [kimchi][lookup] moving adjacent pairs
diff: @@ -18,45 +18,6 @@ use CurrOrNext::*;
  /// Number of constraints produced by the argument.
  pub const CONSTRAINTS: u32 = 7;
  -struct AdjacentPairs<A, I: Iterator<Item = A>> {
  - prev_second_component: Option<A>,
  - i: I,
  -}
  -
  -impl<A: Copy, I: Iterator<Item = A>> Iterator for AdjacentPairs<A, I> {
  - type Item = (A, A);
  -
  - fn next(&mut self) -> Option<(A, A)> {
  - match self.prev_second_component {
  - Some(x) => match self.i.next() {
  - None => None,
  - Some(y) => {
  - self.prev_second_component = Some(y);
  - Some((x, y))
  - }
  - },
  - None => {
  - let x = self.i.next();
  - let y = self.i.next();
  - match (x, y) {
  - (None, _) | (_, None) => None,
  - (Some(x), Some(y)) => {
  - self.prev_second_component = Some(y);
  - Some((x, y))
  - }
  - }
  - }
  - }
  - }
  -}
  -
  -fn adjacent_pairs<A: Copy, I: Iterator<Item = A>>(i: I) -> AdjacentPairs<A, I> {
  - AdjacentPairs {
  - i,
  - prev_second_component: None,
  - }
  -}
  -
  /// The number of random values to append to columns for zero-knowledge.
  pub const ZK_ROWS: usize = 3;
  @@ -469,6 +430,45 @@ pub fn sorted<
  Ok(sorted)
  }
  +struct AdjacentPairs<A, I: Iterator<Item = A>> {
  + prev_second_component: Option<A>,
  + i: I,
  +}
  +
  +impl<A: Copy, I: Iterator<Item = A>> Iterator for AdjacentPairs<A, I> {
  + type Item = (A, A);
  +
  + fn next(&mut self) -> Option<(A, A)> {
  + match self.prev_second_component {
  + Some(x) => match self.i.next() {
  + None => None,
  + Some(y) => {
  + self.prev_second_component = Some(y);
  + Some((x, y))
  + }
  + },
  + None => {
  + let x = self.i.next();
  + let y = self.i.next();
  + match (x, y) {
  + (None, _) | (_, None) => None,
  + (Some(x), Some(y)) => {
  + self.prev_second_component = Some(y);
  + Some((x, y))
  + }
  + }
  + }
  + }
  + }
  +}
  +
  +fn adjacent_pairs<A: Copy, I: Iterator<Item = A>>(i: I) -> AdjacentPairs<A, I> {
  + AdjacentPairs {
  + i,
  + prev_second_component: None,
  + }
  +}
  +
  /// Computes the aggregation polynomial for maximum n lookups per row, whose kth entry is the product of terms
  ///
  /// (gamma(1 + beta) + t_i + beta t_{i+1}) \prod_{0 <= j < n} ( (1 + beta) (gamma + f_{i,j}) )
  