From b072b5536264d6166ebe1cc5948c27c093e43eb1 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Thu, 24 Aug 2023 15:55:28 +0200 Subject: [PATCH 1/2] [MISC] Rename hibf namespace to seqan::hibf --- include/hibf/all.hpp | 2 +- include/hibf/config.hpp | 4 +- include/hibf/contrib/aligned_allocator.hpp | 8 +- .../hibf/detail/build/bin_size_in_bits.hpp | 6 +- include/hibf/detail/build/build_data.hpp | 6 +- .../hibf/detail/build/chopper_pack_record.hpp | 4 +- include/hibf/detail/build/compute_kmers.hpp | 6 +- include/hibf/detail/build/construct_ibf.hpp | 16 +- .../detail/build/initialise_build_tree.hpp | 6 +- include/hibf/detail/build/insert_into_ibf.hpp | 8 +- include/hibf/detail/build/node_data.hpp | 4 +- .../detail/build/update_content_node_data.hpp | 6 +- .../detail/build/update_header_node_data.hpp | 6 +- .../hibf/detail/build/update_parent_kmers.hpp | 6 +- .../hibf/detail/build/update_user_bins.hpp | 4 +- include/hibf/detail/cereal/concepts.hpp | 4 +- include/hibf/detail/data_store.hpp | 4 +- .../detail/layout/compute_fpr_correction.hpp | 4 +- include/hibf/detail/layout/compute_layout.hpp | 4 +- include/hibf/detail/layout/execute.hpp | 4 +- .../detail/layout/hierarchical_binning.hpp | 8 +- include/hibf/detail/layout/layout.hpp | 4 +- include/hibf/detail/layout/print_matrix.hpp | 4 +- include/hibf/detail/layout/simple_binning.hpp | 4 +- include/hibf/detail/prefixes.hpp | 4 +- .../detail/sketch/estimate_kmer_counts.hpp | 6 +- include/hibf/detail/sketch/hyperloglog.hpp | 16 +- include/hibf/detail/sketch/toolbox.hpp | 4 +- include/hibf/detail/timer.hpp | 6 +- .../hierarchical_interleaved_bloom_filter.hpp | 38 ++-- include/hibf/interleaved_bloom_filter.hpp | 146 ++++++------- include/hibf/next_multiple_of_64.hpp | 4 +- include/hibf/user_bins_type.hpp | 4 +- include/hibf/version.hpp | 4 +- src/config.cpp | 8 +- src/detail/build/compute_kmers.cpp | 6 +- src/detail/build/construct_ibf.cpp | 27 +-- src/detail/build/initialise_build_tree.cpp | 6 +- src/detail/build/insert_into_ibf.cpp | 12 +- src/detail/build/update_content_node_data.cpp | 6 +- src/detail/build/update_header_node_data.cpp | 6 +- src/detail/layout/compute_fpr_correction.cpp | 4 +- src/detail/layout/compute_layout.cpp | 10 +- src/detail/layout/execute.cpp | 15 +- src/detail/layout/hierarchical_binning.cpp | 4 +- src/detail/layout/layout.cpp | 12 +- src/detail/layout/simple_binning.cpp | 4 +- src/detail/sketch/hyperloglog.cpp | 4 +- src/detail/sketch/toolbox.cpp | 4 +- src/hierarchical_interleaved_bloom_filter.cpp | 6 +- test/include/hibf/test/bytes.hpp | 4 +- test/include/hibf/test/expect_range_eq.hpp | 10 +- test/include/hibf/test/expect_same_type.hpp | 10 +- test/include/hibf/test/file_access.hpp | 4 +- test/include/hibf/test/sandboxed_path.hpp | 18 +- .../hibf/test/temporary_snippet_file.hpp | 6 +- test/include/hibf/test/tmp_directory.hpp | 6 +- .../include/hibf/test/type_name_as_string.hpp | 4 +- .../interleaved_bloom_filter_benchmark.cpp | 40 ++-- test/snippet/hibf/bin_indices_of_ibf.cpp | 2 +- test/snippet/test/tmp_directory.cpp | 2 +- test/unit/hibf/config_test.cpp | 6 +- .../detail/layout/fpr_correction_test.cpp | 4 +- .../layout/hierarchical_binning_test.cpp | 193 +++++++++--------- test/unit/hibf/detail/layout/layout_test.cpp | 20 +- .../detail/layout/simple_binning_test.cpp | 40 ++-- .../sketch/estimate_kmer_counts_test.cpp | 6 +- .../hibf/detail/sketch/hyperloglog_test.cpp | 38 ++-- test/unit/hibf/detail/sketch/toolbox_test.cpp | 168 +++++++-------- ...archical_interleaved_bloom_filter_test.cpp | 54 ++--- .../hibf/interleaved_bloom_filter_test.cpp | 119 ++++++----- test/unit/test/expect_range_eq_test.cpp | 12 +- test/unit/test/expect_same_type_test.cpp | 80 ++++---- test/unit/test/file_access_test.cpp | 12 +- test/unit/test/sandboxed_path_test.cpp | 2 +- .../unit/test/temporary_snippet_file_test.cpp | 4 +- test/unit/test/tmp_directory_test.cpp | 28 +-- util/fpr_quality.cpp | 25 +-- 78 files changed, 729 insertions(+), 686 deletions(-) diff --git a/include/hibf/all.hpp b/include/hibf/all.hpp index 06c05228..d52a1a0d 100644 --- a/include/hibf/all.hpp +++ b/include/hibf/all.hpp @@ -11,7 +11,7 @@ */ /*!\defgroup search_dream_index DREAM Index - * \brief Provides hibf::interleaved_bloom_filter. + * \brief Provides seqan::hibf::interleaved_bloom_filter. * \ingroup search * \see search */ diff --git a/include/hibf/config.hpp b/include/hibf/config.hpp index 87abd64f..24ed511d 100644 --- a/include/hibf/config.hpp +++ b/include/hibf/config.hpp @@ -21,7 +21,7 @@ #include // for access #include // for make_nvp, CEREAL_NVP -namespace hibf +namespace seqan::hibf { using insert_iterator = std::insert_iterator>; @@ -111,4 +111,4 @@ struct config } }; -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/contrib/aligned_allocator.hpp b/include/hibf/contrib/aligned_allocator.hpp index 8fdf5ecb..36114bc7 100644 --- a/include/hibf/contrib/aligned_allocator.hpp +++ b/include/hibf/contrib/aligned_allocator.hpp @@ -22,7 +22,7 @@ # pragma GCC warning "Non-C++17 compliant compiler! Please open an issue with your compiler and platform!" #endif // __cpp_aligned_new < 201606 -namespace hibf::contrib +namespace seqan::hibf::contrib { /*!\brief Allocates uninitialized storage whose memory-alignment is specified by *alignment*. @@ -151,14 +151,14 @@ class aligned_allocator } /*!\brief Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier call - * to hibf::aligned_allocator::allocate. + * to seqan::hibf::aligned_allocator::allocate. * * \param[in] p The pointer to the memory to be deallocated. * \param[in] n The number of elements to be deallocated. * * \details * - * The argument `n` must be equal to the first argument of the call to hibf::aligned_allocator::allocate that + * The argument `n` must be equal to the first argument of the call to seqan::hibf::aligned_allocator::allocate that * originally produced `p`, otherwise the behavior is undefined. This function calls * [operator delete](https://en.cppreference.com/w/cpp/memory/new/operator_delete) to deallocate the memory of * specified size. @@ -237,4 +237,4 @@ class aligned_allocator //!\} }; -} // namespace hibf::contrib +} // namespace seqan::hibf::contrib diff --git a/include/hibf/detail/build/bin_size_in_bits.hpp b/include/hibf/detail/build/bin_size_in_bits.hpp index 9e517079..6aa78934 100644 --- a/include/hibf/detail/build/bin_size_in_bits.hpp +++ b/include/hibf/detail/build/bin_size_in_bits.hpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Implements hibf::bin_size_in_bits. + * \brief Implements seqan::hibf::bin_size_in_bits. * \author Enrico Seiler */ @@ -17,7 +17,7 @@ #include -namespace hibf +namespace seqan::hibf { struct bin_size_parameters @@ -35,4 +35,4 @@ inline size_t bin_size_in_bits(bin_size_parameters const & params) return result; } -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/build_data.hpp b/include/hibf/detail/build/build_data.hpp index b7ab117e..6e0ea2d9 100644 --- a/include/hibf/detail/build/build_data.hpp +++ b/include/hibf/detail/build/build_data.hpp @@ -17,14 +17,14 @@ #include // for node_data #include // for concurrent, timer -namespace hibf +namespace seqan::hibf { struct build_data { std::atomic ibf_number{}; - hibf::config const & config; + seqan::hibf::config const & config; lemon::ListDigraph ibf_graph{}; lemon::ListDigraph::NodeMap node_map{ibf_graph}; @@ -46,4 +46,4 @@ struct build_data } }; -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/chopper_pack_record.hpp b/include/hibf/detail/build/chopper_pack_record.hpp index ede23982..d46499ed 100644 --- a/include/hibf/detail/build/chopper_pack_record.hpp +++ b/include/hibf/detail/build/chopper_pack_record.hpp @@ -13,7 +13,7 @@ #include -namespace hibf +namespace seqan::hibf { struct chopper_pack_record @@ -45,4 +45,4 @@ struct chopper_pack_record } }; -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/compute_kmers.hpp b/include/hibf/detail/build/compute_kmers.hpp index 25554eca..ecb3cd31 100644 --- a/include/hibf/detail/build/compute_kmers.hpp +++ b/include/hibf/detail/build/compute_kmers.hpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Implements hibf::compute_kmers. + * \brief Implements seqan::hibf::compute_kmers. * \author Enrico Seiler */ @@ -18,11 +18,11 @@ #include // for build_data #include // for layout -namespace hibf +namespace seqan::hibf { void compute_kmers(robin_hood::unordered_flat_set & kmers, build_data const & data, layout::layout::user_bin const & record); -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/construct_ibf.hpp b/include/hibf/detail/build/construct_ibf.hpp index bcbf2546..7599e070 100644 --- a/include/hibf/detail/build/construct_ibf.hpp +++ b/include/hibf/detail/build/construct_ibf.hpp @@ -16,14 +16,14 @@ #include // for build_data #include // for interleaved_bloom_filter -namespace hibf +namespace seqan::hibf { -hibf::interleaved_bloom_filter construct_ibf(robin_hood::unordered_flat_set & parent_kmers, - robin_hood::unordered_flat_set & kmers, - size_t const number_of_bins, - lemon::ListDigraph::Node const & node, - build_data & data, - bool is_root); +seqan::hibf::interleaved_bloom_filter construct_ibf(robin_hood::unordered_flat_set & parent_kmers, + robin_hood::unordered_flat_set & kmers, + size_t const number_of_bins, + lemon::ListDigraph::Node const & node, + build_data & data, + bool is_root); -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/initialise_build_tree.hpp b/include/hibf/detail/build/initialise_build_tree.hpp index cac7a0c2..87bebd04 100644 --- a/include/hibf/detail/build/initialise_build_tree.hpp +++ b/include/hibf/detail/build/initialise_build_tree.hpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Implements hibf::initialise_build_tree. + * \brief Implements seqan::hibf::initialise_build_tree. * \author Svenja Mehringer */ @@ -17,11 +17,11 @@ #include // for node_data #include // for layout -namespace hibf +namespace seqan::hibf { void initialise_build_tree(layout::layout & hibf_layout, lemon::ListDigraph & ibf_graph, lemon::ListDigraph::NodeMap & node_map); -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/insert_into_ibf.hpp b/include/hibf/detail/build/insert_into_ibf.hpp index 8db6266c..a139b845 100644 --- a/include/hibf/detail/build/insert_into_ibf.hpp +++ b/include/hibf/detail/build/insert_into_ibf.hpp @@ -16,18 +16,18 @@ #include // for concurrent, timer #include // for interleaved_bloom_filter -namespace hibf +namespace seqan::hibf { // automatically does naive splitting if number_of_bins > 1 void insert_into_ibf(robin_hood::unordered_flat_set const & kmers, size_t const number_of_bins, size_t const bin_index, - hibf::interleaved_bloom_filter & ibf, + seqan::hibf::interleaved_bloom_filter & ibf, timer & fill_ibf_timer); void insert_into_ibf(build_data const & data, layout::layout::user_bin const & record, - hibf::interleaved_bloom_filter & ibf); + seqan::hibf::interleaved_bloom_filter & ibf); -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/node_data.hpp b/include/hibf/detail/build/node_data.hpp index d1c2f9c8..6dcd2d93 100644 --- a/include/hibf/detail/build/node_data.hpp +++ b/include/hibf/detail/build/node_data.hpp @@ -16,7 +16,7 @@ #include // for operator==, layout -namespace hibf +namespace seqan::hibf { struct node_data // rename:ibf_data? or ibf_node_data @@ -47,4 +47,4 @@ struct node_data // rename:ibf_data? or ibf_node_data } }; -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/update_content_node_data.hpp b/include/hibf/detail/build/update_content_node_data.hpp index e87b7eed..4931d6f4 100644 --- a/include/hibf/detail/build/update_content_node_data.hpp +++ b/include/hibf/detail/build/update_content_node_data.hpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Implements hibf::update_content_node_data. + * \brief Implements seqan::hibf::update_content_node_data. * \author Svenja Mehringer */ @@ -19,11 +19,11 @@ #include // for node_data #include // for layout -namespace hibf +namespace seqan::hibf { void update_content_node_data(std::vector && layout_user_bins, lemon::ListDigraph & ibf_graph, lemon::ListDigraph::NodeMap & node_map); -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/update_header_node_data.hpp b/include/hibf/detail/build/update_header_node_data.hpp index e7df7ce0..4dae3225 100644 --- a/include/hibf/detail/build/update_header_node_data.hpp +++ b/include/hibf/detail/build/update_header_node_data.hpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Implements hibf::update_header_node_data. + * \brief Implements seqan::hibf::update_header_node_data. * \author Svenja Mehringer */ @@ -19,11 +19,11 @@ #include // for node_data #include // for layout -namespace hibf +namespace seqan::hibf { void update_header_node_data(std::vector && header_max_bins, lemon::ListDigraph & ibf_graph, lemon::ListDigraph::NodeMap & node_map); -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/update_parent_kmers.hpp b/include/hibf/detail/build/update_parent_kmers.hpp index 5010bc6f..8f446f12 100644 --- a/include/hibf/detail/build/update_parent_kmers.hpp +++ b/include/hibf/detail/build/update_parent_kmers.hpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Implements hibf::update_parent_kmers. + * \brief Implements seqan::hibf::update_parent_kmers. * \author Svenja Mehringer */ #pragma once @@ -17,7 +17,7 @@ #include // for concurrent, timer #include -namespace hibf +namespace seqan::hibf { inline void update_parent_kmers(robin_hood::unordered_flat_set & parent_kmers, @@ -31,4 +31,4 @@ inline void update_parent_kmers(robin_hood::unordered_flat_set & paren merge_kmers_timer += local_merge_kmers_timer; } -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/build/update_user_bins.hpp b/include/hibf/detail/build/update_user_bins.hpp index bb2f60fd..56e29d64 100644 --- a/include/hibf/detail/build/update_user_bins.hpp +++ b/include/hibf/detail/build/update_user_bins.hpp @@ -13,7 +13,7 @@ #include // for layout -namespace hibf +namespace seqan::hibf { inline void update_user_bins(std::vector & filename_indices, layout::layout::user_bin const & record) @@ -21,4 +21,4 @@ inline void update_user_bins(std::vector & filename_indices, layout::la std::fill_n(filename_indices.begin() + record.storage_TB_id, record.number_of_technical_bins, record.idx); } -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/cereal/concepts.hpp b/include/hibf/detail/cereal/concepts.hpp index 09066a04..09833e7e 100644 --- a/include/hibf/detail/cereal/concepts.hpp +++ b/include/hibf/detail/cereal/concepts.hpp @@ -11,7 +11,7 @@ #include // for InputArchiveBase, OutputArchiveBase -namespace hibf +namespace seqan::hibf { template @@ -23,4 +23,4 @@ concept cereal_input_archive = std::is_base_of_v concept cereal_archive = cereal_output_archive || cereal_input_archive; -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/data_store.hpp b/include/hibf/detail/data_store.hpp index 7315a436..d1a08ada 100644 --- a/include/hibf/detail/data_store.hpp +++ b/include/hibf/detail/data_store.hpp @@ -11,7 +11,7 @@ #include // for layout #include // for hyperloglog -namespace hibf +namespace seqan::hibf { struct data_store @@ -79,4 +79,4 @@ struct data_store //!\} }; -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/layout/compute_fpr_correction.hpp b/include/hibf/detail/layout/compute_fpr_correction.hpp index 7df490b6..5ce229d6 100644 --- a/include/hibf/detail/layout/compute_fpr_correction.hpp +++ b/include/hibf/detail/layout/compute_fpr_correction.hpp @@ -5,7 +5,7 @@ #include -namespace hibf::layout +namespace seqan::hibf::layout { struct fpr_correction_parameters @@ -20,4 +20,4 @@ struct fpr_correction_parameters */ std::vector compute_fpr_correction(fpr_correction_parameters const & params); -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/include/hibf/detail/layout/compute_layout.hpp b/include/hibf/detail/layout/compute_layout.hpp index 9246a5db..050e941b 100644 --- a/include/hibf/detail/layout/compute_layout.hpp +++ b/include/hibf/detail/layout/compute_layout.hpp @@ -7,7 +7,7 @@ #include // for layout #include // for hyperloglog -namespace hibf::layout +namespace seqan::hibf::layout { /*!\brief Computes the layout and stores the kmer_counts and sketches in the respective vectors for further use. @@ -21,4 +21,4 @@ compute_layout(config const & config, std::vector & kmer_counts, std::ve layout compute_layout(config const & config); -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/include/hibf/detail/layout/execute.hpp b/include/hibf/detail/layout/execute.hpp index 86c9bdab..afff8f97 100644 --- a/include/hibf/detail/layout/execute.hpp +++ b/include/hibf/detail/layout/execute.hpp @@ -5,9 +5,9 @@ #include // for config #include // for data_store -namespace hibf +namespace seqan::hibf { size_t execute(config const &, data_store &); -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/layout/hierarchical_binning.hpp b/include/hibf/detail/layout/hierarchical_binning.hpp index 54b7b455..9ff1ab8f 100644 --- a/include/hibf/detail/layout/hierarchical_binning.hpp +++ b/include/hibf/detail/layout/hierarchical_binning.hpp @@ -10,14 +10,14 @@ #include // for data_store #include // for HIBF_WORKAROUND_GCC_BOGUS_MEMCPY -namespace hibf::layout +namespace seqan::hibf::layout { class hierarchical_binning { private: //!\brief The user config passed down from the command line. - hibf::config config{}; + seqan::hibf::config config{}; //!\brief Stores all data that is needed to compute the layout, e.g. the counts, sketches and the layout::layout. data_store * data{nullptr}; @@ -41,7 +41,7 @@ class hierarchical_binning * Each entry in the names_ and input vector respectively is considered a user bin (both vectors must have the * same length). */ - hierarchical_binning(data_store & data_, hibf::config const & config_) : + hierarchical_binning(data_store & data_, seqan::hibf::config const & config_) : config{config_}, data{std::addressof(data_)}, num_user_bins{data->positions.size()}, @@ -130,4 +130,4 @@ class hierarchical_binning void update_max_id(size_t & max_id, size_t & max_size, size_t const new_id, size_t const new_size) const; }; -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/include/hibf/detail/layout/layout.hpp b/include/hibf/detail/layout/layout.hpp index 1f3dbc30..93ea8978 100644 --- a/include/hibf/detail/layout/layout.hpp +++ b/include/hibf/detail/layout/layout.hpp @@ -9,7 +9,7 @@ #include // for header, merged_bin #include -namespace hibf::layout +namespace seqan::hibf::layout { // Currently, the layout is structured by user bin. @@ -94,4 +94,4 @@ struct layout std::vector user_bins{}; }; -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/include/hibf/detail/layout/print_matrix.hpp b/include/hibf/detail/layout/print_matrix.hpp index afffed70..53856b54 100644 --- a/include/hibf/detail/layout/print_matrix.hpp +++ b/include/hibf/detail/layout/print_matrix.hpp @@ -4,7 +4,7 @@ #include -namespace hibf +namespace seqan::hibf { // helper function to print a matrix when debugging @@ -28,4 +28,4 @@ void print_matrix(matrix_type const & matrix, std::cerr << '\n'; } -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/detail/layout/simple_binning.hpp b/include/hibf/detail/layout/simple_binning.hpp index 333136c9..e2f9445a 100644 --- a/include/hibf/detail/layout/simple_binning.hpp +++ b/include/hibf/detail/layout/simple_binning.hpp @@ -9,7 +9,7 @@ #include // for data_store #include // for next_multiple_of_64 -namespace hibf::layout +namespace seqan::hibf::layout { /*!\brief Distributes x Technical Bins across y User Bins while minimizing the maximal Technical Bin size @@ -140,4 +140,4 @@ class simple_binning size_t execute(); }; -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/include/hibf/detail/prefixes.hpp b/include/hibf/detail/prefixes.hpp index 2b1fe6e8..817fc406 100644 --- a/include/hibf/detail/prefixes.hpp +++ b/include/hibf/detail/prefixes.hpp @@ -4,7 +4,7 @@ #include -namespace hibf::prefix +namespace seqan::hibf::prefix { /* These prefixes are for writing the layout file @@ -57,4 +57,4 @@ static_assert(layout_first_header_line.ends_with(layout_top_level)); constexpr std::string_view layout_column_names{"#USER_BIN_IDX\tTECHNICAL_BIN_INDICES\tNUMBER_OF_TECHNICAL_BINS"}; static_assert(layout_column_names.starts_with(layout_header)); -} // namespace hibf::prefix +} // namespace seqan::hibf::prefix diff --git a/include/hibf/detail/sketch/estimate_kmer_counts.hpp b/include/hibf/detail/sketch/estimate_kmer_counts.hpp index ec7dc69c..5e6bbcfa 100644 --- a/include/hibf/detail/sketch/estimate_kmer_counts.hpp +++ b/include/hibf/detail/sketch/estimate_kmer_counts.hpp @@ -5,10 +5,10 @@ #include // for hyperloglog -namespace hibf::sketch +namespace seqan::hibf::sketch { -inline void estimate_kmer_counts(std::vector const & sketches, +inline void estimate_kmer_counts(std::vector const & sketches, std::vector & kmer_counts) { kmer_counts.resize(sketches.size()); @@ -17,4 +17,4 @@ inline void estimate_kmer_counts(std::vector const & kmer_counts[i] = sketches[i].estimate(); } -} // namespace hibf::sketch +} // namespace seqan::hibf::sketch diff --git a/include/hibf/detail/sketch/hyperloglog.hpp b/include/hibf/detail/sketch/hyperloglog.hpp index 69d8e092..2d62bee0 100644 --- a/include/hibf/detail/sketch/hyperloglog.hpp +++ b/include/hibf/detail/sketch/hyperloglog.hpp @@ -18,7 +18,7 @@ #include // for aligned_allocator -namespace hibf::sketch +namespace seqan::hibf::sketch { /** @class hyperloglog @@ -123,12 +123,12 @@ class hyperloglog return arr; }(); - uint64_t mask_{}; ///< mask for the rank bits - double alphaMM_{}; ///< alpha * m^2 - float alphaMM_float_{}; ///< alpha * m^2 - uint64_t m_{}; ///< register size - uint8_t b_{}; ///< register bit width - std::vector> M_{}; ///< registers + uint64_t mask_{}; ///< mask for the rank bits + double alphaMM_{}; ///< alpha * m^2 + float alphaMM_float_{}; ///< alpha * m^2 + uint64_t m_{}; ///< register size + uint8_t b_{}; ///< register bit width + std::vector> M_{}; ///< registers }; -} // namespace hibf::sketch +} // namespace seqan::hibf::sketch diff --git a/include/hibf/detail/sketch/toolbox.hpp b/include/hibf/detail/sketch/toolbox.hpp index de0b20ed..7741468c 100644 --- a/include/hibf/detail/sketch/toolbox.hpp +++ b/include/hibf/detail/sketch/toolbox.hpp @@ -10,7 +10,7 @@ #include // for unordered_flat_map #include // for hyperloglog -namespace hibf::sketch::toolbox +namespace seqan::hibf::sketch::toolbox { //!\brief type for a node in the clustering tree when for the rearrangement @@ -157,4 +157,4 @@ void trace(std::vector const & clustering, size_t const first, size_t const id); -} // namespace hibf::sketch::toolbox +} // namespace seqan::hibf::sketch::toolbox diff --git a/include/hibf/detail/timer.hpp b/include/hibf/detail/timer.hpp index f0e9b071..cdaafced 100644 --- a/include/hibf/detail/timer.hpp +++ b/include/hibf/detail/timer.hpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Provides hibf::timer. + * \brief Provides seqan::hibf::timer. * \author Enrico Seiler */ @@ -19,7 +19,7 @@ #include -namespace hibf +namespace seqan::hibf { enum class concurrent @@ -104,4 +104,4 @@ class timer rep_t ticks{}; }; -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/hierarchical_interleaved_bloom_filter.hpp b/include/hibf/hierarchical_interleaved_bloom_filter.hpp index cc23275e..cb2a4b33 100644 --- a/include/hibf/hierarchical_interleaved_bloom_filter.hpp +++ b/include/hibf/hierarchical_interleaved_bloom_filter.hpp @@ -24,19 +24,19 @@ #include // for CEREAL_SERIALIZE_FUNCTION_NAME -namespace hibf +namespace seqan::hibf { /*!\brief The HIBF binning directory. A data structure that efficiently answers set-membership queries for multiple * bins. * \tparam data_layout_mode_ Indicates whether the underlying data type is compressed. See - * [hibf::data_layout](https://docs.seqan.de/seqan/3.0.3/group__submodule__dream__index.html#gae9cb143481c46a1774b3cdf5d9fdb518). - * \see [hibf::interleaved_bloom_filter][1] + * [seqan::hibf::data_layout](https://docs.seqan.de/seqan/3.0.3/group__submodule__dream__index.html#gae9cb143481c46a1774b3cdf5d9fdb518). + * \see [seqan::hibf::interleaved_bloom_filter][1] * \details * - * This class improves the [hibf::interleaved_bloom_filter][1] by adding additional bookkeeping that allows + * This class improves the [seqan::hibf::interleaved_bloom_filter][1] by adding additional bookkeeping that allows * to establish a hierarchical structure. This structure can then be used to split or merge user bins and distribute - * them over a variable number of technical bins. In the [hibf::interleaved_bloom_filter][1], the number of user bins + * them over a variable number of technical bins. In the [seqan::hibf::interleaved_bloom_filter][1], the number of user bins * and technical bins is always the same. This causes performance degradation when there are many user bins or the user * bins are unevenly distributed. * @@ -52,7 +52,7 @@ namespace hibf * * # Hierarchical Interleaved Bloom Filter (HIBF) * - * In constrast to the [hibf::interleaved_bloom_filter][1], the user bins may be split across multiple technical bins + * In constrast to the [seqan::hibf::interleaved_bloom_filter][1], the user bins may be split across multiple technical bins * , or multiple user bins may be merged into one technical bin. When merging multiple user bins, the HIBF stores * another IBF that is built over the user bins constituting the merged bin. This lower-level IBF can then be used * to further distinguish between merged bins. @@ -66,13 +66,13 @@ namespace hibf * * ## Querying * To query the Hierarchical Interleaved Bloom Filter for values, call - * hibf::hierarchical_interleaved_bloom_filter::membership_agent() and use the returned - * hibf::hierarchical_interleaved_bloom_filter::membership_agent. - * In contrast to the [hibf::interleaved_bloom_filter][1], the result will consist of indices of user bins. + * seqan::hibf::hierarchical_interleaved_bloom_filter::membership_agent() and use the returned + * seqan::hibf::hierarchical_interleaved_bloom_filter::membership_agent. + * In contrast to the [seqan::hibf::interleaved_bloom_filter][1], the result will consist of indices of user bins. * * To count the occurrences in each user bin of a range of values in the Hierarchical Interleaved Bloom Filter, call - * hibf::hierarchical_interleaved_bloom_filter::counting_agent() and use - * the returned hibf::hierarchical_interleaved_bloom_filter::counting_agent_type. + * seqan::hibf::hierarchical_interleaved_bloom_filter::counting_agent() and use + * the returned seqan::hibf::hierarchical_interleaved_bloom_filter::counting_agent_type. * * ## Thread safety * @@ -85,10 +85,10 @@ namespace hibf class hierarchical_interleaved_bloom_filter { public: - /*!\brief Manages membership queries for the hibf::hierarchical_interleaved_bloom_filter. - * \see hibf::hierarchical_interleaved_bloom_filter::user_bins::filename_of_user_bin + /*!\brief Manages membership queries for the seqan::hibf::hierarchical_interleaved_bloom_filter. + * \see seqan::hibf::hierarchical_interleaved_bloom_filter::user_bins::filename_of_user_bin * \details - * In contrast to the [hibf::interleaved_bloom_filter][1], the result will consist of indices of user bins. + * In contrast to the [seqan::hibf::interleaved_bloom_filter][1], the result will consist of indices of user bins. */ class membership_agent_type; @@ -109,7 +109,7 @@ class hierarchical_interleaved_bloom_filter /*!\brief [Advanced] Constructs the HIBF from a layout file (stream) and a given input function * \details * This constructor makes it possible to construct an hibf from a given layout file instead of calculating the - * layout based on the input function. A hibf::config object is not needed as it is assumed to be stored in the + * layout based on the input function. A seqan::hibf::config object is not needed as it is assumed to be stored in the * layout file. A layout file can be constructed manually or via chopper (https://github.com/seqan/chopper) * or raptor-layout (https://github.com/seqan/raptor). */ @@ -137,13 +137,13 @@ class hierarchical_interleaved_bloom_filter /*!\cond DEV * \brief Serialisation support function. - * \tparam archive_t Type of `archive`; must satisfy hibf::cereal_archive. + * \tparam archive_t Type of `archive`; must satisfy seqan::hibf::cereal_archive. * \param[in] archive The archive being serialised from/to. * * \attention These functions are never called directly. * \sa https://docs.seqan.de/seqan/3.2.0/group__io.html#serialisation */ - template + template void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive) { archive(ibf_vector); @@ -227,7 +227,7 @@ class hierarchical_interleaved_bloom_filter::membership_agent_type * ### Thread safety * * Concurrent invocations of this function are not thread safe, please create a - * hibf::hierarchical_interleaved_bloom_filter::membership_agent for each thread. + * seqan::hibf::hierarchical_interleaved_bloom_filter::membership_agent for each thread. */ template [[nodiscard]] std::vector const & bulk_contains(value_range_t && values, size_t const threshold) & noexcept @@ -261,4 +261,4 @@ hierarchical_interleaved_bloom_filter::membership_agent() const return typename hierarchical_interleaved_bloom_filter::membership_agent_type{*this}; } -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/interleaved_bloom_filter.hpp b/include/hibf/interleaved_bloom_filter.hpp index 364d294b..d6f9d07f 100644 --- a/include/hibf/interleaved_bloom_filter.hpp +++ b/include/hibf/interleaved_bloom_filter.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides hibf::interleaved_bloom_filter. + * \brief Provides seqan::hibf::interleaved_bloom_filter. */ #pragma once @@ -32,30 +32,30 @@ #include // for CEREAL_SERIALIZE_FUNCTION_NAME #include // for bit_vector -namespace hibf +namespace seqan::hibf { -//!\brief A strong type that represents the number of bins for the hibf::interleaved_bloom_filter. +//!\brief A strong type that represents the number of bins for the seqan::hibf::interleaved_bloom_filter. //!\ingroup search_dream_index struct bin_count { size_t value; }; -//!\brief A strong type that represents the number of bits for each bin in the hibf::interleaved_bloom_filter. +//!\brief A strong type that represents the number of bits for each bin in the seqan::hibf::interleaved_bloom_filter. //!\ingroup search_dream_index struct bin_size { size_t value; }; -//!\brief A strong type that represents the number of hash functions for the hibf::interleaved_bloom_filter. +//!\brief A strong type that represents the number of hash functions for the seqan::hibf::interleaved_bloom_filter. //!\ingroup search_dream_index struct hash_function_count { size_t value; }; -//!\brief A strong type that represents the bin index for the hibf::interleaved_bloom_filter. +//!\brief A strong type that represents the bin index for the seqan::hibf::interleaved_bloom_filter. //!\ingroup search_dream_index struct bin_index { @@ -64,8 +64,8 @@ struct bin_index /*!\brief The IBF binning directory. A data structure that efficiently answers set-membership queries for multiple bins. * \ingroup search_dream_index - * \tparam data_layout_mode_ Indicates whether the underlying data type is compressed. See hibf::data_layout. - * \implements hibf::cerealisable + * \tparam data_layout_mode_ Indicates whether the underlying data type is compressed. See seqan::hibf::data_layout. + * \implements seqan::hibf::cerealisable * * \details * @@ -109,18 +109,18 @@ struct bin_index * the binningvector, a bitvector of length `b` where the `i`'th bit indicates set membership in the `i`'th bin. * * ### Querying - * To query the Interleaved Bloom Filter for a value, call hibf::interleaved_bloom_filter::membership_agent() and use - * the returned hibf::interleaved_bloom_filter::membership_agent_type. + * To query the Interleaved Bloom Filter for a value, call seqan::hibf::interleaved_bloom_filter::membership_agent() and use + * the returned seqan::hibf::interleaved_bloom_filter::membership_agent_type. * * To count the occurrences of a range of values in the Interleaved Bloom Filter, call - * hibf::interleaved_bloom_filter::counting_agent() and use - * the returned hibf::interleaved_bloom_filter::counting_agent_type. + * seqan::hibf::interleaved_bloom_filter::counting_agent() and use + * the returned seqan::hibf::interleaved_bloom_filter::counting_agent_type. * * ### Compression * * The Interleaved Bloom Filter can be compressed by passing `data_layout::compressed` as template argument. - * The compressed `hibf::interleaved_bloom_filter` can only be constructed from a - * `hibf::interleaved_bloom_filter`, in which case the underlying bitvector is compressed. + * The compressed `seqan::hibf::interleaved_bloom_filter` can only be constructed from a + * `seqan::hibf::interleaved_bloom_filter`, in which case the underlying bitvector is compressed. * The compressed Interleaved Bloom Filter is immutable, i.e. only querying is supported. * * ### Thread safety @@ -212,9 +212,9 @@ class interleaved_bloom_filter * * \include test/snippet_migration/ibf/interleaved_bloom_filter_constructor.cpp */ - interleaved_bloom_filter(hibf::bin_count bins_, - hibf::bin_size size, - hibf::hash_function_count funs = hibf::hash_function_count{2u}) + interleaved_bloom_filter(seqan::hibf::bin_count bins_, + seqan::hibf::bin_size size, + seqan::hibf::hash_function_count funs = seqan::hibf::hash_function_count{2u}) { bins = bins_.value; bin_size_ = size.value; @@ -281,7 +281,7 @@ class interleaved_bloom_filter /*!\brief Clears a range of bins. * \tparam rng_t The type of the range. Must model std::ranges::forward_range and the reference type must be - * hibf::bin_index. + * seqan::hibf::bin_index. * \param[in] bin_range The range of bins to clear. * * \attention This function is only available for **uncompressed** Interleaved Bloom Filters. @@ -297,7 +297,7 @@ class interleaved_bloom_filter { static_assert(std::ranges::forward_range, "The range of bins to clear must model a forward_range."); static_assert(std::same_as>, bin_index>, - "The reference type of the range to clear must be hibf::bin_index."); + "The reference type of the range to clear must be seqan::hibf::bin_index."); #ifndef NDEBUG for (auto && bin : bin_range) assert(bin.value < bins); @@ -314,18 +314,18 @@ class interleaved_bloom_filter * * \attention This function is only available for **uncompressed** Interleaved Bloom Filters. * \attention The new number of bins must be greater or equal to the current number of bins. - * \attention This function invalidates all hibf::interleaved_bloom_filter::membership_agent_type constructed for + * \attention This function invalidates all seqan::hibf::interleaved_bloom_filter::membership_agent_type constructed for * this Interleaved Bloom Filter. * * \details * - * The resulting `hibf::interleaved_bloom_filter` has an increased size proportional to the increase in the + * The resulting `seqan::hibf::interleaved_bloom_filter` has an increased size proportional to the increase in the * `bin_words` (the number of 64-bit words needed to represent `bins` many bins), e.g. - * resizing a `hibf::interleaved_bloom_filter` with 40 bins to 73 bins also increases the `bin_words` from 1 to - * 2 and hence the new `hibf::interleaved_bloom_filter` will be twice the size. + * resizing a `seqan::hibf::interleaved_bloom_filter` with 40 bins to 73 bins also increases the `bin_words` from 1 to + * 2 and hence the new `seqan::hibf::interleaved_bloom_filter` will be twice the size. * This increase in size is necessary to avoid invalidating all computed hash functions. * If you want to add more bins while keeping the size constant, you need to rebuild the - * `hibf::interleaved_bloom_filter`. + * `seqan::hibf::interleaved_bloom_filter`. * * ### Example * @@ -374,29 +374,29 @@ class interleaved_bloom_filter /*!\name Lookup * \{ */ - /*!\brief Returns a hibf::interleaved_bloom_filter::membership_agent_type to be used for lookup. - * \attention Calling hibf::interleaved_bloom_filter::increase_bin_number_to invalidates all - * `hibf::interleaved_bloom_filter::membership_agent_type`s constructed for this Interleaved Bloom Filter. + /*!\brief Returns a seqan::hibf::interleaved_bloom_filter::membership_agent_type to be used for lookup. + * \attention Calling seqan::hibf::interleaved_bloom_filter::increase_bin_number_to invalidates all + * `seqan::hibf::interleaved_bloom_filter::membership_agent_type`s constructed for this Interleaved Bloom Filter. * * \details * * ### Example * * \include test/snippet_migration/ibf/membership_agent_construction.cpp - * \sa hibf::interleaved_bloom_filter::membership_agent_type::bulk_contains + * \sa seqan::hibf::interleaved_bloom_filter::membership_agent_type::bulk_contains */ membership_agent_type membership_agent() const; - /*!\brief Returns a hibf::interleaved_bloom_filter::counting_agent_type to be used for counting. - * \attention Calling hibf::interleaved_bloom_filter::increase_bin_number_to invalidates all - * `hibf::interleaved_bloom_filter::counting_agent_type`s constructed for this Interleaved Bloom Filter. + /*!\brief Returns a seqan::hibf::interleaved_bloom_filter::counting_agent_type to be used for counting. + * \attention Calling seqan::hibf::interleaved_bloom_filter::increase_bin_number_to invalidates all + * `seqan::hibf::interleaved_bloom_filter::counting_agent_type`s constructed for this Interleaved Bloom Filter. * * \details * * ### Example * * \include test/snippet_migration/ibf/counting_agent_construction.cpp - * \sa hibf::interleaved_bloom_filter::counting_agent_type::bulk_count + * \sa seqan::hibf::interleaved_bloom_filter::counting_agent_type::bulk_count */ template counting_agent_type counting_agent() const @@ -445,8 +445,8 @@ class interleaved_bloom_filter * \{ */ /*!\brief Test for equality. - * \param[in] lhs A `hibf::interleaved_bloom_filter`. - * \param[in] rhs `hibf::interleaved_bloom_filter` to compare to. + * \param[in] lhs A `seqan::hibf::interleaved_bloom_filter`. + * \param[in] rhs `seqan::hibf::interleaved_bloom_filter` to compare to. * \returns `true` if equal, `false` otherwise. */ friend bool operator==(interleaved_bloom_filter const & lhs, interleaved_bloom_filter const & rhs) noexcept @@ -468,8 +468,8 @@ class interleaved_bloom_filter } /*!\brief Test for inequality. - * \param[in] lhs A `hibf::interleaved_bloom_filter`. - * \param[in] rhs `hibf::interleaved_bloom_filter` to compare to. + * \param[in] lhs A `seqan::hibf::interleaved_bloom_filter`. + * \param[in] rhs `seqan::hibf::interleaved_bloom_filter` to compare to. * \returns `true` if unequal, `false` otherwise. */ friend bool operator!=(interleaved_bloom_filter const & lhs, interleaved_bloom_filter const & rhs) noexcept @@ -502,7 +502,7 @@ class interleaved_bloom_filter /*!\cond DEV * \brief Serialisation support function. - * \tparam archive_t Type of `archive`; must satisfy hibf::cereal_archive. + * \tparam archive_t Type of `archive`; must satisfy seqan::hibf::cereal_archive. * \param[in] archive The archive being serialised from/to. * * \attention These functions are never called directly. @@ -521,7 +521,7 @@ class interleaved_bloom_filter //!\endcond }; -//!\brief A bitvector representing the result of a call to `bulk_contains` of the hibf::interleaved_bloom_filter. +//!\brief A bitvector representing the result of a call to `bulk_contains` of the seqan::hibf::interleaved_bloom_filter. class interleaved_bloom_filter::binning_bitvector { private: @@ -635,8 +635,8 @@ class interleaved_bloom_filter::binning_bitvector //!\} }; -/*!\brief Manages membership queries for the hibf::interleaved_bloom_filter. - * \attention Calling hibf::interleaved_bloom_filter::increase_bin_number_to on `ibf` invalidates the +/*!\brief Manages membership queries for the seqan::hibf::interleaved_bloom_filter. + * \attention Calling seqan::hibf::interleaved_bloom_filter::increase_bin_number_to on `ibf` invalidates the * membership_agent. * * \details @@ -648,13 +648,13 @@ class interleaved_bloom_filter::binning_bitvector class interleaved_bloom_filter::membership_agent_type { private: - //!\brief The type of the augmented hibf::interleaved_bloom_filter. + //!\brief The type of the augmented seqan::hibf::interleaved_bloom_filter. using ibf_t = interleaved_bloom_filter; - //!\brief A pointer to the augmented hibf::interleaved_bloom_filter. + //!\brief A pointer to the augmented seqan::hibf::interleaved_bloom_filter. ibf_t const * ibf_ptr{nullptr}; - //!\brief Stores access positions of augmented hibf::interleaved_bloom_filter. + //!\brief Stores access positions of augmented seqan::hibf::interleaved_bloom_filter. std::array bloom_filter_indices; public: @@ -668,9 +668,9 @@ class interleaved_bloom_filter::membership_agent_type membership_agent_type & operator=(membership_agent_type &&) = default; //!< Defaulted. ~membership_agent_type() = default; //!< Defaulted. - /*!\brief Construct a membership_agent_type from a hibf::interleaved_bloom_filter. + /*!\brief Construct a membership_agent_type from a seqan::hibf::interleaved_bloom_filter. * \private - * \param ibf The hibf::interleaved_bloom_filter. + * \param ibf The seqan::hibf::interleaved_bloom_filter. */ explicit membership_agent_type(ibf_t const & ibf) : ibf_ptr(std::addressof(ibf)), result_buffer(ibf.bin_count()) {} @@ -697,7 +697,7 @@ class interleaved_bloom_filter::membership_agent_type * ### Thread safety * * Concurrent invocations of this function are not thread safe, please create a - * hibf::interleaved_bloom_filter::membership_agent_type for each thread. + * seqan::hibf::interleaved_bloom_filter::membership_agent_type for each thread. */ [[nodiscard]] binning_bitvector const & bulk_contains(size_t const value) & noexcept { @@ -827,19 +827,19 @@ inline interleaved_bloom_filter::membership_agent_type interleaved_bloom_filter: } /*!\brief A data structure that behaves like a std::vector and can be used to consolidate the results of multiple calls - * to hibf::interleaved_bloom_filter::membership_agent_type::bulk_contains. + * to seqan::hibf::interleaved_bloom_filter::membership_agent_type::bulk_contains. * \ingroup search_dream_index * \tparam value_t The type of the count. Must model std::integral. * * \details * - * When using the hibf::interleaved_bloom_filter::membership_agent_type::bulk_contains operation, a common use case is to + * When using the seqan::hibf::interleaved_bloom_filter::membership_agent_type::bulk_contains operation, a common use case is to * add up, for example, the results for all k-mers in a query. This yields, for each bin, the number of k-mers of a * query that are in the respective bin. Such information can be used to apply further filtering or abundance estimation * based on the k-mer counts. * - * The hibf::counting_vector offers an easy way to add up the individual - * hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector by offering an `+=` operator. + * The seqan::hibf::counting_vector offers an easy way to add up the individual + * seqan::hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector by offering an `+=` operator. * * The `value_t` template parameter should be chosen in a way that no overflow occurs if all calls to `bulk_contains` * return a hit for a specific bin. For example, `uint8_t` will suffice when processing short Illumina reads, whereas @@ -856,7 +856,7 @@ class counting_vector : public std::vector //!\brief The base type. using base_t = std::vector; - //!\brief Is binning_bitvector_t a hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector? + //!\brief Is binning_bitvector_t a seqan::hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector? template static constexpr bool is_binning_bitvector = std::same_as; @@ -875,10 +875,10 @@ class counting_vector : public std::vector using base_t::base_t; //!\} - /*!\brief Bin-wise adds the bits of a hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. + /*!\brief Bin-wise adds the bits of a seqan::hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. * \tparam binning_bitvector_t The type of the right-hand side. - * Must be hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. - * \param binning_bitvector The hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. + * Must be seqan::hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. + * \param binning_bitvector The seqan::hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. * \attention The counting_vector must be at least as big as `binning_bitvector`. * * \details @@ -900,10 +900,10 @@ class counting_vector : public std::vector } /*!\brief Bin-wise subtracts the bits of a - * hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. + * seqan::hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. * \tparam binning_bitvector_t The type of the right-hand side. - * Must be hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. - * \param binning_bitvector The hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. + * Must be seqan::hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. + * \param binning_bitvector The seqan::hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. * \attention The counting_vector must be at least as big as `binning_bitvector`. */ template @@ -919,9 +919,9 @@ class counting_vector : public std::vector return *this; } - /*!\brief Bin-wise addition of two `hibf::counting_vector`s. - * \param rhs The other hibf::counting_vector. - * \attention The hibf::counting_vector must be at least as big as `rhs`. + /*!\brief Bin-wise addition of two `seqan::hibf::counting_vector`s. + * \param rhs The other seqan::hibf::counting_vector. + * \attention The seqan::hibf::counting_vector must be at least as big as `rhs`. * * \details * @@ -938,9 +938,9 @@ class counting_vector : public std::vector return *this; } - /*!\brief Bin-wise substraction of two `hibf::counting_vector`s. - * \param rhs The other hibf::counting_vector. - * \attention The hibf::counting_vector must be at least as big as `rhs`. + /*!\brief Bin-wise substraction of two `seqan::hibf::counting_vector`s. + * \param rhs The other seqan::hibf::counting_vector. + * \attention The seqan::hibf::counting_vector must be at least as big as `rhs`. */ counting_vector & operator-=(counting_vector const & rhs) { @@ -960,7 +960,7 @@ class counting_vector : public std::vector } private: - //!\brief Enumerates all bins of a hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. + //!\brief Enumerates all bins of a seqan::hibf::interleaved_bloom_filter::membership_agent_type::binning_bitvector. template void for_each_set_bin(binning_bitvector_t && binning_bitvector, on_bin_fn_t && on_bin_fn) { @@ -992,8 +992,8 @@ class counting_vector : public std::vector } }; -/*!\brief Manages counting ranges of values for the hibf::interleaved_bloom_filter. - * \attention Calling hibf::interleaved_bloom_filter::increase_bin_number_to invalidates the counting_agent_type. +/*!\brief Manages counting ranges of values for the seqan::hibf::interleaved_bloom_filter. + * \attention Calling seqan::hibf::interleaved_bloom_filter::increase_bin_number_to invalidates the counting_agent_type. * * \details * @@ -1005,13 +1005,13 @@ template class interleaved_bloom_filter::counting_agent_type { private: - //!\brief The type of the augmented hibf::interleaved_bloom_filter. + //!\brief The type of the augmented seqan::hibf::interleaved_bloom_filter. using ibf_t = interleaved_bloom_filter; - //!\brief A pointer to the augmented hibf::interleaved_bloom_filter. + //!\brief A pointer to the augmented seqan::hibf::interleaved_bloom_filter. ibf_t const * ibf_ptr{nullptr}; - //!\brief Store a hibf::interleaved_bloom_filter::membership_agent to call `bulk_contains`. + //!\brief Store a seqan::hibf::interleaved_bloom_filter::membership_agent to call `bulk_contains`. membership_agent_type membership_agent; public: @@ -1025,9 +1025,9 @@ class interleaved_bloom_filter::counting_agent_type counting_agent_type & operator=(counting_agent_type &&) = default; //!< Defaulted. ~counting_agent_type() = default; //!< Defaulted. - /*!\brief Construct a counting_agent_type for an existing hibf::interleaved_bloom_filter. + /*!\brief Construct a counting_agent_type for an existing seqan::hibf::interleaved_bloom_filter. * \private - * \param ibf The hibf::interleaved_bloom_filter. + * \param ibf The seqan::hibf::interleaved_bloom_filter. */ explicit counting_agent_type(ibf_t const & ibf) : ibf_ptr(std::addressof(ibf)), @@ -1059,7 +1059,7 @@ class interleaved_bloom_filter::counting_agent_type * ### Thread safety * * Concurrent invocations of this function are not thread safe, please create a - * hibf::interleaved_bloom_filter::counting_agent_type for each thread. + * seqan::hibf::interleaved_bloom_filter::counting_agent_type for each thread. */ template [[nodiscard]] counting_vector const & bulk_count(value_range_t && values) & noexcept @@ -1086,4 +1086,4 @@ class interleaved_bloom_filter::counting_agent_type //!\} }; -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/next_multiple_of_64.hpp b/include/hibf/next_multiple_of_64.hpp index efe04621..3ffc9099 100644 --- a/include/hibf/next_multiple_of_64.hpp +++ b/include/hibf/next_multiple_of_64.hpp @@ -4,7 +4,7 @@ #include -namespace hibf +namespace seqan::hibf { /*!\brief Returns the smallest integer that is greater or equal to `value` and a multiple of 64. Returns 0 for value 0. @@ -15,4 +15,4 @@ namespace hibf return ((value + 63) >> 6) << 6; } -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/user_bins_type.hpp b/include/hibf/user_bins_type.hpp index ab31f571..8423632f 100644 --- a/include/hibf/user_bins_type.hpp +++ b/include/hibf/user_bins_type.hpp @@ -12,7 +12,7 @@ #include // for string #include // for vector -namespace hibf +namespace seqan::hibf { //!\brief Bookkeeping for user and technical bins. @@ -86,4 +86,4 @@ class user_bins_type //!\endcond }; -} // namespace hibf +} // namespace seqan::hibf diff --git a/include/hibf/version.hpp b/include/hibf/version.hpp index c8d9b73d..a00e8662 100644 --- a/include/hibf/version.hpp +++ b/include/hibf/version.hpp @@ -50,7 +50,7 @@ HIBF_VERSION_CSTRING_HELPER_FUNC(HIBF_VERSION_MAJOR, HIBF_VERSION_MINOR, HIBF_VERSION_PATCH) \ HIBF_RELEASE_CANDIDATE_HELPER(HIBF_RELEASE_CANDIDATE) -namespace hibf +namespace seqan::hibf { //!\brief The major version. @@ -66,7 +66,7 @@ constexpr std::size_t hibf_version = HIBF_VERSION; //!\brief The full version as null terminated string. constexpr char const * hibf_version_cstring = HIBF_VERSION_CSTRING; -} // namespace hibf +} // namespace seqan::hibf #undef HIBF_VERSION_CSTRING_HELPER_STR #undef HIBF_VERSION_CSTRING_HELPER_FUNC diff --git a/src/config.cpp b/src/config.cpp index 281882ea..477b1431 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -14,7 +14,7 @@ #include -namespace hibf +namespace seqan::hibf { void config::read_from(std::istream & stream) @@ -31,8 +31,8 @@ void config::read_from(std::istream & stream) while (std::getline(stream, line) && line != prefix::meta_hibf_config_end) { assert(line.size() >= 2); - assert(std::string_view{line}.substr(0, 1) == hibf::prefix::meta_header); - config_str << line.substr(1); // remove hibf::prefix::meta_header + assert(std::string_view{line}.substr(0, 1) == seqan::hibf::prefix::meta_header); + config_str << line.substr(1); // remove seqan::hibf::prefix::meta_header } assert(line == prefix::meta_hibf_config_end); @@ -57,4 +57,4 @@ void config::write_to(std::ostream & stream) const << prefix::meta_hibf_config_end << '\n'; } -} // namespace hibf +} // namespace seqan::hibf diff --git a/src/detail/build/compute_kmers.cpp b/src/detail/build/compute_kmers.cpp index 32553a46..3b6c396d 100644 --- a/src/detail/build/compute_kmers.cpp +++ b/src/detail/build/compute_kmers.cpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Implements hibf::compute_kmers. + * \brief Implements seqan::hibf::compute_kmers. * \author Enrico Seiler */ @@ -21,7 +21,7 @@ #include // for layout #include // for concurrent, timer -namespace hibf +namespace seqan::hibf { void compute_kmers(robin_hood::unordered_flat_set & kmers, @@ -35,4 +35,4 @@ void compute_kmers(robin_hood::unordered_flat_set & kmers, data.user_bin_io_timer += local_user_bin_io_timer; } -} // namespace hibf +} // namespace seqan::hibf diff --git a/src/detail/build/construct_ibf.cpp b/src/detail/build/construct_ibf.cpp index 799ad8ce..2049e528 100644 --- a/src/detail/build/construct_ibf.cpp +++ b/src/detail/build/construct_ibf.cpp @@ -24,15 +24,15 @@ #include // for concurrent, timer #include // for interleaved_bloom_filter, bin_count, bin_size, hash_fun... -namespace hibf +namespace seqan::hibf { -hibf::interleaved_bloom_filter construct_ibf(robin_hood::unordered_flat_set & parent_kmers, - robin_hood::unordered_flat_set & kmers, - size_t const number_of_bins, - lemon::ListDigraph::Node const & node, - build_data & data, - bool is_root) +seqan::hibf::interleaved_bloom_filter construct_ibf(robin_hood::unordered_flat_set & parent_kmers, + robin_hood::unordered_flat_set & kmers, + size_t const number_of_bins, + lemon::ListDigraph::Node const & node, + build_data & data, + bool is_root) { auto & node_data = data.node_map[node]; @@ -40,14 +40,15 @@ hibf::interleaved_bloom_filter construct_ibf(robin_hood::unordered_flat_set(bin_size_in_bits({.fpr = data.config.maximum_false_positive_rate, .hash_count = data.config.number_of_hash_functions, .elements = kmers_per_bin}))}; - hibf::bin_size const bin_size{static_cast(std::ceil(bin_bits * data.fpr_correction[number_of_bins]))}; - hibf::bin_count const bin_count{node_data.number_of_technical_bins}; + seqan::hibf::bin_size const bin_size{ + static_cast(std::ceil(bin_bits * data.fpr_correction[number_of_bins]))}; + seqan::hibf::bin_count const bin_count{node_data.number_of_technical_bins}; timer local_index_allocation_timer{}; local_index_allocation_timer.start(); - hibf::interleaved_bloom_filter ibf{bin_count, - bin_size, - hibf::hash_function_count{data.config.number_of_hash_functions}}; + seqan::hibf::interleaved_bloom_filter ibf{bin_count, + bin_size, + seqan::hibf::hash_function_count{data.config.number_of_hash_functions}}; local_index_allocation_timer.stop(); data.index_allocation_timer += local_index_allocation_timer; @@ -58,4 +59,4 @@ hibf::interleaved_bloom_filter construct_ibf(robin_hood::unordered_flat_set */ @@ -21,7 +21,7 @@ #include // for update_header_node_data #include // for layout -namespace hibf +namespace seqan::hibf { void initialise_build_tree(layout::layout & hibf_layout, @@ -36,4 +36,4 @@ void initialise_build_tree(layout::layout & hibf_layout, update_content_node_data(std::move(hibf_layout.user_bins), ibf_graph, node_map); } -} // namespace hibf +} // namespace seqan::hibf diff --git a/src/detail/build/insert_into_ibf.cpp b/src/detail/build/insert_into_ibf.cpp index 341036ef..01204c00 100644 --- a/src/detail/build/insert_into_ibf.cpp +++ b/src/detail/build/insert_into_ibf.cpp @@ -22,14 +22,14 @@ #include // for concurrent, timer #include // for interleaved_bloom_filter, bin_index -namespace hibf +namespace seqan::hibf { // automatically does naive splitting if number_of_bins > 1 void insert_into_ibf(robin_hood::unordered_flat_set const & kmers, size_t const number_of_bins, size_t const bin_index, - hibf::interleaved_bloom_filter & ibf, + seqan::hibf::interleaved_bloom_filter & ibf, timer & fill_ibf_timer) { size_t const chunk_size = kmers.size() / number_of_bins + 1; @@ -40,7 +40,7 @@ void insert_into_ibf(robin_hood::unordered_flat_set const & kmers, for (auto chunk : kmers | seqan::std::views::chunk(chunk_size)) { assert(chunk_number < number_of_bins); - hibf::bin_index const bin_idx{bin_index + chunk_number}; + seqan::hibf::bin_index const bin_idx{bin_index + chunk_number}; ++chunk_number; for (size_t const value : chunk) ibf.emplace(value, bin_idx); @@ -51,9 +51,9 @@ void insert_into_ibf(robin_hood::unordered_flat_set const & kmers, void insert_into_ibf(build_data const & data, layout::layout::user_bin const & record, - hibf::interleaved_bloom_filter & ibf) + seqan::hibf::interleaved_bloom_filter & ibf) { - auto const bin_index = hibf::bin_index{static_cast(record.storage_TB_id)}; + auto const bin_index = seqan::hibf::bin_index{static_cast(record.storage_TB_id)}; robin_hood::unordered_flat_set values; timer local_user_bin_io_timer{}; @@ -70,4 +70,4 @@ void insert_into_ibf(build_data const & data, data.fill_ibf_timer += local_fill_ibf_timer; } -} // namespace hibf +} // namespace seqan::hibf diff --git a/src/detail/build/update_content_node_data.cpp b/src/detail/build/update_content_node_data.cpp index 37e5ba20..5b1bb724 100644 --- a/src/detail/build/update_content_node_data.cpp +++ b/src/detail/build/update_content_node_data.cpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Implements hibf::update_content_node_data. + * \brief Implements seqan::hibf::update_content_node_data. * \author Svenja Mehringer */ @@ -24,7 +24,7 @@ #include // for update_content_node_data #include // for layout -namespace hibf +namespace seqan::hibf { void update_content_node_data(std::vector && layout_user_bins, @@ -81,4 +81,4 @@ void update_content_node_data(std::vector && layout_us } } -} // namespace hibf +} // namespace seqan::hibf diff --git a/src/detail/build/update_header_node_data.cpp b/src/detail/build/update_header_node_data.cpp index 68449860..91ce2b31 100644 --- a/src/detail/build/update_header_node_data.cpp +++ b/src/detail/build/update_header_node_data.cpp @@ -6,7 +6,7 @@ // -------------------------------------------------------------------------------------------------- /*!\file - * \brief Implements hibf::update_header_node_data. + * \brief Implements seqan::hibf::update_header_node_data. * \author Svenja Mehringer */ @@ -25,7 +25,7 @@ #include // for update_header_node_data #include // for layout -namespace hibf +namespace seqan::hibf { void update_header_node_data(std::vector && header_max_bins, @@ -69,4 +69,4 @@ void update_header_node_data(std::vector && header_max_ } } -} // namespace hibf +} // namespace seqan::hibf diff --git a/src/detail/layout/compute_fpr_correction.cpp b/src/detail/layout/compute_fpr_correction.cpp index 19935b8e..440169ef 100644 --- a/src/detail/layout/compute_fpr_correction.cpp +++ b/src/detail/layout/compute_fpr_correction.cpp @@ -6,7 +6,7 @@ #include // for compute_fpr_correction #include // for next_multiple_of_64 -namespace hibf::layout +namespace seqan::hibf::layout { std::vector compute_fpr_correction(fpr_correction_parameters const & params) @@ -32,4 +32,4 @@ std::vector compute_fpr_correction(fpr_correction_parameters const & par return fpr_correction; } -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/src/detail/layout/compute_layout.cpp b/src/detail/layout/compute_layout.cpp index a89eecd7..e61acd34 100644 --- a/src/detail/layout/compute_layout.cpp +++ b/src/detail/layout/compute_layout.cpp @@ -15,7 +15,7 @@ #include // for estimate_kmer_counts #include // for hyperloglog -namespace hibf::layout +namespace seqan::hibf::layout { layout @@ -24,7 +24,7 @@ compute_layout(config const & config, std::vector & kmer_counts, std::ve layout resulting_layout{}; // The output streams facilitate writing the layout file in hierarchical structure. - // hibf::execute currently writes the filled buffers to the output file. + // seqan::hibf::execute currently writes the filled buffers to the output file. std::stringstream output_buffer; std::stringstream header_buffer; @@ -36,7 +36,7 @@ compute_layout(config const & config, std::vector & kmer_counts, std::ve #pragma omp parallel for schedule(static) num_threads(config.threads) private(kmers) for (size_t i = 0; i < config.number_of_user_bins; ++i) { - hibf::sketch::hyperloglog sketch(config.sketch_bits); + seqan::hibf::sketch::hyperloglog sketch(config.sketch_bits); kmers.clear(); config.input_fn(i, std::inserter(kmers, kmers.begin())); @@ -55,7 +55,7 @@ compute_layout(config const & config, std::vector & kmer_counts, std::ve .kmer_counts = std::addressof(kmer_counts), .sketches = std::addressof(sketches)}; - size_t const max_hibf_id = hibf::execute(config, store); + size_t const max_hibf_id = seqan::hibf::execute(config, store); store.hibf_layout->top_level_max_bin_id = max_hibf_id; return *store.hibf_layout; // return layout as string for now, containing the file @@ -69,4 +69,4 @@ layout compute_layout(config const & config) return compute_layout(config, kmer_counts, sketches); } -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/src/detail/layout/execute.cpp b/src/detail/layout/execute.cpp index 5c39bed4..72318f59 100644 --- a/src/detail/layout/execute.cpp +++ b/src/detail/layout/execute.cpp @@ -12,12 +12,12 @@ #include // for hierarchical_binning #include // for next_multiple_of_64 -namespace hibf +namespace seqan::hibf { -size_t execute(hibf::config const & config, hibf::data_store & data) +size_t execute(seqan::hibf::config const & config, seqan::hibf::data_store & data) { - hibf::config config_copy{config}; + seqan::hibf::config config_copy{config}; if (config_copy.disable_estimate_union) config_copy.disable_rearrangement = true; @@ -29,11 +29,12 @@ size_t execute(hibf::config const & config, hibf::data_store & data) number_samples >= 1ULL << 32) // sqrt is bigger than uint16_t throw std::invalid_argument{"Too many samples. Please set a tmax (see help via `-hh`)."}; // GCOVR_EXCL_LINE else - config_copy.tmax = hibf::next_multiple_of_64(static_cast(std::ceil(std::sqrt(number_samples)))); + config_copy.tmax = + seqan::hibf::next_multiple_of_64(static_cast(std::ceil(std::sqrt(number_samples)))); } else if (config_copy.tmax % 64 != 0) { - config_copy.tmax = hibf::next_multiple_of_64(config_copy.tmax); + config_copy.tmax = seqan::hibf::next_multiple_of_64(config_copy.tmax); std::cerr << "[HIBF LAYOUT WARNING]: Your requested number of technical bins was not a multiple of 64. " << "Due to the architecture of the HIBF, it will use up space equal to the next multiple of 64 " << "anyway, so we increased your number of technical bins to " << config_copy.tmax << ".\n"; @@ -44,7 +45,7 @@ size_t execute(hibf::config const & config, hibf::data_store & data) .hash_count = config_copy.number_of_hash_functions, .t_max = config_copy.tmax}); - return hibf::layout::hierarchical_binning{data, config_copy}.execute(); + return seqan::hibf::layout::hierarchical_binning{data, config_copy}.execute(); } -} // namespace hibf +} // namespace seqan::hibf diff --git a/src/detail/layout/hierarchical_binning.cpp b/src/detail/layout/hierarchical_binning.cpp index 41b3086c..8dadef94 100644 --- a/src/detail/layout/hierarchical_binning.cpp +++ b/src/detail/layout/hierarchical_binning.cpp @@ -18,7 +18,7 @@ #include // for next_multiple_of_64 #include // for HIBF_WORKAROUND_GCC_BOGUS_MEMCPY -namespace hibf::layout +namespace seqan::hibf::layout { size_t hierarchical_binning::execute() @@ -400,4 +400,4 @@ void hierarchical_binning::update_max_id(size_t & max_id, } } -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/src/detail/layout/layout.cpp b/src/detail/layout/layout.cpp index 19926bb6..79189014 100644 --- a/src/detail/layout/layout.cpp +++ b/src/detail/layout/layout.cpp @@ -13,12 +13,12 @@ #include #include -namespace hibf::layout +namespace seqan::hibf::layout { -hibf::layout::layout::user_bin parse_layout_line(std::string const & current_line) +seqan::hibf::layout::layout::user_bin parse_layout_line(std::string const & current_line) { - hibf::layout::layout::user_bin result{}; + seqan::hibf::layout::layout::user_bin result{}; size_t tmp{}; // integer buffer when reading numbers @@ -56,7 +56,7 @@ hibf::layout::layout::user_bin parse_layout_line(std::string const & current_lin return result; } -void hibf::layout::layout::read_from(std::istream & stream) +void seqan::hibf::layout::layout::read_from(std::istream & stream) { // parse header auto parse_bin_indices = [](std::string_view const & buffer) @@ -125,7 +125,7 @@ void hibf::layout::layout::read_from(std::istream & stream) user_bins.emplace_back(parse_layout_line(line)); } -void hibf::layout::layout::write_to(std::ostream & stream) const +void seqan::hibf::layout::layout::write_to(std::ostream & stream) const { // write layout header with max bin ids stream << prefix::layout_first_header_line << " " << prefix::layout_fullest_technical_bin_idx @@ -141,4 +141,4 @@ void hibf::layout::layout::write_to(std::ostream & stream) const stream << user_bin << '\n'; } -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/src/detail/layout/simple_binning.cpp b/src/detail/layout/simple_binning.cpp index eb9cf3af..a7544136 100644 --- a/src/detail/layout/simple_binning.cpp +++ b/src/detail/layout/simple_binning.cpp @@ -8,7 +8,7 @@ #include // for layout #include // for simple_binning -namespace hibf::layout +namespace seqan::hibf::layout { size_t simple_binning::execute() @@ -104,4 +104,4 @@ size_t simple_binning::execute() return max_id; } -} // namespace hibf::layout +} // namespace seqan::hibf::layout diff --git a/src/detail/sketch/hyperloglog.cpp b/src/detail/sketch/hyperloglog.cpp index 8f03c308..295c426c 100644 --- a/src/detail/sketch/hyperloglog.cpp +++ b/src/detail/sketch/hyperloglog.cpp @@ -18,7 +18,7 @@ #include // for simde_mm256_add_ps, simde_mm256_set_ps, simde__m256i, simde_mm... #include // for simde_mm256_max_epu8 -namespace hibf::sketch +namespace seqan::hibf::sketch { hyperloglog::hyperloglog(uint8_t b) : m_(1 << b), b_(b), M_(m_, 0) @@ -239,4 +239,4 @@ void hyperloglog::restore(std::istream & is) } } -} // namespace hibf::sketch +} // namespace seqan::hibf::sketch diff --git a/src/detail/sketch/toolbox.cpp b/src/detail/sketch/toolbox.cpp index ad31afe6..551fe034 100644 --- a/src/detail/sketch/toolbox.cpp +++ b/src/detail/sketch/toolbox.cpp @@ -14,7 +14,7 @@ #include // for hyperloglog #include // for clustering_node, entry, neighbor, prio_queue, distance_matrix -namespace hibf::sketch::toolbox +namespace seqan::hibf::sketch::toolbox { void sort_by_cardinalities(std::vector const & sketches, @@ -457,4 +457,4 @@ void trace(std::vector const & clustering, trace(clustering, permutation, previous_rightmost, first, curr.right); } -} // namespace hibf::sketch::toolbox +} // namespace seqan::hibf::sketch::toolbox diff --git a/src/hierarchical_interleaved_bloom_filter.cpp b/src/hierarchical_interleaved_bloom_filter.cpp index c5fa3772..8116c49b 100644 --- a/src/hierarchical_interleaved_bloom_filter.cpp +++ b/src/hierarchical_interleaved_bloom_filter.cpp @@ -35,7 +35,7 @@ #include // for interleaved_bloom_filter #include // for user_bins_type -namespace hibf +namespace seqan::hibf { size_t hierarchical_build(hierarchical_interleaved_bloom_filter & hibf, @@ -172,7 +172,7 @@ size_t hierarchical_build(hierarchical_interleaved_bloom_filter & hibf, void build_index(hierarchical_interleaved_bloom_filter & hibf, config const & config, - hibf::layout::layout & hibf_layout) + seqan::hibf::layout::layout & hibf_layout) { size_t const number_of_ibfs = hibf_layout.max_bins.size() + 1; @@ -214,4 +214,4 @@ hierarchical_interleaved_bloom_filter::hierarchical_interleaved_bloom_filter( build_index(*this, configuration, hibf_layout); } -} // namespace hibf +} // namespace seqan::hibf diff --git a/test/include/hibf/test/bytes.hpp b/test/include/hibf/test/bytes.hpp index 93176cf8..e5b753f2 100644 --- a/test/include/hibf/test/bytes.hpp +++ b/test/include/hibf/test/bytes.hpp @@ -14,7 +14,7 @@ #include -namespace hibf::test +namespace seqan::hibf::test { inline namespace literals @@ -34,4 +34,4 @@ static constexpr size_t operator""_GiB(unsigned long long int const number) noex } // namespace literals -} // namespace hibf::test +} // namespace seqan::hibf::test diff --git a/test/include/hibf/test/expect_range_eq.hpp b/test/include/hibf/test/expect_range_eq.hpp index 44527057..4de95d8e 100644 --- a/test/include/hibf/test/expect_range_eq.hpp +++ b/test/include/hibf/test/expect_range_eq.hpp @@ -24,10 +24,10 @@ #include -namespace hibf::test +namespace seqan::hibf::test { struct expect_range_eq; -} // namespace hibf::test +} // namespace seqan::hibf::test namespace std { @@ -42,10 +42,10 @@ void PrintTo(t const & value, std::ostream * out) } // namespace std -namespace hibf::test +namespace seqan::hibf::test { -#define EXPECT_RANGE_EQ(val1, val2) EXPECT_PRED_FORMAT2(::hibf::test::expect_range_eq{}, val1, val2); +#define EXPECT_RANGE_EQ(val1, val2) EXPECT_PRED_FORMAT2(::seqan::hibf::test::expect_range_eq{}, val1, val2); struct expect_range_eq { @@ -72,4 +72,4 @@ struct expect_range_eq } }; -} // namespace hibf::test +} // namespace seqan::hibf::test diff --git a/test/include/hibf/test/expect_same_type.hpp b/test/include/hibf/test/expect_same_type.hpp index 04fcbc5a..81925f00 100644 --- a/test/include/hibf/test/expect_same_type.hpp +++ b/test/include/hibf/test/expect_same_type.hpp @@ -22,7 +22,7 @@ #include // IWYU pragma: keep -namespace hibf::test +namespace seqan::hibf::test { struct expect_same_type; @@ -34,7 +34,7 @@ struct expect_same_type; #define EXPECT_SAME_TYPE_VANEXPECT_SAME_TYPE_ISH #define EXPECT_SAME_TYPE(val1, val2) \ - EXPECT_PRED_FORMAT2(::hibf::test::expect_same_type{}, \ + EXPECT_PRED_FORMAT2(::seqan::hibf::test::expect_same_type{}, \ (std::type_identity{}), \ (std::type_identity{})); @@ -64,9 +64,9 @@ struct expect_same_type return ::testing::internal::CmpHelperEQFailure(remove_wrap_type_identity(lhs_expression).c_str(), remove_wrap_type_identity(rhs_expression).c_str(), - hibf::detail::type_name_as_string, - hibf::detail::type_name_as_string); + seqan::hibf::detail::type_name_as_string, + seqan::hibf::detail::type_name_as_string); } }; -} // namespace hibf::test +} // namespace seqan::hibf::test diff --git a/test/include/hibf/test/file_access.hpp b/test/include/hibf/test/file_access.hpp index 5bfef773..d2c8e423 100644 --- a/test/include/hibf/test/file_access.hpp +++ b/test/include/hibf/test/file_access.hpp @@ -17,7 +17,7 @@ #include -namespace hibf::test +namespace seqan::hibf::test { //!\brief Checks wheter there is read access to a path. @@ -53,4 +53,4 @@ inline bool write_access(std::filesystem::path const & file) } } -} // namespace hibf::test +} // namespace seqan::hibf::test diff --git a/test/include/hibf/test/sandboxed_path.hpp b/test/include/hibf/test/sandboxed_path.hpp index d3e7bf4a..7d640568 100644 --- a/test/include/hibf/test/sandboxed_path.hpp +++ b/test/include/hibf/test/sandboxed_path.hpp @@ -6,7 +6,7 @@ // ------------------------------------------------------------------------------------------------------------ /*!\file - * \brief Provides hibf::test::sandboxed_path and related free functions. + * \brief Provides seqan::hibf::test::sandboxed_path and related free functions. * \author Enrico Seiler */ @@ -19,18 +19,18 @@ #include -namespace hibf::test +namespace seqan::hibf::test { /*!\brief Utility class to stay inside a sandbox path. * - * hibf::sandboxed_path provides the same functionality as std::filesystem::path, but restricts + * seqan::hibf::sandboxed_path provides the same functionality as std::filesystem::path, but restricts * the access to a specified directory. This results in the following invariant, which is checked * for at appropiate places, and some caveats. * * Invariant: - * - hibf::sandboxed_path is always converted to an absolute path - * - hibf::sandboxed_path always points to a file or directory inside a given sandbox directory + * - seqan::hibf::sandboxed_path is always converted to an absolute path + * - seqan::hibf::sandboxed_path always points to a file or directory inside a given sandbox directory * - The sandbox directory is immutable during the life cycle of a sandboxed_path * * Caveat: @@ -455,11 +455,11 @@ class sandboxed_path : public std::filesystem::path void clear() = delete; //!< Not implemented. Invariant requires the path to be an absolute path. }; -/*!\brief Append a path to a hibf::test::sanboxed_path. +/*!\brief Append a path to a seqan::hibf::test::sanboxed_path. * \tparam path_t The type of the path to append. - * \param lhs The hibf::test::sandboxed_path. + * \param lhs The seqan::hibf::test::sandboxed_path. * \param rhs The path to append. - * \relates hibf::test::sandboxed_path * + * \relates seqan::hibf::test::sandboxed_path * * * This work the same as std::filesystem::operator/(std::filesystem::path&) * and additionally checks the invariant. @@ -471,4 +471,4 @@ sandboxed_path operator/(sandboxed_path lhs, Rhs const & rhs) return lhs; } -} // namespace hibf::test +} // namespace seqan::hibf::test diff --git a/test/include/hibf/test/temporary_snippet_file.hpp b/test/include/hibf/test/temporary_snippet_file.hpp index d106e021..9169b892 100644 --- a/test/include/hibf/test/temporary_snippet_file.hpp +++ b/test/include/hibf/test/temporary_snippet_file.hpp @@ -20,7 +20,7 @@ #include // for sandboxed_path, operator/ #include // for tmp_directory -namespace hibf::test +namespace seqan::hibf::test { class temporary_snippet_file @@ -46,7 +46,7 @@ class temporary_snippet_file } private: - static inline hibf::test::tmp_directory const tmp_folder{}; + static inline seqan::hibf::test::tmp_directory const tmp_folder{}; }; -} // namespace hibf::test +} // namespace seqan::hibf::test diff --git a/test/include/hibf/test/tmp_directory.hpp b/test/include/hibf/test/tmp_directory.hpp index 8d1ec00d..51010c3f 100644 --- a/test/include/hibf/test/tmp_directory.hpp +++ b/test/include/hibf/test/tmp_directory.hpp @@ -33,7 +33,7 @@ #include #include // for sandboxed_path -namespace hibf::test +namespace seqan::hibf::test { #if defined(_WIN32) namespace @@ -138,7 +138,7 @@ class tmp_directory //!\} /*!\brief Returns a reference to the path object. - * \return hibf::test::sandboxed_path containing the path of the file. + * \return seqan::hibf::test::sandboxed_path containing the path of the file. */ sandboxed_path path() const { @@ -177,4 +177,4 @@ class tmp_directory std::optional directory_path; }; -} // namespace hibf::test +} // namespace seqan::hibf::test diff --git a/test/include/hibf/test/type_name_as_string.hpp b/test/include/hibf/test/type_name_as_string.hpp index 3eaab3b4..e6bfcf4b 100644 --- a/test/include/hibf/test/type_name_as_string.hpp +++ b/test/include/hibf/test/type_name_as_string.hpp @@ -26,7 +26,7 @@ #include -namespace hibf::detail +namespace seqan::hibf::detail { /*!\brief Defines the human-readable name of the given type using the @@ -85,4 +85,4 @@ inline std::string const type_name_as_string = []() return demangled_name; }(); -} // namespace hibf::detail +} // namespace seqan::hibf::detail diff --git a/test/performance/ibf/interleaved_bloom_filter_benchmark.cpp b/test/performance/ibf/interleaved_bloom_filter_benchmark.cpp index 02d336fa..38f3fb48 100644 --- a/test/performance/ibf/interleaved_bloom_filter_benchmark.cpp +++ b/test/performance/ibf/interleaved_bloom_filter_benchmark.cpp @@ -64,9 +64,9 @@ auto set_up(::benchmark::State const & state) std::vector const bin_indices{generate(bins - 1)}; std::vector const hash_values{generate()}; - hibf::interleaved_bloom_filter ibf{hibf::bin_count{bins}, - hibf::bin_size{bits}, - hibf::hash_function_count{hash_num}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{bins}, + seqan::hibf::bin_size{bits}, + seqan::hibf::hash_function_count{hash_num}}; return std::make_tuple(bin_indices, hash_values, ibf); } @@ -78,7 +78,7 @@ void emplace_benchmark(::benchmark::State & state) for (auto _ : state) { for (auto [hash, bin] : seqan::std::views::zip(hash_values, bin_indices)) - ibf.emplace(hash, hibf::bin_index{bin}); + ibf.emplace(hash, seqan::hibf::bin_index{bin}); } state.counters["hashes/sec"] = hashes_per_second(std::ranges::size(hash_values)); @@ -90,13 +90,13 @@ void clear_benchmark(::benchmark::State & state) (void)bin_indices; (void)hash_values; - std::vector bin_range = std::views::iota(0u, static_cast(state.range(0))) - | std::views::transform( - [](size_t i) - { - return hibf::bin_index{i}; - }) - | seqan::std::ranges::to(); + std::vector bin_range = std::views::iota(0u, static_cast(state.range(0))) + | std::views::transform( + [](size_t i) + { + return seqan::hibf::bin_index{i}; + }) + | seqan::std::ranges::to(); for (auto _ : state) { @@ -113,13 +113,13 @@ void clear_range_benchmark(::benchmark::State & state) (void)bin_indices; (void)hash_values; - std::vector bin_range = std::views::iota(0u, static_cast(state.range(0))) - | std::views::transform( - [](size_t i) - { - return hibf::bin_index{i}; - }) - | seqan::std::ranges::to(); + std::vector bin_range = std::views::iota(0u, static_cast(state.range(0))) + | std::views::transform( + [](size_t i) + { + return seqan::hibf::bin_index{i}; + }) + | seqan::std::ranges::to(); for (auto _ : state) { @@ -134,7 +134,7 @@ void bulk_contains_benchmark(::benchmark::State & state) auto && [bin_indices, hash_values, ibf] = set_up(state); for (auto [hash, bin] : seqan::std::views::zip(hash_values, bin_indices)) - ibf.emplace(hash, hibf::bin_index{bin}); + ibf.emplace(hash, seqan::hibf::bin_index{bin}); auto agent = ibf.membership_agent(); for (auto _ : state) @@ -154,7 +154,7 @@ void bulk_count_benchmark(::benchmark::State & state) auto && [bin_indices, hash_values, ibf] = set_up(state); for (auto [hash, bin] : seqan::std::views::zip(hash_values, bin_indices)) - ibf.emplace(hash, hibf::bin_index{bin}); + ibf.emplace(hash, seqan::hibf::bin_index{bin}); auto agent = ibf.counting_agent(); for (auto _ : state) diff --git a/test/snippet/hibf/bin_indices_of_ibf.cpp b/test/snippet/hibf/bin_indices_of_ibf.cpp index dd64ae6e..75b8a5bb 100644 --- a/test/snippet/hibf/bin_indices_of_ibf.cpp +++ b/test/snippet/hibf/bin_indices_of_ibf.cpp @@ -33,7 +33,7 @@ void print_range(range_t && range) int main() { - hibf::hierarchical_interleaved_bloom_filter hibf{}; + seqan::hibf::hierarchical_interleaved_bloom_filter hibf{}; hibf.user_bins.set_ibf_count(2); diff --git a/test/snippet/test/tmp_directory.cpp b/test/snippet/test/tmp_directory.cpp index 44b9aacc..b7df5151 100644 --- a/test/snippet/test/tmp_directory.cpp +++ b/test/snippet/test/tmp_directory.cpp @@ -7,7 +7,7 @@ TEST(snippet_tmp_directory, tmp_directory_) { // create a directory folder - hibf::test::tmp_directory tmp{}; + seqan::hibf::test::tmp_directory tmp{}; // Some function that should creates temporary files and removes them again { diff --git a/test/unit/hibf/config_test.cpp b/test/unit/hibf/config_test.cpp index ec2eb853..48b5c04f 100644 --- a/test/unit/hibf/config_test.cpp +++ b/test/unit/hibf/config_test.cpp @@ -12,7 +12,7 @@ TEST(config_test, write_to) { std::stringstream ss{}; - hibf::config configuration; + seqan::hibf::config configuration; configuration.number_of_user_bins = 123456789; configuration.number_of_hash_functions = 4; @@ -71,7 +71,7 @@ TEST(config_test, read_from) "@}\n" "@HIBF_CONFIG_END\n"}; - hibf::config configuration; + seqan::hibf::config configuration; configuration.read_from(ss); EXPECT_EQ(configuration.number_of_user_bins, 123456789); @@ -113,7 +113,7 @@ TEST(config_test, read_from_with_more_meta) "@}\n" "@HIBF_CONFIG_END\n"}; - hibf::config configuration; + seqan::hibf::config configuration; configuration.read_from(ss); EXPECT_EQ(configuration.number_of_user_bins, 123456789); diff --git a/test/unit/hibf/detail/layout/fpr_correction_test.cpp b/test/unit/hibf/detail/layout/fpr_correction_test.cpp index 2c21c027..26fc09fe 100644 --- a/test/unit/hibf/detail/layout/fpr_correction_test.cpp +++ b/test/unit/hibf/detail/layout/fpr_correction_test.cpp @@ -8,7 +8,7 @@ TEST(fp_correction_test, one_bin) { - auto fp_correction = hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2u, .t_max = 8u}); + auto fp_correction = seqan::hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2u, .t_max = 8u}); std::vector const values{9123, 123, 12, 87123, 8123, 4660}; @@ -19,7 +19,7 @@ TEST(fp_correction_test, one_bin) TEST(fp_correction_test, example_split) { - auto fp_correction = hibf::layout::compute_fpr_correction({.fpr = 0.01, .hash_count = 5u, .t_max = 256u}); + auto fp_correction = seqan::hibf::layout::compute_fpr_correction({.fpr = 0.01, .hash_count = 5u, .t_max = 256u}); double const abs_error = 0.00001; EXPECT_NEAR(fp_correction[1], 1.0, abs_error); diff --git a/test/unit/hibf/detail/layout/hierarchical_binning_test.cpp b/test/unit/hibf/detail/layout/hierarchical_binning_test.cpp index 61b76ebc..7a84f73e 100644 --- a/test/unit/hibf/detail/layout/hierarchical_binning_test.cpp +++ b/test/unit/hibf/detail/layout/hierarchical_binning_test.cpp @@ -12,29 +12,30 @@ TEST(hierarchical_binning_test, small_example) { - hibf::config config; + seqan::hibf::config config; config.tmax = 4; config.disable_estimate_union = true; // also disables rearrangement - hibf::layout::layout hibf_layout{}; + seqan::hibf::layout::layout hibf_layout{}; std::vector kmer_counts{500, 1000, 500, 500, 500, 500, 500, 500}; - hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; - data.fpr_correction = hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); - hibf::layout::hierarchical_binning algo{data, config}; + data.fpr_correction = + seqan::hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); + seqan::hibf::layout::hierarchical_binning algo{data, config}; EXPECT_EQ(algo.execute(), 1u); // #HIGH_LEVEL_IBF max_bin_id:3 - std::vector expected_max_bins{{{1}, 22}, {{2}, 22}}; + std::vector expected_max_bins{{{1}, 22}, {{2}, 22}}; - std::vector expected_user_bins{{7, {}, 1, 0}, - {4, {1}, 22, 0}, - {5, {1}, 21, 22}, - {6, {1}, 21, 43}, - {0, {2}, 22, 0}, - {2, {2}, 21, 22}, - {3, {2}, 21, 43}, - {1, {}, 1, 3}}; + std::vector expected_user_bins{{7, {}, 1, 0}, + {4, {1}, 22, 0}, + {5, {1}, 21, 22}, + {6, {1}, 21, 43}, + {0, {2}, 22, 0}, + {2, {2}, 21, 22}, + {3, {2}, 21, 43}, + {1, {}, 1, 3}}; EXPECT_RANGE_EQ(hibf_layout.max_bins, expected_max_bins); EXPECT_RANGE_EQ(hibf_layout.user_bins, expected_user_bins); @@ -42,29 +43,30 @@ TEST(hierarchical_binning_test, small_example) TEST(hierarchical_binning_test, another_example) { - hibf::config config; + seqan::hibf::config config; config.tmax = 5; config.disable_estimate_union = true; // also disables rearrangement - hibf::layout::layout hibf_layout{}; + seqan::hibf::layout::layout hibf_layout{}; std::vector kmer_counts{50, 1000, 1000, 50, 5, 10, 10, 5}; - hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; - data.fpr_correction = hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); + data.fpr_correction = + seqan::hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); - hibf::layout::hierarchical_binning algo{data, config}; + seqan::hibf::layout::hierarchical_binning algo{data, config}; EXPECT_EQ(algo.execute(), 1u); // #HIGH_LEVEL_IBF max_bin_id:1 - std::vector expected_max_bins{{{0, 0}, 56}, {{0}, 0}}; + std::vector expected_max_bins{{{0, 0}, 56}, {{0}, 0}}; - std::vector expected_user_bins{{6, {0, 0}, 42, 0}, - {5, {0, 0}, 14, 42}, - {7, {0, 0}, 4, 56}, - {4, {0, 0}, 4, 60}, - {0, {0}, 2, 1}, - {3, {0}, 2, 3}, - {2, {}, 2, 1}, - {1, {}, 2, 3}}; + std::vector expected_user_bins{{6, {0, 0}, 42, 0}, + {5, {0, 0}, 14, 42}, + {7, {0, 0}, 4, 56}, + {4, {0, 0}, 4, 60}, + {0, {0}, 2, 1}, + {3, {0}, 2, 3}, + {2, {}, 2, 1}, + {1, {}, 2, 3}}; EXPECT_RANGE_EQ(hibf_layout.max_bins, expected_max_bins); EXPECT_RANGE_EQ(hibf_layout.user_bins, expected_user_bins); @@ -72,50 +74,52 @@ TEST(hierarchical_binning_test, another_example) TEST(hierarchical_binning_test, high_level_max_bin_id_is_0) { - hibf::config config; + seqan::hibf::config config; config.tmax = 4; config.disable_estimate_union = true; // also disables rearrangement - hibf::layout::layout hibf_layout{}; + seqan::hibf::layout::layout hibf_layout{}; std::vector kmer_counts{500, 500, 500, 500}; - hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; - data.fpr_correction = hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); + data.fpr_correction = + seqan::hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); - hibf::layout::hierarchical_binning algo{data, config}; + seqan::hibf::layout::hierarchical_binning algo{data, config}; EXPECT_EQ(algo.execute(), 0u); // #HIGH_LEVEL_IBF max_bin_id:1 - std::vector expected_user_bins{{3, {}, 1, 0}, - {2, {}, 1, 1}, - {1, {}, 1, 2}, - {0, {}, 1, 3}}; + std::vector expected_user_bins{{3, {}, 1, 0}, + {2, {}, 1, 1}, + {1, {}, 1, 2}, + {0, {}, 1, 3}}; EXPECT_RANGE_EQ(hibf_layout.user_bins, expected_user_bins); } TEST(hierarchical_binning_test, knuts_example) { - hibf::config config; + seqan::hibf::config config; config.alpha = 1; config.tmax = 5; config.disable_estimate_union = true; // also disables rearrangement - hibf::layout::layout hibf_layout{}; + seqan::hibf::layout::layout hibf_layout{}; std::vector kmer_counts{60, 600, 1000, 800, 800}; - hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; - data.fpr_correction = hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); + data.fpr_correction = + seqan::hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); - hibf::layout::hierarchical_binning algo{data, config}; + seqan::hibf::layout::hierarchical_binning algo{data, config}; EXPECT_EQ(algo.execute(), 1u); - std::vector expected_max_bins{{{0}, 63}}; + std::vector expected_max_bins{{{0}, 63}}; - std::vector expected_user_bins{{1, {0}, 63, 0}, - {0, {0}, 1, 63}, - {4, {}, 1, 1}, - {3, {}, 1, 2}, - {2, {}, 2, 3}}; + std::vector expected_user_bins{{1, {0}, 63, 0}, + {0, {0}, 1, 63}, + {4, {}, 1, 1}, + {3, {}, 1, 2}, + {2, {}, 2, 3}}; EXPECT_RANGE_EQ(hibf_layout.max_bins, expected_max_bins); EXPECT_RANGE_EQ(hibf_layout.user_bins, expected_user_bins); @@ -123,30 +127,31 @@ TEST(hierarchical_binning_test, knuts_example) TEST(hierarchical_binning_test, four_level_hibf) { - hibf::config config; + seqan::hibf::config config; config.tmax = 2; config.disable_estimate_union = true; // also disables rearrangement - hibf::layout::layout hibf_layout{}; + seqan::hibf::layout::layout hibf_layout{}; std::vector kmer_counts{11090, 5080, 3040, 1020, 510, 500}; - hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; - data.fpr_correction = hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); + data.fpr_correction = + seqan::hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); - hibf::layout::hierarchical_binning algo{data, config}; + seqan::hibf::layout::hierarchical_binning algo{data, config}; EXPECT_EQ(algo.execute(), 1u); // #HIGH_LEVEL_IBF max_bin_id:1 - std::vector expected_max_bins{{{0, 0, 0, 0}, 33}, - {{0, 0, 0}, 1}, - {{0, 0}, 1}, - {{0}, 1}}; + std::vector expected_max_bins{{{0, 0, 0, 0}, 33}, + {{0, 0, 0}, 1}, + {{0, 0}, 1}, + {{0}, 1}}; - std::vector expected_user_bins{{4, {0, 0, 0, 0}, 33, 0}, - {5, {0, 0, 0, 0}, 31, 33}, - {3, {0, 0, 0}, 1, 1}, - {2, {0, 0}, 1, 1}, - {1, {0}, 1, 1}, - {0, {}, 1, 1}}; + std::vector expected_user_bins{{4, {0, 0, 0, 0}, 33, 0}, + {5, {0, 0, 0, 0}, 31, 33}, + {3, {0, 0, 0}, 1, 1}, + {2, {0, 0}, 1, 1}, + {1, {0}, 1, 1}, + {0, {}, 1, 1}}; EXPECT_RANGE_EQ(hibf_layout.max_bins, expected_max_bins); EXPECT_RANGE_EQ(hibf_layout.user_bins, expected_user_bins); @@ -154,26 +159,27 @@ TEST(hierarchical_binning_test, four_level_hibf) TEST(hierarchical_binning_test, tb0_is_a_merged_bin) { - hibf::config config; + seqan::hibf::config config; config.alpha = 1; config.tmax = 2; config.disable_estimate_union = true; // also disables rearrangement - hibf::layout::layout hibf_layout{}; + seqan::hibf::layout::layout hibf_layout{}; std::vector kmer_counts{500, 500, 500, 500}; - hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; - data.fpr_correction = hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); + data.fpr_correction = + seqan::hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); - hibf::layout::hierarchical_binning algo{data, config}; + seqan::hibf::layout::hierarchical_binning algo{data, config}; EXPECT_EQ(algo.execute(), 0u); - std::vector expected_max_bins{{{0}, 0}, {{1}, 0}}; + std::vector expected_max_bins{{{0}, 0}, {{1}, 0}}; - std::vector expected_user_bins{{2, {0}, 32, 0}, - {3, {0}, 32, 32}, - {0, {1}, 32, 0}, - {1, {1}, 32, 32}}; + std::vector expected_user_bins{{2, {0}, 32, 0}, + {3, {0}, 32, 32}, + {0, {1}, 32, 0}, + {1, {1}, 32, 32}}; EXPECT_RANGE_EQ(hibf_layout.max_bins, expected_max_bins); EXPECT_RANGE_EQ(hibf_layout.user_bins, expected_user_bins); @@ -181,35 +187,36 @@ TEST(hierarchical_binning_test, tb0_is_a_merged_bin) TEST(hierarchical_binning_test, tb0_is_a_merged_bin_and_leads_to_recursive_call) { - hibf::config config; + seqan::hibf::config config; config.alpha = 1; config.tmax = 2; config.disable_estimate_union = true; // also disables rearrangement - hibf::layout::layout hibf_layout{}; + seqan::hibf::layout::layout hibf_layout{}; std::vector kmer_counts{500, 500, 500, 500, 500, 500, 500, 500}; - hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, .kmer_counts = &kmer_counts}; - data.fpr_correction = hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); + data.fpr_correction = + seqan::hibf::layout::compute_fpr_correction({.fpr = 0.05, .hash_count = 2, .t_max = config.tmax}); - hibf::layout::hierarchical_binning algo{data, config}; + seqan::hibf::layout::hierarchical_binning algo{data, config}; EXPECT_EQ(algo.execute(), 0u); - std::vector expected_max_bins{{{0, 0}, 0}, - {{0, 1}, 0}, - {{0}, 0}, - {{1, 0}, 0}, - {{1, 1}, 0}, - {{1}, 0}}; - - std::vector expected_user_bins{{5, {0, 0}, 32, 0}, - {4, {0, 0}, 32, 32}, - {7, {0, 1}, 32, 0}, - {6, {0, 1}, 32, 32}, - {1, {1, 0}, 32, 0}, - {0, {1, 0}, 32, 32}, - {3, {1, 1}, 32, 0}, - {2, {1, 1}, 32, 32}}; + std::vector expected_max_bins{{{0, 0}, 0}, + {{0, 1}, 0}, + {{0}, 0}, + {{1, 0}, 0}, + {{1, 1}, 0}, + {{1}, 0}}; + + std::vector expected_user_bins{{5, {0, 0}, 32, 0}, + {4, {0, 0}, 32, 32}, + {7, {0, 1}, 32, 0}, + {6, {0, 1}, 32, 32}, + {1, {1, 0}, 32, 0}, + {0, {1, 0}, 32, 32}, + {3, {1, 1}, 32, 0}, + {2, {1, 1}, 32, 32}}; EXPECT_RANGE_EQ(hibf_layout.max_bins, expected_max_bins); EXPECT_RANGE_EQ(hibf_layout.user_bins, expected_user_bins); diff --git a/test/unit/hibf/detail/layout/layout_test.cpp b/test/unit/hibf/detail/layout/layout_test.cpp index 3bfa98d6..aeddbe3b 100644 --- a/test/unit/hibf/detail/layout/layout_test.cpp +++ b/test/unit/hibf/detail/layout/layout_test.cpp @@ -13,7 +13,7 @@ TEST(layout_test, printing_max_bins) { std::stringstream ss{}; - hibf::layout::layout layout; + seqan::hibf::layout::layout layout; layout.max_bins.emplace_back(std::vector{}, 0); layout.max_bins.emplace_back(std::vector{2}, 2); @@ -34,7 +34,7 @@ TEST(layout_test, printing_user_bins) { std::stringstream ss{}; - hibf::layout::layout layout; + seqan::hibf::layout::layout layout; layout.user_bins.emplace_back(7, std::vector{}, 1, 0); layout.user_bins.emplace_back(4, std::vector{1}, 22, 0); @@ -55,7 +55,7 @@ TEST(layout_test, write_to) { std::stringstream ss{}; - hibf::layout::layout layout; + seqan::hibf::layout::layout layout; layout.top_level_max_bin_id = 111; layout.max_bins.emplace_back(std::vector{0}, 0); @@ -92,14 +92,14 @@ TEST(layout_test, read_from) 5 1;2;3;4;22 1;1;1;1;21 )layout_file"}; - hibf::layout::layout layout; + seqan::hibf::layout::layout layout; layout.read_from(ss); EXPECT_EQ(layout.top_level_max_bin_id, 111); - EXPECT_EQ(layout.max_bins[0], (hibf::layout::layout::max_bin{{0}, 0})); - EXPECT_EQ(layout.max_bins[1], (hibf::layout::layout::max_bin{{2}, 2})); - EXPECT_EQ(layout.max_bins[2], (hibf::layout::layout::max_bin{{1, 2, 3, 4}, 22})); - EXPECT_EQ(layout.user_bins[0], (hibf::layout::layout::user_bin{7, std::vector{}, 1, 0})); - EXPECT_EQ(layout.user_bins[1], (hibf::layout::layout::user_bin{4, std::vector{1}, 22, 0})); - EXPECT_EQ(layout.user_bins[2], (hibf::layout::layout::user_bin{5, std::vector{1, 2, 3, 4}, 21, 22})); + EXPECT_EQ(layout.max_bins[0], (seqan::hibf::layout::layout::max_bin{{0}, 0})); + EXPECT_EQ(layout.max_bins[1], (seqan::hibf::layout::layout::max_bin{{2}, 2})); + EXPECT_EQ(layout.max_bins[2], (seqan::hibf::layout::layout::max_bin{{1, 2, 3, 4}, 22})); + EXPECT_EQ(layout.user_bins[0], (seqan::hibf::layout::layout::user_bin{7, std::vector{}, 1, 0})); + EXPECT_EQ(layout.user_bins[1], (seqan::hibf::layout::layout::user_bin{4, std::vector{1}, 22, 0})); + EXPECT_EQ(layout.user_bins[2], (seqan::hibf::layout::layout::user_bin{5, std::vector{1, 2, 3, 4}, 21, 22})); } diff --git a/test/unit/hibf/detail/layout/simple_binning_test.cpp b/test/unit/hibf/detail/layout/simple_binning_test.cpp index 13e525fe..0038f6cf 100644 --- a/test/unit/hibf/detail/layout/simple_binning_test.cpp +++ b/test/unit/hibf/detail/layout/simple_binning_test.cpp @@ -11,17 +11,20 @@ TEST(simple_binning_test, small_example) { - hibf::layout::layout hibf_layout; + seqan::hibf::layout::layout hibf_layout; std::vector kmer_counts{100, 40, 20, 20}; - hibf::data_store data{.hibf_layout = &hibf_layout, - .kmer_counts = &kmer_counts, - .fpr_correction = std::vector(65, 1.0)}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, + .kmer_counts = &kmer_counts, + .fpr_correction = std::vector(65, 1.0)}; - hibf::layout::simple_binning algo{data, 9}; + seqan::hibf::layout::simple_binning algo{data, 9}; size_t max_bin = algo.execute(); - std::vector expected{{3, {}, 1, 0}, {2, {}, 1, 1}, {1, {}, 2, 2}, {0, {}, 5, 4}}; + std::vector expected{{3, {}, 1, 0}, + {2, {}, 1, 1}, + {1, {}, 2, 2}, + {0, {}, 5, 4}}; EXPECT_RANGE_EQ(hibf_layout.user_bins, expected); EXPECT_EQ(max_bin, 0u); @@ -29,17 +32,20 @@ TEST(simple_binning_test, small_example) TEST(simple_binning_test, uniform_distribution) { - hibf::layout::layout hibf_layout; + seqan::hibf::layout::layout hibf_layout; std::vector kmer_counts{20, 20, 20, 20}; - hibf::data_store data{.hibf_layout = &hibf_layout, - .kmer_counts = &kmer_counts, - .fpr_correction = std::vector(65, 1.0)}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, + .kmer_counts = &kmer_counts, + .fpr_correction = std::vector(65, 1.0)}; - hibf::layout::simple_binning algo{data, 4u}; + seqan::hibf::layout::simple_binning algo{data, 4u}; size_t max_bin = algo.execute(); - std::vector expected{{3, {}, 1, 0}, {2, {}, 1, 1}, {1, {}, 1, 2}, {0, {}, 1, 3}}; + std::vector expected{{3, {}, 1, 0}, + {2, {}, 1, 1}, + {1, {}, 1, 2}, + {0, {}, 1, 3}}; EXPECT_RANGE_EQ(hibf_layout.user_bins, expected); EXPECT_EQ(max_bin, 0u); @@ -47,13 +53,13 @@ TEST(simple_binning_test, uniform_distribution) TEST(simple_binning_test, user_bins_must_be_smaller_than_technical_bins) { - hibf::layout::layout hibf_layout; + seqan::hibf::layout::layout hibf_layout; std::vector kmer_counts{100, 40, 20, 20}; - hibf::data_store data{.hibf_layout = &hibf_layout, - .kmer_counts = &kmer_counts, - .fpr_correction = std::vector(65, 1.0)}; + seqan::hibf::data_store data{.hibf_layout = &hibf_layout, + .kmer_counts = &kmer_counts, + .fpr_correction = std::vector(65, 1.0)}; - EXPECT_THROW((hibf::layout::simple_binning{data, 2}), std::runtime_error); + EXPECT_THROW((seqan::hibf::layout::simple_binning{data, 2}), std::runtime_error); } diff --git a/test/unit/hibf/detail/sketch/estimate_kmer_counts_test.cpp b/test/unit/hibf/detail/sketch/estimate_kmer_counts_test.cpp index da00727d..d7b64543 100644 --- a/test/unit/hibf/detail/sketch/estimate_kmer_counts_test.cpp +++ b/test/unit/hibf/detail/sketch/estimate_kmer_counts_test.cpp @@ -33,7 +33,7 @@ TEST(estimate_kmer_counts_test, small_example) uint8_t const kmer_size{19}; size_t const b = 12; - hibf::sketch::hyperloglog sketch(b); + seqan::hibf::sketch::hyperloglog sketch(b); for (std::string_view seq : input_sequences) { @@ -48,10 +48,10 @@ TEST(estimate_kmer_counts_test, small_example) } } - std::vector sketches{sketch, sketch}; + std::vector sketches{sketch, sketch}; std::vector kmer_counts; - hibf::sketch::estimate_kmer_counts(sketches, kmer_counts); + seqan::hibf::sketch::estimate_kmer_counts(sketches, kmer_counts); ASSERT_EQ(kmer_counts.size(), 2); EXPECT_EQ(kmer_counts[0], 581); diff --git a/test/unit/hibf/detail/sketch/hyperloglog_test.cpp b/test/unit/hibf/detail/sketch/hyperloglog_test.cpp index 69d5cb6c..9ab3f893 100644 --- a/test/unit/hibf/detail/sketch/hyperloglog_test.cpp +++ b/test/unit/hibf/detail/sketch/hyperloglog_test.cpp @@ -18,9 +18,9 @@ TEST(hyperloglog, bit_widths) { for (uint8_t i : std::views::iota(0u, 4u)) - EXPECT_THROW(hibf::sketch::hyperloglog{i}, std::invalid_argument); + EXPECT_THROW(seqan::hibf::sketch::hyperloglog{i}, std::invalid_argument); - EXPECT_NO_THROW(hibf::sketch::hyperloglog{4u}); + EXPECT_NO_THROW(seqan::hibf::sketch::hyperloglog{4u}); } TEST(hyperloglog, initialization) @@ -28,7 +28,7 @@ TEST(hyperloglog, initialization) size_t const b = 6; size_t const m = 1 << b; - hibf::sketch::hyperloglog sketch(b); + seqan::hibf::sketch::hyperloglog sketch(b); EXPECT_EQ(sketch.registerSize(), m); @@ -42,7 +42,7 @@ TEST(hyperloglog, add_and_estimate_small) { size_t const b = 4; - hibf::sketch::hyperloglog sketch(b); // m = 1 << b + seqan::hibf::sketch::hyperloglog sketch(b); // m = 1 << b // XXH3_64bits hash -> first 4 bits: 0000, rank: 3 sketch.add("bla", 3); @@ -95,7 +95,7 @@ TEST(hyperloglog, add_and_estimate_large) size_t const k = 16; size_t const b = 4; // m = 1 << b - hibf::sketch::hyperloglog sketch(b); + seqan::hibf::sketch::hyperloglog sketch(b); std::unordered_set control; @@ -123,7 +123,7 @@ TEST(hyperloglog, add_and_estimate_small_SIMD) { size_t const b = 5; // m = 1 << b - hibf::sketch::hyperloglog sketch(b); + seqan::hibf::sketch::hyperloglog sketch(b); // XXH3_64bits hash -> first 4 bits: 0000, rank: 3 sketch.add("bla", 3); @@ -142,7 +142,7 @@ TEST(hyperloglog, add_and_estimate_small_SIMD) // XXH3_64bits hash -> first 4 bits: 1000, rank: 2 sketch.add("bladuzel", 8); - hibf::sketch::hyperloglog other{sketch}; + seqan::hibf::sketch::hyperloglog other{sketch}; EXPECT_NEAR(sketch.merge_and_estimate_SIMD(other), 7.89952249, 0.0000001); } @@ -152,11 +152,11 @@ TEST(hyperloglog, merge_and_merge_SIMD) size_t const k = 16; size_t const b = 5; // m = 1 << b - hibf::sketch::hyperloglog full_sketch(b); - hibf::sketch::hyperloglog merge_sketch(b); - hibf::sketch::hyperloglog merge_SIMD_sketch(b); + seqan::hibf::sketch::hyperloglog full_sketch(b); + seqan::hibf::sketch::hyperloglog merge_sketch(b); + seqan::hibf::sketch::hyperloglog merge_SIMD_sketch(b); - std::vector partial_sketches; + std::vector partial_sketches; // put every sequence in this file into the full_sketch // and add a disjointed sketch for every sequence to partial_sketches @@ -190,7 +190,7 @@ TEST(hyperloglog, merge_and_merge_SIMD) TEST(hyperloglog, fail_dump) { - hibf::sketch::hyperloglog sketch{4}; + seqan::hibf::sketch::hyperloglog sketch{4}; std::ofstream ostrm{"hibf_non_existent_outputfile"}; ostrm.close(); EXPECT_THROW(sketch.dump(ostrm), std::runtime_error); @@ -198,28 +198,28 @@ TEST(hyperloglog, fail_dump) TEST(hyperloglog, fail_restore) { - hibf::test::tmp_directory tmp_dir{}; + seqan::hibf::test::tmp_directory tmp_dir{}; std::filesystem::path file_name{tmp_dir.path() / "sketch.hll"}; { uint8_t b{4u}; std::ofstream ostrm{file_name}; ostrm.write((char *)&b, sizeof(b)); } - hibf::sketch::hyperloglog sketch{}; + seqan::hibf::sketch::hyperloglog sketch{}; std::ifstream istrm{file_name}; EXPECT_THROW(sketch.restore(istrm), std::runtime_error); } TEST(hyperloglog, fail_restore_bit_width) { - hibf::test::tmp_directory tmp_dir{}; + seqan::hibf::test::tmp_directory tmp_dir{}; std::filesystem::path file_name{tmp_dir.path() / "wrong.hll"}; { uint8_t b{3u}; std::ofstream ostrm{file_name}; ostrm.write((char *)&b, sizeof(b)); } - hibf::sketch::hyperloglog sketch{}; + seqan::hibf::sketch::hyperloglog sketch{}; std::ifstream istrm{file_name}; EXPECT_THROW(sketch.restore(istrm), std::runtime_error); } @@ -229,8 +229,8 @@ TEST(hyperloglog, dump_and_restore) size_t const k = 16; size_t const b = 4; // m = 1 << b - hibf::sketch::hyperloglog dump_sketch(b); - hibf::sketch::hyperloglog restore_sketch(b); + seqan::hibf::sketch::hyperloglog dump_sketch(b); + seqan::hibf::sketch::hyperloglog restore_sketch(b); // put every sequence in this file into the dump_sketch for (std::string_view seq : input_sequences) @@ -247,7 +247,7 @@ TEST(hyperloglog, dump_and_restore) } // create temp file - hibf::test::tmp_directory tmp_dir{}; + seqan::hibf::test::tmp_directory tmp_dir{}; std::filesystem::path dump_filename{tmp_dir.path() / "dump.hll"}; // dump sketch diff --git a/test/unit/hibf/detail/sketch/toolbox_test.cpp b/test/unit/hibf/detail/sketch/toolbox_test.cpp index a5689c29..d613d058 100644 --- a/test/unit/hibf/detail/sketch/toolbox_test.cpp +++ b/test/unit/hibf/detail/sketch/toolbox_test.cpp @@ -20,9 +20,9 @@ struct toolbox_test : public ::testing::Test std::vector test_filenames{"small.fa", "small.fa", "small2.fa", "small2.fa"}; std::vector test_kmer_counts{500, 600, 700, 800}; std::vector test_positions{0, 1, 2, 3}; - std::vector test_sketches = [this]() + std::vector test_sketches = [this]() { - std::vector result(test_kmer_counts.size()); + std::vector result(test_kmer_counts.size()); std::vector const small_input{ {"ACGATCGACTAGGAGCGATTACGACTGACTACATCTAGCTAGCTAGAGATTCTTCAGAGCTTAGCGATCTCGAGCTATCG" @@ -61,14 +61,14 @@ struct toolbox_test : public ::testing::Test result[2] = result[0]; result[3] = result[0]; - // hibf::sketch::toolbox::read_hll_files_into(data(""), test_filenames, result); + // seqan::hibf::sketch::toolbox::read_hll_files_into(data(""), test_filenames, result); return result; }(); }; TEST_F(toolbox_test, sort_by_cardinalities) { - hibf::sketch::toolbox::sort_by_cardinalities(test_sketches, test_kmer_counts, test_positions); + seqan::hibf::sketch::toolbox::sort_by_cardinalities(test_sketches, test_kmer_counts, test_positions); // filenames do not change EXPECT_RANGE_EQ(test_filenames, (std::vector{"small.fa", "small.fa", "small2.fa", "small2.fa"})); @@ -81,46 +81,46 @@ TEST_F(toolbox_test, precompute_union_estimates_for) { std::vector estimates(4); - hibf::sketch::toolbox::precompute_union_estimates_for(estimates, - test_sketches, - test_kmer_counts, - test_positions, - 0); + seqan::hibf::sketch::toolbox::precompute_union_estimates_for(estimates, + test_sketches, + test_kmer_counts, + test_positions, + 0); EXPECT_RANGE_EQ(estimates, (std::vector{500, 0, 0, 0})); - hibf::sketch::toolbox::precompute_union_estimates_for(estimates, - test_sketches, - test_kmer_counts, - test_positions, - 1); + seqan::hibf::sketch::toolbox::precompute_union_estimates_for(estimates, + test_sketches, + test_kmer_counts, + test_positions, + 1); EXPECT_RANGE_EQ(estimates, (std::vector{658, 600, 0, 0})); - hibf::sketch::toolbox::precompute_union_estimates_for(estimates, - test_sketches, - test_kmer_counts, - test_positions, - 2); + seqan::hibf::sketch::toolbox::precompute_union_estimates_for(estimates, + test_sketches, + test_kmer_counts, + test_positions, + 2); EXPECT_RANGE_EQ(estimates, (std::vector{658, 658, 700, 0})); - hibf::sketch::toolbox::precompute_union_estimates_for(estimates, - test_sketches, - test_kmer_counts, - test_positions, - 3); + seqan::hibf::sketch::toolbox::precompute_union_estimates_for(estimates, + test_sketches, + test_kmer_counts, + test_positions, + 3); EXPECT_RANGE_EQ(estimates, (std::vector{658, 658, 658, 800})); } TEST_F(toolbox_test, random_shuffle) { - hibf::sketch::toolbox::prio_queue default_pq{}; - hibf::sketch::toolbox::distance_matrix dist{{0, default_pq}, - {1, default_pq}, - {2, default_pq}, - {3, default_pq}, - {4, default_pq}}; + seqan::hibf::sketch::toolbox::prio_queue default_pq{}; + seqan::hibf::sketch::toolbox::distance_matrix dist{{0, default_pq}, + {1, default_pq}, + {2, default_pq}, + {3, default_pq}, + {4, default_pq}}; robin_hood::unordered_flat_map ids{{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}}; - hibf::sketch::toolbox::random_shuffle(dist, ids); + seqan::hibf::sketch::toolbox::random_shuffle(dist, ids); // since randomness is seeded, the output is deterministic auto [new_pos_0, new_pos_1, new_pos_2, new_pos_3, new_pos_4] = std::make_tuple(3u, 2u, 1u, 0u, 4u); @@ -140,16 +140,16 @@ TEST_F(toolbox_test, random_shuffle) TEST_F(toolbox_test, prune) { - hibf::sketch::toolbox::prio_queue default_pq{}; - hibf::sketch::toolbox::distance_matrix dist{{0, default_pq}, - {1, default_pq}, - {2, default_pq}, - {3, default_pq}, - {4, default_pq}}; + seqan::hibf::sketch::toolbox::prio_queue default_pq{}; + seqan::hibf::sketch::toolbox::distance_matrix dist{{0, default_pq}, + {1, default_pq}, + {2, default_pq}, + {3, default_pq}, + {4, default_pq}}; robin_hood::unordered_flat_map remaining_ids{{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}}; // since remaining_ids contains all_ids, prune shouldn't do anything. All ids are valid. - hibf::sketch::toolbox::prune(dist, remaining_ids); + seqan::hibf::sketch::toolbox::prune(dist, remaining_ids); EXPECT_EQ(remaining_ids[0], 0u); EXPECT_EQ(remaining_ids[1], 1u); @@ -169,7 +169,7 @@ TEST_F(toolbox_test, prune) // distance entry 1 and 3 are now invalid, since they do not occur in remaining_ids // prune() should therefore remove them from dist. - hibf::sketch::toolbox::prune(dist, remaining_ids); + seqan::hibf::sketch::toolbox::prune(dist, remaining_ids); EXPECT_EQ(remaining_ids[0], 0u); EXPECT_EQ(remaining_ids[2], 2u); @@ -183,7 +183,8 @@ TEST_F(toolbox_test, prune) TEST_F(toolbox_test, rotate) { - hibf::sketch::hyperloglog s{5}; // default sketch for every entry in the tree as it is not important for rotate + seqan::hibf::sketch::hyperloglog s{ + 5}; // default sketch for every entry in the tree as it is not important for rotate auto f = std::numeric_limits::max(); /* test clustering tree @@ -194,16 +195,16 @@ TEST_F(toolbox_test, rotate) * / \ / \ * (f,f) (f,f) (f,f) (f,f) the leaves are the UBs to be clustered */ - std::vector clustering{{f, f, s}, - {f, f, s}, - {f, f, s}, - {f, f, s}, // the leaves come first - {5, 6, s}, - {0, 1, s}, - {2, 3, s}}; + std::vector clustering{{f, f, s}, + {f, f, s}, + {f, f, s}, + {f, f, s}, // the leaves come first + {5, 6, s}, + {0, 1, s}, + {2, 3, s}}; // previous_rightmost is already at the very left. Nothing has to be rotated. - hibf::sketch::toolbox::rotate(clustering, 0 /*previous_rightmost*/, 0 /*interval_start*/, 4 /*root_id*/); + seqan::hibf::sketch::toolbox::rotate(clustering, 0 /*previous_rightmost*/, 0 /*interval_start*/, 4 /*root_id*/); EXPECT_EQ(std::tie(clustering[0].left, clustering[0].right), std::tie(f, f)); EXPECT_EQ(std::tie(clustering[1].left, clustering[1].right), std::tie(f, f)); @@ -214,7 +215,7 @@ TEST_F(toolbox_test, rotate) EXPECT_EQ(std::tie(clustering[6].left, clustering[6].right), std::make_tuple(2u, 3u)); // now the previous_rightmost is within the tree. Rotation should take place - hibf::sketch::toolbox::rotate(clustering, 2 /*previous_rightmost*/, 0 /*interval_start*/, 4 /*root_id*/); + seqan::hibf::sketch::toolbox::rotate(clustering, 2 /*previous_rightmost*/, 0 /*interval_start*/, 4 /*root_id*/); EXPECT_EQ(std::tie(clustering[0].left, clustering[0].right), std::tie(f, f)); EXPECT_EQ(std::tie(clustering[1].left, clustering[1].right), std::tie(f, f)); @@ -227,7 +228,8 @@ TEST_F(toolbox_test, rotate) TEST_F(toolbox_test, trace) { - hibf::sketch::hyperloglog s{5}; // default sketch for every entry in the tree as it is not important for rotate + seqan::hibf::sketch::hyperloglog s{ + 5}; // default sketch for every entry in the tree as it is not important for rotate auto f = std::numeric_limits::max(); /* test clustering tree @@ -238,21 +240,21 @@ TEST_F(toolbox_test, trace) * / \ / \ * (f,f) (f,f) (f,f) (f,f) the leaves are the UBs to be clustered */ - std::vector clustering{{f, f, s}, - {f, f, s}, - {f, f, s}, - {f, f, s}, // the leaves come first - {5, 6, s}, - {1, 3, s}, - {2, 0, s}}; + std::vector clustering{{f, f, s}, + {f, f, s}, + {f, f, s}, + {f, f, s}, // the leaves come first + {5, 6, s}, + {1, 3, s}, + {2, 0, s}}; std::vector permutation{}; - hibf::sketch::toolbox::trace(clustering, - permutation, - 2 /*previous_rightmost*/, - 0 /*interval_start*/, - 4 /*root_id*/); + seqan::hibf::sketch::toolbox::trace(clustering, + permutation, + 2 /*previous_rightmost*/, + 0 /*interval_start*/, + 4 /*root_id*/); EXPECT_RANGE_EQ(permutation, (std::vector{1, 3, 0})); } @@ -261,34 +263,34 @@ TEST_F(toolbox_test, cluster_bins) { { // whole range std::vector permutation{}; - hibf::sketch::toolbox::cluster_bins(test_sketches, - test_kmer_counts, - test_positions, - permutation, - 0 /*interval start*/, - 3 /*interval_end*/, - 1 /*number of threads*/); + seqan::hibf::sketch::toolbox::cluster_bins(test_sketches, + test_kmer_counts, + test_positions, + permutation, + 0 /*interval start*/, + 3 /*interval_end*/, + 1 /*number of threads*/); // index 3 is not part of current permutation so it can participate in "the next interval" EXPECT_RANGE_EQ(permutation, (std::vector{2, 0, 1})); } { // intervals std::vector permutation{}; - hibf::sketch::toolbox::cluster_bins(test_sketches, - test_kmer_counts, - test_positions, - permutation, - 0 /*interval start*/, - 1 /*interval_end*/, - 1 /*number of threads*/); + seqan::hibf::sketch::toolbox::cluster_bins(test_sketches, + test_kmer_counts, + test_positions, + permutation, + 0 /*interval start*/, + 1 /*interval_end*/, + 1 /*number of threads*/); EXPECT_RANGE_EQ(permutation, (std::vector{0})); - hibf::sketch::toolbox::cluster_bins(test_sketches, - test_kmer_counts, - test_positions, - permutation, - 1 /*interval start*/, - 3 /*interval_end*/, - 1 /*number of threads*/); + seqan::hibf::sketch::toolbox::cluster_bins(test_sketches, + test_kmer_counts, + test_positions, + permutation, + 1 /*interval start*/, + 3 /*interval_end*/, + 1 /*number of threads*/); EXPECT_RANGE_EQ(permutation, (std::vector{0, 1, 2})); } } diff --git a/test/unit/hibf/hierarchical_interleaved_bloom_filter_test.cpp b/test/unit/hibf/hierarchical_interleaved_bloom_filter_test.cpp index 2987de0f..9c931d7b 100644 --- a/test/unit/hibf/hierarchical_interleaved_bloom_filter_test.cpp +++ b/test/unit/hibf/hierarchical_interleaved_bloom_filter_test.cpp @@ -21,16 +21,16 @@ TEST(hibf_test, test_specific_hash_values) // range of range of sequences std::vector> hashes{{1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u}, {1u, 2u, 3u, 4u, 5u}}; - hibf::config config{.input_fn = - [&](size_t const num, hibf::insert_iterator it) - { - for (auto const hash : hashes[num]) - it = hash; - }, - .number_of_user_bins = 2, - .disable_rearrangement = true}; + seqan::hibf::config config{.input_fn = + [&](size_t const num, seqan::hibf::insert_iterator it) + { + for (auto const hash : hashes[num]) + it = hash; + }, + .number_of_user_bins = 2, + .disable_rearrangement = true}; - hibf::hierarchical_interleaved_bloom_filter hibf{config}; + seqan::hibf::hierarchical_interleaved_bloom_filter hibf{config}; { std::vector query{1, 2, 3, 4, 5}; @@ -47,7 +47,7 @@ TEST(hibf_test, build_from_layout) // range of range of sequences std::vector> hashes{{1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u}, {1u, 2u, 3u, 4u, 5u}}; - auto input_fn = [&](size_t const num, hibf::insert_iterator it) + auto input_fn = [&](size_t const num, seqan::hibf::insert_iterator it) { for (auto const hash : hashes[num]) it = hash; @@ -76,7 +76,7 @@ TEST(hibf_test, build_from_layout) "1\t0\t34\n" "0\t34\t30\n"}; - hibf::hierarchical_interleaved_bloom_filter hibf{input_fn, stream}; + seqan::hibf::hierarchical_interleaved_bloom_filter hibf{input_fn, stream}; { std::vector query{1, 2, 3, 4, 5}; @@ -99,34 +99,34 @@ TEST(hibf_test, build_from_layout) // TEST(hibf_seqan3_test, input_sequences_of_sequences) // { -// using namespace hibf::literals; +// using namespace seqan::hibf::literals; -// auto kmer_transformation = hibf::views::kmer_hash(hibf::ungapped{2u}); +// auto kmer_transformation = seqan::hibf::views::kmer_hash(seqan::hibf::ungapped{2u}); // // range of range of sequences -// std::vector>> seqs{{"AAAGGGGGGC"_dna4}, {"TTTTTT"_dna4}}; +// std::vector>> seqs{{"AAAGGGGGGC"_dna4}, {"TTTTTT"_dna4}}; -// hibf::config config +// seqan::hibf::config config // { -// .input = seqs | hibf::views::deep{kmer_transformation}, +// .input = seqs | seqan::hibf::views::deep{kmer_transformation}, // .rearrange_user_bins = false // }; -// hibf::hierarchical_interleaved_bloom_filter hibf{config}; +// seqan::hibf::hierarchical_interleaved_bloom_filter hibf{config}; // auto agent = hibf.membership_agent(); -// std::vector query{"AAGG"_dna4}; +// std::vector query{"AAGG"_dna4}; // auto query_kmers = query | kmer_transformation; // auto result = agent.bulk_contains(query_kmers, 1); -// hibf::debug_stream << result << std::endl; +// seqan::hibf::debug_stream << result << std::endl; // } // TEST(hibf_seqan3_test, input_files) // { -// hibf::test::tmp_directory tmp{}; +// seqan::hibf::test::tmp_directory tmp{}; // std::filesystem::path f1{tmp.path() / "f1.fa"}; // std::filesystem::path f2{tmp.path() / "f2.fa"}; @@ -138,33 +138,33 @@ TEST(hibf_test, build_from_layout) // out2 << ">seq1\nTTTTTT\n"; // } -// auto transform = hibf::views::kmer_hash(hibf::ungapped{2u}); +// auto transform = seqan::hibf::views::kmer_hash(seqan::hibf::ungapped{2u}); // // range of range of sequences // std::vector filenames{f1.string(), f2.string()}; // auto file_range = filenames | std::views::transform([&transform](auto const & f) // { // auto record_transform = std::views::transform([&transform](auto && rec){ return rec.sequence() | transform; }); -// return hibf::detail::all(hibf::sequence_file_input{f}) | record_transform; +// return seqan::hibf::detail::all(seqan::hibf::sequence_file_input{f}) | record_transform; // }); -// hibf::config config +// seqan::hibf::config config // { // .input = file_range, // .rearrange_user_bins = false // }; -// hibf::hierarchical_interleaved_bloom_filter hibf{config}; +// seqan::hibf::hierarchical_interleaved_bloom_filter hibf{config}; // auto agent = hibf.membership_agent(); -// using namespace hibf::literals; +// using namespace seqan::hibf::literals; -// std::vector query{"AAGG"_dna4}; +// std::vector query{"AAGG"_dna4}; // auto result = agent.bulk_contains(query | transform, 1); -// hibf::debug_stream << result << std::endl; // prints [0] since query is found in user bin 0 +// seqan::hibf::debug_stream << result << std::endl; // prints [0] since query is found in user bin 0 // } // #endif // HIBF_HAS_SEQAN3 diff --git a/test/unit/hibf/interleaved_bloom_filter_test.cpp b/test/unit/hibf/interleaved_bloom_filter_test.cpp index 5fa7178b..b3b18e4f 100644 --- a/test/unit/hibf/interleaved_bloom_filter_test.cpp +++ b/test/unit/hibf/interleaved_bloom_filter_test.cpp @@ -22,18 +22,19 @@ template struct interleaved_bloom_filter_test : public ::testing::Test { - static ibf_type make_ibf(hibf::bin_count bins, hibf::bin_size bits) + static ibf_type make_ibf(seqan::hibf::bin_count bins, seqan::hibf::bin_size bits) { - return ibf_type{hibf::interleaved_bloom_filter{bins, bits}}; + return ibf_type{seqan::hibf::interleaved_bloom_filter{bins, bits}}; } - static ibf_type make_ibf(hibf::bin_count bins, hibf::bin_size bits, hibf::hash_function_count funs) + static ibf_type + make_ibf(seqan::hibf::bin_count bins, seqan::hibf::bin_size bits, seqan::hibf::hash_function_count funs) { - return ibf_type{hibf::interleaved_bloom_filter{bins, bits, funs}}; + return ibf_type{seqan::hibf::interleaved_bloom_filter{bins, bits, funs}}; } }; -using ibf_types = ::testing::Types; +using ibf_types = ::testing::Types; TYPED_TEST_SUITE(interleaved_bloom_filter_test, ibf_types, ); @@ -47,31 +48,39 @@ TYPED_TEST(interleaved_bloom_filter_test, construction) EXPECT_TRUE(std::is_destructible_v); // num hash functions defaults to two - TypeParam ibf1{TestFixture::make_ibf(hibf::bin_count{64u}, hibf::bin_size{1024u})}; - TypeParam ibf2{TestFixture::make_ibf(hibf::bin_count{64u}, hibf::bin_size{1024u}, hibf::hash_function_count{2u})}; + TypeParam ibf1{TestFixture::make_ibf(seqan::hibf::bin_count{64u}, seqan::hibf::bin_size{1024u})}; + TypeParam ibf2{TestFixture::make_ibf(seqan::hibf::bin_count{64u}, + seqan::hibf::bin_size{1024u}, + seqan::hibf::hash_function_count{2u})}; EXPECT_TRUE(ibf1 == ibf2); // bin_size parameter is too small - EXPECT_THROW((TestFixture::make_ibf(hibf::bin_count{64u}, hibf::bin_size{0u})), std::logic_error); + EXPECT_THROW((TestFixture::make_ibf(seqan::hibf::bin_count{64u}, seqan::hibf::bin_size{0u})), std::logic_error); // not enough bins - EXPECT_THROW((TestFixture::make_ibf(hibf::bin_count{0u}, hibf::bin_size{32u})), std::logic_error); + EXPECT_THROW((TestFixture::make_ibf(seqan::hibf::bin_count{0u}, seqan::hibf::bin_size{32u})), std::logic_error); // not enough hash functions - EXPECT_THROW((TestFixture::make_ibf(hibf::bin_count{64u}, hibf::bin_size{32u}, hibf::hash_function_count{0u})), + EXPECT_THROW((TestFixture::make_ibf(seqan::hibf::bin_count{64u}, + seqan::hibf::bin_size{32u}, + seqan::hibf::hash_function_count{0u})), std::logic_error); // too many hash functions - EXPECT_THROW((TestFixture::make_ibf(hibf::bin_count{64u}, hibf::bin_size{32u}, hibf::hash_function_count{6u})), + EXPECT_THROW((TestFixture::make_ibf(seqan::hibf::bin_count{64u}, + seqan::hibf::bin_size{32u}, + seqan::hibf::hash_function_count{6u})), std::logic_error); } TYPED_TEST(interleaved_bloom_filter_test, member_getter) { - TypeParam t1{TestFixture::make_ibf(hibf::bin_count{64u}, hibf::bin_size{1024u})}; + TypeParam t1{TestFixture::make_ibf(seqan::hibf::bin_count{64u}, seqan::hibf::bin_size{1024u})}; EXPECT_EQ(t1.bin_count(), 64u); EXPECT_EQ(t1.bin_size(), 1024u); EXPECT_EQ(t1.bit_size(), 65'536ull); EXPECT_EQ(t1.hash_function_count(), 2u); - TypeParam t2{TestFixture::make_ibf(hibf::bin_count{73u}, hibf::bin_size{1019u}, hibf::hash_function_count{3u})}; + TypeParam t2{TestFixture::make_ibf(seqan::hibf::bin_count{73u}, + seqan::hibf::bin_size{1019u}, + seqan::hibf::hash_function_count{3u})}; EXPECT_EQ(t2.bin_count(), 73u); EXPECT_EQ(t2.bin_size(), 1019u); EXPECT_EQ(t2.bit_size(), 130'432ull); @@ -80,7 +89,7 @@ TYPED_TEST(interleaved_bloom_filter_test, member_getter) TYPED_TEST(interleaved_bloom_filter_test, bulk_contains) { - TypeParam ibf{TestFixture::make_ibf(hibf::bin_count{64u}, hibf::bin_size{1024u})}; + TypeParam ibf{TestFixture::make_ibf(seqan::hibf::bin_count{64u}, seqan::hibf::bin_size{1024u})}; std::vector expected(64); // empty bitvector is expected since we did not insert anything auto agent = ibf.membership_agent(); @@ -117,11 +126,13 @@ TYPED_TEST(interleaved_bloom_filter_test, bulk_contains) TYPED_TEST(interleaved_bloom_filter_test, emplace) { // 1. Test uncompressed interleaved_bloom_filter directly because the compressed one is not mutable. - hibf::interleaved_bloom_filter ibf{hibf::bin_count{64u}, hibf::bin_size{1024u}, hibf::hash_function_count{2u}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{64u}, + seqan::hibf::bin_size{1024u}, + seqan::hibf::hash_function_count{2u}}; for (size_t bin_idx : std::views::iota(0, 64)) for (size_t hash : std::views::iota(0, 64)) - ibf.emplace(hash, hibf::bin_index{bin_idx}); + ibf.emplace(hash, seqan::hibf::bin_index{bin_idx}); // 2. Construct either the uncompressed or compressed interleaved_bloom_filter and test set with bulk_contains TypeParam ibf2{ibf}; @@ -137,14 +148,16 @@ TYPED_TEST(interleaved_bloom_filter_test, emplace) TYPED_TEST(interleaved_bloom_filter_test, clear) { // 1. Test uncompressed interleaved_bloom_filter directly because the compressed one is not mutable. - hibf::interleaved_bloom_filter ibf{hibf::bin_count{64u}, hibf::bin_size{1024u}, hibf::hash_function_count{2u}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{64u}, + seqan::hibf::bin_size{1024u}, + seqan::hibf::hash_function_count{2u}}; for (size_t bin_idx : std::views::iota(0, 64)) for (size_t hash : std::views::iota(0, 64)) - ibf.emplace(hash, hibf::bin_index{bin_idx}); + ibf.emplace(hash, seqan::hibf::bin_index{bin_idx}); // 2. Clear a bin - ibf.clear(hibf::bin_index{17u}); + ibf.clear(seqan::hibf::bin_index{17u}); // 3. Construct either the uncompressed or compressed interleaved_bloom_filter and test set with bulk_contains TypeParam ibf2{ibf}; @@ -161,14 +174,18 @@ TYPED_TEST(interleaved_bloom_filter_test, clear) TYPED_TEST(interleaved_bloom_filter_test, clear_range) { // 1. Test uncompressed interleaved_bloom_filter directly because the compressed one is not mutable. - hibf::interleaved_bloom_filter ibf{hibf::bin_count{64u}, hibf::bin_size{1024u}, hibf::hash_function_count{2u}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{64u}, + seqan::hibf::bin_size{1024u}, + seqan::hibf::hash_function_count{2u}}; for (size_t bin_idx : std::views::iota(0, 64)) for (size_t hash : std::views::iota(0, 64)) - ibf.emplace(hash, hibf::bin_index{bin_idx}); + ibf.emplace(hash, seqan::hibf::bin_index{bin_idx}); // 2. Clear a range of bins - std::vector bin_range{hibf::bin_index{8u}, hibf::bin_index{17u}, hibf::bin_index{45u}}; + std::vector bin_range{seqan::hibf::bin_index{8u}, + seqan::hibf::bin_index{17u}, + seqan::hibf::bin_index{45u}}; ibf.clear(bin_range); // 3. Construct either the uncompressed or compressed interleaved_bloom_filter and test set with bulk_contains @@ -188,15 +205,17 @@ TYPED_TEST(interleaved_bloom_filter_test, clear_range) TYPED_TEST(interleaved_bloom_filter_test, counting) { // 1. Test uncompressed interleaved_bloom_filter directly because the compressed one is not mutable. - hibf::interleaved_bloom_filter ibf{hibf::bin_count{128u}, hibf::bin_size{1024u}, hibf::hash_function_count{2u}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{128u}, + seqan::hibf::bin_size{1024u}, + seqan::hibf::hash_function_count{2u}}; for (size_t bin_idx : std::views::iota(0, 128)) for (size_t hash : std::views::iota(0, 128)) - ibf.emplace(hash, hibf::bin_index{bin_idx}); + ibf.emplace(hash, seqan::hibf::bin_index{bin_idx}); // 2. Construct either the uncompressed or compressed interleaved_bloom_filter and test set with bulk_contains TypeParam ibf2{ibf}; - hibf::counting_vector counting(128, 0); + seqan::hibf::counting_vector counting(128, 0); auto agent = ibf2.membership_agent(); for (size_t hash : std::views::iota(0, 128)) // test correct resize for each bin individually { @@ -218,18 +237,20 @@ TYPED_TEST(interleaved_bloom_filter_test, counting) EXPECT_EQ(counting, std::vector(128, 128)); // minus other counting vector - counting -= hibf::counting_vector(128, 128 - 42); + counting -= seqan::hibf::counting_vector(128, 128 - 42); EXPECT_EQ(counting, std::vector(128, 42)); } TYPED_TEST(interleaved_bloom_filter_test, counting_agent) { // 1. Test uncompressed interleaved_bloom_filter directly because the compressed one is not mutable. - hibf::interleaved_bloom_filter ibf{hibf::bin_count{128u}, hibf::bin_size{1024u}, hibf::hash_function_count{2u}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{128u}, + seqan::hibf::bin_size{1024u}, + seqan::hibf::hash_function_count{2u}}; for (size_t bin_idx : std::views::iota(0, 128)) for (size_t hash : std::views::iota(0, 128)) - ibf.emplace(hash, hibf::bin_index{bin_idx}); + ibf.emplace(hash, seqan::hibf::bin_index{bin_idx}); // 2. Construct either the uncompressed or compressed interleaved_bloom_filter and test set with bulk_count TypeParam ibf2{ibf}; @@ -245,15 +266,17 @@ TYPED_TEST(interleaved_bloom_filter_test, counting_agent) TYPED_TEST(interleaved_bloom_filter_test, counting_no_ub) { // 1. Test uncompressed interleaved_bloom_filter directly because the compressed one is not mutable. - hibf::interleaved_bloom_filter ibf{hibf::bin_count{128u}, hibf::bin_size{1024u}, hibf::hash_function_count{2u}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{128u}, + seqan::hibf::bin_size{1024u}, + seqan::hibf::hash_function_count{2u}}; for (size_t bin_idx : std::array{63, 127}) for (size_t hash : std::views::iota(0, 128)) - ibf.emplace(hash, hibf::bin_index{bin_idx}); + ibf.emplace(hash, seqan::hibf::bin_index{bin_idx}); // 2. Construct either the uncompressed or compressed interleaved_bloom_filter and test set with bulk_contains TypeParam ibf2{ibf}; - hibf::counting_vector counting(128, 0); + seqan::hibf::counting_vector counting(128, 0); auto agent = ibf2.membership_agent(); for (size_t hash : std::views::iota(0, 128)) // test correct resize for each bin individually { @@ -276,11 +299,13 @@ TYPED_TEST(interleaved_bloom_filter_test, counting_no_ub) TYPED_TEST(interleaved_bloom_filter_test, counting_agent_no_ub) { // 1. Test uncompressed interleaved_bloom_filter directly because the compressed one is not mutable. - hibf::interleaved_bloom_filter ibf{hibf::bin_count{128u}, hibf::bin_size{1024u}, hibf::hash_function_count{2u}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{128u}, + seqan::hibf::bin_size{1024u}, + seqan::hibf::hash_function_count{2u}}; for (size_t bin_idx : std::array{63, 127}) for (size_t hash : std::views::iota(0, 128)) - ibf.emplace(hash, hibf::bin_index{bin_idx}); + ibf.emplace(hash, seqan::hibf::bin_index{bin_idx}); // 2. Construct either the uncompressed or compressed interleaved_bloom_filter and test set with bulk_contains TypeParam ibf2{ibf}; @@ -296,14 +321,14 @@ TYPED_TEST(interleaved_bloom_filter_test, counting_agent_no_ub) TYPED_TEST(interleaved_bloom_filter_test, increase_bin_number_to) { - hibf::interleaved_bloom_filter ibf1{hibf::bin_count{73u}, hibf::bin_size{1024u}}; - hibf::interleaved_bloom_filter ibf2{ibf1}; + seqan::hibf::interleaved_bloom_filter ibf1{seqan::hibf::bin_count{73u}, seqan::hibf::bin_size{1024u}}; + seqan::hibf::interleaved_bloom_filter ibf2{ibf1}; // 1. Throw if trying to reduce number of bins. - EXPECT_THROW(ibf1.increase_bin_number_to(hibf::bin_count{62u}), std::invalid_argument); + EXPECT_THROW(ibf1.increase_bin_number_to(seqan::hibf::bin_count{62u}), std::invalid_argument); // 2. No change in bin_words implies no change in size. - ibf2.increase_bin_number_to({hibf::bin_count{127u}}); + ibf2.increase_bin_number_to({seqan::hibf::bin_count{127u}}); EXPECT_EQ(ibf1.bit_size(), ibf2.bit_size()); EXPECT_EQ(ibf2.bin_count(), 127u); @@ -311,14 +336,14 @@ TYPED_TEST(interleaved_bloom_filter_test, increase_bin_number_to) auto hashes = std::views::iota(0, 64); for (size_t current_bin : std::views::iota(0, 64)) // test correct resize for each bin individually { - hibf::interleaved_bloom_filter ibf{hibf::bin_count{64u}, hibf::bin_size{1024u}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{64u}, seqan::hibf::bin_size{1024u}}; std::ranges::for_each(hashes, [&ibf, ¤t_bin](auto const h) { - ibf.emplace(h, hibf::bin_index{current_bin}); + ibf.emplace(h, seqan::hibf::bin_index{current_bin}); }); - ibf.increase_bin_number_to(hibf::bin_count{73u}); + ibf.increase_bin_number_to(seqan::hibf::bin_count{73u}); EXPECT_EQ(ibf.bin_count(), 73u); EXPECT_GE(ibf.bit_size(), 1024u); @@ -337,7 +362,7 @@ TYPED_TEST(interleaved_bloom_filter_test, increase_bin_number_to) TYPED_TEST(interleaved_bloom_filter_test, data_access) { - hibf::interleaved_bloom_filter ibf{hibf::bin_count{1024u}, hibf::bin_size{1024u}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{1024u}, seqan::hibf::bin_size{1024u}}; EXPECT_LE(sdsl::size_in_mega_bytes(ibf.raw_data()), 1.0f); } @@ -345,13 +370,13 @@ TYPED_TEST(interleaved_bloom_filter_test, data_access) // MIGRATION_TODO // TYPED_TEST(interleaved_bloom_filter_test, serialisation) // { -// TypeParam ibf{TestFixture::make_ibf(hibf::bin_count{73u}, hibf::bin_size{1024u})}; -// hibf::test::do_serialisation(ibf); +// TypeParam ibf{TestFixture::make_ibf(seqan::hibf::bin_count{73u}, seqan::hibf::bin_size{1024u})}; +// seqan::hibf::test::do_serialisation(ibf); // } // TEST(interleaved_bloom_filter_test, decompression) // { -// hibf::interleaved_bloom_filter ibf{hibf::bin_count{64u}, hibf::bin_size{1024u}}; +// seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{64u}, seqan::hibf::bin_size{1024u}}; // // Only use every other bin. // auto take_odd = [](auto number) @@ -360,11 +385,11 @@ TYPED_TEST(interleaved_bloom_filter_test, data_access) // }; // for (size_t bin_idx : std::views::iota(0, 64) | std::views::filter(take_odd)) // for (size_t hash : std::views::iota(0, 64)) -// ibf.emplace(hash, hibf::bin_index{bin_idx}); +// ibf.emplace(hash, seqan::hibf::bin_index{bin_idx}); -// hibf::interleaved_bloom_filter ibf_compressed{ibf}; +// seqan::hibf::interleaved_bloom_filter ibf_compressed{ibf}; -// hibf::interleaved_bloom_filter ibf_decompressed{ibf_compressed}; +// seqan::hibf::interleaved_bloom_filter ibf_decompressed{ibf_compressed}; // EXPECT_TRUE(ibf == ibf_decompressed); // } diff --git a/test/unit/test/expect_range_eq_test.cpp b/test/unit/test/expect_range_eq_test.cpp index 4c0fd6e8..180dc67d 100644 --- a/test/unit/test/expect_range_eq_test.cpp +++ b/test/unit/test/expect_range_eq_test.cpp @@ -35,7 +35,7 @@ TEST(string_view, range_eq_pass) std::vector expect{'H', 'e', 'l', 'l', 'o'}; std::string_view result{"Hello"}; - auto && expect_result = hibf::test::expect_range_eq{}("expect", "result", expect, result); + auto && expect_result = seqan::hibf::test::expect_range_eq{}("expect", "result", expect, result); EXPECT_TRUE(expect_result); EXPECT_RANGE_EQ(expect, result); } @@ -52,7 +52,7 @@ TEST(string_view, range_eq_fail) std::vector expect{'H', 'e', 'l', '\n', 'l', 'o'}; std::string_view result{"Hello!"}; - auto && expect_result = hibf::test::expect_range_eq{}("expect", "result", expect, result); + auto && expect_result = seqan::hibf::test::expect_range_eq{}("expect", "result", expect, result); EXPECT_FALSE(expect_result); EXPECT_STREQ(error_message, expect_result.message()); EXPECT_NONFATAL_FAILURE(EXPECT_RANGE_EQ(expect, result), error_message); @@ -64,7 +64,7 @@ TEST(span, range_eq_pass) std::vector source{-2, -1, 0, 1, 2, 3, 4, 5, 6}; std::span result{source.begin() + 2, 5}; - auto && expect_result = hibf::test::expect_range_eq{}("expect", "result", expect, result); + auto && expect_result = seqan::hibf::test::expect_range_eq{}("expect", "result", expect, result); EXPECT_TRUE(expect_result); EXPECT_RANGE_EQ(expect, result); } @@ -81,7 +81,7 @@ TEST(span, range_eq_fail) std::vector source{-2, -1, 0, 1, 2, 3, 4, 5, 6}; std::span result{source.begin() + 1, 7}; - auto && expect_result = hibf::test::expect_range_eq{}("expect", "result", expect, result); + auto && expect_result = seqan::hibf::test::expect_range_eq{}("expect", "result", expect, result); EXPECT_FALSE(expect_result); EXPECT_STREQ(error_message, expect_result.message()); @@ -144,7 +144,7 @@ TEST(input_range, range_eq_pass) { input_range result{}; - auto && expect_result = hibf::test::expect_range_eq{}("expect", "result", expect, result); + auto && expect_result = seqan::hibf::test::expect_range_eq{}("expect", "result", expect, result); EXPECT_TRUE(expect_result); } @@ -166,7 +166,7 @@ TEST(input_range, range_eq_fail) { input_range result{}; - auto && expect_result = hibf::test::expect_range_eq{}("expect", "result", expect, result); + auto && expect_result = seqan::hibf::test::expect_range_eq{}("expect", "result", expect, result); EXPECT_FALSE(expect_result); EXPECT_STREQ(error_message, expect_result.message()); } diff --git a/test/unit/test/expect_same_type_test.cpp b/test/unit/test/expect_same_type_test.cpp index 7aedeb84..cd1e6c57 100644 --- a/test/unit/test/expect_same_type_test.cpp +++ b/test/unit/test/expect_same_type_test.cpp @@ -25,10 +25,10 @@ TEST(expect_same_type, braces_with_many_commas) TEST(int, same_type_pass) { - auto && expect_result = hibf::test::expect_same_type{}("std::type_identity< decltype(0)>{}", - "std::type_identity< int>{}", - std::type_identity{}, - std::type_identity{}); + auto && expect_result = seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(0)>{}", + "std::type_identity< int>{}", + std::type_identity{}, + std::type_identity{}); EXPECT_TRUE(expect_result); EXPECT_SAME_TYPE(decltype(0), int); } @@ -41,10 +41,10 @@ TEST(int, same_type_fail) " unsigned\n" " Which is: \"unsigned int\""; - auto && expect_result = hibf::test::expect_same_type{}("std::type_identity< decltype(0)>{}", - "std::type_identity< unsigned>{}", - std::type_identity{}, - std::type_identity{}); + auto && expect_result = seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(0)>{}", + "std::type_identity< unsigned>{}", + std::type_identity{}, + std::type_identity{}); EXPECT_FALSE(expect_result); EXPECT_STREQ(error_message, expect_result.message()); EXPECT_NONFATAL_FAILURE(EXPECT_SAME_TYPE(decltype(0), unsigned), error_message); @@ -57,10 +57,10 @@ TEST(int_ref, same_type_pass) { int a{}; int & i = a; - auto && expect_result = hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", - "std::type_identity< int &>{}", - std::type_identity{}, - std::type_identity{}); + auto && expect_result = seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", + "std::type_identity< int &>{}", + std::type_identity{}, + std::type_identity{}); EXPECT_TRUE(expect_result); EXPECT_SAME_TYPE(decltype(i), int &); } @@ -75,10 +75,10 @@ TEST(int_ref, same_type_fail) int a{}; int & i = a; - auto && expect_result = hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", - "std::type_identity< unsigned &>{}", - std::type_identity{}, - std::type_identity{}); + auto && expect_result = seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", + "std::type_identity< unsigned &>{}", + std::type_identity{}, + std::type_identity{}); EXPECT_FALSE(expect_result); EXPECT_STREQ(error_message, expect_result.message()); EXPECT_NONFATAL_FAILURE(EXPECT_SAME_TYPE(decltype(i), unsigned &), error_message); @@ -90,10 +90,10 @@ TEST(int_ref, same_type_fail) TEST(int_const_ref, same_type_pass) { int const & i = 0; - auto && expect_result = hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", - "std::type_identity< int const &>{}", - std::type_identity{}, - std::type_identity{}); + auto && expect_result = seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", + "std::type_identity< int const &>{}", + std::type_identity{}, + std::type_identity{}); EXPECT_TRUE(expect_result); EXPECT_SAME_TYPE(decltype(i), int const &); } @@ -107,10 +107,10 @@ TEST(int_const_ref, same_type_fail) " Which is: \"unsigned int const &\""; int const & i = 0; - auto && expect_result = hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", - "std::type_identity< unsigned const &>{}", - std::type_identity{}, - std::type_identity{}); + auto && expect_result = seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", + "std::type_identity< unsigned const &>{}", + std::type_identity{}, + std::type_identity{}); EXPECT_FALSE(expect_result); EXPECT_STREQ(error_message, expect_result.message()); EXPECT_NONFATAL_FAILURE(EXPECT_SAME_TYPE(decltype(i), unsigned const &), error_message); @@ -122,10 +122,10 @@ TEST(int_const_ref, same_type_fail) TEST(int_rvalue_ref, same_type_pass) { int && i = 0; - auto && expect_result = hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", - "std::type_identity< int &&>{}", - std::type_identity{}, - std::type_identity{}); + auto && expect_result = seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", + "std::type_identity< int &&>{}", + std::type_identity{}, + std::type_identity{}); EXPECT_TRUE(expect_result); EXPECT_SAME_TYPE(decltype(i), int &&); } @@ -139,10 +139,10 @@ TEST(int_rvalue_ref, same_type_fail) " Which is: \"unsigned int &&\""; int && i = 0; - auto && expect_result = hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", - "std::type_identity< unsigned &&>{}", - std::type_identity{}, - std::type_identity{}); + auto && expect_result = seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(i)>{}", + "std::type_identity< unsigned &&>{}", + std::type_identity{}, + std::type_identity{}); EXPECT_FALSE(expect_result); EXPECT_STREQ(error_message, expect_result.message()); EXPECT_NONFATAL_FAILURE(EXPECT_SAME_TYPE(decltype(i), unsigned &&), error_message); @@ -154,10 +154,10 @@ TEST(int_rvalue_ref, same_type_fail) TEST(tuple, same_type_pass) { auto && expect_result = - hibf::test::expect_same_type{}("std::type_identity< decltype(std::tuple{0, .0f, .0, 0u})>{}", - "std::type_identity< std::tuple>{}", - std::type_identity{}, - std::type_identity>{}); + seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(std::tuple{0, .0f, .0, 0u})>{}", + "std::type_identity< std::tuple>{}", + std::type_identity{}, + std::type_identity>{}); EXPECT_TRUE(expect_result); EXPECT_SAME_TYPE(decltype(std::tuple{0, .0f, .0, 0u}), (std::tuple)); @@ -172,10 +172,10 @@ TEST(tuple, same_type_fail) " Which is: \"std::tuple\""; auto && expect_result = - hibf::test::expect_same_type{}("std::type_identity< decltype(std::tuple{0, .0f, .0, 0u})>{}", - "std::type_identity< std::tuple>{}", - std::type_identity{}, - std::type_identity>{}); + seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(std::tuple{0, .0f, .0, 0u})>{}", + "std::type_identity< std::tuple>{}", + std::type_identity{}, + std::type_identity>{}); EXPECT_FALSE(expect_result); EXPECT_STREQ(error_message, expect_result.message()); diff --git a/test/unit/test/file_access_test.cpp b/test/unit/test/file_access_test.cpp index 345e6e52..c82c0778 100644 --- a/test/unit/test/file_access_test.cpp +++ b/test/unit/test/file_access_test.cpp @@ -74,7 +74,7 @@ struct file_access_test : public ::testing::Test TEST_F(file_access_test, file_read_access_granted) { auto path = create_file("hibf_test_permissions_file_read_access_granted"); - EXPECT_TRUE(hibf::test::read_access(path)); + EXPECT_TRUE(seqan::hibf::test::read_access(path)); std::filesystem::remove(path); } @@ -82,14 +82,14 @@ TEST_F(file_access_test, file_read_access_revoked) { auto path = create_file("hibf_test_permissions_file_read_access_revoked"); remove_read_permission(path); - EXPECT_EQ(hibf::test::read_access(path), is_root()); + EXPECT_EQ(seqan::hibf::test::read_access(path), is_root()); std::filesystem::remove(path); } TEST_F(file_access_test, file_write_access_granted) { auto path = create_file("hibf_test_permissions_file_write_access_granted"); - EXPECT_TRUE(hibf::test::write_access(path)); + EXPECT_TRUE(seqan::hibf::test::write_access(path)); std::filesystem::remove(path); } @@ -97,14 +97,14 @@ TEST_F(file_access_test, file_write_access_revoked) { auto path = create_file("hibf_test_permissions_file_write_access_revoked"); remove_write_permission(path); - EXPECT_EQ(hibf::test::write_access(path), is_root()); + EXPECT_EQ(seqan::hibf::test::write_access(path), is_root()); std::filesystem::remove(path); } TEST_F(file_access_test, directory_write_access_granted) { auto path = create_directory("hibf_test_permissions_directory_write_access_granted"); - EXPECT_TRUE(hibf::test::write_access(path)); + EXPECT_TRUE(seqan::hibf::test::write_access(path)); std::filesystem::remove(path); } @@ -112,6 +112,6 @@ TEST_F(file_access_test, directory_write_access_revoked) { auto path = create_directory("hibf_test_permissions_directory_write_access_revoked"); remove_write_permission(path); - EXPECT_EQ(hibf::test::write_access(path), is_root()); + EXPECT_EQ(seqan::hibf::test::write_access(path), is_root()); std::filesystem::remove(path); } diff --git a/test/unit/test/sandboxed_path_test.cpp b/test/unit/test/sandboxed_path_test.cpp index ff408d96..05a0c188 100644 --- a/test/unit/test/sandboxed_path_test.cpp +++ b/test/unit/test/sandboxed_path_test.cpp @@ -15,7 +15,7 @@ #include // for operator/, sandboxed_path namespace fs = std::filesystem; -using sandboxed_path = hibf::test::sandboxed_path; +using sandboxed_path = seqan::hibf::test::sandboxed_path; // initialization TEST(sandboxed_path_init, init) diff --git a/test/unit/test/temporary_snippet_file_test.cpp b/test/unit/test/temporary_snippet_file_test.cpp index 42fe3a4f..2a68a310 100644 --- a/test/unit/test/temporary_snippet_file_test.cpp +++ b/test/unit/test/temporary_snippet_file_test.cpp @@ -16,7 +16,7 @@ TEST(temporary_snippet_file, no_content) { std::filesystem::path const original_path = std::filesystem::current_path(); - hibf::test::temporary_snippet_file tmp_file{"test.txt"}; + seqan::hibf::test::temporary_snippet_file tmp_file{"test.txt"}; std::filesystem::path const new_path = std::filesystem::current_path(); EXPECT_FALSE(std::filesystem::exists(new_path / "test.txt")); @@ -26,7 +26,7 @@ TEST(temporary_snippet_file, no_content) TEST(temporary_snippet_file, with_content) { std::filesystem::path const path = std::filesystem::current_path(); - hibf::test::temporary_snippet_file tmp_file{"test.txt", "some content\n", "more"}; + seqan::hibf::test::temporary_snippet_file tmp_file{"test.txt", "some content\n", "more"}; std::filesystem::path const new_path = std::filesystem::current_path(); EXPECT_TRUE(std::filesystem::exists(new_path / "test.txt")); diff --git a/test/unit/test/tmp_directory_test.cpp b/test/unit/test/tmp_directory_test.cpp index faeacf5a..94312dd9 100644 --- a/test/unit/test/tmp_directory_test.cpp +++ b/test/unit/test/tmp_directory_test.cpp @@ -20,8 +20,8 @@ // check unique creation of paths TEST(tmp_directory, unique) { - hibf::test::tmp_directory t1; - hibf::test::tmp_directory t2; + seqan::hibf::test::tmp_directory t1; + seqan::hibf::test::tmp_directory t2; // checking they are unique EXPECT_NE(t1.path(), t2.path()); @@ -44,9 +44,9 @@ TEST(tmp_directory, unique) // move construction TEST(tmp_directory, move_constructible) { - hibf::test::tmp_directory t1{}; - hibf::test::tmp_directory t2{}; - hibf::test::tmp_directory t3{std::move(t2)}; + seqan::hibf::test::tmp_directory t1{}; + seqan::hibf::test::tmp_directory t2{}; + seqan::hibf::test::tmp_directory t3{std::move(t2)}; EXPECT_TRUE(std::filesystem::exists(t1.path())); EXPECT_TRUE(std::filesystem::exists(t3.path())); @@ -54,7 +54,7 @@ TEST(tmp_directory, move_constructible) EXPECT_TRUE(t3.empty()); EXPECT_NE(t1.path(), t3.path()); - hibf::test::tmp_directory t4(std::move(t1)); + seqan::hibf::test::tmp_directory t4(std::move(t1)); EXPECT_TRUE(std::filesystem::exists(t4.path())); EXPECT_NE(t3.path(), t4.path()); @@ -68,9 +68,9 @@ TEST(tmp_directory, move_assignable) std::filesystem::path p3; { - hibf::test::tmp_directory t1{}; - hibf::test::tmp_directory t2{}; - hibf::test::tmp_directory t3; + seqan::hibf::test::tmp_directory t1{}; + seqan::hibf::test::tmp_directory t2{}; + seqan::hibf::test::tmp_directory t3; p1 = t1.path(); p2 = t2.path(); @@ -94,7 +94,7 @@ TEST(tmp_directory, cleanup_on_destruction) { std::filesystem::path path; { - hibf::test::tmp_directory t1{}; + seqan::hibf::test::tmp_directory t1{}; path = t1.path(); // create file structure @@ -139,7 +139,7 @@ TEST(tmp_directory, dont_warn_about_missing_managed_tmp_directory_on_destruction { std::filesystem::path path; { - hibf::test::tmp_directory t1{}; + seqan::hibf::test::tmp_directory t1{}; path = t1.path(); // create file structure @@ -161,7 +161,7 @@ TEST(tmp_directory, dont_warn_about_missing_managed_tmp_directory_on_destruction TEST(tmp_directory_throw, directory_not_writeable) { // create a temporary folder that will mimic the normal tmp folder - hibf::test::tmp_directory temporary_tmp_folder; + seqan::hibf::test::tmp_directory temporary_tmp_folder; setenv("TMPDIR", temporary_tmp_folder.path().c_str(), 1); // name, value, overwrite // make temporary_tmp_folder read only @@ -170,9 +170,9 @@ TEST(tmp_directory_throw, directory_not_writeable) std::filesystem::perm_options::remove); // The actual test - if (!hibf::test::write_access(temporary_tmp_folder.path())) // Do not execute with root permissions. + if (!seqan::hibf::test::write_access(temporary_tmp_folder.path())) // Do not execute with root permissions. { - EXPECT_THROW(hibf::test::tmp_directory{}, std::filesystem::filesystem_error); + EXPECT_THROW(seqan::hibf::test::tmp_directory{}, std::filesystem::filesystem_error); } // give temporary_tmp_folder write permissions back diff --git a/util/fpr_quality.cpp b/util/fpr_quality.cpp index ce2443a8..9e0d2ccb 100644 --- a/util/fpr_quality.cpp +++ b/util/fpr_quality.cpp @@ -93,7 +93,8 @@ void init_parser(sharg::parser & parser, config & cfg) size_t split_bin_size_in_bits(config const & cfg) { - return hibf::bin_size_in_bits({.fpr = cfg.fpr, .hash_count = cfg.hash, .elements = cfg.split_elements_per_bin}); + return seqan::hibf::bin_size_in_bits( + {.fpr = cfg.fpr, .hash_count = cfg.hash, .elements = cfg.split_elements_per_bin}); } void print_results(size_t const fp_count, config const & cfg) @@ -107,10 +108,10 @@ void print_results(size_t const fp_count, config const & cfg) void single_tb(config const & cfg) { - hibf::interleaved_bloom_filter ibf{ - hibf::bin_count{1u}, - hibf::bin_size{hibf::bin_size_in_bits({.fpr = cfg.fpr, .hash_count = cfg.hash, .elements = cfg.elements})}, - hibf::hash_function_count{cfg.hash}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{1u}, + seqan::hibf::bin_size{seqan::hibf::bin_size_in_bits( + {.fpr = cfg.fpr, .hash_count = cfg.hash, .elements = cfg.elements})}, + seqan::hibf::hash_function_count{cfg.hash}}; auto agent = ibf.membership_agent(); // Generate elements many random kmer values. @@ -123,7 +124,7 @@ void single_tb(config const & cfg) inserted_values.emplace(distrib(gen)); for (uint64_t const value : inserted_values) - ibf.emplace(value, hibf::bin_index{0u}); + ibf.emplace(value, seqan::hibf::bin_index{0u}); // Check all possible kmer values. size_t fp_count{}; @@ -141,9 +142,9 @@ void single_tb(config const & cfg) void multiple_tb(config const & cfg, size_t const bin_size) { - hibf::interleaved_bloom_filter ibf{hibf::bin_count{cfg.splits}, - hibf::bin_size{bin_size}, - hibf::hash_function_count{cfg.hash}}; + seqan::hibf::interleaved_bloom_filter ibf{seqan::hibf::bin_count{cfg.splits}, + seqan::hibf::bin_size{bin_size}, + seqan::hibf::hash_function_count{cfg.hash}}; auto agent = ibf.membership_agent(); // Generate elements many random kmer values. @@ -158,7 +159,7 @@ void multiple_tb(config const & cfg, size_t const bin_size) // Distribute across all bins. size_t counter{}; for (uint64_t const value : all_values) - ibf.emplace(value, hibf::bin_index{counter++ / cfg.split_elements_per_bin}); + ibf.emplace(value, seqan::hibf::bin_index{counter++ / cfg.split_elements_per_bin}); // Check all possible kmer values. size_t fp_count{}; @@ -215,7 +216,7 @@ int main(int argc, char ** argv) multiple_tb(cfg, split_bin_size_in_bits(cfg)); std::cout << "=== Split into " << cfg.splits << " bins corrected ===\n"; - double const fpr_correction = - hibf::layout::compute_fpr_correction({.fpr = cfg.fpr, .hash_count = cfg.hash, .t_max = cfg.splits})[cfg.splits]; + double const fpr_correction = seqan::hibf::layout::compute_fpr_correction( + {.fpr = cfg.fpr, .hash_count = cfg.hash, .t_max = cfg.splits})[cfg.splits]; multiple_tb(cfg, std::ceil(split_bin_size_in_bits(cfg) * fpr_correction)); } From e78c97f9b937230f7bc9e50a8d69a32b42463d10 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Thu, 24 Aug 2023 16:02:08 +0200 Subject: [PATCH 2/2] [MISC] Rename seqan::std to seqan::stl For now. seqan::std causes lookups to fail --- include/hibf/contrib/std/all_view.hpp | 34 ++-- include/hibf/contrib/std/chunk_view.hpp | 58 +++--- include/hibf/contrib/std/concepts.hpp | 10 +- .../hibf/contrib/std/detail/adaptor_base.hpp | 6 +- .../detail/adaptor_for_view_without_args.hpp | 6 +- .../std/detail/adaptor_from_functor.hpp | 6 +- .../std/detail/compiler_definitions.hpp | 2 +- .../contrib/std/detail/exposition_only.hpp | 6 +- .../std/detail/non_propagating_cache.hpp | 6 +- include/hibf/contrib/std/join_with_view.hpp | 80 ++++---- include/hibf/contrib/std/pair.hpp | 66 +++---- include/hibf/contrib/std/to.hpp | 66 +++---- include/hibf/contrib/std/tuple.hpp | 80 ++++---- include/hibf/contrib/std/zip_view.hpp | 172 +++++++++--------- src/detail/build/insert_into_ibf.cpp | 2 +- .../interleaved_bloom_filter_benchmark.cpp | 10 +- 16 files changed, 305 insertions(+), 305 deletions(-) diff --git a/include/hibf/contrib/std/all_view.hpp b/include/hibf/contrib/std/all_view.hpp index fee45f49..db31a8d6 100644 --- a/include/hibf/contrib/std/all_view.hpp +++ b/include/hibf/contrib/std/all_view.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::views::{all, all_t}, and seqan::std::ranges::owning_view. + * \brief Provides seqan::stl::views::{all, all_t}, and seqan::stl::ranges::owning_view. */ // File might be included from multiple libraries. @@ -18,33 +18,33 @@ #if __cpp_lib_ranges >= 202110L -namespace seqan::std::ranges +namespace seqan::stl::ranges { using ::std::ranges::owning_view; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::views +namespace seqan::stl::views { using ::std::ranges::views::all; using ::std::ranges::views::all_t; -} // namespace seqan::std::views +} // namespace seqan::stl::views #else # include "concepts.hpp" # include "detail/adaptor_base.hpp" # include "detail/exposition_only.hpp" -namespace seqan::std::ranges +namespace seqan::stl::ranges { /*!\brief A move-only view that takes unique ownership of a range. * \sa https://en.cppreference.com/w/cpp/ranges/owning_view */ template <::std::ranges::range rng_t> - requires ::std::movable && (!seqan::std::detail::is_initializer_list<::std::remove_cvref_t>) + requires ::std::movable && (!seqan::stl::detail::is_initializer_list<::std::remove_cvref_t>) class owning_view : public ::std::ranges::view_interface> { private: @@ -158,13 +158,13 @@ class owning_view : public ::std::ranges::view_interface> } }; -/*!\brief The functor for seqan::std::views::all. +/*!\brief The functor for seqan::stl::views::all. */ -class all_fn : public seqan::std::detail::adaptor_base +class all_fn : public seqan::stl::detail::adaptor_base { private: //!\brief Befriend the base class. - friend seqan::std::detail::adaptor_base; + friend seqan::stl::detail::adaptor_base; //!\brief Checks whether a type is a view. template @@ -179,7 +179,7 @@ class all_fn : public seqan::std::detail::adaptor_base static constexpr bool valid_for_owning_view = requires { owning_view(::std::declval()); }; public: - using seqan::std::detail::adaptor_base::adaptor_base; + using seqan::stl::detail::adaptor_base::adaptor_base; /*!\brief Returns a view that includes all elements of the range argument. * \sa https://en.cppreference.com/w/cpp/ranges/all_view @@ -191,7 +191,7 @@ class all_fn : public seqan::std::detail::adaptor_base * * A ::std::ranges::ref_view of `rng` if that expression is valid. * * Otherwise, a seqan3::detail::owning_view of `rng`. */ - template + template requires decays_to_view || valid_for_ref_view || valid_for_owning_view static auto impl(rng_t && rng) { @@ -204,21 +204,21 @@ class all_fn : public seqan::std::detail::adaptor_base } }; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::views +namespace seqan::stl::views { /*!\copydoc all_fn::impl */ -inline constexpr auto all = seqan::std::ranges::all_fn{}; +inline constexpr auto all = seqan::stl::ranges::all_fn{}; /*!\brief Returns the type that results from appying seqan3::detail::all to a range. */ -template +template using all_t = decltype(all(::std::declval())); -} // namespace seqan::std::views +} // namespace seqan::stl::views #endif // __cpp_lib_ranges >= 202110L diff --git a/include/hibf/contrib/std/chunk_view.hpp b/include/hibf/contrib/std/chunk_view.hpp index 82f089e4..8657d41c 100644 --- a/include/hibf/contrib/std/chunk_view.hpp +++ b/include/hibf/contrib/std/chunk_view.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::views::chunk. + * \brief Provides seqan::stl::views::chunk. */ // File might be included from multiple libraries. @@ -18,12 +18,12 @@ #ifdef __cpp_lib_ranges_chunk -namespace seqan::std::views +namespace seqan::stl::views { using ::std::ranges::views::chunk; -} // namespace seqan::std::views +} // namespace seqan::stl::views #else @@ -37,7 +37,7 @@ using ::std::ranges::views::chunk; # include "detail/exposition_only.hpp" # include "detail/non_propagating_cache.hpp" -namespace seqan::std::detail::chunk +namespace seqan::stl::detail::chunk { template @@ -55,9 +55,9 @@ constexpr auto to_unsigned_like(T v) noexcept return static_cast<::std::make_unsigned_t>(v); } -} // namespace seqan::std::detail::chunk +} // namespace seqan::stl::detail::chunk -namespace seqan::std::ranges +namespace seqan::stl::ranges { template <::std::ranges::view V> @@ -74,7 +74,7 @@ SEQAN_STD_NESTED_VISIBILITY ::std::ranges::range_difference_t n_; ::std::ranges::range_difference_t remainder_ = 0; - seqan::std::detail::non_propagating_cache<::std::ranges::iterator_t> current_; + seqan::stl::detail::non_propagating_cache<::std::ranges::iterator_t> current_; private: class outer_iterator; @@ -115,19 +115,19 @@ SEQAN_STD_NESTED_VISIBILITY constexpr auto size() requires ::std::ranges::sized_range { - return seqan::std::detail::chunk::to_unsigned_like( - seqan::std::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); + return seqan::stl::detail::chunk::to_unsigned_like( + seqan::stl::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); } constexpr auto size() const requires ::std::ranges::sized_range { - return seqan::std::detail::chunk::to_unsigned_like( - seqan::std::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); + return seqan::stl::detail::chunk::to_unsigned_like( + seqan::stl::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); } }; template -chunk_view(R &&, ::std::ranges::range_difference_t) -> chunk_view>; +chunk_view(R &&, ::std::ranges::range_difference_t) -> chunk_view>; template <::std::ranges::view V> requires ::std::ranges::input_range @@ -180,7 +180,7 @@ class chunk_view::outer_iterator { return dist == 0 ? 0 : 1; } - return seqan::std::detail::chunk::div_ceil(dist - x.parent_->remainder_, x.parent_->n_) + 1; + return seqan::stl::detail::chunk::div_ceil(dist - x.parent_->remainder_, x.parent_->n_) + 1; } friend constexpr difference_type operator-(outer_iterator const & x, ::std::default_sentinel_t y) requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> @@ -214,7 +214,7 @@ struct chunk_view::outer_iterator::value_type : ::std::ranges::view_interface constexpr auto size() const requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> { - return seqan::std::detail::chunk::to_unsigned_like( + return seqan::stl::detail::chunk::to_unsigned_like( ::std::ranges::min(parent_->remainder_, ::std::ranges::end(parent_->base_) - *parent_->current_)); } }; @@ -326,7 +326,7 @@ class chunk_view : public ::std::ranges::view_interface> } constexpr auto begin() - requires (!seqan::std::detail::simple_view) + requires (!seqan::stl::detail::simple_view) { return iterator{this, ::std::ranges::begin(base_)}; } @@ -338,7 +338,7 @@ class chunk_view : public ::std::ranges::view_interface> } constexpr auto end() - requires (!seqan::std::detail::simple_view) + requires (!seqan::stl::detail::simple_view) { if constexpr (::std::ranges::common_range && ::std::ranges::sized_range) { @@ -376,14 +376,14 @@ class chunk_view : public ::std::ranges::view_interface> constexpr auto size() requires ::std::ranges::sized_range { - return seqan::std::detail::chunk::to_unsigned_like( - seqan::std::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); + return seqan::stl::detail::chunk::to_unsigned_like( + seqan::stl::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); } constexpr auto size() const requires ::std::ranges::sized_range { - return seqan::std::detail::chunk::to_unsigned_like( - seqan::std::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); + return seqan::stl::detail::chunk::to_unsigned_like( + seqan::stl::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); } }; @@ -393,8 +393,8 @@ template class chunk_view::iterator { private: - using Parent = seqan::std::detail::maybe_const; - using Base = seqan::std::detail::maybe_const; + using Parent = seqan::stl::detail::maybe_const; + using Base = seqan::stl::detail::maybe_const; ::std::ranges::iterator_t current_ = ::std::ranges::iterator_t{}; ::std::ranges::sentinel_t end_ = ::std::ranges::sentinel_t{}; @@ -575,7 +575,7 @@ class chunk_view::iterator friend constexpr difference_type operator-(::std::default_sentinel_t y, iterator const & x) requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> { - return seqan::std::detail::chunk::div_ceil(x.end_ - x.current_, x.n_); + return seqan::stl::detail::chunk::div_ceil(x.end_ - x.current_, x.n_); } friend constexpr difference_type operator-(iterator const & x, ::std::default_sentinel_t y) @@ -590,24 +590,24 @@ struct chunk_fn template constexpr auto operator()(Difference n) const { - return seqan::std::detail::adaptor_from_functor{*this, n}; + return seqan::stl::detail::adaptor_from_functor{*this, n}; } - template > + template > constexpr auto operator()(Range && range, ::std::type_identity_t n) const { return chunk_view{::std::forward(range), n}; } }; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::views +namespace seqan::stl::views { -inline constexpr auto chunk = seqan::std::ranges::chunk_fn{}; +inline constexpr auto chunk = seqan::stl::ranges::chunk_fn{}; -} // namespace seqan::std::views +} // namespace seqan::stl::views #endif // ifdef __cpp_lib_ranges_chunk diff --git a/include/hibf/contrib/std/concepts.hpp b/include/hibf/contrib/std/concepts.hpp index c2456221..aed5614e 100644 --- a/include/hibf/contrib/std/concepts.hpp +++ b/include/hibf/contrib/std/concepts.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std concepts. + * \brief Provides seqan::stl concepts. */ // File might be included from multiple libraries. @@ -17,7 +17,7 @@ #include #if __cpp_lib_ranges >= 202110L -namespace seqan::std::ranges +namespace seqan::stl::ranges { using ::std::ranges::viewable_range; @@ -25,7 +25,7 @@ using ::std::ranges::viewable_range; } #else # include "detail/exposition_only.hpp" -namespace seqan::std::ranges +namespace seqan::stl::ranges { template @@ -35,9 +35,9 @@ concept viewable_range = ::std::ranges::range || (!::std::ranges::view<::std::remove_cvref_t> && (::std::is_lvalue_reference_v || (::std::movable<::std::remove_reference_t> - && !seqan::std::detail::is_initializer_list<::std::remove_cvref_t>)))); + && !seqan::stl::detail::is_initializer_list<::std::remove_cvref_t>)))); -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges #endif diff --git a/include/hibf/contrib/std/detail/adaptor_base.hpp b/include/hibf/contrib/std/detail/adaptor_base.hpp index b80f6f59..b790e29f 100644 --- a/include/hibf/contrib/std/detail/adaptor_base.hpp +++ b/include/hibf/contrib/std/detail/adaptor_base.hpp @@ -6,7 +6,7 @@ // ----------------------------------------------------------------------------------------------------- /*!\file - * \brief Provides seqan::std::detail::adaptor_base and seqan::std::detail::combined_adaptor + * \brief Provides seqan::stl::detail::adaptor_base and seqan::stl::detail::combined_adaptor * \author Hannes Hauswedell */ @@ -17,7 +17,7 @@ #include #include -namespace seqan::std::detail +namespace seqan::stl::detail { // ============================================================================ @@ -210,6 +210,6 @@ class combined_adaptor : //!\} }; -} // namespace seqan::std::detail +} // namespace seqan::stl::detail #endif // SEQAN_STD_DETAIL_ADAPTOR_BASE diff --git a/include/hibf/contrib/std/detail/adaptor_for_view_without_args.hpp b/include/hibf/contrib/std/detail/adaptor_for_view_without_args.hpp index 61ee565e..7a73fe34 100644 --- a/include/hibf/contrib/std/detail/adaptor_for_view_without_args.hpp +++ b/include/hibf/contrib/std/detail/adaptor_for_view_without_args.hpp @@ -6,7 +6,7 @@ // ----------------------------------------------------------------------------------------------------- /*!\file - * \brief Provides seqan::std::detail::adaptor_for_view_without_args + * \brief Provides seqan::stl::detail::adaptor_for_view_without_args * \author Hannes Hauswedell */ @@ -16,7 +16,7 @@ #include "adaptor_base.hpp" -namespace seqan::std::detail +namespace seqan::stl::detail { // ============================================================================ @@ -68,6 +68,6 @@ class adaptor_for_view_without_args : public adaptor_base */ @@ -16,7 +16,7 @@ #include "adaptor_base.hpp" -namespace seqan::std::detail +namespace seqan::stl::detail { // ============================================================================ @@ -70,6 +70,6 @@ class adaptor_from_functor : //!\} }; -} // namespace seqan::std::detail +} // namespace seqan::stl::detail #endif // SEQAN_STD_DETAIL_ADAPTOR_FROM_FUNCTOR diff --git a/include/hibf/contrib/std/detail/compiler_definitions.hpp b/include/hibf/contrib/std/detail/compiler_definitions.hpp index 39aa7877..417205b8 100644 --- a/include/hibf/contrib/std/detail/compiler_definitions.hpp +++ b/include/hibf/contrib/std/detail/compiler_definitions.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides compiler definitions for seqan::std. + * \brief Provides compiler definitions for seqan::stl. */ // File might be included from multiple libraries. diff --git a/include/hibf/contrib/std/detail/exposition_only.hpp b/include/hibf/contrib/std/detail/exposition_only.hpp index 1ff1584a..4dbf6156 100644 --- a/include/hibf/contrib/std/detail/exposition_only.hpp +++ b/include/hibf/contrib/std/detail/exposition_only.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::detail implementation helper that are used in multiple files. + * \brief Provides seqan::stl::detail implementation helper that are used in multiple files. */ // File might be included from multiple libraries. @@ -16,7 +16,7 @@ #include -namespace seqan::std::detail +namespace seqan::stl::detail { template @@ -33,6 +33,6 @@ concept simple_view = ::std::ranges::view && ::std::ranges::range using maybe_const = ::std::conditional_t; -} // namespace seqan::std::detail +} // namespace seqan::stl::detail #endif // SEQAN_STD_DETAIL_EXPOSITION_ONLY diff --git a/include/hibf/contrib/std/detail/non_propagating_cache.hpp b/include/hibf/contrib/std/detail/non_propagating_cache.hpp index 424dac38..6965fb6c 100644 --- a/include/hibf/contrib/std/detail/non_propagating_cache.hpp +++ b/include/hibf/contrib/std/detail/non_propagating_cache.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides [seqan::std::detail::non_propagating_cache](https://eel.is/c++draft/range.nonprop.cache). + * \brief Provides [seqan::stl::detail::non_propagating_cache](https://eel.is/c++draft/range.nonprop.cache). */ // File might be included from multiple libraries. @@ -16,7 +16,7 @@ #include -namespace seqan::std::detail +namespace seqan::stl::detail { /*!\brief A helper that enables an input view to temporarily cache values as it is iterated over. @@ -78,6 +78,6 @@ class non_propagating_cache : public ::std::optional } }; -} // namespace seqan::std::detail +} // namespace seqan::stl::detail #endif // SEQAN_STD_DETAIL_NON_PROPAGATING_CACHE diff --git a/include/hibf/contrib/std/join_with_view.hpp b/include/hibf/contrib/std/join_with_view.hpp index 25825cdd..c2a6ca4d 100644 --- a/include/hibf/contrib/std/join_with_view.hpp +++ b/include/hibf/contrib/std/join_with_view.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::views::join_with. + * \brief Provides seqan::stl::views::join_with. */ // File might be included from multiple libraries. @@ -18,12 +18,12 @@ #ifdef __cpp_lib_ranges_join_with -namespace seqan::std::views +namespace seqan::stl::views { using ::std::ranges::views::join_with; -} // namespace seqan::std::views +} // namespace seqan::stl::views #else @@ -36,7 +36,7 @@ using ::std::ranges::views::join_with; # include "detail/exposition_only.hpp" # include "detail/non_propagating_cache.hpp" -namespace seqan::std::detail::join_with +namespace seqan::stl::detail::join_with { template @@ -68,18 +68,18 @@ struct cache_helper non_propagating_cache<::std::remove_cv_t> inner_; }; -} // namespace seqan::std::detail::join_with +} // namespace seqan::stl::detail::join_with -namespace seqan::std::ranges +namespace seqan::stl::ranges { template <::std::ranges::input_range V, ::std::ranges::forward_range Pattern> requires ::std::ranges::view && ::std::ranges::input_range<::std::ranges::range_reference_t> && ::std::ranges::view - && seqan::std::detail::join_with::compatible_joinable_ranges<::std::ranges::range_reference_t, Pattern> + && seqan::stl::detail::join_with::compatible_joinable_ranges<::std::ranges::range_reference_t, Pattern> class join_with_view : public ::std::ranges::view_interface>, - private seqan::std::detail::join_with::cache_helper<::std::ranges::range_reference_t> + private seqan::stl::detail::join_with::cache_helper<::std::ranges::range_reference_t> { private: using InnerRng = ::std::ranges::range_reference_t; @@ -128,8 +128,8 @@ class join_with_view : // the sentinels of the non-const view and const range are the same. // If ::std::is_reference_v, we do not have a cache to store the value. Hence, we do not change // any members and can use the const iterator. - constexpr bool use_const = seqan::std::detail::simple_view && ::std::is_reference_v - && seqan::std::detail::simple_view; + constexpr bool use_const = seqan::stl::detail::simple_view && ::std::is_reference_v + && seqan::stl::detail::simple_view; return iterator{*this, ::std::ranges::begin(base_)}; } @@ -142,7 +142,7 @@ class join_with_view : constexpr auto end() { - constexpr bool is_simple = seqan::std::detail::simple_view && seqan::std::detail::simple_view; + constexpr bool is_simple = seqan::stl::detail::simple_view && seqan::stl::detail::simple_view; if constexpr (::std::ranges::forward_range && ::std::is_reference_v && ::std::ranges::forward_range && ::std::ranges::common_range && ::std::ranges::common_range) @@ -165,25 +165,25 @@ class join_with_view : }; template -join_with_view(R &&, P &&) -> join_with_view, seqan::std::views::all_t

