datasketches 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/NOTICE +1 -1
  4. data/README.md +0 -2
  5. data/ext/datasketches/cpc_wrapper.cpp +2 -2
  6. data/ext/datasketches/kll_wrapper.cpp +0 -10
  7. data/lib/datasketches/version.rb +1 -1
  8. data/lib/datasketches.rb +1 -1
  9. data/vendor/datasketches-cpp/CMakeLists.txt +1 -0
  10. data/vendor/datasketches-cpp/CODE_OF_CONDUCT.md +3 -0
  11. data/vendor/datasketches-cpp/CONTRIBUTING.md +50 -0
  12. data/vendor/datasketches-cpp/Doxyfile +2827 -0
  13. data/vendor/datasketches-cpp/LICENSE +0 -76
  14. data/vendor/datasketches-cpp/NOTICE +1 -1
  15. data/vendor/datasketches-cpp/README.md +1 -3
  16. data/vendor/datasketches-cpp/common/CMakeLists.txt +12 -11
  17. data/vendor/datasketches-cpp/common/include/common_defs.hpp +11 -8
  18. data/vendor/datasketches-cpp/common/include/count_zeros.hpp +0 -2
  19. data/vendor/datasketches-cpp/common/include/kolmogorov_smirnov.hpp +9 -6
  20. data/vendor/datasketches-cpp/common/include/optional.hpp +148 -0
  21. data/vendor/datasketches-cpp/common/include/quantiles_sorted_view.hpp +95 -2
  22. data/vendor/datasketches-cpp/common/include/quantiles_sorted_view_impl.hpp +1 -1
  23. data/vendor/datasketches-cpp/common/include/serde.hpp +69 -20
  24. data/vendor/datasketches-cpp/common/test/CMakeLists.txt +1 -1
  25. data/vendor/datasketches-cpp/common/test/optional_test.cpp +85 -0
  26. data/vendor/datasketches-cpp/common/test/test_allocator.hpp +14 -14
  27. data/vendor/datasketches-cpp/count/include/count_min.hpp +132 -78
  28. data/vendor/datasketches-cpp/count/include/count_min_impl.hpp +132 -152
  29. data/vendor/datasketches-cpp/count/test/CMakeLists.txt +11 -12
  30. data/vendor/datasketches-cpp/count/test/count_min_allocation_test.cpp +61 -61
  31. data/vendor/datasketches-cpp/count/test/count_min_test.cpp +175 -178
  32. data/vendor/datasketches-cpp/cpc/include/cpc_common.hpp +14 -20
  33. data/vendor/datasketches-cpp/cpc/include/cpc_compressor.hpp +7 -4
  34. data/vendor/datasketches-cpp/cpc/include/cpc_compressor_impl.hpp +17 -17
  35. data/vendor/datasketches-cpp/cpc/include/cpc_sketch.hpp +40 -40
  36. data/vendor/datasketches-cpp/cpc/include/cpc_sketch_impl.hpp +13 -10
  37. data/vendor/datasketches-cpp/cpc/include/cpc_union.hpp +35 -11
  38. data/vendor/datasketches-cpp/cpc/include/cpc_union_impl.hpp +8 -8
  39. data/vendor/datasketches-cpp/cpc/include/u32_table.hpp +3 -2
  40. data/vendor/datasketches-cpp/cpc/include/u32_table_impl.hpp +5 -5
  41. data/vendor/datasketches-cpp/cpc/test/CMakeLists.txt +20 -7
  42. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_deserialize_from_java_test.cpp +60 -0
  43. data/vendor/datasketches-cpp/{python/include/py_object_lt.hpp → cpc/test/cpc_sketch_serialize_for_java.cpp} +15 -14
  44. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_test.cpp +4 -29
  45. data/vendor/datasketches-cpp/cpc/test/cpc_union_test.cpp +4 -4
  46. data/vendor/datasketches-cpp/density/include/density_sketch.hpp +29 -9
  47. data/vendor/datasketches-cpp/density/include/density_sketch_impl.hpp +1 -1
  48. data/vendor/datasketches-cpp/density/test/CMakeLists.txt +0 -1
  49. data/vendor/datasketches-cpp/fi/include/frequent_items_sketch.hpp +21 -9
  50. data/vendor/datasketches-cpp/fi/include/frequent_items_sketch_impl.hpp +6 -4
  51. data/vendor/datasketches-cpp/fi/test/CMakeLists.txt +14 -1
  52. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_deserialize_from_java_test.cpp +95 -0
  53. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_serialize_for_java.cpp +83 -0
  54. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_test.cpp +3 -42
  55. data/vendor/datasketches-cpp/hll/include/CouponList-internal.hpp +2 -2
  56. data/vendor/datasketches-cpp/hll/include/CouponList.hpp +3 -1
  57. data/vendor/datasketches-cpp/hll/include/HllArray-internal.hpp +3 -3
  58. data/vendor/datasketches-cpp/hll/include/HllArray.hpp +5 -3
  59. data/vendor/datasketches-cpp/hll/include/HllSketch-internal.hpp +4 -4
  60. data/vendor/datasketches-cpp/hll/include/HllSketchImpl.hpp +3 -1
  61. data/vendor/datasketches-cpp/hll/include/HllUtil.hpp +0 -12
  62. data/vendor/datasketches-cpp/hll/include/hll.hpp +70 -57
  63. data/vendor/datasketches-cpp/hll/test/CMakeLists.txt +14 -1
  64. data/vendor/datasketches-cpp/hll/test/ToFromByteArrayTest.cpp +0 -68
  65. data/vendor/datasketches-cpp/hll/test/hll_sketch_deserialize_from_java_test.cpp +69 -0
  66. data/vendor/datasketches-cpp/hll/test/hll_sketch_serialize_for_java.cpp +52 -0
  67. data/vendor/datasketches-cpp/kll/include/kll_helper_impl.hpp +2 -2
  68. data/vendor/datasketches-cpp/kll/include/kll_sketch.hpp +71 -50
  69. data/vendor/datasketches-cpp/kll/include/kll_sketch_impl.hpp +59 -130
  70. data/vendor/datasketches-cpp/kll/test/CMakeLists.txt +14 -1
  71. data/vendor/datasketches-cpp/kll/test/kll_sketch_deserialize_from_java_test.cpp +103 -0
  72. data/vendor/datasketches-cpp/kll/test/kll_sketch_serialize_for_java.cpp +62 -0
  73. data/vendor/datasketches-cpp/kll/test/kll_sketch_test.cpp +3 -38
  74. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch.hpp +68 -51
  75. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch_impl.hpp +62 -132
  76. data/vendor/datasketches-cpp/quantiles/test/CMakeLists.txt +14 -1
  77. data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_deserialize_from_java_test.cpp +84 -0
  78. data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_serialize_for_java.cpp +52 -0
  79. data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_test.cpp +14 -38
  80. data/vendor/datasketches-cpp/req/include/req_common.hpp +7 -3
  81. data/vendor/datasketches-cpp/req/include/req_compactor_impl.hpp +2 -2
  82. data/vendor/datasketches-cpp/req/include/req_sketch.hpp +97 -23
  83. data/vendor/datasketches-cpp/req/include/req_sketch_impl.hpp +48 -109
  84. data/vendor/datasketches-cpp/req/test/CMakeLists.txt +14 -1
  85. data/vendor/datasketches-cpp/req/test/req_sketch_deserialize_from_java_test.cpp +55 -0
  86. data/vendor/datasketches-cpp/{tuple/include/array_of_doubles_intersection_impl.hpp → req/test/req_sketch_serialize_for_java.cpp} +12 -7
  87. data/vendor/datasketches-cpp/req/test/req_sketch_test.cpp +3 -89
  88. data/vendor/datasketches-cpp/sampling/CMakeLists.txt +4 -0
  89. data/vendor/datasketches-cpp/sampling/include/ebpps_sample.hpp +210 -0
  90. data/vendor/datasketches-cpp/sampling/include/ebpps_sample_impl.hpp +535 -0
  91. data/vendor/datasketches-cpp/sampling/include/ebpps_sketch.hpp +281 -0
  92. data/vendor/datasketches-cpp/sampling/include/ebpps_sketch_impl.hpp +531 -0
  93. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch.hpp +69 -26
  94. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch_impl.hpp +3 -3
  95. data/vendor/datasketches-cpp/sampling/include/var_opt_union.hpp +10 -11
  96. data/vendor/datasketches-cpp/sampling/include/var_opt_union_impl.hpp +4 -4
  97. data/vendor/datasketches-cpp/sampling/test/CMakeLists.txt +55 -8
  98. data/vendor/datasketches-cpp/sampling/test/ebpps_allocation_test.cpp +96 -0
  99. data/vendor/datasketches-cpp/sampling/test/ebpps_sample_test.cpp +137 -0
  100. data/vendor/datasketches-cpp/sampling/test/ebpps_sketch_test.cpp +266 -0
  101. data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_deserialize_from_java_test.cpp +81 -0
  102. data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_serialize_for_java.cpp +54 -0
  103. data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_test.cpp +0 -37
  104. data/vendor/datasketches-cpp/sampling/test/var_opt_union_deserialize_from_java_test.cpp +50 -0
  105. data/vendor/datasketches-cpp/sampling/test/var_opt_union_serialize_for_java.cpp +56 -0
  106. data/vendor/datasketches-cpp/sampling/test/var_opt_union_test.cpp +0 -18
  107. data/vendor/datasketches-cpp/theta/include/bit_packing.hpp +2608 -2608
  108. data/vendor/datasketches-cpp/theta/include/bounds_on_ratios_in_sampled_sets.hpp +1 -0
  109. data/vendor/datasketches-cpp/theta/include/bounds_on_ratios_in_theta_sketched_sets.hpp +7 -6
  110. data/vendor/datasketches-cpp/theta/include/theta_a_not_b.hpp +20 -5
  111. data/vendor/datasketches-cpp/theta/include/theta_constants.hpp +10 -4
  112. data/vendor/datasketches-cpp/theta/include/theta_helpers.hpp +1 -1
  113. data/vendor/datasketches-cpp/theta/include/theta_intersection.hpp +13 -5
  114. data/vendor/datasketches-cpp/theta/include/theta_intersection_base_impl.hpp +5 -5
  115. data/vendor/datasketches-cpp/theta/include/theta_intersection_impl.hpp +3 -3
  116. data/vendor/datasketches-cpp/theta/include/theta_jaccard_similarity.hpp +2 -1
  117. data/vendor/datasketches-cpp/theta/include/theta_jaccard_similarity_base.hpp +1 -0
  118. data/vendor/datasketches-cpp/theta/include/theta_set_difference_base_impl.hpp +1 -1
  119. data/vendor/datasketches-cpp/theta/include/theta_sketch.hpp +126 -27
  120. data/vendor/datasketches-cpp/theta/include/theta_sketch_impl.hpp +8 -8
  121. data/vendor/datasketches-cpp/theta/include/theta_union.hpp +17 -10
  122. data/vendor/datasketches-cpp/theta/include/theta_union_base_impl.hpp +1 -1
  123. data/vendor/datasketches-cpp/theta/include/theta_union_impl.hpp +3 -3
  124. data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base.hpp +5 -2
  125. data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base_impl.hpp +11 -1
  126. data/vendor/datasketches-cpp/theta/test/CMakeLists.txt +14 -1
  127. data/vendor/datasketches-cpp/theta/test/theta_sketch_deserialize_from_java_test.cpp +57 -0
  128. data/vendor/datasketches-cpp/theta/test/theta_sketch_serialize_for_java.cpp +61 -0
  129. data/vendor/datasketches-cpp/theta/test/theta_sketch_test.cpp +0 -188
  130. data/vendor/datasketches-cpp/tuple/CMakeLists.txt +8 -7
  131. data/vendor/datasketches-cpp/tuple/include/array_of_doubles_sketch.hpp +19 -144
  132. data/vendor/datasketches-cpp/tuple/include/{array_of_doubles_a_not_b.hpp → array_tuple_a_not_b.hpp} +24 -16
  133. data/vendor/datasketches-cpp/tuple/include/{array_of_doubles_a_not_b_impl.hpp → array_tuple_a_not_b_impl.hpp} +4 -4
  134. data/vendor/datasketches-cpp/tuple/include/array_tuple_intersection.hpp +65 -0
  135. data/vendor/datasketches-cpp/{python/include/py_object_ostream.hpp → tuple/include/array_tuple_intersection_impl.hpp} +7 -24
  136. data/vendor/datasketches-cpp/tuple/include/array_tuple_sketch.hpp +237 -0
  137. data/vendor/datasketches-cpp/tuple/include/{array_of_doubles_sketch_impl.hpp → array_tuple_sketch_impl.hpp} +40 -41
  138. data/vendor/datasketches-cpp/tuple/include/array_tuple_union.hpp +81 -0
  139. data/vendor/datasketches-cpp/tuple/include/array_tuple_union_impl.hpp +43 -0
  140. data/vendor/datasketches-cpp/tuple/include/tuple_a_not_b.hpp +11 -2
  141. data/vendor/datasketches-cpp/tuple/include/tuple_intersection.hpp +17 -10
  142. data/vendor/datasketches-cpp/tuple/include/tuple_jaccard_similarity.hpp +2 -1
  143. data/vendor/datasketches-cpp/tuple/include/tuple_sketch.hpp +95 -32
  144. data/vendor/datasketches-cpp/tuple/include/tuple_union.hpp +19 -11
  145. data/vendor/datasketches-cpp/tuple/test/CMakeLists.txt +16 -1
  146. data/vendor/datasketches-cpp/tuple/test/aod_sketch_deserialize_from_java_test.cpp +76 -0
  147. data/vendor/datasketches-cpp/tuple/test/aod_sketch_serialize_for_java.cpp +62 -0
  148. data/vendor/datasketches-cpp/tuple/test/array_of_doubles_sketch_test.cpp +5 -129
  149. data/vendor/datasketches-cpp/tuple/test/engagement_test.cpp +85 -89
  150. data/vendor/datasketches-cpp/tuple/test/tuple_jaccard_similarity_test.cpp +3 -1
  151. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_deserialize_from_java_test.cpp +47 -0
  152. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_serialize_for_java.cpp +38 -0
  153. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_test.cpp +1 -1
  154. data/vendor/datasketches-cpp/version.cfg.in +1 -1
  155. metadata +47 -93
  156. data/vendor/datasketches-cpp/MANIFEST.in +0 -39
  157. data/vendor/datasketches-cpp/fi/test/items_sketch_string_from_java.sk +0 -0
  158. data/vendor/datasketches-cpp/fi/test/items_sketch_string_utf8_from_java.sk +0 -0
  159. data/vendor/datasketches-cpp/fi/test/longs_sketch_from_java.sk +0 -0
  160. data/vendor/datasketches-cpp/hll/test/array6_from_java.sk +0 -0
  161. data/vendor/datasketches-cpp/hll/test/compact_array4_from_java.sk +0 -0
  162. data/vendor/datasketches-cpp/hll/test/compact_set_from_java.sk +0 -0
  163. data/vendor/datasketches-cpp/hll/test/list_from_java.sk +0 -0
  164. data/vendor/datasketches-cpp/hll/test/updatable_array4_from_java.sk +0 -0
  165. data/vendor/datasketches-cpp/hll/test/updatable_set_from_java.sk +0 -0
  166. data/vendor/datasketches-cpp/kll/test/kll_sketch_from_java.sk +0 -0
  167. data/vendor/datasketches-cpp/pyproject.toml +0 -23
  168. data/vendor/datasketches-cpp/python/CMakeLists.txt +0 -87
  169. data/vendor/datasketches-cpp/python/README.md +0 -85
  170. data/vendor/datasketches-cpp/python/datasketches/DensityWrapper.py +0 -87
  171. data/vendor/datasketches-cpp/python/datasketches/KernelFunction.py +0 -35
  172. data/vendor/datasketches-cpp/python/datasketches/PySerDe.py +0 -110
  173. data/vendor/datasketches-cpp/python/datasketches/TuplePolicy.py +0 -77
  174. data/vendor/datasketches-cpp/python/datasketches/TupleWrapper.py +0 -205
  175. data/vendor/datasketches-cpp/python/datasketches/__init__.py +0 -38
  176. data/vendor/datasketches-cpp/python/include/kernel_function.hpp +0 -98
  177. data/vendor/datasketches-cpp/python/include/py_serde.hpp +0 -113
  178. data/vendor/datasketches-cpp/python/include/quantile_conditional.hpp +0 -104
  179. data/vendor/datasketches-cpp/python/include/tuple_policy.hpp +0 -136
  180. data/vendor/datasketches-cpp/python/jupyter/CPCSketch.ipynb +0 -345
  181. data/vendor/datasketches-cpp/python/jupyter/FrequentItemsSketch.ipynb +0 -354
  182. data/vendor/datasketches-cpp/python/jupyter/HLLSketch.ipynb +0 -346
  183. data/vendor/datasketches-cpp/python/jupyter/KLLSketch.ipynb +0 -463
  184. data/vendor/datasketches-cpp/python/jupyter/ThetaSketchNotebook.ipynb +0 -403
  185. data/vendor/datasketches-cpp/python/pybind11Path.cmd +0 -21
  186. data/vendor/datasketches-cpp/python/src/__init__.py +0 -18
  187. data/vendor/datasketches-cpp/python/src/count_wrapper.cpp +0 -101
  188. data/vendor/datasketches-cpp/python/src/cpc_wrapper.cpp +0 -76
  189. data/vendor/datasketches-cpp/python/src/datasketches.cpp +0 -58
  190. data/vendor/datasketches-cpp/python/src/density_wrapper.cpp +0 -95
  191. data/vendor/datasketches-cpp/python/src/fi_wrapper.cpp +0 -182
  192. data/vendor/datasketches-cpp/python/src/hll_wrapper.cpp +0 -126
  193. data/vendor/datasketches-cpp/python/src/kll_wrapper.cpp +0 -158
  194. data/vendor/datasketches-cpp/python/src/ks_wrapper.cpp +0 -68
  195. data/vendor/datasketches-cpp/python/src/py_serde.cpp +0 -112
  196. data/vendor/datasketches-cpp/python/src/quantiles_wrapper.cpp +0 -155
  197. data/vendor/datasketches-cpp/python/src/req_wrapper.cpp +0 -154
  198. data/vendor/datasketches-cpp/python/src/theta_wrapper.cpp +0 -166
  199. data/vendor/datasketches-cpp/python/src/tuple_wrapper.cpp +0 -215
  200. data/vendor/datasketches-cpp/python/src/vector_of_kll.cpp +0 -490
  201. data/vendor/datasketches-cpp/python/src/vo_wrapper.cpp +0 -173
  202. data/vendor/datasketches-cpp/python/tests/__init__.py +0 -16
  203. data/vendor/datasketches-cpp/python/tests/count_min_test.py +0 -86
  204. data/vendor/datasketches-cpp/python/tests/cpc_test.py +0 -64
  205. data/vendor/datasketches-cpp/python/tests/density_test.py +0 -93
  206. data/vendor/datasketches-cpp/python/tests/fi_test.py +0 -149
  207. data/vendor/datasketches-cpp/python/tests/hll_test.py +0 -129
  208. data/vendor/datasketches-cpp/python/tests/kll_test.py +0 -159
  209. data/vendor/datasketches-cpp/python/tests/quantiles_test.py +0 -160
  210. data/vendor/datasketches-cpp/python/tests/req_test.py +0 -159
  211. data/vendor/datasketches-cpp/python/tests/theta_test.py +0 -148
  212. data/vendor/datasketches-cpp/python/tests/tuple_test.py +0 -206
  213. data/vendor/datasketches-cpp/python/tests/vector_of_kll_test.py +0 -148
  214. data/vendor/datasketches-cpp/python/tests/vo_test.py +0 -132
  215. data/vendor/datasketches-cpp/req/test/req_float_empty_from_java.sk +0 -0
  216. data/vendor/datasketches-cpp/req/test/req_float_estimation_from_java.sk +0 -0
  217. data/vendor/datasketches-cpp/req/test/req_float_exact_from_java.sk +0 -0
  218. data/vendor/datasketches-cpp/req/test/req_float_raw_items_from_java.sk +0 -0
  219. data/vendor/datasketches-cpp/req/test/req_float_single_item_from_java.sk +0 -0
  220. data/vendor/datasketches-cpp/sampling/test/binaries_from_java.txt +0 -67
  221. data/vendor/datasketches-cpp/sampling/test/varopt_sketch_long_sampling.sk +0 -0
  222. data/vendor/datasketches-cpp/sampling/test/varopt_sketch_string_exact.sk +0 -0
  223. data/vendor/datasketches-cpp/sampling/test/varopt_union_double_sampling.sk +0 -0
  224. data/vendor/datasketches-cpp/setup.py +0 -110
  225. data/vendor/datasketches-cpp/theta/test/theta_compact_empty_from_java.sk +0 -0
  226. data/vendor/datasketches-cpp/theta/test/theta_compact_estimation_from_java.sk +0 -0
  227. data/vendor/datasketches-cpp/theta/test/theta_compact_exact_from_java.sk +0 -0
  228. data/vendor/datasketches-cpp/theta/test/theta_compact_single_item_from_java.sk +0 -0
  229. data/vendor/datasketches-cpp/tox.ini +0 -26
  230. data/vendor/datasketches-cpp/tuple/include/array_of_doubles_intersection.hpp +0 -52
  231. data/vendor/datasketches-cpp/tuple/include/array_of_doubles_union.hpp +0 -81
  232. data/vendor/datasketches-cpp/tuple/include/array_of_doubles_union_impl.hpp +0 -43
  233. data/vendor/datasketches-cpp/tuple/test/aod_1_compact_empty_from_java.sk +0 -1
  234. data/vendor/datasketches-cpp/tuple/test/aod_1_compact_estimation_from_java.sk +0 -0
  235. data/vendor/datasketches-cpp/tuple/test/aod_1_compact_non_empty_no_entries_from_java.sk +0 -0
  236. data/vendor/datasketches-cpp/tuple/test/aod_2_compact_exact_from_java.sk +0 -0
  237. data/vendor/datasketches-cpp/tuple/test/aod_3_compact_empty_from_java.sk +0 -1
@@ -20,160 +20,35 @@
20
20
  #ifndef ARRAY_OF_DOUBLES_SKETCH_HPP_
21
21
  #define ARRAY_OF_DOUBLES_SKETCH_HPP_
22
22
 
23
- #include <vector>
24
- #include <memory>
25
-
26
- #include "serde.hpp"
27
- #include "tuple_sketch.hpp"
23
+ #include "array_tuple_sketch.hpp"
24
+ #include "array_tuple_union.hpp"
25
+ #include "array_tuple_intersection.hpp"
26
+ #include "array_tuple_a_not_b.hpp"
28
27
 
29
28
  namespace datasketches {
30
29
 
31
- // This sketch is equivalent of ArrayOfDoublesSketch in Java
32
-
33
- // This simple array of double is faster than std::vector and should be sufficient for this application
34
- template<typename Allocator = std::allocator<double>>
35
- class aod {
36
- public:
37
- explicit aod(uint8_t size, const Allocator& allocator = Allocator()):
38
- allocator_(allocator), size_(size), array_(allocator_.allocate(size_)) {
39
- std::fill(array_, array_ + size_, 0);
40
- }
41
- aod(const aod& other):
42
- allocator_(other.allocator_),
43
- size_(other.size_),
44
- array_(allocator_.allocate(size_))
45
- {
46
- std::copy(other.array_, other.array_ + size_, array_);
47
- }
48
- aod(aod&& other) noexcept:
49
- allocator_(std::move(other.allocator_)),
50
- size_(other.size_),
51
- array_(other.array_)
52
- {
53
- other.array_ = nullptr;
54
- }
55
- ~aod() {
56
- if (array_ != nullptr) allocator_.deallocate(array_, size_);
57
- }
58
- aod& operator=(const aod& other) {
59
- aod copy(other);
60
- std::swap(allocator_, copy.allocator_);
61
- std::swap(size_, copy.size_);
62
- std::swap(array_, copy.array_);
63
- return *this;
64
- }
65
- aod& operator=(aod&& other) {
66
- std::swap(allocator_, other.allocator_);
67
- std::swap(size_, other.size_);
68
- std::swap(array_, other.array_);
69
- return *this;
70
- }
71
- double& operator[](size_t index) { return array_[index]; }
72
- double operator[](size_t index) const { return array_[index]; }
73
- uint8_t size() const { return size_; }
74
- double* data() { return array_; }
75
- const double* data() const { return array_; }
76
- bool operator==(const aod& other) const {
77
- for (uint8_t i = 0; i < size_; ++i) if (array_[i] != other.array_[i]) return false;
78
- return true;
79
- }
80
- private:
81
- Allocator allocator_;
82
- uint8_t size_;
83
- double* array_;
84
- };
85
-
86
- template<typename A = std::allocator<double>>
87
- class array_of_doubles_update_policy {
88
- public:
89
- array_of_doubles_update_policy(uint8_t num_values = 1, const A& allocator = A()):
90
- allocator_(allocator), num_values_(num_values) {}
91
- aod<A> create() const {
92
- return aod<A>(num_values_, allocator_);
93
- }
94
- template<typename InputVector> // to allow any type with indexed access (such as double*)
95
- void update(aod<A>& summary, const InputVector& update) const {
96
- for (uint8_t i = 0; i < num_values_; ++i) summary[i] += update[i];
97
- }
98
- uint8_t get_num_values() const {
99
- return num_values_;
100
- }
101
-
102
- private:
103
- A allocator_;
104
- uint8_t num_values_;
105
- };
106
-
107
- // forward declaration
108
- template<typename A> class compact_array_of_doubles_sketch_alloc;
109
-
110
- template<typename A> using AllocAOD = typename std::allocator_traits<A>::template rebind_alloc<aod<A>>;
111
-
112
- template<typename A = std::allocator<double>>
113
- class update_array_of_doubles_sketch_alloc: public update_tuple_sketch<aod<A>, aod<A>, array_of_doubles_update_policy<A>, AllocAOD<A>> {
114
- public:
115
- using Base = update_tuple_sketch<aod<A>, aod<A>, array_of_doubles_update_policy<A>, AllocAOD<A>>;
116
- using resize_factor = typename Base::resize_factor;
117
-
118
- class builder;
30
+ /// convenience alias with default allocator, default policy for update_array_of_doubles_sketch
31
+ using default_array_of_doubles_update_policy = default_array_tuple_update_policy<array<double>>;
119
32
 
120
- compact_array_of_doubles_sketch_alloc<A> compact(bool ordered = true) const;
121
- uint8_t get_num_values() const;
33
+ /// convenience alias with default allocator, equivalent to ArrayOfDoublesUpdatableSketch in Java
34
+ using update_array_of_doubles_sketch = update_array_tuple_sketch<array<double>>;
122
35
 
123
- private:
124
- // for builder
125
- update_array_of_doubles_sketch_alloc(uint8_t lg_cur_size, uint8_t lg_nom_size, resize_factor rf, float p, uint64_t theta,
126
- uint64_t seed, const array_of_doubles_update_policy<A>& policy, const A& allocator);
127
- };
36
+ /// convenience alias with default allocator, equivalent to ArrayOfDoublesCompactSketch in Java
37
+ using compact_array_of_doubles_sketch = compact_array_tuple_sketch<array<double>>;
128
38
 
129
- // alias with the default allocator for convenience
130
- using update_array_of_doubles_sketch = update_array_of_doubles_sketch_alloc<>;
39
+ /// convenience alias, default policy for array_of_doubles_union
40
+ using default_array_of_doubles_union_policy = default_array_tuple_union_policy<array<double>>;
131
41
 
132
- template<typename A>
133
- class update_array_of_doubles_sketch_alloc<A>::builder: public tuple_base_builder<builder, array_of_doubles_update_policy<A>, A> {
134
- public:
135
- builder(const array_of_doubles_update_policy<A>& policy = array_of_doubles_update_policy<A>(), const A& allocator = A());
136
- update_array_of_doubles_sketch_alloc<A> build() const;
137
- };
42
+ /// convenience alias with default allocator, equivalent to ArrayOfDoublesUnion in Java
43
+ using array_of_doubles_union = array_tuple_union<array<double>>;
138
44
 
139
- template<typename A = std::allocator<double>>
140
- class compact_array_of_doubles_sketch_alloc: public compact_tuple_sketch<aod<A>, AllocAOD<A>> {
141
- public:
142
- using Base = compact_tuple_sketch<aod<A>, AllocAOD<A>>;
143
- using Entry = typename Base::Entry;
144
- using AllocEntry = typename Base::AllocEntry;
145
- using AllocU64 = typename Base::AllocU64;
146
- using vector_bytes = typename Base::vector_bytes;
45
+ /// convenience alias with default allocator, equivalent to ArrayOfDoublesIntersection in Java
46
+ /// no default policy since it is not clear in general
47
+ template<typename Policy> using array_of_doubles_intersection = array_tuple_intersection<array<double>, Policy>;
147
48
 
148
- static const uint8_t SERIAL_VERSION = 1;
149
- static const uint8_t SKETCH_FAMILY = 9;
150
- static const uint8_t SKETCH_TYPE = 3;
151
- enum flags { UNUSED1, UNUSED2, IS_EMPTY, HAS_ENTRIES, IS_ORDERED };
152
-
153
- template<typename Sketch>
154
- compact_array_of_doubles_sketch_alloc(const Sketch& other, bool ordered = true);
155
-
156
- uint8_t get_num_values() const;
157
-
158
- void serialize(std::ostream& os) const;
159
- vector_bytes serialize(unsigned header_size_bytes = 0) const;
160
-
161
- static compact_array_of_doubles_sketch_alloc deserialize(std::istream& is, uint64_t seed = DEFAULT_SEED, const A& allocator = A());
162
- static compact_array_of_doubles_sketch_alloc deserialize(const void* bytes, size_t size, uint64_t seed = DEFAULT_SEED,
163
- const A& allocator = A());
164
-
165
- // for internal use
166
- compact_array_of_doubles_sketch_alloc(bool is_empty, bool is_ordered, uint16_t seed_hash, uint64_t theta, std::vector<Entry, AllocEntry>&& entries, uint8_t num_values);
167
- compact_array_of_doubles_sketch_alloc(uint8_t num_values, Base&& base);
168
- private:
169
- uint8_t num_values_;
170
- };
171
-
172
- // alias with the default allocator for convenience
173
- using compact_array_of_doubles_sketch = compact_array_of_doubles_sketch_alloc<>;
49
+ /// convenience alias with default allocator, equivalent to ArrayOfDoublesAnotB in Java
50
+ using array_of_doubles_a_not_b = array_tuple_a_not_b<array<double>>;
174
51
 
175
52
  } /* namespace datasketches */
