proof_of_sql/base/database/
table_evaluation.rs

1use crate::base::scalar::Scalar;
2use alloc::vec::Vec;
3
4/// The result of evaluating a table
5#[derive(Debug, Eq, PartialEq, Clone)]
6pub struct TableEvaluation<S: Scalar> {
7    /// Evaluation of each column in the table
8    column_evals: Vec<S>,
9    /// Evaluation of an all-one column with the same length as the table
10    chi_eval: S,
11}
12
13impl<S: Scalar> TableEvaluation<S> {
14    /// Creates a new [`TableEvaluation`].
15    #[must_use]
16    pub fn new(column_evals: Vec<S>, chi_eval: S) -> Self {
17        Self {
18            column_evals,
19            chi_eval,
20        }
21    }
22
23    /// Returns the evaluation of each column in the table.
24    #[must_use]
25    pub fn column_evals(&self) -> &[S] {
26        &self.column_evals
27    }
28
29    /// Returns the evaluation of an all-one column with the same length as the table.
30    #[must_use]
31    pub fn chi_eval(&self) -> S {
32        self.chi_eval
33    }
34}