datasketches 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/NOTICE +1 -1
- data/README.md +0 -2
- data/ext/datasketches/cpc_wrapper.cpp +3 -3
- data/ext/datasketches/kll_wrapper.cpp +0 -10
- data/lib/datasketches/version.rb +1 -1
- data/lib/datasketches.rb +1 -1
- data/vendor/datasketches-cpp/CMakeLists.txt +23 -20
- data/vendor/datasketches-cpp/CODE_OF_CONDUCT.md +3 -0
- data/vendor/datasketches-cpp/CONTRIBUTING.md +50 -0
- data/vendor/datasketches-cpp/Doxyfile +2827 -0
- data/vendor/datasketches-cpp/LICENSE +0 -76
- data/vendor/datasketches-cpp/README.md +1 -3
- data/vendor/datasketches-cpp/common/CMakeLists.txt +12 -11
- data/vendor/datasketches-cpp/common/include/MurmurHash3.h +25 -27
- data/vendor/datasketches-cpp/common/include/common_defs.hpp +15 -10
- data/vendor/datasketches-cpp/common/include/count_zeros.hpp +11 -2
- data/vendor/datasketches-cpp/common/include/kolmogorov_smirnov.hpp +9 -6
- data/vendor/datasketches-cpp/common/include/memory_operations.hpp +5 -4
- data/vendor/datasketches-cpp/common/include/optional.hpp +148 -0
- data/vendor/datasketches-cpp/common/include/quantiles_sorted_view.hpp +95 -2
- data/vendor/datasketches-cpp/common/include/quantiles_sorted_view_impl.hpp +1 -1
- data/vendor/datasketches-cpp/common/include/serde.hpp +69 -20
- data/vendor/datasketches-cpp/common/test/CMakeLists.txt +2 -2
- data/vendor/datasketches-cpp/common/test/integration_test.cpp +6 -0
- data/vendor/datasketches-cpp/common/test/optional_test.cpp +85 -0
- data/vendor/datasketches-cpp/common/test/test_allocator.hpp +14 -14
- data/vendor/datasketches-cpp/{python/src/__init__.py → count/CMakeLists.txt} +25 -1
- data/vendor/datasketches-cpp/count/include/count_min.hpp +405 -0
- data/vendor/datasketches-cpp/count/include/count_min_impl.hpp +497 -0
- data/vendor/datasketches-cpp/{MANIFEST.in → count/test/CMakeLists.txt} +23 -20
- data/vendor/datasketches-cpp/count/test/count_min_allocation_test.cpp +155 -0
- data/vendor/datasketches-cpp/count/test/count_min_test.cpp +303 -0
- data/vendor/datasketches-cpp/cpc/include/cpc_common.hpp +14 -20
- data/vendor/datasketches-cpp/cpc/include/cpc_compressor.hpp +7 -4
- data/vendor/datasketches-cpp/cpc/include/cpc_compressor_impl.hpp +17 -17
- data/vendor/datasketches-cpp/cpc/include/cpc_confidence.hpp +3 -3
- data/vendor/datasketches-cpp/cpc/include/cpc_sketch.hpp +40 -40
- data/vendor/datasketches-cpp/cpc/include/cpc_sketch_impl.hpp +14 -11
- data/vendor/datasketches-cpp/cpc/include/cpc_union.hpp +35 -11
- data/vendor/datasketches-cpp/cpc/include/cpc_union_impl.hpp +8 -8
- data/vendor/datasketches-cpp/cpc/include/cpc_util.hpp +16 -8
- data/vendor/datasketches-cpp/cpc/include/u32_table.hpp +3 -2
- data/vendor/datasketches-cpp/cpc/include/u32_table_impl.hpp +5 -5
- data/vendor/datasketches-cpp/cpc/test/CMakeLists.txt +20 -7
- data/vendor/datasketches-cpp/cpc/test/cpc_sketch_deserialize_from_java_test.cpp +60 -0
- data/vendor/datasketches-cpp/cpc/test/cpc_sketch_serialize_for_java.cpp +38 -0
- data/vendor/datasketches-cpp/cpc/test/cpc_sketch_test.cpp +4 -29
- data/vendor/datasketches-cpp/cpc/test/cpc_union_test.cpp +4 -4
- data/vendor/datasketches-cpp/{tox.ini → density/CMakeLists.txt} +24 -8
- data/vendor/datasketches-cpp/density/include/density_sketch.hpp +256 -0
- data/vendor/datasketches-cpp/density/include/density_sketch_impl.hpp +543 -0
- data/vendor/datasketches-cpp/{python/datasketches/__init__.py → density/test/CMakeLists.txt} +15 -3
- data/vendor/datasketches-cpp/density/test/density_sketch_test.cpp +244 -0
- data/vendor/datasketches-cpp/fi/include/frequent_items_sketch.hpp +21 -9
- data/vendor/datasketches-cpp/fi/include/frequent_items_sketch_impl.hpp +6 -4
- data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map.hpp +9 -3
- data/vendor/datasketches-cpp/fi/test/CMakeLists.txt +14 -1
- data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_deserialize_from_java_test.cpp +95 -0
- data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_serialize_for_java.cpp +83 -0
- data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_test.cpp +3 -42
- data/vendor/datasketches-cpp/hll/include/CouponList-internal.hpp +2 -2
- data/vendor/datasketches-cpp/hll/include/CouponList.hpp +3 -1
- data/vendor/datasketches-cpp/hll/include/Hll4Array-internal.hpp +19 -11
- data/vendor/datasketches-cpp/hll/include/Hll4Array.hpp +2 -5
- data/vendor/datasketches-cpp/hll/include/Hll6Array-internal.hpp +19 -7
- data/vendor/datasketches-cpp/hll/include/Hll6Array.hpp +1 -1
- data/vendor/datasketches-cpp/hll/include/Hll8Array-internal.hpp +98 -42
- data/vendor/datasketches-cpp/hll/include/Hll8Array.hpp +2 -0
- data/vendor/datasketches-cpp/hll/include/HllArray-internal.hpp +94 -61
- data/vendor/datasketches-cpp/hll/include/HllArray.hpp +20 -8
- data/vendor/datasketches-cpp/hll/include/HllSketch-internal.hpp +4 -4
- data/vendor/datasketches-cpp/hll/include/HllSketchImpl.hpp +3 -1
- data/vendor/datasketches-cpp/hll/include/HllSketchImplFactory.hpp +3 -21
- data/vendor/datasketches-cpp/hll/include/HllUnion-internal.hpp +8 -0
- data/vendor/datasketches-cpp/hll/include/HllUtil.hpp +14 -18
- data/vendor/datasketches-cpp/hll/include/coupon_iterator-internal.hpp +1 -1
- data/vendor/datasketches-cpp/hll/include/coupon_iterator.hpp +8 -2
- data/vendor/datasketches-cpp/hll/include/hll.hpp +79 -65
- data/vendor/datasketches-cpp/hll/test/CMakeLists.txt +14 -1
- data/vendor/datasketches-cpp/hll/test/HllUnionTest.cpp +7 -1
- data/vendor/datasketches-cpp/hll/test/ToFromByteArrayTest.cpp +0 -68
- data/vendor/datasketches-cpp/hll/test/hll_sketch_deserialize_from_java_test.cpp +69 -0
- data/vendor/datasketches-cpp/hll/test/hll_sketch_serialize_for_java.cpp +52 -0
- data/vendor/datasketches-cpp/kll/include/kll_helper.hpp +0 -1
- data/vendor/datasketches-cpp/kll/include/kll_helper_impl.hpp +2 -2
- data/vendor/datasketches-cpp/kll/include/kll_sketch.hpp +79 -53
- data/vendor/datasketches-cpp/kll/include/kll_sketch_impl.hpp +61 -132
- data/vendor/datasketches-cpp/kll/test/CMakeLists.txt +14 -1
- data/vendor/datasketches-cpp/kll/test/kll_sketch_deserialize_from_java_test.cpp +103 -0
- data/vendor/datasketches-cpp/kll/test/kll_sketch_serialize_for_java.cpp +62 -0
- data/vendor/datasketches-cpp/kll/test/kll_sketch_test.cpp +5 -40
- data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch.hpp +76 -54
- data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch_impl.hpp +66 -136
- data/vendor/datasketches-cpp/quantiles/test/CMakeLists.txt +14 -1
- data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_deserialize_from_java_test.cpp +84 -0
- data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_serialize_for_java.cpp +52 -0
- data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_test.cpp +15 -39
- data/vendor/datasketches-cpp/req/include/req_common.hpp +7 -3
- data/vendor/datasketches-cpp/req/include/req_compactor_impl.hpp +2 -4
- data/vendor/datasketches-cpp/req/include/req_sketch.hpp +105 -26
- data/vendor/datasketches-cpp/req/include/req_sketch_impl.hpp +50 -111
- data/vendor/datasketches-cpp/req/test/CMakeLists.txt +14 -1
- data/vendor/datasketches-cpp/req/test/req_sketch_deserialize_from_java_test.cpp +55 -0
- data/vendor/datasketches-cpp/{tuple/include/array_of_doubles_intersection_impl.hpp → req/test/req_sketch_serialize_for_java.cpp} +12 -7
- data/vendor/datasketches-cpp/req/test/req_sketch_test.cpp +3 -89
- data/vendor/datasketches-cpp/sampling/CMakeLists.txt +4 -0
- data/vendor/datasketches-cpp/sampling/include/ebpps_sample.hpp +210 -0
- data/vendor/datasketches-cpp/sampling/include/ebpps_sample_impl.hpp +535 -0
- data/vendor/datasketches-cpp/sampling/include/ebpps_sketch.hpp +281 -0
- data/vendor/datasketches-cpp/sampling/include/ebpps_sketch_impl.hpp +531 -0
- data/vendor/datasketches-cpp/sampling/include/var_opt_sketch.hpp +89 -32
- data/vendor/datasketches-cpp/sampling/include/var_opt_sketch_impl.hpp +33 -19
- data/vendor/datasketches-cpp/sampling/include/var_opt_union.hpp +13 -10
- data/vendor/datasketches-cpp/sampling/include/var_opt_union_impl.hpp +23 -19
- data/vendor/datasketches-cpp/sampling/test/CMakeLists.txt +55 -8
- data/vendor/datasketches-cpp/sampling/test/ebpps_allocation_test.cpp +96 -0
- data/vendor/datasketches-cpp/sampling/test/ebpps_sample_test.cpp +137 -0
- data/vendor/datasketches-cpp/sampling/test/ebpps_sketch_test.cpp +266 -0
- data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_deserialize_from_java_test.cpp +81 -0
- data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_serialize_for_java.cpp +54 -0
- data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_test.cpp +33 -51
- data/vendor/datasketches-cpp/sampling/test/var_opt_union_deserialize_from_java_test.cpp +50 -0
- data/vendor/datasketches-cpp/sampling/test/var_opt_union_serialize_for_java.cpp +56 -0
- data/vendor/datasketches-cpp/sampling/test/var_opt_union_test.cpp +0 -20
- data/vendor/datasketches-cpp/theta/CMakeLists.txt +1 -0
- data/vendor/datasketches-cpp/theta/include/bit_packing.hpp +6279 -0
- data/vendor/datasketches-cpp/theta/include/bounds_on_ratios_in_sampled_sets.hpp +1 -0
- data/vendor/datasketches-cpp/theta/include/bounds_on_ratios_in_theta_sketched_sets.hpp +7 -6
- data/vendor/datasketches-cpp/theta/include/compact_theta_sketch_parser.hpp +14 -8
- data/vendor/datasketches-cpp/theta/include/compact_theta_sketch_parser_impl.hpp +60 -46
- data/vendor/datasketches-cpp/theta/include/theta_a_not_b.hpp +20 -5
- data/vendor/datasketches-cpp/theta/include/theta_constants.hpp +10 -4
- data/vendor/datasketches-cpp/theta/include/theta_helpers.hpp +3 -1
- data/vendor/datasketches-cpp/theta/include/theta_intersection.hpp +13 -5
- data/vendor/datasketches-cpp/theta/include/theta_intersection_base_impl.hpp +5 -5
- data/vendor/datasketches-cpp/theta/include/theta_intersection_impl.hpp +3 -3
- data/vendor/datasketches-cpp/theta/include/theta_jaccard_similarity.hpp +2 -1
- data/vendor/datasketches-cpp/theta/include/theta_jaccard_similarity_base.hpp +1 -0
- data/vendor/datasketches-cpp/theta/include/theta_set_difference_base_impl.hpp +1 -1
- data/vendor/datasketches-cpp/theta/include/theta_sketch.hpp +180 -33
- data/vendor/datasketches-cpp/theta/include/theta_sketch_impl.hpp +430 -130
- data/vendor/datasketches-cpp/theta/include/theta_union.hpp +17 -10
- data/vendor/datasketches-cpp/theta/include/theta_union_base_impl.hpp +10 -10
- data/vendor/datasketches-cpp/theta/include/theta_union_impl.hpp +3 -3
- data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base.hpp +21 -6
- data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base_impl.hpp +13 -3
- data/vendor/datasketches-cpp/theta/test/CMakeLists.txt +15 -1
- data/vendor/datasketches-cpp/theta/test/bit_packing_test.cpp +80 -0
- data/vendor/datasketches-cpp/theta/test/theta_sketch_deserialize_from_java_test.cpp +57 -0
- data/vendor/datasketches-cpp/theta/test/theta_sketch_serialize_for_java.cpp +61 -0
- data/vendor/datasketches-cpp/theta/test/theta_sketch_test.cpp +39 -188
- data/vendor/datasketches-cpp/theta/test/theta_union_test.cpp +25 -0
- data/vendor/datasketches-cpp/tuple/CMakeLists.txt +8 -7
- data/vendor/datasketches-cpp/tuple/include/array_of_doubles_sketch.hpp +19 -144
- data/vendor/datasketches-cpp/tuple/include/{array_of_doubles_a_not_b.hpp → array_tuple_a_not_b.hpp} +24 -16
- data/vendor/datasketches-cpp/tuple/include/{array_of_doubles_a_not_b_impl.hpp → array_tuple_a_not_b_impl.hpp} +4 -4
- data/vendor/datasketches-cpp/tuple/include/array_tuple_intersection.hpp +65 -0
- data/vendor/datasketches-cpp/tuple/include/array_tuple_intersection_impl.hpp +31 -0
- data/vendor/datasketches-cpp/tuple/include/array_tuple_sketch.hpp +237 -0
- data/vendor/datasketches-cpp/tuple/include/{array_of_doubles_sketch_impl.hpp → array_tuple_sketch_impl.hpp} +40 -41
- data/vendor/datasketches-cpp/tuple/include/array_tuple_union.hpp +81 -0
- data/vendor/datasketches-cpp/tuple/include/array_tuple_union_impl.hpp +43 -0
- data/vendor/datasketches-cpp/tuple/include/tuple_a_not_b.hpp +11 -2
- data/vendor/datasketches-cpp/tuple/include/tuple_intersection.hpp +17 -10
- data/vendor/datasketches-cpp/tuple/include/tuple_jaccard_similarity.hpp +2 -1
- data/vendor/datasketches-cpp/tuple/include/tuple_sketch.hpp +95 -32
- data/vendor/datasketches-cpp/tuple/include/tuple_sketch_impl.hpp +2 -1
- data/vendor/datasketches-cpp/tuple/include/tuple_union.hpp +19 -11
- data/vendor/datasketches-cpp/tuple/test/CMakeLists.txt +16 -1
- data/vendor/datasketches-cpp/tuple/test/aod_sketch_deserialize_from_java_test.cpp +76 -0
- data/vendor/datasketches-cpp/tuple/test/aod_sketch_serialize_for_java.cpp +62 -0
- data/vendor/datasketches-cpp/tuple/test/array_of_doubles_sketch_test.cpp +5 -129
- data/vendor/datasketches-cpp/tuple/test/engagement_test.cpp +85 -89
- data/vendor/datasketches-cpp/tuple/test/tuple_jaccard_similarity_test.cpp +3 -1
- data/vendor/datasketches-cpp/tuple/test/tuple_sketch_deserialize_from_java_test.cpp +47 -0
- data/vendor/datasketches-cpp/{python/src/datasketches.cpp → tuple/test/tuple_sketch_serialize_for_java.cpp} +16 -30
- data/vendor/datasketches-cpp/tuple/test/tuple_sketch_test.cpp +1 -1
- data/vendor/datasketches-cpp/version.cfg.in +1 -1
- metadata +61 -79
- data/vendor/datasketches-cpp/fi/test/items_sketch_string_from_java.sk +0 -0
- data/vendor/datasketches-cpp/fi/test/items_sketch_string_utf8_from_java.sk +0 -0
- data/vendor/datasketches-cpp/fi/test/longs_sketch_from_java.sk +0 -0
- data/vendor/datasketches-cpp/hll/test/array6_from_java.sk +0 -0
- data/vendor/datasketches-cpp/hll/test/compact_array4_from_java.sk +0 -0
- data/vendor/datasketches-cpp/hll/test/compact_set_from_java.sk +0 -0
- data/vendor/datasketches-cpp/hll/test/list_from_java.sk +0 -0
- data/vendor/datasketches-cpp/hll/test/updatable_array4_from_java.sk +0 -0
- data/vendor/datasketches-cpp/hll/test/updatable_set_from_java.sk +0 -0
- data/vendor/datasketches-cpp/kll/test/kll_sketch_from_java.sk +0 -0
- data/vendor/datasketches-cpp/pyproject.toml +0 -23
- data/vendor/datasketches-cpp/python/CMakeLists.txt +0 -81
- data/vendor/datasketches-cpp/python/README.md +0 -85
- data/vendor/datasketches-cpp/python/datasketches/PySerDe.py +0 -104
- data/vendor/datasketches-cpp/python/include/py_serde.hpp +0 -113
- data/vendor/datasketches-cpp/python/jupyter/CPCSketch.ipynb +0 -345
- data/vendor/datasketches-cpp/python/jupyter/FrequentItemsSketch.ipynb +0 -354
- data/vendor/datasketches-cpp/python/jupyter/HLLSketch.ipynb +0 -346
- data/vendor/datasketches-cpp/python/jupyter/KLLSketch.ipynb +0 -463
- data/vendor/datasketches-cpp/python/jupyter/ThetaSketchNotebook.ipynb +0 -403
- data/vendor/datasketches-cpp/python/pybind11Path.cmd +0 -21
- data/vendor/datasketches-cpp/python/src/cpc_wrapper.cpp +0 -90
- data/vendor/datasketches-cpp/python/src/fi_wrapper.cpp +0 -128
- data/vendor/datasketches-cpp/python/src/hll_wrapper.cpp +0 -134
- data/vendor/datasketches-cpp/python/src/kll_wrapper.cpp +0 -210
- data/vendor/datasketches-cpp/python/src/ks_wrapper.cpp +0 -68
- data/vendor/datasketches-cpp/python/src/py_serde.cpp +0 -111
- data/vendor/datasketches-cpp/python/src/quantiles_wrapper.cpp +0 -204
- data/vendor/datasketches-cpp/python/src/req_wrapper.cpp +0 -215
- data/vendor/datasketches-cpp/python/src/theta_wrapper.cpp +0 -172
- data/vendor/datasketches-cpp/python/src/vector_of_kll.cpp +0 -490
- data/vendor/datasketches-cpp/python/src/vo_wrapper.cpp +0 -173
- data/vendor/datasketches-cpp/python/tests/__init__.py +0 -16
- data/vendor/datasketches-cpp/python/tests/cpc_test.py +0 -64
- data/vendor/datasketches-cpp/python/tests/fi_test.py +0 -110
- data/vendor/datasketches-cpp/python/tests/hll_test.py +0 -130
- data/vendor/datasketches-cpp/python/tests/kll_test.py +0 -125
- data/vendor/datasketches-cpp/python/tests/quantiles_test.py +0 -126
- data/vendor/datasketches-cpp/python/tests/req_test.py +0 -126
- data/vendor/datasketches-cpp/python/tests/theta_test.py +0 -146
- data/vendor/datasketches-cpp/python/tests/vector_of_kll_test.py +0 -148
- data/vendor/datasketches-cpp/python/tests/vo_test.py +0 -125
- data/vendor/datasketches-cpp/req/test/req_float_empty_from_java.sk +0 -0
- data/vendor/datasketches-cpp/req/test/req_float_estimation_from_java.sk +0 -0
- data/vendor/datasketches-cpp/req/test/req_float_exact_from_java.sk +0 -0
- data/vendor/datasketches-cpp/req/test/req_float_raw_items_from_java.sk +0 -0
- data/vendor/datasketches-cpp/req/test/req_float_single_item_from_java.sk +0 -0
- data/vendor/datasketches-cpp/sampling/test/binaries_from_java.txt +0 -67
- data/vendor/datasketches-cpp/sampling/test/varopt_sketch_long_sampling.sk +0 -0
- data/vendor/datasketches-cpp/sampling/test/varopt_sketch_string_exact.sk +0 -0
- data/vendor/datasketches-cpp/sampling/test/varopt_union_double_sampling.sk +0 -0
- data/vendor/datasketches-cpp/setup.py +0 -110
- data/vendor/datasketches-cpp/theta/test/theta_compact_empty_from_java.sk +0 -0
- data/vendor/datasketches-cpp/theta/test/theta_compact_estimation_from_java.sk +0 -0
- data/vendor/datasketches-cpp/theta/test/theta_compact_exact_from_java.sk +0 -0
- data/vendor/datasketches-cpp/theta/test/theta_compact_single_item_from_java.sk +0 -0
- data/vendor/datasketches-cpp/tuple/include/array_of_doubles_intersection.hpp +0 -52
- data/vendor/datasketches-cpp/tuple/include/array_of_doubles_union.hpp +0 -81
- data/vendor/datasketches-cpp/tuple/include/array_of_doubles_union_impl.hpp +0 -43
- data/vendor/datasketches-cpp/tuple/test/aod_1_compact_empty_from_java.sk +0 -1
- data/vendor/datasketches-cpp/tuple/test/aod_1_compact_estimation_from_java.sk +0 -0
- data/vendor/datasketches-cpp/tuple/test/aod_1_compact_non_empty_no_entries_from_java.sk +0 -0
- data/vendor/datasketches-cpp/tuple/test/aod_2_compact_exact_from_java.sk +0 -0
- data/vendor/datasketches-cpp/tuple/test/aod_3_compact_empty_from_java.sk +0 -1
@@ -27,6 +27,9 @@
|
|
27
27
|
|
28
28
|
namespace datasketches {
|
29
29
|
|
30
|
+
/**
|
31
|
+
* Sorted view for quantiles sketches (REQ, KLL and Quantiles)
|
32
|
+
*/
|
30
33
|
template<
|
31
34
|
typename T,
|
32
35
|
typename Comparator, // strict weak ordering function (see C++ named requirements: Compare)
|
@@ -34,30 +37,119 @@ template<
|
|
34
37
|
>
|
35
38
|
class quantiles_sorted_view {
|
36
39
|
public:
|
40
|
+
/// Entry type
|
37
41
|
using Entry = typename std::conditional<std::is_arithmetic<T>::value, std::pair<T, uint64_t>, std::pair<const T*, uint64_t>>::type;
|
38
42
|
using AllocEntry = typename std::allocator_traits<Allocator>::template rebind_alloc<Entry>;
|
39
43
|
using Container = std::vector<Entry, AllocEntry>;
|
40
44
|
|
45
|
+
/// @private
|
41
46
|
quantiles_sorted_view(uint32_t num, const Comparator& comparator, const Allocator& allocator);
|
42
47
|
|
48
|
+
/// @private
|
43
49
|
template<typename Iterator>
|
44
50
|
void add(Iterator begin, Iterator end, uint64_t weight);
|
45
51
|
|
52
|
+
/// @private
|
46
53
|
void convert_to_cummulative();
|
47
54
|
|
48
55
|
class const_iterator;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Iterator pointing to the first entry in the view.
|
59
|
+
* If the view is empty, the returned iterator must not be dereferenced or incremented.
|
60
|
+
* @return iterator pointing to the first entry
|
61
|
+
*/
|
49
62
|
const_iterator begin() const;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Iterator pointing to the past-the-end entry in the view.
|
66
|
+
* The past-the-end entry is the hypothetical entry that would follow the last entry.
|
67
|
+
* It does not point to any entry, and must not be dereferenced or incremented.
|
68
|
+
* @return iterator pointing to the past-the-end entry
|
69
|
+
*/
|
50
70
|
const_iterator end() const;
|
51
71
|
|
72
|
+
/// @return size of the view
|
52
73
|
size_t size() const;
|
53
74
|
|
75
|
+
/**
|
76
|
+
* Returns an approximation to the normalized rank of the given item.
|
77
|
+
*
|
78
|
+
* <p>If the view is empty this throws std::runtime_error.
|
79
|
+
*
|
80
|
+
* @param item to be ranked
|
81
|
+
* @param inclusive if true the weight of the given item is included into the rank.
|
82
|
+
* Otherwise the rank equals the sum of the weights of all items that are less than the given item
|
83
|
+
* according to the Comparator.
|
84
|
+
*
|
85
|
+
* @return an approximate normalized rank of the given item (0 to 1 inclusive)
|
86
|
+
*/
|
54
87
|
double get_rank(const T& item, bool inclusive = true) const;
|
55
88
|
|
89
|
+
/**
|
90
|
+
* Quantile return type.
|
91
|
+
* This is to return quantiles either by value (for arithmetic types) or by const reference (for all other types)
|
92
|
+
*/
|
56
93
|
using quantile_return_type = typename std::conditional<std::is_arithmetic<T>::value, T, const T&>::type;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Returns an item from the sketch that is the best approximation to an item
|
97
|
+
* from the original stream with the given normalized rank.
|
98
|
+
*
|
99
|
+
* <p>If the view is empty this throws std::runtime_error.
|
100
|
+
*
|
101
|
+
* @param rank of an item in the hypothetical sorted stream.
|
102
|
+
* @param inclusive if true, the given rank is considered inclusive (includes weight of an item)
|
103
|
+
*
|
104
|
+
* @return approximate quantile associated with the given normalized rank
|
105
|
+
*/
|
57
106
|
quantile_return_type get_quantile(double rank, bool inclusive = true) const;
|
58
107
|
|
59
108
|
using vector_double = std::vector<double, typename std::allocator_traits<Allocator>::template rebind_alloc<double>>;
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Returns an approximation to the Cumulative Distribution Function (CDF), which is the
|
112
|
+
* cumulative analog of the PMF, of the input stream given a set of split points (items).
|
113
|
+
*
|
114
|
+
* <p>If the view is empty this throws std::runtime_error.
|
115
|
+
*
|
116
|
+
* @param split_points an array of <i>m</i> unique, monotonically increasing items
|
117
|
+
* that divide the input domain into <i>m+1</i> consecutive disjoint intervals.
|
118
|
+
*
|
119
|
+
* @param size the number of split points in the array
|
120
|
+
*
|
121
|
+
* @param inclusive if true the rank of an item includes its own weight, and therefore
|
122
|
+
* if the sketch contains items equal to a slit point, then in CDF such items are
|
123
|
+
* included into the interval to the left of split point. Otherwise they are included into
|
124
|
+
* the interval to the right of split point.
|
125
|
+
*
|
126
|
+
* @return an array of m+1 doubles, which are a consecutive approximation to the CDF
|
127
|
+
* of the input stream given the split_points. The value at array position j of the returned
|
128
|
+
* CDF array is the sum of the returned values in positions 0 through j of the returned PMF
|
129
|
+
* array. This can be viewed as array of ranks of the given split points plus one more value
|
130
|
+
* that is always 1.
|
131
|
+
*/
|
60
132
|
vector_double get_CDF(const T* split_points, uint32_t size, bool inclusive = true) const;
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Returns an approximation to the Probability Mass Function (PMF) of the input stream
|
136
|
+
* given a set of split points (items).
|
137
|
+
*
|
138
|
+
* <p>If the view is empty this throws std::runtime_error.
|
139
|
+
*
|
140
|
+
* @param split_points an array of <i>m</i> unique, monotonically increasing items
|
141
|
+
* that divide the input domain into <i>m+1</i> consecutive disjoint intervals (bins).
|
142
|
+
*
|
143
|
+
* @param size the number of split points in the array
|
144
|
+
*
|
145
|
+
* @param inclusive if true the rank of an item includes its own weight, and therefore
|
146
|
+
* if the sketch contains items equal to a slit point, then in PMF such items are
|
147
|
+
* included into the interval to the left of split point. Otherwise they are included into the interval
|
148
|
+
* to the right of split point.
|
149
|
+
*
|
150
|
+
* @return an array of m+1 doubles each of which is an approximation
|
151
|
+
* to the fraction of the input stream items (the mass) that fall into one of those intervals.
|
152
|
+
*/
|
61
153
|
vector_double get_PMF(const T* split_points, uint32_t size, bool inclusive = true) const;
|
62
154
|
|
63
155
|
private:
|
@@ -122,8 +214,6 @@ public:
|
|
122
214
|
using Base = typename quantiles_sorted_view<T, C, A>::Container::const_iterator;
|
123
215
|
using value_type = typename std::conditional<std::is_arithmetic<T>::value, typename Base::value_type, std::pair<const T&, const uint64_t>>::type;
|
124
216
|
|
125
|
-
const_iterator(const Base& it, const Base& begin): Base(it), begin(begin) {}
|
126
|
-
|
127
217
|
template<typename TT = T, typename std::enable_if<std::is_arithmetic<TT>::value, int>::type = 0>
|
128
218
|
const value_type operator*() const { return Base::operator*(); }
|
129
219
|
|
@@ -147,6 +237,9 @@ public:
|
|
147
237
|
|
148
238
|
private:
|
149
239
|
Base begin;
|
240
|
+
|
241
|
+
friend class quantiles_sorted_view<T, C, A>;
|
242
|
+
const_iterator(const Base& it, const Base& begin): Base(it), begin(begin) {}
|
150
243
|
};
|
151
244
|
|
152
245
|
} /* namespace datasketches */
|
@@ -75,7 +75,7 @@ double quantiles_sorted_view<T, C, A>::get_rank(const T& item, bool inclusive) c
|
|
75
75
|
template<typename T, typename C, typename A>
|
76
76
|
auto quantiles_sorted_view<T, C, A>::get_quantile(double rank, bool inclusive) const -> quantile_return_type {
|
77
77
|
if (entries_.empty()) throw std::runtime_error("operation is undefined for an empty sketch");
|
78
|
-
uint64_t weight = inclusive ? std::ceil(rank * total_weight_) : rank * total_weight_;
|
78
|
+
uint64_t weight = static_cast<uint64_t>(inclusive ? std::ceil(rank * total_weight_) : rank * total_weight_);
|
79
79
|
auto it = inclusive ?
|
80
80
|
std::lower_bound(entries_.begin(), entries_.end(), make_dummy_entry<T>(weight), compare_pairs_by_second())
|
81
81
|
: std::upper_bound(entries_.begin(), entries_.end(), make_dummy_entry<T>(weight), compare_pairs_by_second());
|
@@ -30,23 +30,56 @@
|
|
30
30
|
|
31
31
|
namespace datasketches {
|
32
32
|
|
33
|
-
|
33
|
+
/// Interface for serializing and deserializing items
|
34
34
|
template<typename T, typename Enable = void> struct serde {
|
35
|
-
|
35
|
+
/**
|
36
|
+
* Stream serialization
|
37
|
+
* @param os output stream
|
38
|
+
* @param items pointer to array of items
|
39
|
+
* @param num number of items
|
40
|
+
*/
|
36
41
|
void serialize(std::ostream& os, const T* items, unsigned num) const;
|
37
|
-
void deserialize(std::istream& is, T* items, unsigned num) const; // items allocated but not initialized
|
38
42
|
|
39
|
-
|
40
|
-
|
43
|
+
/**
|
44
|
+
* Stream deserialization
|
45
|
+
* @param is input stream
|
46
|
+
* @param items pointer to array of items (items in the array are allocated but not initialized)
|
47
|
+
* @param num number of items
|
48
|
+
*/
|
49
|
+
void deserialize(std::istream& is, T* items, unsigned num) const;
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Raw bytes serialization
|
53
|
+
* @param ptr pointer to output buffer
|
54
|
+
* @param capacity size of the buffer in bytes
|
55
|
+
* @param items pointer to array of items
|
56
|
+
* @param num number of items
|
57
|
+
*/
|
41
58
|
size_t serialize(void* ptr, size_t capacity, const T* items, unsigned num) const;
|
42
|
-
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Raw bytes deserialization
|
62
|
+
* @param ptr pointer to input buffer
|
63
|
+
* @param capacity size of the buffer in bytes
|
64
|
+
* @param items pointer to array of items (items in the array are allocated but not initialized)
|
65
|
+
* @param num number of items
|
66
|
+
*/
|
67
|
+
size_t deserialize(const void* ptr, size_t capacity, T* items, unsigned num) const;
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Size of the given item
|
71
|
+
* @param item to be sized
|
72
|
+
* @return size of the given item in bytes
|
73
|
+
*/
|
74
|
+
size_t size_of_item(const T& item) const;
|
43
75
|
};
|
44
76
|
|
45
|
-
|
46
|
-
|
47
|
-
|
77
|
+
/// serde for all fixed-size arithmetic types (int and float of different sizes).
|
78
|
+
/// in particular, kll_sketch<int64_t> should produce sketches binary-compatible
|
79
|
+
/// with LongsSketch and ItemsSketch<Long> with ArrayOfLongsSerDe in Java
|
48
80
|
template<typename T>
|
49
81
|
struct serde<T, typename std::enable_if<std::is_arithmetic<T>::value>::type> {
|
82
|
+
/// @copydoc serde::serialize
|
50
83
|
void serialize(std::ostream& os, const T* items, unsigned num) const {
|
51
84
|
bool failure = false;
|
52
85
|
try {
|
@@ -58,6 +91,7 @@ struct serde<T, typename std::enable_if<std::is_arithmetic<T>::value>::type> {
|
|
58
91
|
throw std::runtime_error("error writing to std::ostream with " + std::to_string(num) + " items");
|
59
92
|
}
|
60
93
|
}
|
94
|
+
|
61
95
|
void deserialize(std::istream& is, T* items, unsigned num) const {
|
62
96
|
bool failure = false;
|
63
97
|
try {
|
@@ -70,30 +104,37 @@ struct serde<T, typename std::enable_if<std::is_arithmetic<T>::value>::type> {
|
|
70
104
|
}
|
71
105
|
}
|
72
106
|
|
73
|
-
|
74
|
-
return sizeof(T);
|
75
|
-
}
|
107
|
+
/// @copydoc serde::serialize(void*,size_t,const T*,unsigned) const
|
76
108
|
size_t serialize(void* ptr, size_t capacity, const T* items, unsigned num) const {
|
77
109
|
const size_t bytes_written = sizeof(T) * num;
|
78
110
|
check_memory_size(bytes_written, capacity);
|
79
111
|
memcpy(ptr, items, bytes_written);
|
80
112
|
return bytes_written;
|
81
113
|
}
|
114
|
+
|
115
|
+
/// @copydoc serde::deserialize(const void*,size_t,T*,unsigned) const
|
82
116
|
size_t deserialize(const void* ptr, size_t capacity, T* items, unsigned num) const {
|
83
117
|
const size_t bytes_read = sizeof(T) * num;
|
84
118
|
check_memory_size(bytes_read, capacity);
|
85
119
|
memcpy(items, ptr, bytes_read);
|
86
120
|
return bytes_read;
|
87
121
|
}
|
122
|
+
|
123
|
+
/// @copydoc serde::size_of_item
|
124
|
+
size_t size_of_item(const T& item) const {
|
125
|
+
unused(item);
|
126
|
+
return sizeof(T);
|
127
|
+
}
|
88
128
|
};
|
89
129
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
130
|
+
/// serde for std::string items.
|
131
|
+
/// This should produce sketches binary-compatible with
|
132
|
+
/// ItemsSketch<String> with ArrayOfStringsSerDe in Java.
|
133
|
+
/// The length of each string is stored as a 32-bit integer (historically),
|
134
|
+
/// which may be too wasteful. Treat this as an example.
|
95
135
|
template<>
|
96
136
|
struct serde<std::string> {
|
137
|
+
/// @copydoc serde::serialize
|
97
138
|
void serialize(std::ostream& os, const std::string* items, unsigned num) const {
|
98
139
|
unsigned i = 0;
|
99
140
|
bool failure = false;
|
@@ -110,6 +151,8 @@ struct serde<std::string> {
|
|
110
151
|
throw std::runtime_error("error writing to std::ostream at item " + std::to_string(i));
|
111
152
|
}
|
112
153
|
}
|
154
|
+
|
155
|
+
/// @copydoc serde::deserialize
|
113
156
|
void deserialize(std::istream& is, std::string* items, unsigned num) const {
|
114
157
|
unsigned i = 0;
|
115
158
|
bool failure = false;
|
@@ -137,9 +180,8 @@ struct serde<std::string> {
|
|
137
180
|
throw std::runtime_error("error reading from std::istream at item " + std::to_string(i));
|
138
181
|
}
|
139
182
|
}
|
140
|
-
|
141
|
-
|
142
|
-
}
|
183
|
+
|
184
|
+
/// @copydoc serde::serialize(void*,size_t,const T*,unsigned) const
|
143
185
|
size_t serialize(void* ptr, size_t capacity, const std::string* items, unsigned num) const {
|
144
186
|
size_t bytes_written = 0;
|
145
187
|
for (unsigned i = 0; i < num; ++i) {
|
@@ -154,6 +196,8 @@ struct serde<std::string> {
|
|
154
196
|
}
|
155
197
|
return bytes_written;
|
156
198
|
}
|
199
|
+
|
200
|
+
/// @copydoc serde::deserialize(const void*,size_t,T*,unsigned) const
|
157
201
|
size_t deserialize(const void* ptr, size_t capacity, std::string* items, unsigned num) const {
|
158
202
|
size_t bytes_read = 0;
|
159
203
|
unsigned i = 0;
|
@@ -189,6 +233,11 @@ struct serde<std::string> {
|
|
189
233
|
|
190
234
|
return bytes_read;
|
191
235
|
}
|
236
|
+
|
237
|
+
/// @copydoc serde::size_of_item
|
238
|
+
size_t size_of_item(const std::string& item) const {
|
239
|
+
return sizeof(uint32_t) + item.size();
|
240
|
+
}
|
192
241
|
};
|
193
242
|
|
194
243
|
} /* namespace datasketches */
|
@@ -34,7 +34,6 @@ FetchContent_MakeAvailable(Catch2)
|
|
34
34
|
target_link_libraries(common_test_lib PUBLIC Catch2::Catch2)
|
35
35
|
|
36
36
|
set_target_properties(common_test_lib PROPERTIES
|
37
|
-
CXX_STANDARD 11
|
38
37
|
CXX_STANDARD_REQUIRED YES
|
39
38
|
)
|
40
39
|
|
@@ -69,12 +68,13 @@ add_test(
|
|
69
68
|
target_sources(common_test
|
70
69
|
PRIVATE
|
71
70
|
quantiles_sorted_view_test.cpp
|
71
|
+
optional_test.cpp
|
72
72
|
)
|
73
73
|
|
74
74
|
# now the integration test part
|
75
75
|
add_executable(integration_test)
|
76
76
|
|
77
|
-
target_link_libraries(integration_test cpc fi hll kll req sampling theta tuple common_test_lib)
|
77
|
+
target_link_libraries(integration_test count cpc density fi hll kll req sampling theta tuple common_test_lib)
|
78
78
|
|
79
79
|
set_target_properties(integration_test PROPERTIES
|
80
80
|
CXX_STANDARD 11
|
@@ -19,8 +19,10 @@
|
|
19
19
|
|
20
20
|
#include <catch2/catch.hpp>
|
21
21
|
|
22
|
+
#include "count_min.hpp"
|
22
23
|
#include "cpc_sketch.hpp"
|
23
24
|
#include "cpc_union.hpp"
|
25
|
+
#include "density_sketch.hpp"
|
24
26
|
#include "frequent_items_sketch.hpp"
|
25
27
|
#include "hll.hpp"
|
26
28
|
#include "kll_sketch.hpp"
|
@@ -48,9 +50,13 @@ struct subtracting_intersection_policy {
|
|
48
50
|
using tuple_intersection_float = tuple_intersection<float, subtracting_intersection_policy<float>>;
|
49
51
|
|
50
52
|
TEST_CASE("integration: declare all sketches", "[integration]") {
|
53
|
+
count_min_sketch<double> cm(5, 128);
|
54
|
+
|
51
55
|
cpc_sketch cpc(12);
|
52
56
|
cpc_union cpc_u(12);
|
53
57
|
|
58
|
+
density_sketch<double> ds(32, 3);
|
59
|
+
|
54
60
|
frequent_items_sketch<std::string> fi(100);
|
55
61
|
|
56
62
|
hll_sketch hll(13);
|
@@ -0,0 +1,85 @@
|
|
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
|
+
#include <catch2/catch.hpp>
|
21
|
+
|
22
|
+
#include <iostream>
|
23
|
+
|
24
|
+
#include "optional.hpp"
|
25
|
+
|
26
|
+
namespace datasketches {
|
27
|
+
|
28
|
+
class tt {
|
29
|
+
public:
|
30
|
+
tt() = delete; // make sure it cannot be default constructed
|
31
|
+
tt(int val): val_(val) {}
|
32
|
+
tt(const tt& other): val_(other.val_) { std::cout << "tt copy constructor\n"; }
|
33
|
+
tt(tt&& other): val_(other.val_) { std::cout << "tt move constructor\n"; }
|
34
|
+
tt& operator=(const tt& other) { val_ = other.val_; std::cout << "tt copy assignment\n"; return *this; }
|
35
|
+
tt& operator=(tt&& other) { val_ = other.val_; std::cout << "tt move assignment\n"; return *this; }
|
36
|
+
int get_val() const { return val_; }
|
37
|
+
private:
|
38
|
+
int val_;
|
39
|
+
};
|
40
|
+
|
41
|
+
TEST_CASE("optional", "[common]") {
|
42
|
+
optional<tt> opt;
|
43
|
+
REQUIRE_FALSE(opt);
|
44
|
+
opt.emplace(5);
|
45
|
+
REQUIRE(bool(opt));
|
46
|
+
REQUIRE((*opt).get_val() == 5);
|
47
|
+
REQUIRE(opt->get_val() == 5);
|
48
|
+
opt.reset();
|
49
|
+
REQUIRE_FALSE(opt);
|
50
|
+
|
51
|
+
optional<tt> opt2(opt);
|
52
|
+
REQUIRE_FALSE(opt2);
|
53
|
+
|
54
|
+
opt2.emplace(3);
|
55
|
+
if (opt2) *opt2 = 6; // good if it is initialized
|
56
|
+
REQUIRE(opt2->get_val() == 6);
|
57
|
+
|
58
|
+
opt.reset();
|
59
|
+
REQUIRE_FALSE(opt);
|
60
|
+
optional<tt> opt3(std::move(opt));
|
61
|
+
REQUIRE_FALSE(opt3);
|
62
|
+
*opt3 = 7; // don't do this! may be dangerous for arbitrary T, and it still thinks it is not initialized
|
63
|
+
REQUIRE_FALSE(opt3);
|
64
|
+
opt3.emplace(8);
|
65
|
+
REQUIRE(bool(opt3));
|
66
|
+
REQUIRE(opt3->get_val() == 8);
|
67
|
+
|
68
|
+
std::swap(opt2, opt3);
|
69
|
+
REQUIRE(opt2->get_val() == 8);
|
70
|
+
REQUIRE(opt3->get_val() == 6);
|
71
|
+
|
72
|
+
std::swap(opt2, opt);
|
73
|
+
REQUIRE_FALSE(opt2);
|
74
|
+
REQUIRE(bool(opt));
|
75
|
+
REQUIRE(opt->get_val() == 8);
|
76
|
+
}
|
77
|
+
|
78
|
+
TEST_CASE("optional conversion", "[common]") {
|
79
|
+
optional<float> opt_f(1);
|
80
|
+
optional<double> opt_d(opt_f);
|
81
|
+
REQUIRE(bool(opt_d));
|
82
|
+
REQUIRE(*opt_d == static_cast<double>(*opt_f));
|
83
|
+
}
|
84
|
+
|
85
|
+
} /* namespace datasketches */
|
@@ -33,16 +33,16 @@ extern long long test_allocator_net_allocations;
|
|
33
33
|
|
34
34
|
template <class T> class test_allocator {
|
35
35
|
public:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
using value_type = T;
|
37
|
+
using pointer = value_type*;
|
38
|
+
using const_pointer = const value_type*;
|
39
|
+
using reference = value_type&;
|
40
|
+
using const_reference = const value_type&;
|
41
|
+
using size_type = std::size_t;
|
42
|
+
using difference_type = std::ptrdiff_t;
|
43
43
|
|
44
44
|
template <class U>
|
45
|
-
struct rebind {
|
45
|
+
struct rebind { using other = test_allocator<U>; };
|
46
46
|
|
47
47
|
// this is to test that a given instance of an allocator is used instead of instantiating
|
48
48
|
static const bool DISALLOW_DEFAULT_CONSTRUCTOR = true;
|
@@ -66,7 +66,7 @@ public:
|
|
66
66
|
}
|
67
67
|
|
68
68
|
pointer allocate(size_type n, const_pointer = 0) {
|
69
|
-
void* p = new
|
69
|
+
void* p = ::operator new(n * sizeof(value_type));
|
70
70
|
if (!p) throw std::bad_alloc();
|
71
71
|
test_allocator_total_bytes += n * sizeof(value_type);
|
72
72
|
++test_allocator_net_allocations;
|
@@ -74,7 +74,7 @@ public:
|
|
74
74
|
}
|
75
75
|
|
76
76
|
void deallocate(pointer p, size_type n) {
|
77
|
-
if (p) delete
|
77
|
+
if (p) ::operator delete(p);
|
78
78
|
test_allocator_total_bytes -= n * sizeof(value_type);
|
79
79
|
--test_allocator_net_allocations;
|
80
80
|
}
|
@@ -92,12 +92,12 @@ public:
|
|
92
92
|
|
93
93
|
template<> class test_allocator<void> {
|
94
94
|
public:
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
using value_type = void;
|
96
|
+
using pointer = void*;
|
97
|
+
using const_pointer = const void*;
|
98
98
|
|
99
99
|
template <class U>
|
100
|
-
struct rebind {
|
100
|
+
struct rebind { using other = test_allocator<U>; };
|
101
101
|
};
|
102
102
|
|
103
103
|
|
@@ -15,4 +15,28 @@
|
|
15
15
|
# specific language governing permissions and limitations
|
16
16
|
# under the License.
|
17
17
|
|
18
|
-
|
18
|
+
add_library(count INTERFACE)
|
19
|
+
|
20
|
+
add_library(${PROJECT_NAME}::COUNT ALIAS count)
|
21
|
+
|
22
|
+
if (BUILD_TESTS)
|
23
|
+
add_subdirectory(test)
|
24
|
+
endif()
|
25
|
+
|
26
|
+
target_include_directories(count
|
27
|
+
INTERFACE
|
28
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
29
|
+
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>
|
30
|
+
)
|
31
|
+
|
32
|
+
target_link_libraries(count INTERFACE common)
|
33
|
+
target_compile_features(count INTERFACE cxx_std_11)
|
34
|
+
|
35
|
+
install(TARGETS count
|
36
|
+
EXPORT ${PROJECT_NAME}
|
37
|
+
)
|
38
|
+
|
39
|
+
install(FILES
|
40
|
+
include/count_min.hpp
|
41
|
+
include/count_min_impl.hpp
|
42
|
+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/DataSketches")
|