ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::PartitionedBloomFilter< T, H > Class Template Reference

a filter of Bloom of \( r \) parts of \( m / r \) bits, a hash for each part More...

#include <ADS/set/BloomVariants.h>

Public member functions

 PartitionedBloomFilter (void)
 a filter of 64 bits and one part, empty
 PartitionedBloomFilter (std::size_t m, int r, H h=H())
 the empty filter of about \( m \) bits in \( r \) parts
void insert (const T &x)
 \( x \) into the filter, one bit in each part
bool maybe (const T &x) const
 whether \( x \) may be in the set, its bit of each part read: false only if \( x \) was never inserted
std::size_t ones (void) const
 the bits set
std::size_t bits (void) const
 the bits, \( r \) times those of a part
template<class A>
void persist (A &a)
 the members written to, or read from, the archive \( a \) [see Persistence.h]

Static public member functions

static constexpr std::uint64_t persistTag (void)
 the parameters of the layout, in a file

Static public attributes

static constexpr std::string_view persistName = "PartitionedBloomFilter"
 the name of the structure in a file [see Persistence.h]

Detailed description

template<class T, class H = std::hash< T >>
class ADS::PartitionedBloomFilter< T, H >

a filter of Bloom of \( r \) parts of \( m / r \) bits, a hash for each part

Constructor and destructor documentation

◆ PartitionedBloomFilter() [1/2]

template<class T, class H = std::hash< T >>
ADS::PartitionedBloomFilter< T, H >::PartitionedBloomFilter ( void )
inline

a filter of 64 bits and one part, empty

◆ PartitionedBloomFilter() [2/2]

template<class T, class H = std::hash< T >>
ADS::PartitionedBloomFilter< T, H >::PartitionedBloomFilter ( std::size_t m,
int r,
H h = H() )

the empty filter of about \( m \) bits in \( r \) parts

Precondition
\( r \ge 1 \) and \( m \ge r \)

Member function documentation

◆ bits()

template<class T, class H = std::hash< T >>
std::size_t ADS::PartitionedBloomFilter< T, H >::bits ( void ) const
nodiscard

the bits, \( r \) times those of a part

◆ insert()

template<class T, class H = std::hash< T >>
void ADS::PartitionedBloomFilter< T, H >::insert ( const T & x)

\( x \) into the filter, one bit in each part

In pseudocode (Grandi), \( w = \lfloor m / r \rfloor \) the bits of a part:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{insert}( x ) \cr 2 & \quad \textbf{for}\ i \gets 0\ \textbf{to}\ r - 1\ \textbf{do} \ B[ i w + ( h_1 + i h_2 ) \bmod w ] \gets 1 \end{array}} \]

Postcondition
maybe( x )

◆ maybe()

template<class T, class H = std::hash< T >>
bool ADS::PartitionedBloomFilter< T, H >::maybe ( const T & x) const
nodiscard

whether \( x \) may be in the set, its bit of each part read: false only if \( x \) was never inserted

◆ ones()

template<class T, class H = std::hash< T >>
std::size_t ADS::PartitionedBloomFilter< T, H >::ones ( void ) const
nodiscard

the bits set

◆ persist()

template<class T, class H = std::hash< T >>
template<class A>
void ADS::PartitionedBloomFilter< T, H >::persist ( A & a)

the members written to, or read from, the archive \( a \) [see Persistence.h]

◆ persistTag()

template<class T, class H = std::hash< T >>
constexpr std::uint64_t ADS::PartitionedBloomFilter< T, H >::persistTag ( void )
inlinestaticnodiscardconstexpr

the parameters of the layout, in a file

Member data documentation

◆ persistName

template<class T, class H = std::hash< T >>
std::string_view ADS::PartitionedBloomFilter< T, H >::persistName = "PartitionedBloomFilter"
staticconstexpr

the name of the structure in a file [see Persistence.h]


The documentation for this class was generated from the following file: