datasketches 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/LICENSE +4 -6
  4. data/NOTICE +6 -5
  5. data/ext/datasketches/kll_wrapper.cpp +20 -20
  6. data/ext/datasketches/theta_wrapper.cpp +2 -2
  7. data/lib/datasketches/version.rb +1 -1
  8. data/vendor/datasketches-cpp/CMakeLists.txt +9 -1
  9. data/vendor/datasketches-cpp/LICENSE +4 -6
  10. data/vendor/datasketches-cpp/MANIFEST.in +21 -4
  11. data/vendor/datasketches-cpp/common/CMakeLists.txt +5 -2
  12. data/vendor/datasketches-cpp/common/include/common_defs.hpp +10 -0
  13. data/vendor/datasketches-cpp/common/include/kolmogorov_smirnov_impl.hpp +6 -6
  14. data/vendor/datasketches-cpp/common/include/memory_operations.hpp +1 -0
  15. data/vendor/datasketches-cpp/common/include/{quantile_sketch_sorted_view.hpp → quantiles_sorted_view.hpp} +60 -25
  16. data/vendor/datasketches-cpp/common/include/quantiles_sorted_view_impl.hpp +125 -0
  17. data/vendor/datasketches-cpp/common/{test/test_runner.cpp → include/version.hpp.in} +15 -8
  18. data/vendor/datasketches-cpp/common/test/CMakeLists.txt +37 -7
  19. data/vendor/datasketches-cpp/common/test/catch_runner.cpp +22 -1
  20. data/vendor/datasketches-cpp/common/test/integration_test.cpp +1 -1
  21. data/vendor/datasketches-cpp/common/test/quantiles_sorted_view_test.cpp +459 -0
  22. data/vendor/datasketches-cpp/cpc/test/CMakeLists.txt +1 -1
  23. data/vendor/datasketches-cpp/cpc/test/compression_test.cpp +1 -1
  24. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_allocation_test.cpp +1 -1
  25. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_test.cpp +1 -1
  26. data/vendor/datasketches-cpp/cpc/test/cpc_union_test.cpp +1 -1
  27. data/vendor/datasketches-cpp/fi/include/frequent_items_sketch.hpp +28 -44
  28. data/vendor/datasketches-cpp/fi/include/frequent_items_sketch_impl.hpp +70 -78
  29. data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map.hpp +11 -4
  30. data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map_impl.hpp +17 -10
  31. data/vendor/datasketches-cpp/fi/test/CMakeLists.txt +1 -1
  32. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_custom_type_test.cpp +55 -42
  33. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_test.cpp +1 -1
  34. data/vendor/datasketches-cpp/fi/test/reverse_purge_hash_map_test.cpp +4 -4
  35. data/vendor/datasketches-cpp/hll/include/Hll4Array-internal.hpp +2 -2
  36. data/vendor/datasketches-cpp/hll/test/AuxHashMapTest.cpp +1 -1
  37. data/vendor/datasketches-cpp/hll/test/CMakeLists.txt +1 -1
  38. data/vendor/datasketches-cpp/hll/test/CouponHashSetTest.cpp +1 -1
  39. data/vendor/datasketches-cpp/hll/test/CouponListTest.cpp +1 -1
  40. data/vendor/datasketches-cpp/hll/test/CrossCountingTest.cpp +1 -1
  41. data/vendor/datasketches-cpp/hll/test/HllArrayTest.cpp +1 -1
  42. data/vendor/datasketches-cpp/hll/test/HllSketchTest.cpp +1 -1
  43. data/vendor/datasketches-cpp/hll/test/HllUnionTest.cpp +1 -1
  44. data/vendor/datasketches-cpp/hll/test/IsomorphicTest.cpp +1 -1
  45. data/vendor/datasketches-cpp/hll/test/TablesTest.cpp +1 -1
  46. data/vendor/datasketches-cpp/hll/test/ToFromByteArrayTest.cpp +1 -1
  47. data/vendor/datasketches-cpp/kll/include/kll_helper.hpp +0 -32
  48. data/vendor/datasketches-cpp/kll/include/kll_sketch.hpp +176 -233
  49. data/vendor/datasketches-cpp/kll/include/kll_sketch_impl.hpp +337 -395
  50. data/vendor/datasketches-cpp/kll/test/CMakeLists.txt +1 -1
  51. data/vendor/datasketches-cpp/kll/test/kll_sketch_custom_type_test.cpp +27 -27
  52. data/vendor/datasketches-cpp/kll/test/kll_sketch_test.cpp +197 -233
  53. data/vendor/datasketches-cpp/kll/test/kll_sketch_validation.cpp +42 -32
  54. data/vendor/datasketches-cpp/kll/test/kolmogorov_smirnov_test.cpp +1 -1
  55. data/vendor/datasketches-cpp/pyproject.toml +17 -13
  56. data/vendor/datasketches-cpp/python/CMakeLists.txt +8 -1
  57. data/vendor/datasketches-cpp/python/README.md +1 -1
  58. data/vendor/datasketches-cpp/python/datasketches/PySerDe.py +104 -0
  59. data/vendor/datasketches-cpp/python/datasketches/__init__.py +22 -0
  60. data/vendor/datasketches-cpp/python/include/py_serde.hpp +113 -0
  61. data/vendor/datasketches-cpp/python/jupyter/ThetaSketchNotebook.ipynb +31 -24
  62. data/vendor/datasketches-cpp/python/pybind11Path.cmd +19 -1
  63. data/vendor/datasketches-cpp/python/src/__init__.py +17 -1
  64. data/vendor/datasketches-cpp/python/src/datasketches.cpp +9 -3
  65. data/vendor/datasketches-cpp/python/src/kll_wrapper.cpp +18 -54
  66. data/vendor/datasketches-cpp/python/src/py_serde.cpp +111 -0
  67. data/vendor/datasketches-cpp/python/src/quantiles_wrapper.cpp +17 -53
  68. data/vendor/datasketches-cpp/python/src/req_wrapper.cpp +17 -55
  69. data/vendor/datasketches-cpp/python/src/vector_of_kll.cpp +62 -67
  70. data/vendor/datasketches-cpp/python/src/vo_wrapper.cpp +47 -14
  71. data/vendor/datasketches-cpp/python/tests/__init__.py +16 -0
  72. data/vendor/datasketches-cpp/python/tests/req_test.py +1 -1
  73. data/vendor/datasketches-cpp/python/tests/vo_test.py +25 -1
  74. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch.hpp +135 -180
  75. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch_impl.hpp +205 -210
  76. data/vendor/datasketches-cpp/quantiles/test/CMakeLists.txt +1 -1
  77. data/vendor/datasketches-cpp/quantiles/test/kolmogorov_smirnov_test.cpp +1 -1
  78. data/vendor/datasketches-cpp/quantiles/test/quantiles_compatibility_test.cpp +20 -19
  79. data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_test.cpp +241 -233
  80. data/vendor/datasketches-cpp/req/include/req_compactor.hpp +15 -9
  81. data/vendor/datasketches-cpp/req/include/req_compactor_impl.hpp +35 -19
  82. data/vendor/datasketches-cpp/req/include/req_sketch.hpp +126 -147
  83. data/vendor/datasketches-cpp/req/include/req_sketch_impl.hpp +265 -245
  84. data/vendor/datasketches-cpp/req/test/CMakeLists.txt +1 -1
  85. data/vendor/datasketches-cpp/req/test/req_sketch_custom_type_test.cpp +27 -27
  86. data/vendor/datasketches-cpp/req/test/req_sketch_test.cpp +117 -104
  87. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch.hpp +22 -46
  88. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch_impl.hpp +180 -207
  89. data/vendor/datasketches-cpp/sampling/include/var_opt_union.hpp +18 -39
  90. data/vendor/datasketches-cpp/sampling/include/var_opt_union_impl.hpp +75 -85
  91. data/vendor/datasketches-cpp/sampling/test/CMakeLists.txt +1 -1
  92. data/vendor/datasketches-cpp/sampling/test/var_opt_allocation_test.cpp +7 -7
  93. data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_test.cpp +3 -3
  94. data/vendor/datasketches-cpp/sampling/test/var_opt_union_test.cpp +5 -5
  95. data/vendor/datasketches-cpp/setup.py +14 -3
  96. data/vendor/datasketches-cpp/theta/include/theta_sketch_impl.hpp +15 -25
  97. data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base.hpp +0 -9
  98. data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base_impl.hpp +5 -5
  99. data/vendor/datasketches-cpp/theta/test/CMakeLists.txt +1 -1
  100. data/vendor/datasketches-cpp/theta/test/theta_a_not_b_test.cpp +1 -1
  101. data/vendor/datasketches-cpp/theta/test/theta_intersection_test.cpp +1 -1
  102. data/vendor/datasketches-cpp/theta/test/theta_jaccard_similarity_test.cpp +1 -1
  103. data/vendor/datasketches-cpp/theta/test/theta_setop_test.cpp +1 -1
  104. data/vendor/datasketches-cpp/theta/test/theta_sketch_test.cpp +3 -2
  105. data/vendor/datasketches-cpp/theta/test/theta_union_test.cpp +1 -1
  106. data/vendor/datasketches-cpp/tox.ini +26 -0
  107. data/vendor/datasketches-cpp/tuple/include/tuple_sketch.hpp +36 -12
  108. data/vendor/datasketches-cpp/tuple/include/tuple_sketch_impl.hpp +41 -35
  109. data/vendor/datasketches-cpp/tuple/test/CMakeLists.txt +2 -1
  110. data/vendor/datasketches-cpp/tuple/test/array_of_doubles_sketch_test.cpp +1 -1
  111. data/vendor/datasketches-cpp/tuple/test/engagement_test.cpp +299 -0
  112. data/vendor/datasketches-cpp/tuple/test/tuple_a_not_b_test.cpp +1 -1
  113. data/vendor/datasketches-cpp/tuple/test/tuple_intersection_test.cpp +1 -1
  114. data/vendor/datasketches-cpp/tuple/test/tuple_jaccard_similarity_test.cpp +1 -1
  115. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_allocation_test.cpp +1 -1
  116. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_test.cpp +27 -1
  117. data/vendor/datasketches-cpp/tuple/test/tuple_union_test.cpp +1 -1
  118. data/vendor/datasketches-cpp/version.cfg.in +1 -0
  119. metadata +14 -7
  120. data/vendor/datasketches-cpp/common/include/quantile_sketch_sorted_view_impl.hpp +0 -91
  121. data/vendor/datasketches-cpp/common/test/catch.hpp +0 -17618
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
  #include <sstream>
