binius_hal/sumcheck_evaluator.rs
1// Copyright 2024-2025 Irreducible Inc.
2
3use std::ops::Range;
4
5use binius_field::{Field, PackedField};
6
7/// Evaluations of a polynomial at a set of evaluation points.
8#[derive(Debug, Clone)]
9pub struct RoundEvals<F: Field>(pub Vec<F>);
10
11pub trait SumcheckEvaluator<P: PackedField, Composition> {
12 /// The range of eval point indices over which composition evaluation and summation should happen.
13 /// Returned range must equal the result of `n_round_evals()` in length.
14 fn eval_point_indices(&self) -> Range<usize>;
15
16 /// Compute composition evals over a subcube.
17 ///
18 /// `batch_query` should contain multilinears evals over a subcube represented
19 /// by `subcube_vars` and `subcube_index`.
20 ///
21 /// See doc comments to [EvaluationDomain](binius_math::EvaluationDomain) for the intuition
22 /// behind `is_infinity_point`.
23 ///
24 /// Returns a packed sum (which may be spread across scalars).
25 fn process_subcube_at_eval_point(
26 &self,
27 subcube_vars: usize,
28 subcube_index: usize,
29 is_infinity_point: bool,
30 batch_query: &[&[P]],
31 ) -> P;
32
33 /// Returns the composition evaluated by this object.
34 fn composition(&self) -> &Composition;
35
36 /// In case of zerocheck returns eq_ind that the results should be folded with.
37 /// In case of sumcheck returns None.
38 fn eq_ind_partial_eval(&self) -> Option<&[P]>;
39}