build_composite_mle

Function build_composite_mle 

Source
pub fn build_composite_mle<F: Field>(
    mles: &[(&MultilinearExtension<F>, Vec<bool>)],
) -> MultilinearExtension<F>
Expand description

Construct a parent MLE for the given MLEs and prefix bits, where the prefix bits of each MLE specify how it should be inserted into the parent. Entries left unspecified are filled with F::ZERO.

§Requires:

  • that the number of variables in each MLE, plus the number of its prefix bits, is the same across all pairs; this will be the number of variables in the returned MLE.
  • the slice is non-empty.

§Example:

use remainder::utils::mle::build_composite_mle;
use remainder::mle::evals::MultilinearExtension;
use shared_types::Fr;
use itertools::{Itertools};
let mle1 = MultilinearExtension::new(vec![Fr::from(2)]);
let mle2 = MultilinearExtension::new(vec![Fr::from(1), Fr::from(3)]);
let result = build_composite_mle(&[(&mle1, vec![false, true]), (&mle2, vec![true])]);
assert_eq!(*result.f.iter().collect_vec().clone(), vec![Fr::from(0), Fr::from(2), Fr::from(1), Fr::from(3)]);