finishing frequency
This commit is contained in:
@ -26,7 +26,11 @@ impl Frequency {
|
||||
|
||||
pub fn add(&mut self, e: &RSset, run: usize) {
|
||||
for &el in e.iter() {
|
||||
self.frequency_map.entry(el).or_insert(vec![0; run + 1])[run] += 1
|
||||
let entry = self.frequency_map.entry(el).or_insert(vec![0; run + 1]);
|
||||
if entry.len() < run +1 {
|
||||
entry.resize(run + 1, 0);
|
||||
}
|
||||
entry[run] += 1
|
||||
}
|
||||
// TODO resize clones all prev values, replace with in place method
|
||||
if self.totals.len() < run + 1 {
|
||||
|
||||
Reference in New Issue
Block a user