Skip to content

Commit

Permalink
Evaluation oods once
Browse files Browse the repository at this point in the history
  • Loading branch information
spapinistarkware committed Mar 28, 2024
1 parent 04dfbe3 commit 295483c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/core/air/air_ext.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::iter::zip;

use itertools::Itertools;
use tracing::{span, Level};

use super::accumulation::{DomainEvaluationAccumulator, PointEvaluationAccumulator};
use super::{Air, ComponentTrace};
Expand Down Expand Up @@ -43,6 +42,7 @@ pub trait AirExt<B: Backend>: Air<B> {
accumulator.finalize()
}

// TODO(spapini): Remove.
fn mask_points_and_values(
&self,
point: CirclePoint<SecureField>,
Expand All @@ -51,7 +51,6 @@ pub trait AirExt<B: Backend>: Air<B> {
ComponentVec<Vec<CirclePoint<SecureField>>>,
ComponentVec<Vec<SecureField>>,
) {
let _span = span!(Level::INFO, "Eval columns ood").entered();
let mut component_points = ComponentVec(Vec::new());
let mut component_values = ComponentVec(Vec::new());
zip(self.components(), component_traces).for_each(|(component, trace)| {
Expand Down
4 changes: 3 additions & 1 deletion src/core/commitment_scheme/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ impl<B: Backend + MerkleOps<MerkleHasher>> CommitmentSchemeProver<B> {
sampled_points: TreeVec<ColumnVec<Vec<CirclePoint<SecureField>>>>,
channel: &mut ProofChannel,
) -> CommitmentSchemeProof {
// Evaluate polynomials on samples points.
// Evaluate polynomials on open points.
let span = span!(Level::INFO, "Eval columns ood").entered();
let samples = self
.polynomials()
.zip_cols(&sampled_points)
Expand All @@ -88,6 +89,7 @@ impl<B: Backend + MerkleOps<MerkleHasher>> CommitmentSchemeProver<B> {
})
.collect_vec()
});
span.exit();
let sampled_values = samples
.as_cols_ref()
.map_cols(|x| x.iter().map(|o| o.value).collect());
Expand Down
7 changes: 2 additions & 5 deletions src/core/prover/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ mod tests {
use crate::core::circle::{CirclePoint, CirclePointIndex, Coset};
use crate::core::fields::m31::BaseField;
use crate::core::fields::qm31::SecureField;
use crate::core::poly::circle::{CircleDomain, MAX_CIRCLE_DOMAIN_LOG_SIZE};
use crate::core::poly::circle::{CanonicCoset, CircleDomain, MAX_CIRCLE_DOMAIN_LOG_SIZE};
use crate::core::prover::{prove, ProvingError};
use crate::core::test_utils::test_channel;
use crate::qm31;
Expand Down Expand Up @@ -372,10 +372,7 @@ mod tests {
max_constraint_log_degree_bound: LOG_DOMAIN_SIZE,
},
};
let domain = CircleDomain::new(Coset::new(
CirclePointIndex::generator(),
LOG_DOMAIN_SIZE - 1,
));
let domain = CanonicCoset::new(LOG_DOMAIN_SIZE).circle_domain();
let values = vec![BaseField::zero(); 1 << LOG_DOMAIN_SIZE];
let trace = vec![CPUCircleEvaluation::new(domain, values)];

Expand Down
8 changes: 1 addition & 7 deletions src/examples/wide_fibonacci/constraint_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ impl Component<CPUBackend> for WideFibComponent {
evaluation_accumulator: &mut DomainEvaluationAccumulator<CPUBackend>,
) {
let constraint_log_degree = Component::<CPUBackend>::max_constraint_log_degree_bound(self);
let mut trace_evals = vec![];
// TODO(ShaharS), Share this LDE with the commitment LDE.
for poly_index in 0..64 {
let poly = &trace.columns[poly_index];
let trace_eval_domain = CanonicCoset::new(constraint_log_degree).circle_domain();
trace_evals.push(poly.evaluate(trace_eval_domain).bit_reverse());
}
let trace_evals = &trace.evals;
let zero_domain = CanonicCoset::new(self.log_size).coset;
let eval_domain = CanonicCoset::new(self.log_size + 1).circle_domain();
let mut denoms = vec![];
Expand Down
8 changes: 7 additions & 1 deletion src/examples/wide_fibonacci/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,15 @@ mod tests {
.into_iter()
.map(|eval| eval.interpolate())
.collect_vec();
let eval_domain = CanonicCoset::new(wide_fib.log_size + 1).circle_domain();
let trace_evals = trace_polys
.iter()
.map(|poly| poly.evaluate(eval_domain))
.collect_vec();

let trace = ComponentTrace {
columns: trace_polys.iter().collect(),
polys: trace_polys.iter().collect(),
evals: trace_evals.iter().collect(),
};

wide_fib.evaluate_constraint_quotients_on_domain(&trace, &mut acc);
Expand Down

0 comments on commit 295483c

Please sign in to comment.