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

\( h( k ) = ( a k \bmod 2^h ) \operatorname{div} 2^{h - l} \), with \( a \) odd More...

#include <ADS/dictionary/UniversalHashing.h>

Public member functions

 MultiplyShiftHash (int h, int l, std::uint64_t seed=1)
 a function with a random odd \( a \), from the seed
std::uint64_t operator() (std::uint64_t k) const
 \( h( k ) \), a product and a shift

Static public member functions

static MultiplyShiftHash ofMultiplier (int h, int l, std::uint64_t a)
 the function of the multiplier \( a \)

Detailed description

\( h( k ) = ( a k \bmod 2^h ) \operatorname{div} 2^{h - l} \), with \( a \) odd

Constructor and destructor documentation

◆ MultiplyShiftHash()

ADS::MultiplyShiftHash::MultiplyShiftHash ( int h,
int l,
std::uint64_t seed = 1 )

a function with a random odd \( a \), from the seed

Precondition
\( 1 \le l < h \le 64 \)

Member function documentation

◆ ofMultiplier()

MultiplyShiftHash ADS::MultiplyShiftHash::ofMultiplier ( int h,
int l,
std::uint64_t a )
staticnodiscard

the function of the multiplier \( a \)

Precondition
\( 1 \le l < h \le 64 \), \( a \) odd and below \( 2^h \)

◆ operator()()

std::uint64_t ADS::MultiplyShiftHash::operator() ( std::uint64_t k) const
nodiscard

\( h( k ) \), a product and a shift

Precondition
\( k < 2^h \)
Postcondition
the result is below \( 2^l \)

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