22
22
  #include <stdexcept>
23
23
 
@@ -27,62 +27,75 @@
27
27
 
28
28
  namespace datasketches {
29
29
 
30
- using frequent_test_type_sketch = frequent_items_sketch<test_type, float, test_type_hash, test_type_equal, test_type_serde, test_allocator<test_type>>;
30
+ using frequent_test_type_sketch = frequent_items_sketch<test_type, float, test_type_hash, test_type_equal, test_allocator<test_type>>;
31
31
  using alloc = test_allocator<test_type>;
32
32
 
33
33
  TEST_CASE("frequent items: custom type", "[frequent_items_sketch]") {
34
- frequent_test_type_sketch sketch(3, frequent_test_type_sketch::LG_MIN_MAP_SIZE, 0);
35
- sketch.update(1, 10); // should survive the purge
36
- sketch.update(2);
37
- sketch.update(3);
38
- sketch.update(4);
39
- sketch.update(5);
40
- sketch.update(6);
41
- sketch.update(7);
42
- test_type a8(8);
43
- sketch.update(a8);
44
- REQUIRE_FALSE(sketch.is_empty());
45
- REQUIRE(sketch.get_total_weight() == 17);
46
- REQUIRE(sketch.get_estimate(1) == 10);
34
+ test_allocator_total_bytes = 0;
35
+ {
36
+ frequent_test_type_sketch sketch(3, frequent_test_type_sketch::LG_MIN_MAP_SIZE, test_type_equal(), 0);
37
+ sketch.update(1, 10); // should survive the purge
38
+ sketch.update(2);
39
+ sketch.update(3);
40
+ sketch.update(4);
41
+ sketch.update(5);
42
+ sketch.update(6);
43
+ sketch.update(7);
44
+ test_type a8(8);
45
+ sketch.update(a8);
46
+ REQUIRE_FALSE(sketch.is_empty());
47
+ REQUIRE(sketch.get_total_weight() == 17);
48
+ REQUIRE(sketch.get_estimate(1) == 10);
47
49
 
48
- auto items = sketch.get_frequent_items(frequent_items_error_type::NO_FALSE_POSITIVES);
49
- REQUIRE(items.size() == 1); // only 1 item should be above threshold
50
- REQUIRE(items[0].get_item().get_value() == 1);
51
- REQUIRE(items[0].get_estimate() == 10);
50
+ auto items = sketch.get_frequent_items(frequent_items_error_type::NO_FALSE_POSITIVES);
51
+ REQUIRE(items.size() == 1); // only 1 item should be above threshold
52
+ REQUIRE(items[0].get_item().get_value() == 1);
53
+ REQUIRE(items[0].get_estimate() == 10);
52
54
 
53
- std::stringstream s(std::ios::in | std::ios::out | std::ios::binary);
54
- sketch.serialize(s);
55
- auto sketch2 = frequent_test_type_sketch::deserialize(s, alloc(0));
56
- REQUIRE_FALSE(sketch2.is_empty());
57
- REQUIRE(sketch2.get_total_weight() == 17);
58
- REQUIRE(sketch2.get_estimate(1) == 10);
59
- REQUIRE(sketch.get_num_active_items() == sketch2.get_num_active_items());
60
- REQUIRE(sketch.get_maximum_error() == sketch2.get_maximum_error());
55
+ std::stringstream s(std::ios::in | std::ios::out | std::ios::binary);
56
+ sketch.serialize(s, test_type_serde());
57
+ auto sketch2 = frequent_test_type_sketch::deserialize(s, test_type_serde(), test_type_equal(), 0);
58
+ REQUIRE_FALSE(sketch2.is_empty());
59
+ REQUIRE(sketch2.get_total_weight() == 17);
60
+ REQUIRE(sketch2.get_estimate(1) == 10);
61
+ REQUIRE(sketch.get_num_active_items() == sketch2.get_num_active_items());
62
+ REQUIRE(sketch.get_maximum_error() == sketch2.get_maximum_error());
61
63
 
62
- auto bytes = sketch.serialize();
63
- auto sketch3 = frequent_test_type_sketch::deserialize(bytes.data(), bytes.size(), alloc(0));
64
- REQUIRE_FALSE(sketch3.is_empty());
65
- REQUIRE(sketch3.get_total_weight() == 17);
66
- REQUIRE(sketch3.get_estimate(1) == 10);
67
- REQUIRE(sketch.get_num_active_items() == sketch3.get_num_active_items());
68
- REQUIRE(sketch.get_maximum_error() == sketch3.get_maximum_error());
64
+ auto bytes = sketch.serialize(0, test_type_serde());
65
+ auto sketch3 = frequent_test_type_sketch::deserialize(bytes.data(), bytes.size(), test_type_serde(),
66
+ test_type_equal(), 0);
67
+ REQUIRE_FALSE(sketch3.is_empty());
68
+ REQUIRE(sketch3.get_total_weight() == 17);
69
+ REQUIRE(sketch3.get_estimate(1) == 10);
70
+ REQUIRE(sketch.get_num_active_items() == sketch3.get_num_active_items());
71
+ REQUIRE(sketch.get_maximum_error() == sketch3.get_maximum_error());
72
+ }
73
+ REQUIRE(test_allocator_total_bytes == 0);
69
74
  }
70
75
 
71
76
  // this is to see the debug print from test_type if enabled there to make sure items are moved
72
77
  TEST_CASE("frequent items: moving merge", "[frequent_items_sketch]") {
73
- frequent_test_type_sketch sketch1(3, frequent_test_type_sketch::LG_MIN_MAP_SIZE, 0);
74
- sketch1.update(1);
78
+ test_allocator_total_bytes = 0;
79
+ {
80
+ frequent_test_type_sketch sketch1(3, frequent_test_type_sketch::LG_MIN_MAP_SIZE, test_type_equal(), 0);
81
+ sketch1.update(1);
75
82
 
76
- frequent_test_type_sketch sketch2(3, frequent_test_type_sketch::LG_MIN_MAP_SIZE, 0);
77
- sketch2.update(2);
83
+ frequent_test_type_sketch sketch2(3, frequent_test_type_sketch::LG_MIN_MAP_SIZE, test_type_equal(), 0);
84
+ sketch2.update(2);
78
85
 
79
- sketch2.merge(std::move(sketch1));
80
- REQUIRE(sketch2.get_total_weight() == 2);
86
+ sketch2.merge(std::move(sketch1));
87
+ REQUIRE(sketch2.get_total_weight() == 2);
88
+ }
89
+ REQUIRE(test_allocator_total_bytes == 0);
81
90
  }
82
91
 
83
92
  TEST_CASE("frequent items: negative weight", "[frequent_items_sketch]") {
84
- frequent_test_type_sketch sketch(3, frequent_test_type_sketch::LG_MIN_MAP_SIZE, 0);
85
- REQUIRE_THROWS_AS(sketch.update(1, -1), std::invalid_argument);
93
+ test_allocator_total_bytes = 0;
94
+ {
95
+ frequent_test_type_sketch sketch(3, frequent_test_type_sketch::LG_MIN_MAP_SIZE, test_type_equal(), 0);
96
+ REQUIRE_THROWS_AS(sketch.update(1, -1), std::invalid_argument);
97
+ }
98
+ REQUIRE(test_allocator_total_bytes == 0);
86
99
  }
87
100
 
88
101
  } /* namespace datasketches */
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
  #include <sstream>
