86 if constexpr (
sizeof(size_t) >= 8)
93 return (hi << 32) | lo;
107 void update(
const T & val,
const double weight = 1.0)
128 template <
typename Itor>
133 update((*beg).first, (*beg).second);
144 fingerprint |= (
static_cast<uint64_t>(1) << i);
154 const int distance = std::popcount(f1 ^ f2);
155 return 1.0 - (
static_cast<double>(distance) /
static_cast<double>(
FINGERPRINT_SIZE));
Exception handling system with formatted messages for Aleph-w.
Simple dynamic array with automatic resizing and functional operations.
SimHash fingerprint generator.
static constexpr size_t FINGERPRINT_SIZE
Number of bits in the SimHash fingerprint (always 64).
static uint64_t hash64(const T &val) noexcept
Compute a 64-bit hash value from a feature.
SimHash()
Construct SimHash accumulator.
void update(const T &val, const double weight=1.0)
Add a feature to the set.
void update(Itor beg, const Itor &end)
Add all features in a range to the SimHash accumulator.
static double similarity(const uint64_t f1, const uint64_t f2) noexcept
Estimate similarity with another fingerprint.
void clear()
Reset the accumulator.
Array< double > v_
Accumulator vector for each bit.
uint64_t get_fingerprint() const noexcept
Returns the fingerprint.
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
std::decay_t< typename HeadC::Item_Type > T
size_t murmur3hash(const Key &key, std::uint32_t seed)
Dynamic array container with automatic resizing.