datasketches 0.2.5 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/LICENSE +4 -6
  4. data/NOTICE +6 -5
  5. data/ext/datasketches/kll_wrapper.cpp +2 -2
  6. data/lib/datasketches/version.rb +1 -1
  7. data/vendor/datasketches-cpp/CMakeLists.txt +1 -1
  8. data/vendor/datasketches-cpp/LICENSE +4 -6
  9. data/vendor/datasketches-cpp/MANIFEST.in +0 -2
  10. data/vendor/datasketches-cpp/NOTICE +6 -5
  11. data/vendor/datasketches-cpp/common/CMakeLists.txt +2 -2
  12. data/vendor/datasketches-cpp/common/test/CMakeLists.txt +13 -2
  13. data/vendor/datasketches-cpp/common/test/catch_runner.cpp +22 -1
  14. data/vendor/datasketches-cpp/common/test/integration_test.cpp +1 -1
  15. data/vendor/datasketches-cpp/cpc/include/cpc_compressor_impl.hpp +2 -1
  16. data/vendor/datasketches-cpp/cpc/test/compression_test.cpp +1 -1
  17. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_allocation_test.cpp +1 -1
  18. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_test.cpp +1 -1
  19. data/vendor/datasketches-cpp/cpc/test/cpc_union_test.cpp +1 -1
  20. data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map_impl.hpp +1 -1
  21. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_custom_type_test.cpp +1 -1
  22. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_test.cpp +1 -1
  23. data/vendor/datasketches-cpp/fi/test/reverse_purge_hash_map_test.cpp +1 -1
  24. data/vendor/datasketches-cpp/hll/test/AuxHashMapTest.cpp +1 -1
  25. data/vendor/datasketches-cpp/hll/test/CouponHashSetTest.cpp +1 -1
  26. data/vendor/datasketches-cpp/hll/test/CouponListTest.cpp +1 -1
  27. data/vendor/datasketches-cpp/hll/test/CrossCountingTest.cpp +1 -1
  28. data/vendor/datasketches-cpp/hll/test/HllArrayTest.cpp +1 -1
  29. data/vendor/datasketches-cpp/hll/test/HllSketchTest.cpp +1 -1
  30. data/vendor/datasketches-cpp/hll/test/HllUnionTest.cpp +1 -1
  31. data/vendor/datasketches-cpp/hll/test/IsomorphicTest.cpp +1 -1
  32. data/vendor/datasketches-cpp/hll/test/TablesTest.cpp +1 -1
  33. data/vendor/datasketches-cpp/hll/test/ToFromByteArrayTest.cpp +1 -1
  34. data/vendor/datasketches-cpp/kll/include/kll_helper_impl.hpp +2 -2
  35. data/vendor/datasketches-cpp/kll/include/kll_sketch.hpp +22 -9
  36. data/vendor/datasketches-cpp/kll/include/kll_sketch_impl.hpp +47 -9
  37. data/vendor/datasketches-cpp/kll/test/kll_sketch_custom_type_test.cpp +1 -1
  38. data/vendor/datasketches-cpp/kll/test/kll_sketch_test.cpp +72 -7
  39. data/vendor/datasketches-cpp/kll/test/kll_sketch_validation.cpp +1 -1
  40. data/vendor/datasketches-cpp/kll/test/kolmogorov_smirnov_test.cpp +1 -1
  41. data/vendor/datasketches-cpp/pyproject.toml +0 -1
  42. data/vendor/datasketches-cpp/python/README.md +6 -9
  43. data/vendor/datasketches-cpp/python/pybind11Path.cmd +1 -1
  44. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch.hpp +15 -0
  45. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch_impl.hpp +78 -14
  46. data/vendor/datasketches-cpp/quantiles/test/kolmogorov_smirnov_test.cpp +3 -3
  47. data/vendor/datasketches-cpp/quantiles/test/quantiles_compatibility_test.cpp +1 -1
  48. data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_test.cpp +64 -1
  49. data/vendor/datasketches-cpp/req/include/req_compactor.hpp +6 -0
  50. data/vendor/datasketches-cpp/req/include/req_compactor_impl.hpp +27 -0
  51. data/vendor/datasketches-cpp/req/include/req_sketch.hpp +11 -0
  52. data/vendor/datasketches-cpp/req/include/req_sketch_impl.hpp +29 -2
  53. data/vendor/datasketches-cpp/req/test/req_sketch_custom_type_test.cpp +1 -1
  54. data/vendor/datasketches-cpp/req/test/req_sketch_test.cpp +70 -4
  55. data/vendor/datasketches-cpp/sampling/test/var_opt_allocation_test.cpp +1 -1
  56. data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_test.cpp +1 -1
  57. data/vendor/datasketches-cpp/sampling/test/var_opt_union_test.cpp +1 -1
  58. data/vendor/datasketches-cpp/setup.py +2 -3
  59. data/vendor/datasketches-cpp/theta/test/theta_a_not_b_test.cpp +1 -1
  60. data/vendor/datasketches-cpp/theta/test/theta_intersection_test.cpp +1 -1
  61. data/vendor/datasketches-cpp/theta/test/theta_jaccard_similarity_test.cpp +1 -1
  62. data/vendor/datasketches-cpp/theta/test/theta_setop_test.cpp +1 -1
  63. data/vendor/datasketches-cpp/theta/test/theta_sketch_test.cpp +1 -1
  64. data/vendor/datasketches-cpp/theta/test/theta_union_test.cpp +1 -1
  65. data/vendor/datasketches-cpp/tuple/include/tuple_sketch_impl.hpp +25 -31
  66. data/vendor/datasketches-cpp/tuple/test/array_of_doubles_sketch_test.cpp +1 -1
  67. data/vendor/datasketches-cpp/tuple/test/tuple_a_not_b_test.cpp +1 -1
  68. data/vendor/datasketches-cpp/tuple/test/tuple_intersection_test.cpp +1 -1
  69. data/vendor/datasketches-cpp/tuple/test/tuple_jaccard_similarity_test.cpp +1 -1
  70. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_allocation_test.cpp +1 -1
  71. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_test.cpp +1 -1
  72. data/vendor/datasketches-cpp/tuple/test/tuple_union_test.cpp +1 -1
  73. metadata +2 -4
  74. data/vendor/datasketches-cpp/common/test/catch.hpp +0 -17618
  75. data/vendor/datasketches-cpp/common/test/test_runner.cpp +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9eaa8a17efdbc591b3e56f94650e887babd30dc79d95db3a7986df0261184191