>; +join_with_view(R &&, P &&) -> join_with_view, seqan::stl::views::all_t

>; template <::std::ranges::input_range R> join_with_view(R &&, ::std::ranges::range_value_t<::std::ranges::range_reference_t>) - -> join_with_view, + -> join_with_view, ::std::ranges::single_view<::std::ranges::range_value_t<::std::ranges::range_reference_t>>>; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::detail::join_with +namespace seqan::stl::detail::join_with { template struct helper { - using Parent = seqan::std::detail::maybe_const>; - using Base = seqan::std::detail::maybe_const; + using Parent = seqan::stl::detail::maybe_const>; + using Base = seqan::stl::detail::maybe_const; using InnerBase = ::std::ranges::range_reference_t; - using PatternBase = seqan::std::detail::maybe_const; + using PatternBase = seqan::stl::detail::maybe_const; using OuterIter = ::std::ranges::iterator_t; using InnerIter = ::std::ranges::iterator_t; @@ -237,22 +237,22 @@ template struct iterator_category_t {}; -} // namespace seqan::std::detail::join_with +} // namespace seqan::stl::detail::join_with -namespace seqan::std::ranges +namespace seqan::stl::ranges { template <::std::ranges::input_range V, ::std::ranges::forward_range Pattern> requires ::std::ranges::view && ::std::ranges::input_range<::std::ranges::range_reference_t> && ::std::ranges::view - && seqan::std::detail::join_with::compatible_joinable_ranges<::std::ranges::range_reference_t, Pattern> + && seqan::stl::detail::join_with::compatible_joinable_ranges<::std::ranges::range_reference_t, Pattern> template class join_with_view::iterator : - public seqan::std::detail::join_with:: - iterator_category_t::ref_is_glvalue> + public seqan::stl::detail::join_with:: + iterator_category_t::ref_is_glvalue> { private: - using helper_t = seqan::std::detail::join_with::helper; + using helper_t = seqan::stl::detail::join_with::helper; using Parent = helper_t::Parent; using Base = helper_t::Base; using InnerBase = helper_t::InnerBase; @@ -338,8 +338,8 @@ SEQAN_STD_NESTED_VISIBILITY !ref_is_glvalue, ::std::input_iterator_tag, ::std::conditional_t< - ::std::ranges::bidirectional_range && seqan::std::detail::join_with::bidirectional_common - && seqan::std::detail::join_with::bidirectional_common, + ::std::ranges::bidirectional_range && seqan::stl::detail::join_with::bidirectional_common + && seqan::stl::detail::join_with::bidirectional_common, ::std::bidirectional_iterator_tag, ::std::conditional_t<::std::ranges::forward_range && ::std::ranges::forward_range, ::std::forward_iterator_tag, @@ -405,8 +405,8 @@ SEQAN_STD_NESTED_VISIBILITY constexpr iterator & operator--() requires ref_is_glvalue && ::std::ranges::bidirectional_range - && seqan::std::detail::join_with::bidirectional_common - && seqan::std::detail::join_with::bidirectional_common + && seqan::stl::detail::join_with::bidirectional_common + && seqan::stl::detail::join_with::bidirectional_common { if (outer_it_ == ::std::ranges::end(parent_->base_)) { @@ -456,8 +456,8 @@ SEQAN_STD_NESTED_VISIBILITY constexpr iterator operator--(int) requires ref_is_glvalue && ::std::ranges::bidirectional_range - && seqan::std::detail::join_with::bidirectional_common - && seqan::std::detail::join_with::bidirectional_common + && seqan::stl::detail::join_with::bidirectional_common + && seqan::stl::detail::join_with::bidirectional_common { iterator tmp = *this; --*this; @@ -487,13 +487,13 @@ SEQAN_STD_NESTED_VISIBILITY template <::std::ranges::input_range V, ::std::ranges::forward_range Pattern> requires ::std::ranges::view && ::std::ranges::input_range<::std::ranges::range_reference_t> && ::std::ranges::view - && seqan::std::detail::join_with::compatible_joinable_ranges<::std::ranges::range_reference_t, Pattern> + && seqan::stl::detail::join_with::compatible_joinable_ranges<::std::ranges::range_reference_t, Pattern> template class join_with_view::sentinel { private: - using Parent = seqan::std::detail::maybe_const; - using Base = seqan::std::detail::maybe_const; + using Parent = seqan::stl::detail::maybe_const; + using Base = seqan::stl::detail::maybe_const; ::std::ranges::sentinel_t end_ = ::std::ranges::sentinel_t(); friend class join_with_view; @@ -510,7 +510,7 @@ class join_with_view::sentinel template requires ::std::sentinel_for<::std::ranges::sentinel_t, - ::std::ranges::iterator_t>> + ::std::ranges::iterator_t>> friend constexpr bool operator==(iterator const & x, sentinel const & y) { return x.outer_it_ == y.end_; @@ -522,24 +522,24 @@ struct join_with_fn template constexpr auto operator()(Pattern && pattern) const { - return seqan::std::detail::adaptor_from_functor{*this, ::std::forward(pattern)}; + return seqan::stl::detail::adaptor_from_functor{*this, ::std::forward(pattern)}; } - template + template constexpr auto operator()(urng_t && urange, Pattern && pattern) const { return join_with_view{::std::forward(urange), ::std::forward(pattern)}; } }; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::views +namespace seqan::stl::views { -inline constexpr auto join_with = seqan::std::ranges::join_with_fn{}; +inline constexpr auto join_with = seqan::stl::ranges::join_with_fn{}; -} // namespace seqan::std::views +} // namespace seqan::stl::views #endif // ifdef __cpp_lib_ranges_join_with diff --git a/include/hibf/contrib/std/pair.hpp b/include/hibf/contrib/std/pair.hpp index e6d66f13..6e7dc400 100644 --- a/include/hibf/contrib/std/pair.hpp +++ b/include/hibf/contrib/std/pair.hpp @@ -6,7 +6,7 @@ // ----------------------------------------------------------------------------------------------------- /*!\file - * \brief Provides seqan::std::pair. + * \brief Provides seqan::stl::pair. * \author Enrico Seiler */ @@ -17,16 +17,16 @@ #ifdef __cpp_lib_tuple_like -namespace seqan::std +namespace seqan::stl { using ::std::pair; -} // namespace seqan::std +} // namespace seqan::stl #else -namespace seqan::std +namespace seqan::stl { template @@ -544,124 +544,124 @@ struct pair : public ::std::pair template pair(T1, T2) -> pair; -} // namespace seqan::std +} // namespace seqan::stl namespace std { template -struct tuple_size> : public tuple_size<::std::pair> +struct tuple_size> : public tuple_size<::std::pair> {}; template -struct tuple_element> : public tuple_element> +struct tuple_element> : public tuple_element> {}; template - requires requires { typename seqan::std::pair<::std::common_type_t, ::std::common_type_t>; } -struct common_type, seqan::std::pair> + requires requires { typename seqan::stl::pair<::std::common_type_t, ::std::common_type_t>; } +struct common_type, seqan::stl::pair> { - using type = seqan::std::pair<::std::common_type_t, ::std::common_type_t>; + using type = seqan::stl::pair<::std::common_type_t, ::std::common_type_t>; }; template - requires requires { typename seqan::std::pair<::std::common_type_t, ::std::common_type_t>; } -struct common_type<::std::pair, seqan::std::pair> + requires requires { typename seqan::stl::pair<::std::common_type_t, ::std::common_type_t>; } +struct common_type<::std::pair, seqan::stl::pair> { - using type = seqan::std::pair<::std::common_type_t, ::std::common_type_t>; + using type = seqan::stl::pair<::std::common_type_t, ::std::common_type_t>; }; template - requires requires { typename seqan::std::pair<::std::common_type_t, ::std::common_type_t>; } -struct common_type, ::std::pair> + requires requires { typename seqan::stl::pair<::std::common_type_t, ::std::common_type_t>; } +struct common_type, ::std::pair> { - using type = seqan::std::pair<::std::common_type_t, ::std::common_type_t>; + using type = seqan::stl::pair<::std::common_type_t, ::std::common_type_t>; }; template class TQual, template class UQual> requires requires { - typename seqan::std::pair<::std::common_reference_t, UQual>, + typename seqan::stl::pair<::std::common_reference_t, UQual>, ::std::common_reference_t, UQual>>; } -struct basic_common_reference, seqan::std::pair, TQual, UQual> +struct basic_common_reference, seqan::stl::pair, TQual, UQual> { - using type = seqan::std::pair<::std::common_reference_t, UQual>, + using type = seqan::stl::pair<::std::common_reference_t, UQual>, ::std::common_reference_t, UQual>>; }; template class TQual, template class UQual> requires requires { - typename seqan::std::pair<::std::common_reference_t, UQual>, + typename seqan::stl::pair<::std::common_reference_t, UQual>, ::std::common_reference_t, UQual>>; } -struct basic_common_reference<::std::pair, seqan::std::pair, TQual, UQual> +struct basic_common_reference<::std::pair, seqan::stl::pair, TQual, UQual> { - using type = seqan::std::pair<::std::common_reference_t, UQual>, + using type = seqan::stl::pair<::std::common_reference_t, UQual>, ::std::common_reference_t, UQual>>; }; template class TQual, template class UQual> requires requires { - typename seqan::std::pair<::std::common_reference_t, UQual>, + typename seqan::stl::pair<::std::common_reference_t, UQual>, ::std::common_reference_t, UQual>>; } -struct basic_common_reference, ::std::pair, TQual, UQual> +struct basic_common_reference, ::std::pair, TQual, UQual> { - using type = seqan::std::pair<::std::common_reference_t, UQual>, + using type = seqan::stl::pair<::std::common_reference_t, UQual>, ::std::common_reference_t, UQual>>; }; template <::std::size_t i, class T1, class T2> -constexpr ::std::tuple_element_t> & get(seqan::std::pair & t) noexcept +constexpr ::std::tuple_element_t> & get(seqan::stl::pair & t) noexcept requires (i < 2) { return ::std::get(static_cast<::std::pair &>(t)); } template <::std::size_t i, class T1, class T2> -constexpr ::std::tuple_element_t> const & get(seqan::std::pair const & t) noexcept +constexpr ::std::tuple_element_t> const & get(seqan::stl::pair const & t) noexcept requires (i < 2) { return ::std::get(static_cast<::std::pair const &>(t)); } template <::std::size_t i, class T1, class T2> -constexpr ::std::tuple_element_t> && get(seqan::std::pair && t) noexcept +constexpr ::std::tuple_element_t> && get(seqan::stl::pair && t) noexcept requires (i < 2) { return ::std::get(static_cast<::std::pair &&>(::std::move(t))); } template <::std::size_t i, class T1, class T2> -constexpr ::std::tuple_element_t> const && get(seqan::std::pair const && t) noexcept +constexpr ::std::tuple_element_t> const && get(seqan::stl::pair const && t) noexcept requires (i < 2) { return ::std::get(static_cast<::std::pair const &&>(::std::move(t))); } template -constexpr type & get(seqan::std::pair & t) noexcept +constexpr type & get(seqan::stl::pair & t) noexcept requires (!::std::same_as) { return ::std::get(static_cast<::std::pair &>(t)); } template -constexpr type const & get(seqan::std::pair const & t) noexcept +constexpr type const & get(seqan::stl::pair const & t) noexcept requires (!::std::same_as) { return ::std::get(static_cast<::std::pair const &>(t)); } template -constexpr type && get(seqan::std::pair && t) noexcept +constexpr type && get(seqan::stl::pair && t) noexcept requires (!::std::same_as) { return ::std::get(static_cast<::std::pair &&>(::std::move(t))); } template -constexpr type const && get(seqan::std::pair const && t) noexcept +constexpr type const && get(seqan::stl::pair const && t) noexcept requires (!::std::same_as) { return ::std::get(static_cast<::std::pair const &&>(::std::move(t))); diff --git a/include/hibf/contrib/std/to.hpp b/include/hibf/contrib/std/to.hpp index d144a820..278c6146 100644 --- a/include/hibf/contrib/std/to.hpp +++ b/include/hibf/contrib/std/to.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::ranges::to. + * \brief Provides seqan::stl::ranges::to. */ // File might be included from multiple libraries. @@ -18,21 +18,21 @@ #ifdef __cpp_lib_ranges_to_container -namespace seqan::std +namespace seqan::stl { using ::std::from_range_t; inline constexpr from_range_t from_range{}; -} // namespace seqan::std +} // namespace seqan::stl -namespace seqan::std::ranges +namespace seqan::stl::ranges { using ::std::ranges::to; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges #else @@ -40,7 +40,7 @@ using ::std::ranges::to; # include "detail/adaptor_from_functor.hpp" -namespace seqan::std +namespace seqan::stl { struct from_range_t @@ -50,9 +50,9 @@ struct from_range_t inline constexpr from_range_t from_range{}; -} // namespace seqan::std +} // namespace seqan::stl -namespace seqan::std::detail::to +namespace seqan::stl::detail::to { // clang-format off @@ -107,9 +107,9 @@ template concept has_input_iterator_category = ::std::derived_from::iterator_category, ::std::input_iterator_tag>; -} // namespace seqan::std::detail::to +} // namespace seqan::stl::detail::to -namespace seqan::std::ranges +namespace seqan::stl::ranges { template @@ -121,22 +121,22 @@ constexpr C to(R && r, Args &&... args) { if constexpr (::std::constructible_from) return C(::std::forward(r), ::std::forward(args)...); - else if constexpr (::std::constructible_from) - return C(seqan::std::from_range, ::std::forward(r), ::std::forward(args)...); + else if constexpr (::std::constructible_from) + return C(seqan::stl::from_range, ::std::forward(r), ::std::forward(args)...); else if constexpr (::std::ranges::common_range - && seqan::std::detail::to::has_input_iterator_category<::std::ranges::iterator_t> + && seqan::stl::detail::to::has_input_iterator_category<::std::ranges::iterator_t> && ::std::constructible_from, ::std::ranges::sentinel_t, Args...>) return C(::std::ranges::begin(r), ::std::ranges::end(r), ::std::forward(args)...); else if constexpr (::std::constructible_from - && seqan::std::detail::to::container_insertable>) + && seqan::stl::detail::to::container_insertable>) { C c(::std::forward(args)...); - if constexpr (::std::ranges::sized_range && seqan::std::detail::to::reservable_container) + if constexpr (::std::ranges::sized_range && seqan::stl::detail::to::reservable_container) c.reserve(static_cast<::std::ranges::range_size_t>(::std::ranges::size(r))); - ::std::ranges::copy(r, seqan::std::detail::to::container_inserter<::std::ranges::range_reference_t>(c)); + ::std::ranges::copy(r, seqan::stl::detail::to::container_inserter<::std::ranges::range_reference_t>(c)); return c; } } @@ -158,25 +158,25 @@ constexpr auto to(R && r, Args &&... args) if constexpr (requires { C(::std::declval(), ::std::declval()...); }) return to(), ::std::declval()...))>(::std::forward(r), ::std::forward(args)...); - else if constexpr (requires { C(seqan::std::from_range, ::std::declval(), ::std::declval()...); }) - return to(), ::std::declval()...))>( + else if constexpr (requires { C(seqan::stl::from_range, ::std::declval(), ::std::declval()...); }) + return to(), ::std::declval()...))>( ::std::forward(r), ::std::forward(args)...); else if constexpr (requires { - C(::std::declval>(), - ::std::declval>(), + C(::std::declval>(), + ::std::declval>(), ::std::declval()...); }) - return to>(), - ::std::declval>(), + return to>(), + ::std::declval>(), ::std::declval()...))>(::std::forward(r), ::std::forward(args)...); else __builtin_unreachable(); } -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::detail::to +namespace seqan::stl::detail::to { template @@ -186,13 +186,13 @@ struct to_fn1 template constexpr auto operator()(Args &&... args) const { - return seqan::std::detail::adaptor_from_functor{*this, ::std::forward(args)...}; + return seqan::stl::detail::adaptor_from_functor{*this, ::std::forward(args)...}; } template <::std::ranges::input_range R, class... Args> constexpr auto operator()(R && r, Args &&... args) const { - return seqan::std::ranges::to(::std::forward(r), ::std::forward(args)...); + return seqan::stl::ranges::to(::std::forward(r), ::std::forward(args)...); } }; @@ -202,35 +202,35 @@ struct to_fn2 template constexpr auto operator()(Args &&... args) const { - return seqan::std::detail::adaptor_from_functor{*this, ::std::forward(args)...}; + return seqan::stl::detail::adaptor_from_functor{*this, ::std::forward(args)...}; } template <::std::ranges::input_range R, class... Args> constexpr auto operator()(R && r, Args &&... args) const { - return seqan::std::ranges::to(::std::forward(r), ::std::forward(args)...); + return seqan::stl::ranges::to(::std::forward(r), ::std::forward(args)...); } }; -} // namespace seqan::std::detail::to +} // namespace seqan::stl::detail::to -namespace seqan::std::ranges +namespace seqan::stl::ranges { template requires (!::std::ranges::view) constexpr auto to(Args &&... args) { - return seqan::std::detail::to::to_fn1{}(::std::forward(args)...); + return seqan::stl::detail::to::to_fn1{}(::std::forward(args)...); } template