shockwave-plus/shockwave_plus/src/utils.rs
shockwave_plus/src/utils.rsRaw
1use crate::FieldExt;
2
3// Returns a vector of vectors of length m, where each vector is a boolean vector (little endian)
4pub fn boolean_hypercube<F: FieldExt>(m: usize) -> Vec<Vec<F>> {
5 let n = 2usize.pow(m as u32);
6
7 let mut boolean_hypercube = Vec::<Vec<F>>::with_capacity(n);
8
9 for i in 0..n {
10 let mut tmp = Vec::with_capacity(m);
11 for j in 0..m {
12 let i_b = F::from((i >> j & 1) as u64);
13 tmp.push(i_b);
14 }
15 boolean_hypercube.push(tmp);
16 }
17
18 boolean_hypercube
19}