Function index_to_hypercube_point

Source
pub fn index_to_hypercube_point<F: Field>(n_vars: usize, index: usize) -> Vec<F>
Expand description

Converts an index to a hypercube point representation.

Given an index and number of variables, decomposes the index into a vector of field elements where each element is either F::ZERO or F::ONE based on the corresponding bit in the index.

§Arguments

  • n_vars - Number of variables (bits) in the hypercube point
  • index - The index to convert (must be less than 2^n_vars)

§Returns

Vector of n_vars field elements, where element i is F::ONE if bit i of index is 1, and F::ZERO otherwise.

§Example

let point = index_to_hypercube_point::<B128>(3, 5);
// 5 = 0b101, so point = [F::ONE, F::ZERO, F::ONE]