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: (S, usize),
11}
12
13impl<S: Scalar> TableEvaluation<S> {
14    /// Creates a new [`TableEvaluation`].
15    #[must_use]
16    pub fn new(column_evals: Vec<S>, chi: (S, usize)) -> Self {
17        Self { column_evals, chi }
18    }
19
20    /// Returns the evaluation of each column in the table.
21    #[must_use]
22    pub fn column_evals(&self) -> &[S] {
23        &self.column_evals
24    }
25
26    /// Returns the evaluation of an all-one column with the same length as the table.
27    #[must_use]
28    pub fn chi_eval(&self) -> S {
29        self.chi.0
30    }
31
32    /// Returns the evaluation of an all-one column with the same length as the table.
33    #[must_use]
34    pub fn chi(&self) -> (S, usize) {
35        self.chi
36    }
37}