the multiplicative hashing of section 5.1.1 of Morin's book, \( \mathrm{hash}( x ) = ( z x \bmod 2^w ) \operatorname{div} 2^{w-d} \) on a table of \( 2^d \) places, \( z \) a random odd word and \( x \) the hash code Code( k ) of the key
More...
#include <ADS/dictionary/UniversalHashing.h>
|
| | MultiplicativeHash (std::uint64_t seed=1, Code code=Code()) |
| | a function with a random odd \( z \) of 64 bits, from the seed
|
| std::uint64_t | operator() (const K &k) const |
| | the product \( z x \bmod 2^{64} \), whose high bits are the hash
|
| std::size_t | place (const K &k, std::size_t m) const |
| | the place of \( k \) in a table of \( m = 2^d \) places, the \( d \) high bits of \( z x \bmod 2^{64} \) [see PlaceHash in TableSize.h]; two distinct codes collide with probability at most \( 2 / 2^d \) (Lemma 5.1 of Morin's book)
|
| std::uint64_t | multiplier (void) const |
| | the multiplier \( z \)
|
template<class K = std::uint64_t, class Code = std::hash< K >>
class ADS::MultiplicativeHash< K, Code >
the multiplicative hashing of section 5.1.1 of Morin's book, \( \mathrm{hash}( x ) = ( z x \bmod 2^w ) \operatorname{div} 2^{w-d} \) on a table of \( 2^d \) places, \( z \) a random odd word and \( x \) the hash code Code( k ) of the key
◆ MultiplicativeHash()
template<class K = std::uint64_t, class Code = std::hash< K >>
a function with a random odd \( z \) of 64 bits, from the seed
◆ multiplier()
template<class K = std::uint64_t, class Code = std::hash< K >>
◆ ofMultiplier()
template<class K = std::uint64_t, class Code = std::hash< K >>
the function of the multiplier \( z \)
- Precondition
- \( z \) odd
◆ operator()()
template<class K = std::uint64_t, class Code = std::hash< K >>
the product \( z x \bmod 2^{64} \), whose high bits are the hash
◆ place()
template<class K = std::uint64_t, class Code = std::hash< K >>
the place of \( k \) in a table of \( m = 2^d \) places, the \( d \) high bits of \( z x \bmod 2^{64} \) [see PlaceHash in TableSize.h]; two distinct codes collide with probability at most \( 2 / 2^d \) (Lemma 5.1 of Morin's book)
In pseudocode (section 5.1.1 of Morin's book):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{place}( k , 2^d ) \cr
2 & \quad \textbf{return}\ ( z \cdot \mathrm{code}( k ) \bmod 2^w )
\operatorname{div} 2^{w-d}
\end{array}}
\]
- Precondition
- \( m \) is a power of two
- Postcondition
- the result is below \( m \)
The documentation for this class was generated from the following file: