80template <data_layout data_layout_mode_ = data_layout::uncompressed>
85 template <data_layout data_layout_mode>
103 13043817825332782213ULL,
104 10650232656628343401ULL,
105 16499269484942379435ULL,
106 4893150838803335377ULL};
119 h *= 11400714819323198485ULL;
121#ifdef __SIZEOF_INT128__
122 h =
static_cast<uint64_t
>((
static_cast<__uint128_t
>(h) *
static_cast<__uint128_t
>(
size_in_bits)) >> 64);
162 throw std::logic_error{
"The number of hash functions must be > 0 and <= 5."};
186 data = sdsl::sd_vector<>{bf.data};
210 assert(idx <
data.size());
230 sdsl::util::_set_zero_bits(
data);
253 assert(idx <
data.size());
279 template <std::ranges::range value_range_t>
280 size_t count(value_range_t && values)
const noexcept
282 static_assert(std::ranges::input_range<value_range_t>,
"The values must model input_range.");
283 static_assert(std::unsigned_integral<std::ranges::range_value_t<value_range_t>>,
284 "An individual value must be an unsigned integral.");
288 for (
auto && value : values)
325 return std::tie(lhs.size_in_bits, lhs.hash_shift, lhs.hash_funs, lhs.data)
326 ==
std::tie(rhs.size_in_bits, rhs.hash_shift, rhs.hash_funs, rhs.data);
336 return !(lhs == rhs);
369 template <cereal_archive archive_t>
The Bloom Filter. A data structure that efficiently answers set-membership queries.
Definition bloom_filter.hpp:82
size_t size_in_bits
The size of the underlying bit vector in bits.
Definition bloom_filter.hpp:94
friend bool operator!=(bloom_filter const &lhs, bloom_filter const &rhs) noexcept
Test for inequality.
Definition bloom_filter.hpp:334
constexpr data_type & raw_data() noexcept
Provides direct, unsafe access to the underlying data structure.
Definition bloom_filter.hpp:350
size_t hash_shift
The number of bits to shift the hash value before doing multiplicative hashing.
Definition bloom_filter.hpp:96
bloom_filter(bloom_filter &&)=default
Defaulted.
static constexpr data_layout data_layout_mode
Indicates whether the Bloom Filter is compressed.
Definition bloom_filter.hpp:131
static constexpr std::array< size_t, 5 > hash_seeds
Precalculated seeds for multiplicative hashing. We use large irrational numbers for a uniform hashing...
Definition bloom_filter.hpp:102
constexpr data_type const & raw_data() const noexcept
Provides direct, unsafe access to the underlying data structure.
Definition bloom_filter.hpp:356
bloom_filter & operator=(bloom_filter const &)=default
Defaulted.
bool contains(size_t const value) const noexcept
Check whether a value is present in the Bloom Filter.
Definition bloom_filter.hpp:248
bloom_filter(bloom_filter< data_layout::uncompressed > const &bf)
Construct a compressed Bloom Filter.
Definition bloom_filter.hpp:181
constexpr size_t hash_and_fit(size_t h, size_t const seed) const
Perturbs a value and fits it into the vector.
Definition bloom_filter.hpp:115
data_type data
The bitvector.
Definition bloom_filter.hpp:100
friend bool operator==(bloom_filter const &lhs, bloom_filter const &rhs) noexcept
Test for equality.
Definition bloom_filter.hpp:323
size_t hash_funs
The number of hash functions.
Definition bloom_filter.hpp:98
void reset() noexcept
Remove all values from the Bloom Filter by setting all bits to 0.
Definition bloom_filter.hpp:227
bloom_filter(bloom_filter const &)=default
Defaulted.
size_t hash_function_count() const noexcept
Returns the number of hash functions used in the Bloom Filter.
Definition bloom_filter.hpp:301
size_t count(value_range_t &&values) const noexcept
Counts the occurrences for all values in a range.
Definition bloom_filter.hpp:280
bloom_filter()=default
Defaulted.
size_t bit_size() const noexcept
Returns the size of the underlying bitvector.
Definition bloom_filter.hpp:309
bloom_filter & operator=(bloom_filter &&)=default
Defaulted.
void emplace(size_t const value) noexcept
Inserts a value into the Bloom Filter.
Definition bloom_filter.hpp:204
~bloom_filter()=default
Defaulted.
bloom_filter(seqan3::bin_size size, seqan3::hash_function_count funs=seqan3::hash_function_count{2u})
Construct an uncompressed Bloom Filter.
Definition bloom_filter.hpp:155
data_layout
Determines if the Interleaved Bloom Filter is compressed.
Definition interleaved_bloom_filter.hpp:25
@ uncompressed
The Interleaved Bloom Filter is uncompressed.
Definition interleaved_bloom_filter.hpp:26
@ compressed
The Interleaved Bloom Filter is compressed.
Definition interleaved_bloom_filter.hpp:27
Provides seqan3::interleaved_bloom_filter.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
A strong type that represents the number of bits for each bin in the seqan3::interleaved_bloom_filter...
Definition interleaved_bloom_filter.hpp:40
A strong type that represents the number of hash functions for the seqan3::interleaved_bloom_filter.
Definition interleaved_bloom_filter.hpp:47
strong_type for seed.
Definition minimiser_hash.hpp:22