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 13, 2024
1 parent 215b1cd commit dc89e3b
Show file tree
Hide file tree
Showing 2 changed files with 15 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
12 changes: 12 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,18 @@ pub trait PolyOps: FieldOps<BaseField> + Sized {
itwiddles: &TwiddleTree<Self>,
) -> CirclePoly<Self>;

/// Computes minimal polynomials that evaluate to the same values as each evaluation in `columns`.
/// Used by the [`TreeBuilder::extend_evals()`] function.
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 dc89e3b

Please sign in to comment.