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

\( h( k ) = ( ( a k + b ) \bmod p ) \bmod m \), of the class \( H_{p,m} \) of Carter and Wegman More...

#include <ADS/dictionary/UniversalHashing.h>

Public member functions

 CarterWegmanHash (void)
 the function into one place drawn from the seed 1, to be read from a file [see Persistence.h]
 CarterWegmanHash (std::uint64_t m, std::uint64_t seed=1)
 a function drawn from \( H_{p,m} \) with \( p = 2^{61} - 1 \), from the seed
 CarterWegmanHash (std::uint64_t p, std::uint64_t a, std::uint64_t b, std::uint64_t m)
 the function of the given parameters
std::uint64_t operator() (std::uint64_t k) const
 \( h( k ) \), the product \( a k \bmod p \) computed with no overflow [see mulMod()]
std::uint64_t p (void) const
 the prime \( p \)
std::uint64_t a (void) const
 the multiplier \( a \)
std::uint64_t b (void) const
 the addend \( b \)
std::uint64_t m (void) const
 the size \( m \) of the range
template<class A>
void persist (A &a)
 the parameters written to, or read from, the archive \( a \) [see Persistence.h]

Detailed description

\( h( k ) = ( ( a k + b ) \bmod p ) \bmod m \), of the class \( H_{p,m} \) of Carter and Wegman

Constructor and destructor documentation

◆ CarterWegmanHash() [1/3]

ADS::CarterWegmanHash::CarterWegmanHash ( void )
inline

the function into one place drawn from the seed 1, to be read from a file [see Persistence.h]

◆ CarterWegmanHash() [2/3]

ADS::CarterWegmanHash::CarterWegmanHash ( std::uint64_t m,
std::uint64_t seed = 1 )
explicit

a function drawn from \( H_{p,m} \) with \( p = 2^{61} - 1 \), from the seed

Precondition
\( m \ge 1 \)

◆ CarterWegmanHash() [3/3]

ADS::CarterWegmanHash::CarterWegmanHash ( std::uint64_t p,
std::uint64_t a,
std::uint64_t b,
std::uint64_t m )

the function of the given parameters

Precondition
\( 2 \le p < 2^{63} \), \( 1 \le a < p \), \( b < p \) and \( m \ge 1 \)

Member function documentation

◆ a()

std::uint64_t ADS::CarterWegmanHash::a ( void ) const
inlinenodiscard

the multiplier \( a \)

◆ b()

std::uint64_t ADS::CarterWegmanHash::b ( void ) const
inlinenodiscard

the addend \( b \)

◆ m()

std::uint64_t ADS::CarterWegmanHash::m ( void ) const
inlinenodiscard

the size \( m \) of the range

◆ operator()()

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

\( h( k ) \), the product \( a k \bmod p \) computed with no overflow [see mulMod()]

Precondition
\( k < p \)
Postcondition
the result is below \( m \)

◆ p()

std::uint64_t ADS::CarterWegmanHash::p ( void ) const
inlinenodiscard

the prime \( p \)

◆ persist()

template<class A>
void ADS::CarterWegmanHash::persist ( A & a)
inline

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


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