Akumuli
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
hashfnfamily.h
1 #pragma once
2 
3 #include <cstdint>
4 #include <random>
5 #include <vector>
6 
7 namespace Akumuli {
8 
10 struct HashFnFamily {
11  const uint32_t N;
12  const uint32_t K;
14  std::vector<std::vector<unsigned short>> table_;
15 
17  HashFnFamily(uint32_t N, uint32_t K);
18 
20  uint32_t hash(int ix, uint64_t key) const;
21 
22 private:
23  uint32_t hash32(int ix, uint32_t key) const;
24 };
25 
26 } // namespace
HashFnFamily(uint32_t N, uint32_t K)
C-tor. N - number of different hash functions, K - number of values (should be a power of two) ...
Definition: hashfnfamily.cpp:12
uint32_t hash(int ix, uint64_t key) const
Calculate hash value in range [0, K)
Definition: hashfnfamily.cpp:42
Family of 4-universal hash functions.
Definition: hashfnfamily.h:10
std::vector< std::vector< unsigned short > > table_
Tabulation based hash fn used, N tables should be generated using RNG in c-tor.
Definition: hashfnfamily.h:14