Skip to content

Commit

Permalink
Add new PolyOps trait for evaluating many polynomials at many out-of-…
Browse files Browse the repository at this point in the history
…domain points
  • Loading branch information
jarnesino committed Oct 17, 2024
1 parent ce5b975 commit fa16181
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
15 changes: 2 additions & 13 deletions crates/prover/src/core/pcs/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use super::super::fields::qm31::SecureField;
use super::super::fri::{FriProof, FriProver};
use super::super::poly::BitReversedOrder;
use super::super::ColumnVec;
use super::quotients::{compute_fri_quotients, PointSample};
use super::quotients::compute_fri_quotients;
use super::utils::TreeVec;
use super::{PcsConfig, TreeSubspan};
use crate::core::air::Trace;
Expand Down Expand Up @@ -87,18 +87,7 @@ impl<'a, B: BackendForChannel<MC>, MC: MerkleChannel> CommitmentSchemeProver<'a,
) -> CommitmentSchemeProof<MC::H> {
// Evaluate polynomials on open points.
let span = span!(Level::INFO, "Evaluate columns out of domain").entered();
let samples = self
.polynomials()
.zip_cols(&sampled_points)
.map_cols(|(poly, points)| {
points
.iter()
.map(|&point| PointSample {
point,
value: poly.eval_at_point(point),
})
.collect_vec()
});
let samples = B::evaluate_polynomials_out_of_domain(self.polynomials(), sampled_points);
span.exit();
let sampled_values = samples
.as_cols_ref()
Expand Down
20 changes: 20 additions & 0 deletions crates/prover/src/core/poly/circle/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use crate::core::fields::FieldOps;
use crate::core::poly::twiddles::TwiddleTree;
use crate::core::poly::BitReversedOrder;
use crate::core::ColumnVec;
use crate::core::pcs::quotients::PointSample;
use crate::core::pcs::TreeVec;

/// Operations on BaseField polynomials.
pub trait PolyOps: FieldOps<BaseField> + Sized {
Expand Down Expand Up @@ -44,6 +46,24 @@ pub trait PolyOps: FieldOps<BaseField> + Sized {
/// Used by the [`CirclePoly::eval_at_point()`] function.
fn eval_at_point(poly: &CirclePoly<Self>, point: CirclePoint<SecureField>) -> SecureField;

fn evaluate_polynomials_out_of_domain(
polynomials: TreeVec<ColumnVec<&CirclePoly<Self>>>,
points: TreeVec<ColumnVec<Vec<CirclePoint<SecureField>>>>,
) -> TreeVec<ColumnVec<Vec<PointSample>>> {
polynomials
.zip_cols(&points)
.map_cols(|(poly, points)| {
points
.iter()
.map(|&point| PointSample {
point,
value: poly.eval_at_point(point),
})
.collect_vec()
})
}


/// Extends the polynomial to a larger degree bound.
/// Used by the [`CirclePoly::extend()`] function.
fn extend(poly: &CirclePoly<Self>, log_size: u32) -> CirclePoly<Self>;
Expand Down

0 comments on commit fa16181

Please sign in to comment.