56#ifndef __ADS_RandomHashing
57 #define __ADS_RandomHashing
99[[nodiscard]]
constexpr std::uint64_t
splitmix64( std::uint64_t x );
127 explicit constexpr SplitMix64( std::uint64_t seed = 0 ) : f_s( seed ) { }
133 f_s += 0x9e3779b97f4a7c15ULL;
138 static constexpr std::uint64_t
min(
void ) {
return( 0 ); }
141 static constexpr std::uint64_t
max(
void ) {
142 return( std::numeric_limits< std::uint64_t >::max() );
158inline std::uint64_t instanceSeed(
void )
160 static std::atomic< std::uint64_t > c{ 0 };
161 return(
splitmix64( c.fetch_add( 1 , std::memory_order_relaxed ) ) );
176 ZobristTable( std::size_t n , std::size_t m , std::uint64_t seed = 1 );
181 [[nodiscard]] std::uint64_t
operator()( std::size_t f , std::size_t v )
const;
198 template< std::ranges::random_access_range S >
199 requires std::ranges::sized_range< S >
200 [[nodiscard]] std::uint64_t
hash(
const S & s )
const;
206 [[nodiscard]] std::uint64_t
update( std::uint64_t h , std::size_t f ,
207 std::size_t a , std::size_t b )
const;
210 std::size_t f_n , f_m;
211 std::vector< std::uint64_t > f_R;
236 [[nodiscard]] std::uint64_t
operator()( std::uint64_t x )
const;
244 [[nodiscard]] std::size_t
place( std::uint64_t x , std::size_t m )
const;
247 std::array< std::array< std::uint64_t , 256 > , 8 > f_T;
258#include "ADS/dictionary/impl/RandomHashing.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
constexpr std::uint64_t operator()(void)
the next word, splitmix64() of the state, which then grows by
Definition RandomHashing.h:131
static constexpr std::uint64_t max(void)
the largest word,
Definition RandomHashing.h:141
static constexpr std::uint64_t min(void)
the least word, 0
Definition RandomHashing.h:138
constexpr SplitMix64(std::uint64_t seed=0)
the generator from the state seed
Definition RandomHashing.h:127
std::uint64_t result_type
the words generated
Definition RandomHashing.h:124
std::size_t place(std::uint64_t x, std::size_t m) const
the place of in a table of places, the most significant bits of its hash, as the LinearHashTable o...
TabulationHash(std::uint64_t seed=1)
the 8 tables of 256 random words, from the seed
std::uint64_t operator()(std::uint64_t x) const
the XOR of the words of the 8 bytes of
std::uint64_t operator()(std::size_t f, std::size_t v) const
the word of the feature with the value
std::uint64_t hash(const S &s) const
the hash of a state, the value of each feature by its place in , any range with a size and access by ...
ZobristTable(std::size_t n, std::size_t m, std::uint64_t seed=1)
the words of features with values each, from the seed
std::uint64_t update(std::uint64_t h, std::size_t f, std::size_t a, std::size_t b) const
the hash of a state after the feature changes from to , , since takes the old word away
constexpr std::uint64_t splitmix64(std::uint64_t x)
the mix of SplitMix64: a bijection of the words of 64 bits
constexpr std::uint64_t fibonacciPlace(std::uint64_t h, int b)
the place of the hash in a table of places, its top bits after the product by