22
22
  #include <fstream>
23
23
  #include <stdexcept>
@@ -17,27 +17,27 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
 
22
22
  #include <reverse_purge_hash_map.hpp>
23
23
 
24
24
  namespace datasketches {
25
25
 
26
26
  TEST_CASE("reverse purge hash map: empty", "[frequent_items_sketch]") {
27
- reverse_purge_hash_map<int> map(3, 3, std::allocator<int>());
27
+ reverse_purge_hash_map<int> map(3, 3, std::equal_to<int>(), std::allocator<int>());
28
28
  REQUIRE(map.get_num_active() == 0);
29
29
  REQUIRE(map.get_lg_cur_size() == 3); // static_cast<uint8_t>(3)
30
30
  }
31
31
 
32
32
  TEST_CASE("reverse purge hash map: one item", "[frequent_items_sketch]") {
33
- reverse_purge_hash_map<int> map(3, 3, std::allocator<int>());
33
+ reverse_purge_hash_map<int> map(3, 3, std::equal_to<int>(), std::allocator<int>());
34
34
  map.adjust_or_insert(1, 1);
35
35
  REQUIRE(map.get_num_active() == 1);
36
36
  REQUIRE(map.get(1) == 1);
37
37
  }
38
38
 
39
39
  TEST_CASE("reverse purge hash map: iterator", "[frequent_items_sketch]") {
40
- reverse_purge_hash_map<int> map(3, 4, std::allocator<int>());
40
+ reverse_purge_hash_map<int> map(3, 4, std::equal_to<int>(), std::allocator<int>());
41
41
  for (int i = 0; i < 11; i++) map.adjust_or_insert(i, 1); // this should fit with no purge
42
42
  uint64_t sum = 0;
43
43
  for (auto it: map) sum += it.second;
@@ -267,10 +267,10 @@ void Hll4Array<A>::shiftToBiggerCurMin() {
267
267
  for (const auto coupon: *auxHashMap_) {
268
268
  slotNum = HllUtil<A>::getLow26(coupon) & configKmask;
269
269
  oldActualVal = HllUtil<A>::getValue(coupon);
270
- newShiftedVal = oldActualVal - newCurMin;
271
- if (newShiftedVal < 0) {
270
+ if (oldActualVal < newCurMin) {
272
271
  throw std::logic_error("oldActualVal < newCurMin when incrementing curMin");
273
272
  }
273
+ newShiftedVal = oldActualVal - newCurMin;
274
274
 
275
275
  if (getSlot(slotNum) != hll_constants::AUX_TOKEN) {
276
276
  throw std::logic_error("getSlot(slotNum) != AUX_TOKEN for item in auxiliary hash map");
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
  #include <memory>
22
22
  #include <stdexcept>
23
23
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  add_executable(hll_test)
19
19
 
20
- target_link_libraries(hll_test hll common_test)
20
+ target_link_libraries(hll_test hll common_test_lib)
21
21
 
22
22
  set_target_properties(hll_test PROPERTIES
23
23
  CXX_STANDARD 11
@@ -21,7 +21,7 @@
21
21
  #include "CouponHashSet.hpp"
22
22
  #include "HllUtil.hpp"
23
23
 
24
- #include <catch.hpp>
24
+ #include <catch2/catch.hpp>
25
25
  #include <ostream>
26
26
  #include <cmath>
27
27
  #include <string>
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
  #include <ostream>
22
22
  #include <sstream>
23
23
  #include <cmath>
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
  #include <ostream>
22
22
  #include <cmath>
23
23
  #include <string>
@@ -22,7 +22,7 @@
22
22
  #include <exception>
23
23
  #include <sstream>
24
24
  #include <stdexcept>
25
- #include <catch.hpp>
25
+ #include <catch2/catch.hpp>
26
26
 
27
27
  namespace datasketches {
28
28
 
@@ -21,7 +21,7 @@
21
21
 
22
22
  #include "hll.hpp"
23
23
 
24
- #include <catch.hpp>
24
+ #include <catch2/catch.hpp>
25
25
  #include <test_allocator.hpp>
26
26
 
27
27
  namespace datasketches {
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
  #include <sstream>
22
22
  #include <stdexcept>
23
23
 
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
 
22
22
  #include <cstdio>
23
23
 
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include <stdexcept>
21
21
 
22
- #include <catch.hpp>
22
+ #include <catch2/catch.hpp>
23
23
 
24
24
  #include "CubicInterpolation.hpp"
25
25
 
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
  #include <fstream>
22
22
 
23
23
  #include "hll.hpp"
@@ -48,38 +48,6 @@ class kll_helper {
48
48
  static inline uint16_t int_cap_aux_aux(uint16_t k, uint8_t depth);
49
49
  static inline uint64_t sum_the_sample_weights(uint8_t num_levels, const uint32_t* levels);
50
50
 
51
- /*
52
- * This version is for floating point types
53
- * Checks the sequential validity of the given array of values.
54
- * They must be unique, monotonically increasing and not NaN.
55
- */
56
- template <typename T, typename C>
57
- static typename std::enable_if<std::is_floating_point<T>::value, void>::type
58
- validate_values(const T* values, uint32_t size) {
59
- for (uint32_t i = 0; i < size ; i++) {
60
- if (std::isnan(values[i])) {
61
- throw std::invalid_argument("Values must not be NaN");
62
- }
63
- if ((i < (size - 1)) && !(C()(values[i], values[i + 1]))) {
64
- throw std::invalid_argument("Values must be unique and monotonically increasing");
65
- }
66
- }
67
- }
68
- /*
69
- * This version is for non-floating point types
70
- * Checks the sequential validity of the given array of values.
71
- * They must be unique and monotonically increasing.
72
- */
73
- template <typename T, typename C>
74
- static typename std::enable_if<!std::is_floating_point<T>::value, void>::type
75
- validate_values(const T* values, uint32_t size) {
76
- for (uint32_t i = 0; i < size ; i++) {
77
- if ((i < (size - 1)) && !(C()(values[i], values[i + 1]))) {
78
- throw std::invalid_argument("Values must be unique and monotonically increasing");
79
- }
80
- }
81
- }
82
-
83
51
  template <typename T>
84
52
  static void randomly_halve_down(T* buf, uint32_t start, uint32_t length);
85
53