Template Class SpectralBloomFilter

Class Documentation

template<class T, class C = std::uint32_t, class H = std::hash<T>>
class SpectralBloomFilter

a filter of Bloom of m counters C and r hashes, for multisets

Public Functions

SpectralBloomFilter(std::size_t m, int r, H h = H())

the empty filter of m counters and r hashes

Pre:

m >= 1 and r >= 1

void insert(const T &x, C f = 1)

adds f to the multiplicity of x

Post:

count( x ) >= f, and maybe( x ) if f > 0

void remove(const T &x, C f = 1)

subtracts f from the multiplicity of x; a stuck counter stays

Pre:

count( x ) >= f

C count(const T &x) const

the least counter of x: never below its multiplicity

bool maybe(const T &x) const

false only if x is not there

std::size_t stuck(void) const

the counters at their largest value, which no longer move

std::size_t counters(void) const
int hashes(void) const