diff --git a/src/cell_space.rs b/src/cell_space.rs index b3babc5..7ef426c 100644 --- a/src/cell_space.rs +++ b/src/cell_space.rs @@ -55,9 +55,11 @@ where // result as this is the max number of elements per bucket. let max_offset = (distinct.len() / (1 << cell_bits)) + 1; - // Do not forget to initialise cells[0] let mut cells: Vec> = Vec::with_capacity(1 << cell_bits); + // Do not forget to initialise cells[0]! + cells.push(Vec::with_capacity(max_offset)); + for coordinate in distinct { //trace!("{:?} {:?} {:?} {:?}", dimension, coordinate, cell, count);