Created
February 22, 2015 20:39
-
-
Save codahale/12d39714a6723289dc9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn estimate(&self, e: &E) -> u64 { | |
indexes(e, self.width) | |
.take(self.depth) | |
.enumerate() | |
.map(|(i, idx)| self.counters[i][idx]) | |
.min() | |
.unwrap() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn estimate(&self, e: E) -> C { | |
let (h1, h2) = hashes(e); | |
let mut max: C = Int::zero(); | |
for (i, c) in self.counters.iter().enumerate() { | |
let idx = index(h1, h2, i, c.len()); | |
let v = c[idx]; | |
if v > max { | |
max = v | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment