blob: 6d262668153df6d5ab14baad75c656bf88844b66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//pub mod incremental_block;
pub mod intuitive;
#[cfg(feature = "gpu")]
pub mod opencl;
pub mod gpusolver;
lazy_static! {
pub static ref PERMUTATIONS: (Vec<Vec<u32>>, Vec<u64>) = {
let n = crate::N;
let mut heap = (1..=n).collect::<Vec<u32>>();
let heap = permutohedron::Heap::new(&mut heap);
let n_f = permutohedron::factorial(n as usize);
let mut permutations = Vec::with_capacity(n_f);
let mut masks: Vec<u64> = vec![0; n_f];
println!("Generating permutations");
for (j, data) in heap.enumerate() {
let mut sum = 0;
permutations.push(data.clone());
for stone in data.iter().take(n as usize - 1) {
sum += stone;
masks[j] |= 1 << sum;
}
}
(permutations, masks)
};
}
|