176
53
 
177
- #include "array_of_doubles_sketch_impl.hpp"
178
-
179
54
  #endif
@@ -17,36 +17,44 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #ifndef ARRAY_OF_DOUBLES_A_NOT_B_HPP_
21
- #define ARRAY_OF_DOUBLES_A_NOT_B_HPP_
20
+ #ifndef ARRAY_TUPLE_A_NOT_B_HPP_
21
+ #define ARRAY_TUPLE_A_NOT_B_HPP_
22
22
 
23
23
  #include <vector>
24
24
  #include <memory>
25
25
 
26
- #include "array_of_doubles_sketch.hpp"
26
+ #include "array_tuple_sketch.hpp"
27
27
  #include "tuple_a_not_b.hpp"
28
28
 
29
29
  namespace datasketches {
30
30
 
31
- template<typename Allocator = std::allocator<double>>
32
- class array_of_doubles_a_not_b_alloc: tuple_a_not_b<aod<Allocator>, AllocAOD<Allocator>> {
31
+ /// array tuple A-not-B
32
+ template<typename Array, typename Allocator = typename Array::allocator_type>
33
+ class array_tuple_a_not_b: tuple_a_not_b<Array, Allocator> {
33
34
  public:
34
- using Summary = aod<Allocator>;
35
- using AllocSummary = AllocAOD<Allocator>;
36
- using Base = tuple_a_not_b<Summary, AllocSummary>;
37
- using CompactSketch = compact_array_of_doubles_sketch_alloc<Allocator>;
38
-
39
- explicit array_of_doubles_a_not_b_alloc(uint64_t seed = DEFAULT_SEED, const Allocator& allocator = Allocator());
40
-
35
+ using Base = tuple_a_not_b<Array, Allocator>;
36
+ using CompactSketch = compact_array_tuple_sketch<Array, Allocator>;
37
+
38
+ /**
39
+ * Constructor
40
+ * @param seed for the hash function that was used to create the sketch
41
+ * @param allocator to use for allocating and deallocating memory
42
+ */
43
+ explicit array_tuple_a_not_b(uint64_t seed = DEFAULT_SEED, const Allocator& allocator = Allocator());
44
+
45
+ /**
46
+ * Computes the A-not-B set operation given two sketches.
47
+ * @param a sketch A
48
+ * @param b sketch B
49
+ * @param ordered optional flag to specify if an ordered sketch should be produced
50
+ * @return the result of A-not-B as a compact sketch
51
+ */
41
52
  template<typename FwdSketch, typename Sketch>
42
53
  CompactSketch compute(FwdSketch&& a, const Sketch& b, bool ordered = true) const;
43
54
  };
44
55
 
45
- // alias with the default allocator for convenience
46
- using array_of_doubles_a_not_b = array_of_doubles_a_not_b_alloc<>;
47
-
48
56
  } /* namespace datasketches */
49
57
 
50
- #include "array_of_doubles_a_not_b_impl.hpp"
58
+ #include "array_tuple_a_not_b_impl.hpp"
51
59
 
52
60
  #endif
@@ -19,13 +19,13 @@
19
19
 
20
20
  namespace datasketches {
21
21
 
22
- template<typename A>
23
- array_of_doubles_a_not_b_alloc<A>::array_of_doubles_a_not_b_alloc(uint64_t seed, const A& allocator):
22
+ template<typename Array, typename Allocator>
23
+ array_tuple_a_not_b<Array, Allocator>::array_tuple_a_not_b(uint64_t seed, const Allocator& allocator):
24
24
  Base(seed, allocator) {}
25
25
 
26
- template<typename A>
26
+ template<typename Array, typename Allocator>
27
27
  template<typename FwdSketch, typename Sketch>
28
- auto array_of_doubles_a_not_b_alloc<A>::compute(FwdSketch&& a, const Sketch& b, bool ordered) const -> CompactSketch {
28
+ auto array_tuple_a_not_b<Array, Allocator>::compute(FwdSketch&& a, const Sketch& b, bool ordered) const -> CompactSketch {
29
29
  return CompactSketch(a.get_num_values(), Base::compute(std::forward<FwdSketch>(a), b, ordered));
30
30
  }
31
31
 
@@ -0,0 +1,65 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ #ifndef ARRAY_TUPLE_INTERSECTION_HPP_
21
+ #define ARRAY_TUPLE_INTERSECTION_HPP_
22
+
23
+ #include <vector>
24
+ #include <memory>
25
+
26
+ #include "array_tuple_sketch.hpp"
27
+ #include "tuple_intersection.hpp"
28
+
29
+ namespace datasketches {
30
+
31
+ /// array tuple intersection
32
+ template<
33
+ typename Array,
34
+ typename Policy,
35
+ typename Allocator = typename Array::allocator_type
36
+ >
37
+ class array_tuple_intersection: public tuple_intersection<Array, Policy, Allocator> {
38
+ public:
39
+ using Base = tuple_intersection<Array, Policy, Allocator>;
40
+ using CompactSketch = compact_array_tuple_sketch<Array, Allocator>;
41
+ using resize_factor = theta_constants::resize_factor;
42
+
43
+ /**
44
+ * Constructor
45
+ * @param seed for the hash function that was used to create the sketch
46
+ * @param policy user-defined way of combining Summary during intersection
47
+ * @param allocator to use for allocating and deallocating memory
48
+ */
49
+ explicit array_tuple_intersection(uint64_t seed = DEFAULT_SEED, const Policy& policy = Policy(), const Allocator& allocator = Allocator());
50
+
51
+ /**
52
+ * Produces a copy of the current state of the intersection.
53
+ * If update() was not called, the state is the infinite "universe",
54
+ * which is considered an undefined state, and throws an exception.
55
+ * @param ordered optional flag to specify if an ordered sketch should be produced
56
+ * @return the result of the intersection as a compact sketch
57
+ */
58
+ CompactSketch get_result(bool ordered = true) const;
59
+ };
60
+
61
+ } /* namespace datasketches */
62
+
63
+ #include "array_tuple_intersection_impl.hpp"
64
+
65
+ #endif
@@ -17,32 +17,15 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #ifndef _PY_OBJECT_OSTREAM_HPP_
21
- #define _PY_OBJECT_OSTREAM_HPP_
22
-
23
- #include <pybind11/pybind11.h>
24
-
25
- #include <string>
26
- #include <ostream>
27
-
28
- /*
29
- This header defines an ostream output operator on a generic python
30
- object. The implementation calls the object's built-in __str__()
31
- method. If that method is not defined, the call may fail.
32
-
33
- NOTE: This header must be included before the inclusion of
34
- any sketch classes.
35
- */
36
-
37
- namespace py = pybind11;
38
-
39
20
  namespace datasketches {
40
21
 
41
- static std::ostream& operator<<(std::ostream& os, const py::object& obj) {
42
- os << std::string(pybind11::str(obj));
43
- return os;
44
- }
22
+ template<typename Array, typename Policy, typename Allocator>
23
+ array_tuple_intersection<Array, Policy, Allocator>::array_tuple_intersection(uint64_t seed, const Policy& policy, const Allocator& allocator):
24
+ Base(seed, policy, allocator) {}
45
25
 
26
+ template<typename Array, typename Policy, typename Allocator>
27
+ auto array_tuple_intersection<Array, Policy, Allocator>::get_result(bool ordered) const -> CompactSketch {
28
+ return CompactSketch(this->state_.get_policy().get_external_policy().get_num_values(), Base::get_result(ordered));
46
29
  }
47
30
 
48
- #endif // _PY_OBJECT_OSTREAM_HPP_
31
+ } /* namespace datasketches */
@@ -0,0 +1,237 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ #ifndef ARRAY_TUPLE_SKETCH_HPP_
21
+ #define ARRAY_TUPLE_SKETCH_HPP_
22
+
23
+ #include <vector>
24
+ #include <memory>
25
+
26
+ #include "serde.hpp"
27
+ #include "tuple_sketch.hpp"
28
+
29
+ namespace datasketches {
30
+
31
+ // This simple array is faster than std::vector and should be sufficient for this application
32
+ template<typename T, typename Allocator = std::allocator<T>>
33
+ class array {
34
+ public:
35
+ using value_type = T;
36
+ using allocator_type = Allocator;
37
+
38
+ explicit array(uint8_t size, T value, const Allocator& allocator = Allocator()):
39
+ allocator_(allocator), size_(size), array_(allocator_.allocate(size_)) {
40
+ std::fill(array_, array_ + size_, value);
41
+ }
42
+ array(const array& other):
43
+ allocator_(other.allocator_),
44
+ size_(other.size_),
45
+ array_(allocator_.allocate(size_))
46
+ {
47
+ std::copy(other.array_, other.array_ + size_, array_);
48
+ }
49
+ array(array&& other) noexcept:
50
+ allocator_(std::move(other.allocator_)),
51
+ size_(other.size_),
52
+ array_(other.array_)
53
+ {
54
+ other.array_ = nullptr;
55
+ }
56
+ ~array() {
57
+ if (array_ != nullptr) allocator_.deallocate(array_, size_);
58
+ }
59
+ array& operator=(const array& other) {
60
+ array copy(other);
61
+ std::swap(allocator_, copy.allocator_);
62
+ std::swap(size_, copy.size_);
63
+ std::swap(array_, copy.array_);
64
+ return *this;
65
+ }
66
+ array& operator=(array&& other) {
67
+ std::swap(allocator_, other.allocator_);
68
+ std::swap(size_, other.size_);
69
+ std::swap(array_, other.array_);
70
+ return *this;
71
+ }
72
+ T& operator[](size_t index) { return array_[index]; }
73
+ T operator[](size_t index) const { return array_[index]; }
74
+ uint8_t size() const { return size_; }
75
+ T* data() { return array_; }
76
+ const T* data() const { return array_; }
77
+ bool operator==(const array& other) const {
78
+ for (uint8_t i = 0; i < size_; ++i) if (array_[i] != other.array_[i]) return false;
79
+ return true;
80
+ }
81
+ private:
82
+ Allocator allocator_;
83
+ uint8_t size_;
84
+ T* array_;
85
+ };
86
+
87
+ /// default array tuple update policy
88
+ template<typename Array, typename Allocator = typename Array::allocator_type>
89
+ class default_array_tuple_update_policy {
90
+ public:
91
+ default_array_tuple_update_policy(uint8_t num_values = 1, const Allocator& allocator = Allocator()):
92
+ allocator_(allocator), num_values_(num_values) {}
93
+ Array create() const {
94
+ return Array(num_values_, 0, allocator_);
95
+ }
96
+ template<typename InputArray> // to allow any type with indexed access (such as double* or std::vector)
97
+ void update(Array& array, const InputArray& update) const {
98
+ for (uint8_t i = 0; i < num_values_; ++i) array[i] += update[i];
99
+ }
100
+ uint8_t get_num_values() const {
101
+ return num_values_;
102
+ }
103
+
104
+ private:
105
+ Allocator allocator_;
106
+ uint8_t num_values_;
107
+ };
108
+
109
+ // forward declaration
110
+ template<typename Array, typename Allocator> class compact_array_tuple_sketch;
111
+
112
+ /**
113
+ * Update array tuple sketch.
114
+ * This is a wrapper around tuple sketch to match the functionality and serialization format of ArrayOfDoublesSketch in Java.
115
+ * For this the sketch must be configured with array<double> or std::vector<double>.
116
+ * This is a more generic implementation for any arithmetic type (serialization assumes contiguous array size_of(T) * num_values).
117
+ * A set of type definitions for the ArrayOfDoubles* equivalent is provided in a separate file array_of_doubles_sketch.hpp.
118
+ * There is no constructor. Use builder instead.
119
+ */
120
+ template<
121
+ typename Array,
122
+ typename Policy = default_array_tuple_update_policy<Array>,
123
+ typename Allocator = typename Array::allocator_type
124
+ >
125
+ class update_array_tuple_sketch: public update_tuple_sketch<Array, Array, Policy, Allocator> {
126
+ public:
127
+ using Base = update_tuple_sketch<Array, Array, Policy, Allocator>;
128
+ using resize_factor = typename Base::resize_factor;
129
+
130
+ class builder;
131
+
132
+ compact_array_tuple_sketch<Array, Allocator> compact(bool ordered = true) const;
133
+
134
+ /// @return number of values in array
135
+ uint8_t get_num_values() const;
136
+
137
+ private:
138
+ // for builder
139
+ update_array_tuple_sketch(uint8_t lg_cur_size, uint8_t lg_nom_size, resize_factor rf, float p, uint64_t theta,
140
+ uint64_t seed, const Policy& policy, const Allocator& allocator);
141
+ };
142
+
143
+ /// Update array tuple sketch builder
144
+ template<typename Array, typename Policy, typename Allocator>
145
+ class update_array_tuple_sketch<Array, Policy, Allocator>::builder: public tuple_base_builder<builder, Policy, Allocator> {
146
+ public:
147
+ /**
148
+ * Constructor
149
+ * @param policy
150
+ * @param allocator
151
+ */
152
+ builder(const Policy& policy = Policy(), const Allocator& allocator = Allocator());
153
+
154
+ /// @return instance of sketch
155
+ update_array_tuple_sketch build() const;
156
+ };
157
+
158
+ /// Compact array tuple sketch
159
+ template<
160
+ typename Array,
161
+ typename Allocator = typename Array::allocator_type
162
+ >
163
+ class compact_array_tuple_sketch: public compact_tuple_sketch<Array, Allocator> {
164
+ public:
165
+ using Base = compact_tuple_sketch<Array, Allocator>;
166
+ using Entry = typename Base::Entry;
167
+ using AllocEntry = typename Base::AllocEntry;
168
+ using AllocU64 = typename Base::AllocU64;
169
+ using vector_bytes = typename Base::vector_bytes;
170
+
171
+ static const uint8_t SERIAL_VERSION = 1;
172
+ static const uint8_t SKETCH_FAMILY = 9;
173
+ static const uint8_t SKETCH_TYPE = 3;
174
+ enum flags { UNUSED1, UNUSED2, IS_EMPTY, HAS_ENTRIES, IS_ORDERED };
175
+
176
+ /**
177
+ * Copy constructor.
178
+ * Constructs a compact sketch from another sketch (update or compact)
179
+ * @param other sketch to be constructed from
180
+ * @param ordered if true make the resulting sketch ordered
181
+ */
182
+ template<typename Sketch>
183
+ compact_array_tuple_sketch(const Sketch& other, bool ordered = true);
184
+
185
+ /// @return number of double values in array
186
+ uint8_t get_num_values() const;
187
+
188
+ /**
189
+ * This method serializes the sketch into a given stream in a binary form
190
+ * @param os output stream
191
+ */
192
+ void serialize(std::ostream& os) const;
193
+
194
+ /**
195
+ * This method serializes the sketch as a vector of bytes.
196
+ * An optional header can be reserved in front of the sketch.
197
+ * It is a blank space of a given size.
198
+ * @param header_size_bytes space to reserve in front of the sketch
199
+ * @return serialized sketch as a vector of bytes
200
+ */
201
+ vector_bytes serialize(unsigned header_size_bytes = 0) const;
202
+
203
+ /**
204
+ * This method deserializes a sketch from a given stream.
205
+ * @param is input stream
206
+ * @param seed the seed for the hash function that was used to create the sketch
207
+ * @param allocator instance of an Allocator
208
+ * @return an instance of the sketch
209
+ */
210
+ static compact_array_tuple_sketch deserialize(std::istream& is, uint64_t seed = DEFAULT_SEED, const Allocator& allocator = Allocator());
211
+
212
+ /**
213
+ * This method deserializes a sketch from a given array of bytes.
214
+ * @param bytes pointer to the array of bytes
215
+ * @param size the size of the array
216
+ * @param seed the seed for the hash function that was used to create the sketch
217
+ * @param allocator instance of an Allocator
218
+ * @return an instance of the sketch
219
+ */
220
+ static compact_array_tuple_sketch deserialize(const void* bytes, size_t size, uint64_t seed = DEFAULT_SEED,
221
+ const Allocator& allocator = Allocator());
222
+
223
+ private:
224
+ uint8_t num_values_;
225
+
226
+ template<typename Ar, typename P, typename Al> friend class array_tuple_union;
227
+ template<typename Ar, typename P, typename Al> friend class array_tuple_intersection;
228
+ template<typename Ar, typename Al> friend class array_tuple_a_not_b;
229
+ compact_array_tuple_sketch(bool is_empty, bool is_ordered, uint16_t seed_hash, uint64_t theta, std::vector<Entry, AllocEntry>&& entries, uint8_t num_values);
230
+ compact_array_tuple_sketch(uint8_t num_values, Base&& base);
231
+ };
232
+
233
+ } /* namespace datasketches */
234
+
235
+ #include "array_tuple_sketch_impl.hpp"
236
+
237
+ #endif