23#include <cereal/cereal.hpp>
24#include <cereal/macros.hpp>
25#include <cereal/types/base_class.hpp>
26#include <cereal/types/vector.hpp>
28#include <hibf/cereal/concepts.hpp>
29#include <hibf/contrib/aligned_allocator.hpp>
32#include <hibf/misc/next_multiple_of_64.hpp>
155 template <
typename t>
161 size_t technical_bins{};
172 13043817825332782213ULL,
173 10650232656628343401ULL,
174 16499269484942379435ULL,
175 4893150838803335377ULL};
184 [[gnu::always_inline]]
inline constexpr size_t hash_and_fit(
size_t h,
size_t const seed)
const
187 assert(hash_shift < 64);
188 h ^= h >> hash_shift;
189 h *= 11400714819323198485ULL;
191 h =
static_cast<uint64_t
>((
static_cast<__uint128_t
>(h) *
static_cast<__uint128_t
>(bin_size_)) >> 64);
197 class membership_agent_type;
198 template <std::
integral value_t>
199 class counting_agent_type;
226 bool const track_occupancy_ =
false);
281 template <
typename rng_t>
282 void clear(rng_t && bin_range)
noexcept
284 static_assert(std::ranges::forward_range<rng_t>,
"The range of bins to clear must model a forward_range.");
286 "The reference type of the range to clear must be seqan::hibf::bin_index.");
288 for (
auto && bin : bin_range)
289 assert(bin.value < technical_bins);
292 for (
size_t offset = 0, i = 0; i < bin_size_; offset += technical_bins, ++i)
293 for (
auto && bin : bin_range)
294 (*
this)[bin.value + offset] = 0;
282 void clear(rng_t && bin_range)
noexcept {
…}
372 template <
typename value_t = u
int16_t>
456 template <cereal_archive archive_t>
457 void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
459 uint32_t parsed_version{
version};
460 archive(cereal::make_nvp(
"version", parsed_version));
462 archive(technical_bins);
467 archive(cereal::base_class<base_t>(
this));
457 void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive) {
…}
512 ibf_ptr(
std::addressof(ibf)),
559template <std::
integral value_t>
588 ibf_ptr(
std::addressof(ibf)),
589 membership_agent(ibf),
591 result_buffer(ibf.bin_count())
598 result_buffer.
resize(ibf.bin_count());
600# if defined(_LIBCPP_VERSION) && !defined(_LIBCPP_HAS_NO_ASAN)
601 __sanitizer_annotate_contiguous_container(result_buffer.
data(),
603 result_buffer.
data() + result_buffer.
size(),
633 template <std::ranges::range value_range_t>
636 assert(ibf_ptr !=
nullptr);
639 static_assert(std::ranges::input_range<value_range_t>,
"The values must model input_range.");
641 "An individual value must be an unsigned integral.");
645 for (
auto && value : values)
648 return result_buffer;
653 template <std::ranges::range value_range_t>
Provides seqan::hibf::bit_vector.
An bit vector.
Definition bit_vector.hpp:68
constexpr size_type size() const noexcept
Returns the number of elements.
Definition bit_vector.hpp:624
A data structure that behaves like a std::vector and can be used to consolidate the results of multip...
Definition counting_vector.hpp:146
Manages counting ranges of values for the seqan::hibf::interleaved_bloom_filter.
Definition interleaved_bloom_filter.hpp:561
counting_vector< value_t > const & bulk_count(value_range_t &&values) &noexcept
Counts the occurrences in each bin for all values in a range.
Definition interleaved_bloom_filter.hpp:634
counting_agent_type()=default
Defaulted.
counting_vector< value_t > const & bulk_count(value_range_t &&values) &&noexcept=delete
Counts the occurrences in each bin for all values in a range.
counting_agent_type(counting_agent_type const &)=default
Defaulted.
counting_agent_type(counting_agent_type &&) noexcept=default
Defaulted.
counting_agent_type & operator=(counting_agent_type const &)=default
Defaulted.
Manages membership queries for the seqan::hibf::interleaved_bloom_filter.
Definition interleaved_bloom_filter.hpp:485
membership_agent_type(membership_agent_type const &)=default
Defaulted.
bit_vector const & bulk_contains(size_t const value) &noexcept
Determines set membership of a given value.
membership_agent_type(membership_agent_type &&) noexcept=default
Defaulted.
membership_agent_type & operator=(membership_agent_type const &)=default
Defaulted.
bit_vector const & bulk_contains(size_t const value) &&noexcept=delete
Determines set membership of a given value.
membership_agent_type()=default
Defaulted.
The IBF binning directory. A data structure that efficiently answers set-membership queries for multi...
Definition interleaved_bloom_filter.hpp:149
bool track_occupancy
Whether to track the occupancy of the bins.
Definition interleaved_bloom_filter.hpp:443
std::vector< size_t > occupancy
Contains the number of unique values inserted into each bin.
Definition interleaved_bloom_filter.hpp:440
size_t bit_size() const noexcept
Returns the size of the underlying bitvector.
Definition interleaved_bloom_filter.hpp:409
interleaved_bloom_filter(config &configuration, size_t const max_bin_elements=0u)
Construct an Interleaved Bloom Filter.
interleaved_bloom_filter()=default
Defaulted.
counting_agent_type< value_t > counting_agent() const
Returns a seqan::hibf::interleaved_bloom_filter::counting_agent_type to be used for counting.
Definition interleaved_bloom_filter.hpp:373
void increase_bin_number_to(bin_count const new_bin_count)
Increases the number of bins stored in the Interleaved Bloom Filter.
friend struct cereal::base_class
Allow cereal to cast the IBF into its base class.
Definition interleaved_bloom_filter.hpp:156
size_t hash_function_count() const noexcept
Returns the number of hash functions used in the Interleaved Bloom Filter.
Definition interleaved_bloom_filter.hpp:385
void emplace(size_t const value, bin_index const bin) noexcept
Inserts a value into a specific bin.
void clear(bin_index const bin) noexcept
Clears a specific bin.
interleaved_bloom_filter & operator=(interleaved_bloom_filter const &)=default
Defaulted.
bool try_increase_bin_number_to(bin_count const new_bin_count) noexcept
Tries increasing the number of bins stored in the Interleaved Bloom Filter without reallocating memor...
void clear(rng_t &&bin_range) noexcept
Clears a range of bins.
Definition interleaved_bloom_filter.hpp:282
membership_agent_type membership_agent() const
Returns a seqan::hibf::interleaved_bloom_filter::membership_agent_type to be used for lookup.
Definition interleaved_bloom_filter.hpp:545
static constexpr uint32_t version
The version of the HIBF.
Definition interleaved_bloom_filter.hpp:448
interleaved_bloom_filter(interleaved_bloom_filter const &)=default
Defaulted.
interleaved_bloom_filter(interleaved_bloom_filter &&) noexcept=default
Defaulted.
size_t bin_size() const noexcept
Returns the size of a single bin that the Interleaved Bloom Filter manages.
Definition interleaved_bloom_filter.hpp:401
size_t bin_count() const noexcept
Returns the number of bins that the Interleaved Bloom Filter manages.
Definition interleaved_bloom_filter.hpp:393
Provides seqan::hibf::counting_vector.
constexpr size_t next_multiple_of_64(size_t const value) noexcept
Returns the smallest integer that is greater or equal to value and a multiple of 64....
Definition next_multiple_of_64.hpp:18
A strong type that represents the number of bins for the seqan::hibf::interleaved_bloom_filter.
Definition interleaved_bloom_filter.hpp:46
A strong type that represents the bin index for the seqan::hibf::interleaved_bloom_filter.
Definition interleaved_bloom_filter.hpp:73
A strong type that represents the number of bits for each bin in the seqan::hibf::interleaved_bloom_f...
Definition interleaved_bloom_filter.hpp:55
The configuration used to build an (H)IBF.
Definition config.hpp:75
A strong type that represents the number of hash functions for the seqan::hibf::interleaved_bloom_fil...
Definition interleaved_bloom_filter.hpp:64