Skip to content

Commit

Permalink
Add new PolyOps trait for evaluating many polynomials (columns) for t…
Browse files Browse the repository at this point in the history
…he commitment extension
  • Loading branch information
jarnesino committed Oct 1, 2024
1 parent b7544d8 commit a95d5ec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
14 changes: 2 additions & 12 deletions crates/prover/src/core/pcs/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use super::super::circle::CirclePoint;
use super::super::fields::m31::BaseField;
use super::super::fields::qm31::SecureField;
use super::super::fri::{FriProof, FriProver};
use super::super::poly::circle::CanonicCoset;
use super::super::poly::BitReversedOrder;
use super::super::ColumnVec;
use super::quotients::{compute_fri_quotients, PointSample};
Expand Down Expand Up @@ -208,22 +207,13 @@ pub struct CommitmentTreeProver<B: BackendForChannel<MC>, MC: MerkleChannel> {

impl<B: BackendForChannel<MC>, MC: MerkleChannel> CommitmentTreeProver<B, MC> {
pub fn new(
polynomials: ColumnVec<CirclePoly<B>>,
mut polynomials: ColumnVec<CirclePoly<B>>,
log_blowup_factor: u32,
channel: &mut MC::C,
twiddles: &TwiddleTree<B>,
) -> Self {
let span = span!(Level::INFO, "Extension").entered();
let evaluations = polynomials
.iter()
.map(|poly| {
poly.evaluate_with_twiddles(
CanonicCoset::new(poly.log_size() + log_blowup_factor).circle_domain(),
twiddles,
)
})
.collect_vec();

let evaluations = B::evaluate_columns(&mut polynomials, log_blowup_factor, twiddles);
span.exit();

let _span = span!(Level::INFO, "Merkle").entered();
Expand Down
18 changes: 18 additions & 0 deletions crates/prover/src/core/poly/circle/ops.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use itertools::Itertools;
use super::{CanonicCoset, CircleDomain, CircleEvaluation, CirclePoly};
use crate::core::backend::Col;
use crate::core::circle::{CirclePoint, Coset};
use crate::core::ColumnVec;
use crate::core::fields::m31::BaseField;
use crate::core::fields::qm31::SecureField;
use crate::core::fields::FieldOps;
Expand Down Expand Up @@ -43,6 +45,22 @@ pub trait PolyOps: FieldOps<BaseField> + Sized {
twiddles: &TwiddleTree<Self>,
) -> CircleEvaluation<Self, BaseField, BitReversedOrder>;

fn evaluate_polynomials(
polynomials: &mut ColumnVec<CirclePoly<Self>>,
log_blowup_factor: u32,
twiddles: &TwiddleTree<Self>,
) -> Vec<CircleEvaluation<Self, BaseField, BitReversedOrder>> {
polynomials
.iter()
.map(|poly| {
poly.evaluate_with_twiddles(
CanonicCoset::new(poly.log_size() + log_blowup_factor).circle_domain(),
twiddles,
)
})
.collect_vec()
}

/// Precomputes twiddles for a given coset.
fn precompute_twiddles(coset: Coset) -> TwiddleTree<Self>;
}

0 comments on commit a95d5ec

Please sign in to comment.