4
- data.tar.gz: 5544326a0edf165d87373a680d8bf5b80acba2894b9048f92cbdb261fcd66d57
3
+ metadata.gz: 4a7fef851c11ba93a002a6215f76170b973628f8b1f0a89fb89a5e655f6a421a
4
+ data.tar.gz: a590d7cde413596640f8bf169db67742696d7e304097be8bc0820244ed32ebd5
5
5
  SHA512:
6
- metadata.gz: 5a28c093ecda083762367149800770f59fee8e630c0d983d3f29ed32d027fae2e2515dff243ee11bbd41f4875c7cea622f7bc5cc5d7e73176e785503ed19fc0b
7
- data.tar.gz: 6b210f2fdca1ae3cbd4e4cbf88e284855014b5a1e1c883085dc96a057da29e370005163ce628e54351c9127b00fae4b7b33a4ca63e6f4b90e0665e93b7742a66
6
+ metadata.gz: dea9986097b4e9e4c7aba8b6f69108dce21caa2f6fa1e8723a9bf8be2077b925507bf84bd92bc794c1831285963f8ecb8f4739797c3246a15a438a82816043d6
7
+ data.tar.gz: 64f2ed1ed4656c09057892ae493a9a2c7178b3090dd84c24105b9e2f16d45f9aaed728c2bb6154e6518e018bbd240f5c2e562fa2edbee397b5deccb8b1dd11f5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.2.7 (2022-11-05)
2
+
3
+ - Updated DataSketches to 3.5.1
4
+
5
+ ## 0.2.6 (2022-07-13)
6
+
7
+ - Updated DataSketches to 3.5.0
8
+
1
9
  ## 0.2.5 (2022-05-21)
2
10
 
3
11
  - Updated DataSketches to 3.4.0
data/LICENSE CHANGED
@@ -255,10 +255,8 @@ APPENDIX B: Additional licenses relevant to this product.
255
255
  =============================================================
