72#ifndef ALEPH_COMPACT_CUCKOO_FILTER_H
73#define ALEPH_COMPACT_CUCKOO_FILTER_H
175 const size_t idx = dist(
rng);
333 std::uniform_int_distribution<int>
coin(0, 1);
Exception handling system with formatted messages for Aleph-w.
General utility functions and helpers.
Space-efficient bit array implementation.
Simple dynamic array with automatic resizing and functional operations.
Contiguous array of bits.
int read_bit(const size_t i) const
Read bit i.
void write_bit(const size_t i, const unsigned int value)
Write bit i with the value.
Memory-optimized Cuckoo Filter with bit-packed fingerprints.
bool append(const T &item)
Alias for insert().
bool contains(const T &item) const
Test membership.
static constexpr double kTargetLoad
Victim stash_[stash_size]
bool is_empty() const noexcept
Synonym for empty() in traditional Aleph style.
Aleph::Array< Bucket > buckets
size_t size() const noexcept
Return the number of items currently in the filter.
void clear()
Clear the filter.
bool remove(const T &item)
Remove an item from the filter.
bool insert(const T &item)
Insert an item into the filter.
double load_factor() const noexcept
Return the load factor of the filter (relative to capacity()).
Compact_Cuckoo_Filter(size_t capacity, const std::optional< std::uint32_t > seed=std::nullopt)
Construct a Compact Cuckoo Filter with a given capacity.
static constexpr size_t stash_size
size_t alt_index(const size_t i, Fingerprint fp) const
static constexpr size_t max_kicks
size_t memory_usage() const noexcept
Return approximate memory usage in bytes.
static constexpr Fingerprint fp_mask
bool empty() const noexcept
Return whether the filter contains no items.
size_t capacity() const noexcept
Return the total number of fingerprint slots (including stash).
Fingerprint get_fingerprint(const T &item) const
size_t index_hash(const T &item) const noexcept
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
unsigned long next_power_of_2(unsigned long x)
In x is not exact power of 2, it returns the next power of 2.
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 dft_hash_fct(const Key &key) noexcept
Primary default hash: best speed/quality trade-off.
size_t murmur3hash(const Key &key, std::uint32_t seed)
bool remove(Fingerprint fp)
Fingerprint get_slot(const size_t idx) const
size_t swap_random_slot(Fingerprint &fp, std::mt19937 &rng)
void restore(Fingerprint fp, size_t idx)
bool contains(const Fingerprint fp) const
bool insert(Fingerprint fp)
void set_slot(size_t idx, Fingerprint fp)
Victim entry: a fingerprint that was displaced during a failed insert.
Dynamic array container with automatic resizing.