Skip to content

Commit

Permalink
Add new PolyOps trait for interpolating many columns
Browse files Browse the repository at this point in the history
  • Loading branch information
jarnesino committed Sep 9, 2024
1 parent 215b1cd commit 5398d91
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 3 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,10 @@ 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: Vec<CirclePoly<B>> =
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| Self::interpolate(eval.clone(), 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 5398d91

Please sign in to comment.