|
| | SpectralBloomFilter (void) |
| | a filter of 64 counters and one hash, empty
|
| | SpectralBloomFilter (std::size_t m, int r, H h=H()) |
| | the empty filter of \( m \) counters and \( r \) hashes
|
| void | insert (const T &x, C f=1) |
| | \( f \) added to the multiplicity of \( x \)
|
| void | remove (const T &x, C f=1) |
| | \( f \) subtracted from the multiplicity of \( x \); a stuck counter stays
|
| C | count (const T &x) const |
| | the least counter of \( x \) (the minimum selection), never below its multiplicity
|
| bool | maybe (const T &x) const |
| | whether \( x \) may be there, count( x ) \( > 0 \): 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 |
| | the counters \( m \)
|
| int | hashes (void) const |
| | the hashes \( r \)
|
| template<class A> |
| void | persist (A &a) |
| | the members written to, or read from, the archive \( a \) [see Persistence.h]
|
template<class T, class C = std::uint32_t, class H = std::hash< T >>
class ADS::SpectralBloomFilter< T, C, H >
a filter of Bloom of \( m \) counters of the type C and \( r \) hashes, for multisets
template<class T, class C = std::uint32_t, class H = std::hash< T >>
the least counter of \( x \) (the minimum selection), never below its multiplicity
In pseudocode (Cohen and Matias):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{count}( x ) \cr
2 & \quad \textbf{return}\ \min\{ C[ j ] : j \text{ among the } r
\text{ places of } x \}
\end{array}}
\]
template<class T, class C = std::uint32_t, class H = std::hash< T >>
\( f \) added to the multiplicity of \( x \)
In pseudocode (Cohen and Matias), \( C \) the counters and \( \mathit{top} \) the largest value of a counter, at which it sticks:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{procedure}\ \mathrm{insert}( x , f ) \cr
2 & \quad \textbf{foreach}\ j\ \text{among the } r \text{ places of }
x\ \textbf{do} \cr
3 & \qquad C[ j ] \gets \min( C[ j ] + f , \mathit{top} )
\end{array}}
\]
- Postcondition
- count( x ) \( \ge f \), and maybe( x ) if \( f > 0 \)
template<class T, class C = std::uint32_t, class H = std::hash< T >>
\( f \) subtracted from the multiplicity of \( x \); a stuck counter stays
In pseudocode (Cohen and Matias, Fan et al.):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{procedure}\ \mathrm{remove}( x , f ) \cr
2 & \quad \textbf{foreach}\ j\ \text{among the } r \text{ places of }
x\ \textbf{with}\ C[ j ] \ne \mathit{top}\ \textbf{do}\ C[ j ]
\gets C[ j ] - f
\end{array}}
\]
- Precondition
- count( x ) \( \ge f \)