Skip to content

Commit

Permalink
Add new PolyOps trait for interpolating many columns (#823)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarnesino authored Oct 7, 2024
1 parent e71dd7d commit bb0cce2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/prover/src/core/pcs/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,9 @@ impl<'a, 'b, B: BackendForChannel<MC>, MC: MerkleChannel> TreeBuilder<'a, 'b, B,
columns: impl IntoIterator<Item = CircleEvaluation<B, BaseField, BitReversedOrder>>,
) -> TreeSubspan {
let span = span!(Level::INFO, "Interpolation for commitment").entered();
let polys = columns
.into_iter()
.map(|eval| eval.interpolate_with_twiddles(self.commitment_scheme.twiddles))
.collect_vec();
let polys = B::interpolate_columns(columns, self.commitment_scheme.twiddles);
span.exit();

self.extend_polys(polys)
}

Expand Down
10 changes: 10 additions & 0 deletions crates/prover/src/core/poly/circle/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ pub trait PolyOps: FieldOps<BaseField> + Sized {
itwiddles: &TwiddleTree<Self>,
) -> CirclePoly<Self>;

fn interpolate_columns(
columns: impl IntoIterator<Item = CircleEvaluation<Self, BaseField, BitReversedOrder>>,
twiddles: &TwiddleTree<Self>,
) -> Vec<CirclePoly<Self>> {
columns
.into_iter()
.map(|eval| eval.interpolate_with_twiddles(twiddles))
.collect()
}

/// Evaluates the polynomial at a single point.
/// Used by the [`CirclePoly::eval_at_point()`] function.
fn eval_at_point(poly: &CirclePoly<Self>, point: CirclePoint<SecureField>) -> SecureField;
Expand Down

0 comments on commit bb0cce2

Please sign in to comment.