finishing frequency

This commit is contained in:
elvis
2025-07-02 17:27:36 +02:00
parent f3ba949b82
commit fb3256c4a7
4 changed files with 120 additions and 26 deletions

View File

@ -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 {