Function evaluate

Source
pub fn evaluate<F, P, Data>(
    evals: &FieldBuffer<P, Data>,
    point: &[F],
) -> Result<F, Error>
where F: Field, P: PackedField<Scalar = F>, Data: Deref<Target = [P]>,
Expand description

Evaluates a multilinear polynomial at a given point using sqrt(n) memory.

This method computes the evaluation by splitting the computation into two phases:

  1. Expand an eq tensor for the first half of coordinates (or at least P::LOG_WIDTH)
  2. Take inner products of evaluation chunks with the eq tensor to reduce the problem size
  3. Evaluate the remaining coordinates using evaluate_inplace

This approach uses O(sqrt(2^n)) memory instead of O(2^n).

§Arguments

  • evals - A FieldBuffer containing the 2^n evaluations over the boolean hypercube
  • point - The n coordinates at which to evaluate the polynomial

§Returns

The evaluation of the multilinear polynomial at the given point