ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::TabulationHash Class Reference

the simple tabulation hashing of the keys of 64 bits More...

#include <ADS/dictionary/RandomHashing.h>

Public member functions

 TabulationHash (std::uint64_t seed=1)
 the 8 tables of 256 random words, from the seed
std::uint64_t operator() (std::uint64_t x) const
 the XOR of the words of the 8 bytes of \( x \)
std::size_t place (std::uint64_t x, std::size_t m) const
 the place of \( x \) in a table of \( m = 2^d \) places, the \( d \) most significant bits of its hash, as the LinearHashTable of section 5.2.3 of Morin's book takes them [see PlaceHash in TableSize.h]

Detailed description

the simple tabulation hashing of the keys of 64 bits

Constructor and destructor documentation

◆ TabulationHash()

ADS::TabulationHash::TabulationHash ( std::uint64_t seed = 1)
explicit

the 8 tables of 256 random words, from the seed

Member function documentation

◆ operator()()

std::uint64_t ADS::TabulationHash::operator() ( std::uint64_t x) const
nodiscard

the XOR of the words of the 8 bytes of \( x \)

In pseudocode (the simple tabulation of Carter and Wegman, beyond the book), \( x_0 , \ldots , x_7 \) the bytes of \( x \):

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{tabulation}( x ) \cr 2 & \quad \textbf{return}\ T_0[ x_0 ] \oplus T_1[ x_1 ] \oplus \cdots \oplus T_7[ x_7 ] \end{array}} \]

◆ place()

std::size_t ADS::TabulationHash::place ( std::uint64_t x,
std::size_t m ) const
nodiscard

the place of \( x \) in a table of \( m = 2^d \) places, the \( d \) most significant bits of its hash, as the LinearHashTable of section 5.2.3 of Morin's book takes them [see PlaceHash in TableSize.h]

Precondition
\( m \) is a power of two
Postcondition
the result is below \( m \)

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