256
256
  Boost License (https://www.boost.org/LICENSE_1_0.txt)
257
257
  =============================================================
258
- Original source code:
259
- https://github.com/catchorg/Catch2/blob/master/single_include/catch2/catch.hpp
260
- -------------------------------------------------------------
261
- Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
258
+ Original source:
259
+ https://github.com/catchorg/Catch2/blob/v2.x/LICENSE.txt
262
260
 
263
261
  Boost Software License - Version 1.0 - August 17th, 2003
264
262
 
@@ -285,8 +283,8 @@ APPENDIX B: Additional licenses relevant to this product.
285
283
  DEALINGS IN THE SOFTWARE.
286
284
  -------------------------------------------------------------
287
285
  Code Locations:
288
- * https://github.com/apache/datasketches-cpp/blob/master/common/test/catch.hpp
289
- that is adapted from the above.
286
+ Found in the Catch2 unit test code that is downloaded from github.com as part
287
+ of CMake configuration if configured to build tests.
290
288
 
291
289
 
292
290
  =============================================================
data/NOTICE CHANGED
@@ -1,11 +1,12 @@
1
- Apache DataSketches-cpp
2
- Copyright 2020-2021 The Apache Software Foundation
1
+ Apache DataSketches C++ and Python
2
+ Copyright 2022 The Apache Software Foundation
3
3
 
4
- Copyright 2015-2018 Yahoo
5
- Copyright 2019 Verizon Media
4
+ Copyright 2015-2018 Yahoo Inc.
5
+ Copyright 2019-2020 Verizon Media
6
+ Copyright 2021 Yahoo Inc.
6
7
 
7
8
  This product includes software developed at
8
9
  The Apache Software Foundation (http://www.apache.org/).
9
10
 
10
11
  Prior to moving to ASF, the software for this project was developed at
11
- Yahoo (now Verizon Media) (https://developer.yahoo.com).
12
+ Yahoo Inc. (https://developer.yahoo.com).
@@ -55,12 +55,12 @@ void bind_kll_sketch(Rice::Module& m, const char* name) {
55
55
  })
56
56
  .define_method(
57
57
  "pmf",
58
- [](kll_sketch<T>& self, std::vector<T> split_points) {
58
+ [](kll_sketch<T>& self, const std::vector<T>& split_points) {
59
59
  return self.get_PMF(&split_points[0], split_points.size());
60
60
  })
61
61
  .define_method(
62
62
  "cdf",
63
- [](kll_sketch<T>& self, std::vector<T> split_points) {
63
+ [](kll_sketch<T>& self, const std::vector<T>& split_points) {
64
64
  return self.get_CDF(&split_points[0], split_points.size());
65
65
  })
66
66
  .define_method(
@@ -1,3 +1,3 @@
1
1
  module DataSketches
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.7"
3
3
  end
@@ -17,7 +17,7 @@
17
17
 
18
18
  cmake_minimum_required(VERSION 3.16.0)
19
19
  project(DataSketches
20
- VERSION 3.4.0
20
+ VERSION 3.5.1
21
21
  LANGUAGES CXX)
22
22
 
23
23
  include(GNUInstallDirs)
@@ -255,10 +255,8 @@ APPENDIX B: Additional licenses relevant to this product.
255
255
  =============================================================
256
256
  Boost License (https://www.boost.org/LICENSE_1_0.txt)
257
257
  =============================================================
258
- Original source code:
259
- https://github.com/catchorg/Catch2/blob/master/single_include/catch2/catch.hpp
260
- -------------------------------------------------------------
261
- Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
258
+ Original source:
259
+ https://github.com/catchorg/Catch2/blob/v2.x/LICENSE.txt
262
260
 
263
261
  Boost Software License - Version 1.0 - August 17th, 2003
264
262
 
@@ -285,8 +283,8 @@ APPENDIX B: Additional licenses relevant to this product.
285
283
  DEALINGS IN THE SOFTWARE.
286
284
  -------------------------------------------------------------
287
285
  Code Locations:
288
- * https://github.com/apache/datasketches-cpp/blob/master/common/test/catch.hpp
289
- that is adapted from the above.
286
+ Found in the Catch2 unit test code that is downloaded from github.com as part
287
+ of CMake configuration if configured to build tests.
290
288
 
291
289
 
292
290
  =============================================================
@@ -7,8 +7,6 @@ global-include *.bin
7
7
 
8
8
  global-exclude .git*
9
9
 
10
- recursive-include python/pybind11 *
11
-
12
10
  graft cmake
13
11
  graft common
14
12
  graft cpc
@@ -1,11 +1,12 @@
1
- Apache DataSketches-cpp
2
- Copyright 2020-2021 The Apache Software Foundation
1
+ Apache DataSketches C++ and Python
2
+ Copyright 2022 The Apache Software Foundation
3
3
 
4
- Copyright 2015-2018 Yahoo
5
- Copyright 2019 Verizon Media
4
+ Copyright 2015-2018 Yahoo Inc.
5
+ Copyright 2019-2020 Verizon Media
6
+ Copyright 2021 Yahoo Inc.
6
7
 
7
8
  This product includes software developed at
8
9
  The Apache Software Foundation (http://www.apache.org/).
9
10
 
10
11
  Prior to moving to ASF, the software for this project was developed at
11
- Yahoo (now Verizon Media) (https://developer.yahoo.com).
12
+ Yahoo Inc. (https://developer.yahoo.com).
@@ -43,8 +43,8 @@ install(FILES
43
43
  include/conditional_forward.hpp
44
44
  include/ceiling_power_of_2.hpp
45
45
  include/bounds_binomial_proportions.hpp
46
- include/kolmogorov_smirnov.hpp
47
- include/kolmogorov_smirnov_impl.hpp
48
46
  include/quantile_sketch_sorted_view.hpp
49
47
  include/quantile_sketch_sorted_view_impl.hpp
48
+ include/kolmogorov_smirnov.hpp
49
+ include/kolmogorov_smirnov_impl.hpp
50
50
  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/DataSketches")
@@ -21,6 +21,18 @@
21
21
  # common dependencies for tests
22
22
  add_library(common_test OBJECT "")
23
23
 
24
+ include(FetchContent)
25
+
26
+ FetchContent_Declare(
27
+ Catch2
28
+ GIT_REPOSITORY https://github.com/catchorg/Catch2
29
+ GIT_TAG v2.13.9
30
+ )
31
+
32
+ FetchContent_MakeAvailable(Catch2)
33
+
34
+ target_link_libraries(common_test PUBLIC Catch2::Catch2)
35
+
24
36
  set_target_properties(common_test PROPERTIES
25
37
  CXX_STANDARD 11
26
38
  CXX_STANDARD_REQUIRED YES
@@ -33,7 +45,6 @@ target_include_directories(common_test
33
45
 
34
46
  target_sources(common_test
35
47
  INTERFACE
36
- ${CMAKE_CURRENT_SOURCE_DIR}/catch.hpp
37
48
  ${CMAKE_CURRENT_SOURCE_DIR}/test_allocator.hpp
38
49
  ${CMAKE_CURRENT_SOURCE_DIR}/test_type.hpp
39
50
  PRIVATE
@@ -59,4 +70,4 @@ add_test(
59
70
  target_sources(integration_test
60
71
  PRIVATE
61
72
  integration_test.cpp
62
- )
73
+ )
@@ -1,7 +1,28 @@
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
+
1
20
  #ifndef _TEST_COMMON_HPP_
2
21
  #define _TEST_COMMON_HPP_
3
22
 
23
+ // this largely just ensures that, for our simple test cases at least,
24
+ // we define main() exactly once per test executable
4
25
  #define CATCH_CONFIG_MAIN
5
- #include "catch.hpp"
26
+ #include <catch2/catch.hpp>
6
27
 
7
28
  #endif // _TEST_COMMON_HPP_
@@ -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 "cpc_sketch.hpp"
23
23
  #include "cpc_union.hpp"
@@ -297,6 +297,7 @@ void cpc_compressor<A>::compress_sliding_flavor(const cpc_sketch_alloc<A>& sourc
297
297
  // changes the implied ordering of the pairs, so we must do it before sorting.
298
298
 
299
299
  const uint8_t pseudo_phase = determine_pseudo_phase(source.get_lg_k(), source.get_num_coupons());
300
+ if (pseudo_phase >= 16) throw std::logic_error("unexpected pseudo phase for sliding flavor");
300
301
  const uint8_t* permutation = column_permutations_for_encoding[pseudo_phase];
301
302
 
302
303
  const uint8_t offset = source.window_offset;
@@ -333,7 +334,7 @@ void cpc_compressor<A>::uncompress_sliding_flavor(const compressed_state<A>& sou
333
334
  lg_k, source.table_data.get_allocator());
334
335
 
335
336
  const uint8_t pseudo_phase = determine_pseudo_phase(lg_k, num_coupons);
336
- if (pseudo_phase >= 16) throw std::logic_error("pseudo phase >= 16");
337
+ if (pseudo_phase >= 16) throw std::logic_error("unexpected pseudo phase for sliding flavor");
337
338
  const uint8_t* permutation = column_permutations_for_decoding[pseudo_phase];
338
339
 
339
340
  uint8_t offset = cpc_sketch_alloc<A>::determine_correct_offset(lg_k, num_coupons);
@@ -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 <algorithm>
22
22
 
23
23
  #include "cpc_compressor.hpp"
@@ -22,7 +22,7 @@
22
22
  #include <sstream>
23
23
  #include <fstream>
24
24
 
25
- #include <catch.hpp>
25
+ #include <catch2/catch.hpp>
26
26
 
27
27
  #include "cpc_sketch.hpp"
28
28
  #include "cpc_union.hpp"
@@ -23,7 +23,7 @@
23
23
  #include <fstream>
24
24
  #include <stdexcept>
25
25
 
26
- #include <catch.hpp>
26
+ #include <catch2/catch.hpp>
27
27
 
28
28
  #include "cpc_sketch.hpp"
29
29
 
@@ -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 "cpc_union.hpp"
23
23
 
@@ -71,8 +71,8 @@ states_(nullptr)
71
71
  if (other.states_[i] > 0) {
72
72
  new (&keys_[i]) K(other.keys_[i]);
73
73
  values_[i] = other.values_[i];
74
+ if (--num == 0) break;
74
75
  }
75
- if (--num == 0) break;
76
76
  }
77
77
  }
78
78
  std::copy(other.states_, other.states_ + size, states_);
@@ -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
  #include <sstream>
22
22
  #include <fstream>
23
23
  #include <stdexcept>
@@ -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 <reverse_purge_hash_map.hpp>
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
  #include <memory>
22
22
  #include <stdexcept>
23
23
 
@@ -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"
@@ -230,7 +230,7 @@ kll_helper::compress_result kll_helper::general_compress(uint16_t k, uint8_t m,
230
230
  // move level over as is
231
231
  // make sure we are not moving data upwards
232
232
  if (raw_beg < out_levels[current_level]) throw std::logic_error("wrong move");
233
- std::move(&items[raw_beg], &items[raw_lim], &items[out_levels[current_level]]);
233
+ std::move(items + raw_beg, items + raw_lim, items + out_levels[current_level]);
234
234
  out_levels[current_level + 1] = out_levels[current_level] + raw_pop;
235
235
  } else {
236
236
  // The sketch is too full AND this level is too full, so we compact it
@@ -251,7 +251,7 @@ kll_helper::compress_result kll_helper::general_compress(uint16_t k, uint8_t m,
251
251
 
252
252
  // level zero might not be sorted, so we must sort it if we wish to compact it
253
253
  if ((current_level == 0) && !is_level_zero_sorted) {
254
- std::sort(&items[adj_beg], &items[adj_beg + adj_pop], C());
254
+ std::sort(items + adj_beg, items + adj_beg + adj_pop, C());
255
255
  }
256
256
 
257
257
  if (pop_above == 0) { // Level above is empty, so halve up
@@ -170,7 +170,7 @@ class kll_sketch {
170
170
  using comparator = C;
171
171
 
172
172
  static const uint8_t DEFAULT_M = 8;
173
- // TODO: Redundant and deprecated. Will be remove din next major version.
173
+ // TODO: Redundant and deprecated. Will be removed in next major version.
174
174
  static const uint16_t DEFAULT_K = kll_constants::DEFAULT_K;
175
175
  static const uint16_t MIN_K = DEFAULT_M;
176
176
  static const uint16_t MAX_K = (1 << 16) - 1;
@@ -182,6 +182,14 @@ class kll_sketch {
182
182
  kll_sketch& operator=(const kll_sketch& other);
183
183
  kll_sketch& operator=(kll_sketch&& other);
184
184
 
185
+ /*
186
+ * Type converting constructor.
187
+ * @param other sketch of a different type
188
+ * @param allocator instance of an Allocator
189
+ */
190
+ template<typename TT, typename CC, typename SS, typename AA>
191
+ explicit kll_sketch(const kll_sketch<TT, CC, SS, AA>& other, const A& allocator = A());
192
+
185
193
  /**
186
194
  * Updates this sketch with the given data item.
187
195
  * @param value an item from a stream of items
@@ -390,7 +398,7 @@ class kll_sketch {
390
398
  /**
391
399
  * Computes size needed to serialize the current state of the sketch.
392
400
  * This version is for fixed-size arithmetic types (integral and floating point).
393
- * @param instance of a SerDe
401
+ * @param serde instance of a SerDe
394
402
  * @return size in bytes needed to serialize this sketch
395
403
  */
396
404
  template<typename TT = T, typename SerDe = S, typename std::enable_if<std::is_arithmetic<TT>::value, int>::type = 0>
@@ -399,7 +407,7 @@ class kll_sketch {
399
407
  /**
400
408
  * Computes size needed to serialize the current state of the sketch.
401
409
  * This version is for all other types and can be expensive since every item needs to be looked at.
402
- * @param instance of a SerDe
410
+ * @param serde instance of a SerDe
403
411
  * @return size in bytes needed to serialize this sketch
404
412
  */
405
413
  template<typename TT = T, typename SerDe = S, typename std::enable_if<!std::is_arithmetic<TT>::value, int>::type = 0>
@@ -459,7 +467,7 @@ class kll_sketch {
459
467
  /**
460
468
  * This method deserializes a sketch from a given stream.
461
469
  * @param is input stream
462
- * @param instance of an Allocator
470
+ * @param allocator instance of an Allocator
463
471
  * @return an instance of a sketch
464
472
  *
465
473
  * Deprecated, to be removed in the next major version
@@ -469,8 +477,8 @@ class kll_sketch {
469
477
  /**
470
478
  * This method deserializes a sketch from a given stream.
471
479
  * @param is input stream
472
- * @param instance of a SerDe
473
- * @param instance of an Allocator
480
+ * @param serde instance of a SerDe
481
+ * @param allocator instance of an Allocator
474
482
  * @return an instance of a sketch
475
483
  */
476
484
  template<typename SerDe = S>
@@ -480,7 +488,7 @@ class kll_sketch {
480
488
  * This method deserializes a sketch from a given array of bytes.
481
489
  * @param bytes pointer to the array of bytes
482
490
  * @param size the size of the array
483
- * @param instance of an Allocator
491
+ * @param allocator instance of an Allocator
484
492
  * @return an instance of a sketch
485
493
  *
486
494
  * Deprecated, to be removed in the next major version
@@ -491,8 +499,8 @@ class kll_sketch {
491
499
  * This method deserializes a sketch from a given array of bytes.
492
500
  * @param bytes pointer to the array of bytes
493
501
  * @param size the size of the array
494
- * @param instance of a SerDe
495
- * @param instance of an Allocator
502
+ * @param serde instance of a SerDe
503
+ * @param allocator instance of an Allocator
496
504
  * @return an instance of a sketch
497
505
  */
498
506
  template<typename SerDe = S>
@@ -606,6 +614,8 @@ class kll_sketch {
606
614
  static void check_serial_version(uint8_t serial_version);
607
615
  static void check_family_id(uint8_t family_id);
608
616
 
617
+ void check_sorting() const;
618
+
609
619
  // implementations for floating point types
610
620
  template<typename TT = T, typename std::enable_if<std::is_floating_point<TT>::value, int>::type = 0>
611
621
  static const TT& get_invalid_value() {
@@ -629,6 +639,9 @@ class kll_sketch {
629
639
  return true;
630
640
  }
631
641
 
642
+ // for type converting constructor
643
+ template<typename TT, typename CC, typename SS, typename AA>
644
+ friend class kll_sketch;
632
645
  };
633
646
 
634
647
  template<typename T, typename C, typename S, typename A>