Class DotProductHash

Class Documentation

class DotProductHash

h( k ) = sum_i a_i k_i mod m, the k_i being the digits of k in base m

Public Functions

DotProductHash(std::uint64_t m, int r, std::uint64_t seed = 1)

a function with r random digits a_i, from the seed

Pre:

2 <= m <= 2^32 and r >= 1

DotProductHash(std::uint64_t m, std::vector<std::uint64_t> a)

the function of the digits a

Pre:

2 <= m <= 2^32, a not empty, each digit below m

std::uint64_t operator()(std::uint64_t k) const
Pre:

k < m^r

Post:

the result is below m

std::uint64_t universe(void) const

the size m^r of the universe, or 0 if it exceeds 2^64 - 1