Skip to content

Commit

Permalink
Merge pull request #1922 from o1-labs/dw/add-more-documentation-regar…
Browse files Browse the repository at this point in the history
…ding-expr-module

Kimchi/expr: document EvalResult
  • Loading branch information
dannywillems authored Mar 7, 2024
2 parents 42dd5e6 + bda7ae5 commit 4364d48
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions kimchi/src/circuits/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,18 @@ fn unnormalized_lagrange_evals<'a, F: FftField, Environment: ColumnEnvironment<'
Evaluations::<F, D<F>>::from_vec_and_domain(evals, res_domain)
}

/// Implement algebraic methods like `add`, `sub`, `mul`, `square`, etc to use
/// algebra on the type `EvalResult`.
impl<'a, F: FftField> EvalResult<'a, F> {
/// Create an evaluation over the domain `res_domain`.
/// The second parameter, `g`, is a function used to define the
/// evaluations at a given point of the domain.
/// For instance, the second parameter `g` can simply be the identity
/// functions over a set of field elements.
/// It can also be used to define polynomials like `x^2` when we only have the
/// value of `x`. It can be used in particular to evaluate an expression (a
/// multi-variate polynomial) when we only do have access to the evaluations
/// of the individual variables.
fn init_<G: Sync + Send + Fn(usize) -> F>(
res_domain: (Domain, D<F>),
g: G,
Expand All @@ -1184,6 +1195,8 @@ impl<'a, F: FftField> EvalResult<'a, F> {
)
}

/// Call the internal function `init_` and return the computed evaluation as
/// a value `Evals`.
fn init<G: Sync + Send + Fn(usize) -> F>(res_domain: (Domain, D<F>), g: G) -> Self {
Self::Evals {
domain: res_domain.0,
Expand Down

0 comments on commit 4364d48

Please sign in to comment.