datasketches 0.1.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/LICENSE +40 -3
  4. data/NOTICE +1 -1
  5. data/ext/datasketches/cpc_wrapper.cpp +12 -13
  6. data/ext/datasketches/ext.cpp +1 -1
  7. data/ext/datasketches/ext.h +4 -0
  8. data/ext/datasketches/extconf.rb +1 -1
  9. data/ext/datasketches/fi_wrapper.cpp +6 -8
  10. data/ext/datasketches/hll_wrapper.cpp +13 -14
  11. data/ext/datasketches/kll_wrapper.cpp +28 -76
  12. data/ext/datasketches/theta_wrapper.cpp +27 -41
  13. data/ext/datasketches/vo_wrapper.cpp +4 -6
  14. data/lib/datasketches/version.rb +1 -1
  15. data/vendor/datasketches-cpp/CMakeLists.txt +10 -0
  16. data/vendor/datasketches-cpp/LICENSE +40 -3
  17. data/vendor/datasketches-cpp/NOTICE +1 -1
  18. data/vendor/datasketches-cpp/README.md +4 -4
  19. data/vendor/datasketches-cpp/common/include/MurmurHash3.h +18 -7
  20. data/vendor/datasketches-cpp/common/include/binomial_bounds.hpp +8 -8
  21. data/vendor/datasketches-cpp/common/include/bounds_binomial_proportions.hpp +12 -15
  22. data/vendor/datasketches-cpp/common/include/common_defs.hpp +26 -0
  23. data/vendor/datasketches-cpp/common/include/conditional_forward.hpp +20 -8
  24. data/vendor/datasketches-cpp/common/include/count_zeros.hpp +2 -2
  25. data/vendor/datasketches-cpp/common/include/memory_operations.hpp +12 -0
  26. data/vendor/datasketches-cpp/common/include/serde.hpp +7 -7
  27. data/vendor/datasketches-cpp/common/test/CMakeLists.txt +24 -0
  28. data/vendor/datasketches-cpp/common/test/integration_test.cpp +77 -0
  29. data/vendor/datasketches-cpp/common/test/test_allocator.hpp +9 -1
  30. data/vendor/datasketches-cpp/cpc/include/cpc_common.hpp +13 -3
  31. data/vendor/datasketches-cpp/cpc/include/cpc_compressor.hpp +20 -20
  32. data/vendor/datasketches-cpp/cpc/include/cpc_compressor_impl.hpp +116 -105
  33. data/vendor/datasketches-cpp/cpc/include/cpc_sketch.hpp +22 -6
  34. data/vendor/datasketches-cpp/cpc/include/cpc_sketch_impl.hpp +140 -101
  35. data/vendor/datasketches-cpp/cpc/include/cpc_union.hpp +2 -2
  36. data/vendor/datasketches-cpp/cpc/include/cpc_union_impl.hpp +20 -20
  37. data/vendor/datasketches-cpp/cpc/include/cpc_util.hpp +10 -16
  38. data/vendor/datasketches-cpp/cpc/include/icon_estimator.hpp +6 -6
  39. data/vendor/datasketches-cpp/cpc/include/u32_table.hpp +10 -10
  40. data/vendor/datasketches-cpp/cpc/include/u32_table_impl.hpp +21 -21
  41. data/vendor/datasketches-cpp/cpc/test/CMakeLists.txt +1 -0
  42. data/vendor/datasketches-cpp/cpc/test/compression_test.cpp +10 -10
  43. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_allocation_test.cpp +237 -0
  44. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_test.cpp +25 -0
  45. data/vendor/datasketches-cpp/cpc/test/cpc_union_test.cpp +1 -1
  46. data/vendor/datasketches-cpp/fi/include/frequent_items_sketch.hpp +15 -10
  47. data/vendor/datasketches-cpp/fi/include/frequent_items_sketch_impl.hpp +102 -105
  48. data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map.hpp +19 -13
  49. data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map_impl.hpp +141 -125
  50. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_custom_type_test.cpp +15 -12
  51. data/vendor/datasketches-cpp/fi/test/reverse_purge_hash_map_test.cpp +5 -5
  52. data/vendor/datasketches-cpp/hll/CMakeLists.txt +3 -0
  53. data/vendor/datasketches-cpp/hll/include/AuxHashMap-internal.hpp +81 -109
  54. data/vendor/datasketches-cpp/hll/include/AuxHashMap.hpp +25 -24
  55. data/vendor/datasketches-cpp/hll/include/CompositeInterpolationXTable-internal.hpp +15 -15
  56. data/vendor/datasketches-cpp/hll/include/CompositeInterpolationXTable.hpp +5 -5
  57. data/vendor/datasketches-cpp/hll/include/CouponHashSet-internal.hpp +89 -105
  58. data/vendor/datasketches-cpp/hll/include/CouponHashSet.hpp +13 -13
  59. data/vendor/datasketches-cpp/hll/include/CouponList-internal.hpp +130 -165
  60. data/vendor/datasketches-cpp/hll/include/CouponList.hpp +21 -22
  61. data/vendor/datasketches-cpp/hll/include/CubicInterpolation-internal.hpp +2 -4
  62. data/vendor/datasketches-cpp/hll/include/CubicInterpolation.hpp +2 -2
  63. data/vendor/datasketches-cpp/hll/include/HarmonicNumbers-internal.hpp +1 -1
  64. data/vendor/datasketches-cpp/hll/include/HarmonicNumbers.hpp +2 -2
  65. data/vendor/datasketches-cpp/hll/include/Hll4Array-internal.hpp +88 -83
  66. data/vendor/datasketches-cpp/hll/include/Hll4Array.hpp +9 -9
  67. data/vendor/datasketches-cpp/hll/include/Hll6Array-internal.hpp +34 -45
  68. data/vendor/datasketches-cpp/hll/include/Hll6Array.hpp +7 -8
  69. data/vendor/datasketches-cpp/hll/include/Hll8Array-internal.hpp +41 -52
  70. data/vendor/datasketches-cpp/hll/include/Hll8Array.hpp +7 -8
  71. data/vendor/datasketches-cpp/hll/include/HllArray-internal.hpp +220 -251
  72. data/vendor/datasketches-cpp/hll/include/HllArray.hpp +42 -42
  73. data/vendor/datasketches-cpp/hll/include/HllSketch-internal.hpp +36 -38
  74. data/vendor/datasketches-cpp/hll/include/HllSketchImpl-internal.hpp +22 -22
  75. data/vendor/datasketches-cpp/hll/include/HllSketchImpl.hpp +15 -14
  76. data/vendor/datasketches-cpp/hll/include/HllSketchImplFactory.hpp +47 -44
  77. data/vendor/datasketches-cpp/hll/include/HllUnion-internal.hpp +62 -87
  78. data/vendor/datasketches-cpp/hll/include/HllUtil.hpp +121 -128
  79. data/vendor/datasketches-cpp/hll/include/RelativeErrorTables.hpp +1 -1
  80. data/vendor/datasketches-cpp/hll/include/coupon_iterator-internal.hpp +9 -9
  81. data/vendor/datasketches-cpp/hll/include/coupon_iterator.hpp +5 -5
  82. data/vendor/datasketches-cpp/hll/include/hll.hpp +25 -53
  83. data/vendor/datasketches-cpp/hll/test/AuxHashMapTest.cpp +8 -8
  84. data/vendor/datasketches-cpp/hll/test/CouponHashSetTest.cpp +36 -36
  85. data/vendor/datasketches-cpp/hll/test/CouponListTest.cpp +28 -28
  86. data/vendor/datasketches-cpp/hll/test/CrossCountingTest.cpp +2 -2
  87. data/vendor/datasketches-cpp/hll/test/HllArrayTest.cpp +37 -37
  88. data/vendor/datasketches-cpp/hll/test/HllSketchTest.cpp +57 -61
  89. data/vendor/datasketches-cpp/hll/test/HllUnionTest.cpp +10 -14
  90. data/vendor/datasketches-cpp/hll/test/IsomorphicTest.cpp +3 -3
  91. data/vendor/datasketches-cpp/hll/test/ToFromByteArrayTest.cpp +4 -4
  92. data/vendor/datasketches-cpp/kll/include/kll_helper.hpp +5 -4
  93. data/vendor/datasketches-cpp/kll/include/kll_helper_impl.hpp +6 -6
  94. data/vendor/datasketches-cpp/kll/include/kll_quantile_calculator.hpp +14 -6
  95. data/vendor/datasketches-cpp/kll/include/kll_quantile_calculator_impl.hpp +40 -25
  96. data/vendor/datasketches-cpp/kll/include/kll_sketch.hpp +50 -6
  97. data/vendor/datasketches-cpp/kll/include/kll_sketch_impl.hpp +164 -136
  98. data/vendor/datasketches-cpp/kll/include/kolmogorov_smirnov.hpp +67 -0
  99. data/vendor/datasketches-cpp/kll/include/kolmogorov_smirnov_impl.hpp +78 -0
  100. data/vendor/datasketches-cpp/kll/test/CMakeLists.txt +1 -0
  101. data/vendor/datasketches-cpp/kll/test/kll_sketch_custom_type_test.cpp +11 -10
  102. data/vendor/datasketches-cpp/kll/test/kll_sketch_test.cpp +178 -88
  103. data/vendor/datasketches-cpp/kll/test/kolmogorov_smirnov_test.cpp +111 -0
  104. data/vendor/datasketches-cpp/pyproject.toml +4 -2
  105. data/vendor/datasketches-cpp/python/CMakeLists.txt +12 -6
  106. data/vendor/datasketches-cpp/python/README.md +52 -49
  107. data/vendor/datasketches-cpp/python/pybind11Path.cmd +3 -0
  108. data/vendor/datasketches-cpp/python/src/cpc_wrapper.cpp +1 -1
  109. data/vendor/datasketches-cpp/python/src/datasketches.cpp +2 -0
  110. data/vendor/datasketches-cpp/python/src/hll_wrapper.cpp +4 -6
  111. data/vendor/datasketches-cpp/python/src/kll_wrapper.cpp +4 -2
  112. data/vendor/datasketches-cpp/python/src/req_wrapper.cpp +246 -0
  113. data/vendor/datasketches-cpp/python/src/theta_wrapper.cpp +38 -28
  114. data/vendor/datasketches-cpp/python/src/vector_of_kll.cpp +11 -5
  115. data/vendor/datasketches-cpp/python/src/vo_wrapper.cpp +2 -2
  116. data/vendor/datasketches-cpp/python/tests/hll_test.py +1 -2
  117. data/vendor/datasketches-cpp/python/tests/kll_test.py +5 -5
  118. data/vendor/datasketches-cpp/python/tests/req_test.py +126 -0
  119. data/vendor/datasketches-cpp/python/tests/theta_test.py +28 -3
  120. data/vendor/datasketches-cpp/python/tests/vector_of_kll_test.py +4 -4
  121. data/vendor/datasketches-cpp/python/tests/vo_test.py +3 -3
  122. data/vendor/datasketches-cpp/req/CMakeLists.txt +60 -0
  123. data/vendor/datasketches-cpp/{tuple/include/theta_a_not_b_experimental_impl.hpp → req/include/req_common.hpp} +18 -8
  124. data/vendor/datasketches-cpp/req/include/req_compactor.hpp +137 -0
  125. data/vendor/datasketches-cpp/req/include/req_compactor_impl.hpp +488 -0
  126. data/vendor/datasketches-cpp/req/include/req_quantile_calculator.hpp +69 -0
  127. data/vendor/datasketches-cpp/req/include/req_quantile_calculator_impl.hpp +60 -0
  128. data/vendor/datasketches-cpp/req/include/req_sketch.hpp +395 -0
  129. data/vendor/datasketches-cpp/req/include/req_sketch_impl.hpp +810 -0
  130. data/vendor/datasketches-cpp/req/test/CMakeLists.txt +43 -0
  131. data/vendor/datasketches-cpp/req/test/req_float_empty_from_java.sk +0 -0
  132. data/vendor/datasketches-cpp/req/test/req_float_estimation_from_java.sk +0 -0
  133. data/vendor/datasketches-cpp/req/test/req_float_exact_from_java.sk +0 -0
  134. data/vendor/datasketches-cpp/req/test/req_float_raw_items_from_java.sk +0 -0
  135. data/vendor/datasketches-cpp/req/test/req_float_single_item_from_java.sk +0 -0
  136. data/vendor/datasketches-cpp/req/test/req_sketch_custom_type_test.cpp +128 -0
  137. data/vendor/datasketches-cpp/req/test/req_sketch_test.cpp +494 -0
  138. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch.hpp +19 -13
  139. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch_impl.hpp +130 -127
  140. data/vendor/datasketches-cpp/sampling/include/var_opt_union.hpp +5 -5
  141. data/vendor/datasketches-cpp/sampling/include/var_opt_union_impl.hpp +41 -49
  142. data/vendor/datasketches-cpp/sampling/test/CMakeLists.txt +1 -0
  143. data/vendor/datasketches-cpp/sampling/test/var_opt_allocation_test.cpp +96 -0
  144. data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_test.cpp +6 -6
  145. data/vendor/datasketches-cpp/sampling/test/var_opt_union_test.cpp +13 -44
  146. data/vendor/datasketches-cpp/setup.py +11 -6
  147. data/vendor/datasketches-cpp/theta/CMakeLists.txt +30 -3
  148. data/vendor/datasketches-cpp/{tuple → theta}/include/bounds_on_ratios_in_sampled_sets.hpp +3 -2
  149. data/vendor/datasketches-cpp/{tuple → theta}/include/bounds_on_ratios_in_theta_sketched_sets.hpp +1 -1
  150. data/vendor/datasketches-cpp/theta/include/compact_theta_sketch_parser.hpp +67 -0
  151. data/vendor/datasketches-cpp/theta/include/compact_theta_sketch_parser_impl.hpp +70 -0
  152. data/vendor/datasketches-cpp/theta/include/theta_a_not_b.hpp +12 -29
  153. data/vendor/datasketches-cpp/theta/include/theta_a_not_b_impl.hpp +5 -46
  154. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_comparators.hpp +0 -0
  155. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_constants.hpp +11 -4
  156. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_helpers.hpp +0 -0
  157. data/vendor/datasketches-cpp/theta/include/theta_intersection.hpp +26 -28
  158. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_intersection_base.hpp +0 -0
  159. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_intersection_base_impl.hpp +0 -0
  160. data/vendor/datasketches-cpp/theta/include/theta_intersection_impl.hpp +8 -90
  161. data/vendor/datasketches-cpp/{tuple/test/theta_union_experimental_test.cpp → theta/include/theta_jaccard_similarity.hpp} +11 -18
  162. data/vendor/datasketches-cpp/{tuple/include/jaccard_similarity.hpp → theta/include/theta_jaccard_similarity_base.hpp} +24 -36
  163. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_set_difference_base.hpp +0 -0
  164. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_set_difference_base_impl.hpp +5 -0
  165. data/vendor/datasketches-cpp/theta/include/theta_sketch.hpp +163 -256
  166. data/vendor/datasketches-cpp/theta/include/theta_sketch_impl.hpp +250 -651
  167. data/vendor/datasketches-cpp/theta/include/theta_union.hpp +27 -60
  168. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_union_base.hpp +1 -1
  169. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_union_base_impl.hpp +6 -1
  170. data/vendor/datasketches-cpp/theta/include/theta_union_impl.hpp +13 -69
  171. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_update_sketch_base.hpp +10 -21
  172. data/vendor/datasketches-cpp/{tuple → theta}/include/theta_update_sketch_base_impl.hpp +44 -30
  173. data/vendor/datasketches-cpp/theta/test/CMakeLists.txt +1 -0
  174. data/vendor/datasketches-cpp/theta/test/theta_a_not_b_test.cpp +23 -1
  175. data/vendor/datasketches-cpp/theta/test/theta_intersection_test.cpp +21 -1
  176. data/vendor/datasketches-cpp/{tuple → theta}/test/theta_jaccard_similarity_test.cpp +60 -5
  177. data/vendor/datasketches-cpp/theta/test/theta_sketch_test.cpp +74 -235
  178. data/vendor/datasketches-cpp/theta/test/theta_union_test.cpp +22 -2
  179. data/vendor/datasketches-cpp/tuple/CMakeLists.txt +3 -35
  180. data/vendor/datasketches-cpp/tuple/include/array_of_doubles_sketch_impl.hpp +47 -60
  181. data/vendor/datasketches-cpp/tuple/include/tuple_jaccard_similarity.hpp +38 -0
  182. data/vendor/datasketches-cpp/tuple/include/tuple_sketch.hpp +28 -13
  183. data/vendor/datasketches-cpp/tuple/include/tuple_sketch_impl.hpp +57 -70
  184. data/vendor/datasketches-cpp/tuple/test/CMakeLists.txt +1 -6
  185. data/vendor/datasketches-cpp/tuple/test/array_of_doubles_sketch_test.cpp +1 -1
  186. data/vendor/datasketches-cpp/tuple/test/tuple_a_not_b_test.cpp +18 -21
  187. data/vendor/datasketches-cpp/tuple/test/tuple_intersection_test.cpp +13 -16
  188. data/vendor/datasketches-cpp/tuple/test/tuple_jaccard_similarity_test.cpp +7 -6
  189. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_allocation_test.cpp +3 -3
  190. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_test.cpp +20 -20
  191. data/vendor/datasketches-cpp/tuple/test/tuple_union_test.cpp +13 -16
  192. metadata +51 -36
  193. data/vendor/datasketches-cpp/tuple/include/theta_a_not_b_experimental.hpp +0 -53
  194. data/vendor/datasketches-cpp/tuple/include/theta_intersection_experimental.hpp +0 -78
  195. data/vendor/datasketches-cpp/tuple/include/theta_intersection_experimental_impl.hpp +0 -43
  196. data/vendor/datasketches-cpp/tuple/include/theta_sketch_experimental.hpp +0 -393
  197. data/vendor/datasketches-cpp/tuple/include/theta_sketch_experimental_impl.hpp +0 -481
  198. data/vendor/datasketches-cpp/tuple/include/theta_union_experimental.hpp +0 -88
  199. data/vendor/datasketches-cpp/tuple/include/theta_union_experimental_impl.hpp +0 -47
  200. data/vendor/datasketches-cpp/tuple/test/theta_a_not_b_experimental_test.cpp +0 -250
  201. data/vendor/datasketches-cpp/tuple/test/theta_compact_empty_from_java.sk +0 -0
  202. data/vendor/datasketches-cpp/tuple/test/theta_compact_estimation_from_java.sk +0 -0
  203. data/vendor/datasketches-cpp/tuple/test/theta_compact_single_item_from_java.sk +0 -0
  204. data/vendor/datasketches-cpp/tuple/test/theta_intersection_experimental_test.cpp +0 -224
  205. data/vendor/datasketches-cpp/tuple/test/theta_sketch_experimental_test.cpp +0 -247
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d74bd4504918fd8217f9cf7d8c24442b5c196b2d874a042f6a2f30a24ae51db
4
- data.tar.gz: 7521194ca0d05808b234c6cb1bb5150874c28f7e9536820f728b33b0aec8c52a
3
+ metadata.gz: ea00e444de6dc1bebc2b8cf878a250f08717d55eaa55f63f6bec28f4be2af00d
4
+ data.tar.gz: 161b9089e3b8d0dbd99cfb6cc0af463934c42ba85f4788a08306369966f28571
5
5
  SHA512:
6
- metadata.gz: db41c21f18a51bf285e32556c52e06453810448d1d75d11cd1022576a98d5069977d65fe6bab7e5bd6425468531414fdd801a1bde1bfdf82fc05f455d97b80fd
7
- data.tar.gz: 892e9f2c4b891194cfc1af8387494e78eb2e703b4a56f7c91e1b4784f0bd2439f35f8e25f92e954be44418d2964e804f892ab687df2acf8e9b64d43e0049cca0
6
+ metadata.gz: '09eede1e6e4c0fe57c0116c4e8873670192fea845783687ca34890bd9358af9dd19a535774ab7dd667055cf6acd0d3913f044dcf2274e0ec092b33307250a74a'
7
+ data.tar.gz: b8bcaeb7af0d27e836f21941663229a2750922914c4f31f4ffbd6e3c3876320f9ce92916eb9730e02227b87e8f244bc08e5bc38541bf4ef4e3485203fff01942
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 0.2.3 (2021-09-29)
2
+
3
+ - Updated DataSketches to 3.2.0
4
+
5
+ ## 0.2.2 (2021-07-17)
6
+
7
+ - Updated DataSketches to 3.1.0
8
+
9
+ ## 0.2.1 (2021-05-23)
10
+
11
+ - Improved performance
12
+
13
+ ## 0.2.0 (2021-05-17)
14
+
15
+ - Updated DataSketches to 3.0.0
16
+ - Updated to Rice 4
17
+
1
18
  ## 0.1.2 (2021-01-21)
2
19
 
3
20
  - Added `CpcUnion` and `UpdateThetaSketch`
data/LICENSE CHANGED
@@ -284,11 +284,48 @@ APPENDIX B: Additional licenses relevant to this product.
284
284
  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
285
285
  DEALINGS IN THE SOFTWARE.
286
286
  -------------------------------------------------------------
287
- Code Locations
287
+ Code Locations:
288
288
  * https://github.com/apache/datasketches-cpp/blob/master/common/test/catch.hpp
289
289
  that is adapted from the above.
290
290
 
291
291
 
292
+ =============================================================
293
+ BSD License
294
+ =============================================================
295
+ Original source code:
296
+ https://github.com/pybind/pybind11/blob/master/LICENSE
297
+
298
+ Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved.
299
+
300
+ Redistribution and use in source and binary forms, with or without
301
+ modification, are permitted provided that the following conditions are met:
302
+
303
+ 1. Redistributions of source code must retain the above copyright notice, this
304
+ list of conditions and the following disclaimer.
305
+
306
+ 2. Redistributions in binary form must reproduce the above copyright notice,
307
+ this list of conditions and the following disclaimer in the documentation
308
+ and/or other materials provided with the distribution.
309
+
310
+ 3. Neither the name of the copyright holder nor the names of its contributors
311
+ may be used to endorse or promote products derived from this software
312
+ without specific prior written permission.
313
+
314
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
315
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
316
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
317
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
318
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
319
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
320
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
321
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
322
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
323
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
324
+ -------------------------------------------------------------
325
+ Code Locations:
326
+ Found only in the convenience binaries distributed from PyPI, which rely
327
+ on pybind11 code during compilation.
328
+
292
329
 
293
330
  =============================================================
294
331
  Public Domain
@@ -297,7 +334,7 @@ APPENDIX B: Additional licenses relevant to this product.
297
334
  https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp
298
335
  Placed in the Public Domain by Austin Appleby
299
336
 
300
- Code Locations
337
+ Code Locations:
301
338
  common/include/MurmurHash3.h
302
339
  that is adapted from the above.
303
340
  -------------------------------------------------------------
@@ -305,6 +342,6 @@ APPENDIX B: Additional licenses relevant to this product.
305
342
  * https://graphics.stanford.edu/~seander/bithacks.html
306
343
  * Placed in the Public Domain by Sean Eron Anderson
307
344
 
308
- Code Locations
345
+ Code Locations:
309
346
  * common/include/ceiling_power_of_2.hpp
310
347
  that is adapted from the above.
data/NOTICE CHANGED
@@ -1,5 +1,5 @@
1
1
  Apache DataSketches-cpp
2
- Copyright 2020 The Apache Software Foundation
2
+ Copyright 2020-2021 The Apache Software Foundation
3
3
 
4
4
  Copyright 2015-2018 Yahoo
5
5
  Copyright 2019 Verizon Media
@@ -3,8 +3,7 @@
3
3
  #include <cpc_sketch.hpp>
4
4
  #include <cpc_union.hpp>
5
5
 
6
- #include <rice/Constructor.hpp>
7
- #include <rice/Module.hpp>
6
+ #include "ext.h"
8
7
 
9
8
  using datasketches::cpc_sketch;
10
9
  using datasketches::cpc_union;
@@ -16,30 +15,30 @@ using Rice::Arg;
16
15
 
17
16
  void init_cpc(Rice::Module& m) {
18
17
  Rice::define_class_under<cpc_sketch>(m, "CpcSketch")
19
- .define_constructor(Rice::Constructor<cpc_sketch, uint8_t, uint64_t>(), (Rice::Arg("lg_k")=CPC_DEFAULT_LG_K, Rice::Arg("seed")=DEFAULT_SEED))
18
+ .define_constructor(Rice::Constructor<cpc_sketch, uint8_t, uint64_t>(), Rice::Arg("lg_k")=CPC_DEFAULT_LG_K, Rice::Arg("seed")=DEFAULT_SEED)
20
19
  .define_method("lg_k", &cpc_sketch::get_lg_k)
21
20
  .define_method("empty?", &cpc_sketch::is_empty)
22
21
  .define_method("lower_bound", &cpc_sketch::get_lower_bound)
23
22
  .define_method("upper_bound", &cpc_sketch::get_upper_bound)
24
23
  .define_method(
25
24
  "update",
26
- *[](cpc_sketch& self, Rice::Object datum) {
25
+ [](cpc_sketch& self, Rice::Object datum) {
27
26
  if (FIXNUM_P(datum.value())) {
28
- return self.update(from_ruby<int64_t>(datum));
27
+ return self.update(Rice::detail::From_Ruby<int64_t>().convert(datum));
29
28
  } else if (datum.is_a(rb_cNumeric)) {
30
- return self.update(from_ruby<double>(datum));
29
+ return self.update(Rice::detail::From_Ruby<double>().convert(datum));
31
30
  } else {
32
31
  return self.update(datum.to_s().str());
33
32
  }
34
33
  })
35
34
  .define_method(
36
35
  "estimate",
37
- *[](cpc_sketch& self) {
36
+ [](cpc_sketch& self) {
38
37
  return self.get_estimate();
39
38
  })
40
39
  .define_method(
41
40
  "serialize",
42
- *[](cpc_sketch& self) {
41
+ [](cpc_sketch& self) {
43
42
  std::ostringstream oss;
44
43
  self.serialize(oss);
45
44
  return oss.str();
@@ -47,22 +46,22 @@ void init_cpc(Rice::Module& m) {
47
46
  // TODO change to summary?
48
47
  .define_method(
49
48
  "to_string",
50
- *[](cpc_sketch& self) {
49
+ [](cpc_sketch& self) {
51
50
  return self.to_string();
52
51
  })
53
- .define_singleton_method(
52
+ .define_singleton_function(
54
53
  "deserialize",
55
- *[](std::string& is) {
54
+ [](const std::string& is) {
56
55
  std::istringstream iss(is);
57
56
  return cpc_sketch::deserialize(iss);
58
57
  });
59
58
 
60
59
  Rice::define_class_under<cpc_union>(m, "CpcUnion")
61
- .define_constructor(Rice::Constructor<cpc_union, uint8_t, uint64_t>(), (Rice::Arg("lg_k"), Rice::Arg("seed")=DEFAULT_SEED))
60
+ .define_constructor(Rice::Constructor<cpc_union, uint8_t, uint64_t>(), Rice::Arg("lg_k"), Rice::Arg("seed")=DEFAULT_SEED)
62
61
  .define_method("result", &cpc_union::get_result)
63
62
  .define_method(
64
63
  "update",
65
- *[](cpc_union& self, cpc_sketch& sketch) {
64
+ [](cpc_union& self, cpc_sketch& sketch) {
66
65
  self.update(sketch);
67
66
  });
68
67
  }
@@ -1,4 +1,4 @@
1
- #include <rice/Module.hpp>
1
+ #include "ext.h"
2
2
 
3
3
  void init_cpc(Rice::Module& m);
4
4
  void init_fi(Rice::Module& m);
@@ -0,0 +1,4 @@
1
+ #pragma once
2
+
3
+ #include <rice/rice.hpp>
4
+ #include <rice/stl.hpp>
@@ -1,6 +1,6 @@
1
1
  require "mkmf-rice"
2
2
 
3
- $CXXFLAGS += " -std=c++11"
3
+ $CXXFLAGS += " -std=c++17 $(optflags)"
4
4
 
5
5
  ext = File.expand_path(".", __dir__)
6
6
  datasketches = File.expand_path("../../vendor/datasketches-cpp", __dir__)
@@ -2,8 +2,7 @@
2
2
 
3
3
  #include <frequent_items_sketch.hpp>
4
4
 
5
- #include <rice/Constructor.hpp>
6
- #include <rice/Module.hpp>
5
+ #include "ext.h"
7
6
 
8
7
  template<typename T>
9
8
  void bind_fi_sketch(Rice::Module& m, const char* name) {
@@ -18,12 +17,12 @@ void bind_fi_sketch(Rice::Module& m, const char* name) {
18
17
  .define_method("maximum_error", &datasketches::frequent_items_sketch<T>::get_maximum_error)
19
18
  .define_method(
20
19
  "update",
21
- *[](datasketches::frequent_items_sketch<T>& self, const T item) {
20
+ [](datasketches::frequent_items_sketch<T>& self, const T item) {
22
21
  self.update(item);
23
22
  })
24
23
  .define_method(
25
24
  "serialize",
26
- *[](datasketches::frequent_items_sketch<T>& self) {
25
+ [](datasketches::frequent_items_sketch<T>& self) {
27
26
  std::ostringstream oss;
28
27
  self.serialize(oss);
29
28
  return oss.str();
@@ -31,13 +30,12 @@ void bind_fi_sketch(Rice::Module& m, const char* name) {
31
30
  // TODO change to summary?
32
31
  .define_method(
33
32
  "to_string",
34
- *[](datasketches::frequent_items_sketch<T>& self) {
33
+ [](datasketches::frequent_items_sketch<T>& self) {
35
34
  return self.to_string();
36
35
  })
37
- .define_singleton_method(
36
+ .define_singleton_function(
38
37
  "deserialize",
39
- // TODO figure out segfault
40
- *[](std::string is) {
38
+ [](const std::string& is) {
41
39
  std::istringstream iss(is);
42
40
  return datasketches::frequent_items_sketch<T>::deserialize(iss);
43
41
  });
@@ -2,8 +2,7 @@
2
2
 
3
3
  #include <hll.hpp>
4
4
 
5
- #include <rice/Constructor.hpp>
6
- #include <rice/Module.hpp>
5
+ #include "ext.h"
7
6
 
8
7
  using datasketches::hll_sketch;
9
8
  using datasketches::hll_union;
@@ -17,30 +16,30 @@ void init_hll(Rice::Module& m) {
17
16
  .define_method("composite_estimate", &hll_sketch::get_composite_estimate)
18
17
  .define_method(
19
18
  "update",
20
- *[](hll_sketch& self, Rice::Object datum) {
19
+ [](hll_sketch& self, Rice::Object datum) {
21
20
  if (FIXNUM_P(datum.value())) {
22
- return self.update(from_ruby<int64_t>(datum));
21
+ return self.update(Rice::detail::From_Ruby<int64_t>().convert(datum));
23
22
  } else if (datum.is_a(rb_cNumeric)) {
24
- return self.update(from_ruby<double>(datum));
23
+ return self.update(Rice::detail::From_Ruby<double>().convert(datum));
25
24
  } else {
26
25
  return self.update(datum.to_s().str());
27
26
  }
28
27
  })
29
28
  .define_method(
30
29
  "estimate",
31
- *[](hll_sketch& self) {
30
+ [](hll_sketch& self) {
32
31
  return self.get_estimate();
33
32
  })
34
33
  .define_method(
35
34
  "serialize_compact",
36
- *[](hll_sketch& self) {
35
+ [](hll_sketch& self) {
37
36
  std::ostringstream oss;
38
37
  self.serialize_compact(oss);
39
38
  return oss.str();
40
39
  })
41
40
  .define_method(
42
41
  "serialize_updatable",
43
- *[](hll_sketch& self) {
42
+ [](hll_sketch& self) {
44
43
  std::ostringstream oss;
45
44
  self.serialize_updatable(oss);
46
45
  return oss.str();
@@ -48,12 +47,12 @@ void init_hll(Rice::Module& m) {
48
47
  // TODO change to summary?
49
48
  .define_method(
50
49
  "to_string",
51
- *[](hll_sketch& self) {
50
+ [](hll_sketch& self) {
52
51
  return self.to_string();
53
52
  })
54
- .define_singleton_method(
53
+ .define_singleton_function(
55
54
  "deserialize",
56
- *[](std::string& is) {
55
+ [](const std::string& is) {
57
56
  std::istringstream iss(is);
58
57
  return hll_sketch::deserialize(iss);
59
58
  });
@@ -62,17 +61,17 @@ void init_hll(Rice::Module& m) {
62
61
  .define_constructor(Rice::Constructor<hll_union, int>())
63
62
  .define_method(
64
63
  "update",
65
- *[](hll_union& self, hll_sketch& sketch) {
64
+ [](hll_union& self, hll_sketch& sketch) {
66
65
  self.update(sketch);
67
66
  })
68
67
  .define_method(
69
68
  "estimate",
70
- *[](hll_union& self) {
69
+ [](hll_union& self) {
71
70
  return self.get_estimate();
72
71
  })
73
72
  .define_method(
74
73
  "result",
75
- *[](hll_union& self) {
74
+ [](hll_union& self) {
76
75
  return self.get_result();
77
76
  });
78
77
  }
@@ -2,79 +2,31 @@
2
2
 
3
3
  #include <kll_sketch.hpp>
4
4
 
5
- #include <rice/Array.hpp>
6
- #include <rice/Constructor.hpp>
7
- #include <rice/Module.hpp>
5
+ #include "ext.h"
8
6
 
9
7
  using datasketches::kll_sketch;
10
8
 
11
- template<>
12
- std::vector<int> from_ruby<std::vector<int>>(Rice::Object x)
9
+ namespace Rice::detail
13
10
  {
14
- auto a = Rice::Array(x);
15
- std::vector<int> vec(a.size());
16
- for (long i = 0; i < a.size(); i++) {
17
- vec[i] = from_ruby<int>(a[i]);
18
- }
19
- return vec;
20
- }
21
-
22
- template<>
23
- std::vector<float> from_ruby<std::vector<float>>(Rice::Object x)
24
- {
25
- auto a = Rice::Array(x);
26
- std::vector<float> vec(a.size());
27
- for (long i = 0; i < a.size(); i++) {
28
- vec[i] = from_ruby<float>(a[i]);
29
- }
30
- return vec;
31
- }
32
-
33
- template<>
34
- std::vector<double> from_ruby<std::vector<double>>(Rice::Object x)
35
- {
36
- auto a = Rice::Array(x);
37
- std::vector<double> vec(a.size());
38
- for (long i = 0; i < a.size(); i++) {
39
- vec[i] = from_ruby<double>(a[i]);
40
- }
41
- return vec;
42
- }
43
-
44
- template<>
45
- Rice::Object to_ruby<std::vector<int>>(std::vector<int> const & x)
46
- {
47
- auto a = Rice::Array();
48
- for (size_t i = 0; i < x.size(); i++) {
49
- a.push(x[i]);
50
- }
51
- return a;
52
- }
53
-
54
- template<>
55
- Rice::Object to_ruby<std::vector<float>>(std::vector<float> const & x)
56
- {
57
- auto a = Rice::Array();
58
- for (size_t i = 0; i < x.size(); i++) {
59
- a.push(x[i]);
60
- }
61
- return a;
62
- }
63
-
64
- template<>
65
- Rice::Object to_ruby<std::vector<double>>(std::vector<double> const & x)
66
- {
67
- auto a = Rice::Array();
68
- for (size_t i = 0; i < x.size(); i++) {
69
- a.push(x[i]);
70
- }
71
- return a;
11
+ template<typename T>
12
+ class To_Ruby<std::vector<T>>
13
+ {
14
+ public:
15
+ VALUE convert(std::vector<T> const & x)
16
+ {
17
+ auto a = rb_ary_new2(x.size());
18
+ for (const auto& v : x) {
19
+ detail::protect(rb_ary_push, a, To_Ruby<T>().convert(v));
20
+ }
21
+ return a;
22
+ }
23
+ };
72
24
  }
73
25
 
74
26
  template<typename T>
75
27
  void bind_kll_sketch(Rice::Module& m, const char* name) {
76
28
  Rice::define_class_under<kll_sketch<T>>(m, name)
77
- .define_constructor(Rice::Constructor<kll_sketch<T>, uint16_t>(), (Rice::Arg("k")=kll_sketch<T>::DEFAULT_K))
29
+ .define_constructor(Rice::Constructor<kll_sketch<T>, uint16_t>(), Rice::Arg("k")=kll_sketch<T>::DEFAULT_K)
78
30
  .define_method("empty?", &kll_sketch<T>::is_empty)
79
31
  .define_method("n", &kll_sketch<T>::get_n)
80
32
  .define_method("num_retained", &kll_sketch<T>::get_num_retained)
@@ -84,42 +36,42 @@ void bind_kll_sketch(Rice::Module& m, const char* name) {
84
36
  .define_method("quantile", &kll_sketch<T>::get_quantile)
85
37
  .define_method(
86
38
  "quantiles",
87
- *[](kll_sketch<T>& self, Rice::Object obj) {
39
+ [](kll_sketch<T>& self, Rice::Object obj) {
88
40
  if (obj.is_a(rb_cArray)) {
89
- auto fractions = from_ruby<std::vector<double>>(obj);
41
+ auto fractions = Rice::detail::From_Ruby<std::vector<double>>().convert(obj);
90
42
  return self.get_quantiles(&fractions[0], fractions.size());
91
43
  } else {
92
- return self.get_quantiles(from_ruby<size_t>(obj));
44
+ return self.get_quantiles(Rice::detail::From_Ruby<size_t>().convert(obj));
93
45
  }
94
46
  })
95
47
  .define_method(
96
48
  "rank",
97
- *[](kll_sketch<T>& self, const T item) {
49
+ [](kll_sketch<T>& self, const T item) {
98
50
  return self.get_rank(item);
99
51
  })
100
52
  .define_method(
101
53
  "pmf",
102
- *[](kll_sketch<T>& self, std::vector<T> split_points) {
54
+ [](kll_sketch<T>& self, std::vector<T> split_points) {
103
55
  return self.get_PMF(&split_points[0], split_points.size());
104
56
  })
105
57
  .define_method(
106
58
  "cdf",
107
- *[](kll_sketch<T>& self, std::vector<T> split_points) {
59
+ [](kll_sketch<T>& self, std::vector<T> split_points) {
108
60
  return self.get_CDF(&split_points[0], split_points.size());
109
61
  })
110
62
  .define_method(
111
63
  "merge",
112
- *[](kll_sketch<T>& self, const kll_sketch<T>& other) {
64
+ [](kll_sketch<T>& self, const kll_sketch<T>& other) {
113
65
  self.merge(other);
114
66
  })
115
67
  .define_method(
116
68
  "update",
117
- *[](kll_sketch<T>& self, const T item) {
69
+ [](kll_sketch<T>& self, const T item) {
118
70
  self.update(item);
119
71
  })
120
72
  .define_method(
121
73
  "serialize",
122
- *[](kll_sketch<T>& self) {
74
+ [](kll_sketch<T>& self) {
123
75
  std::ostringstream oss;
124
76
  self.serialize(oss);
125
77
  return oss.str();
@@ -127,12 +79,12 @@ void bind_kll_sketch(Rice::Module& m, const char* name) {
127
79
  // TODO change to summary?
128
80
  .define_method(
129
81
  "to_string",
130
- *[](kll_sketch<T>& self) {
82
+ [](kll_sketch<T>& self) {
131
83
  return self.to_string();
132
84
  })
133
- .define_singleton_method(
85
+ .define_singleton_function(
134
86
  "deserialize",
135
- *[](std::string& is) {
87
+ [](const std::string& is) {
136
88
  std::istringstream iss(is);
137
89
  return kll_sketch<T>::deserialize(iss);
138
90
  });
@@ -5,8 +5,7 @@
5
5
  #include <theta_intersection.hpp>
6
6
  #include <theta_a_not_b.hpp>
7
7
 
8
- #include <rice/Constructor.hpp>
9
- #include <rice/Module.hpp>
8
+ #include "ext.h"
10
9
 
11
10
  using datasketches::theta_sketch;
12
11
  using datasketches::update_theta_sketch;
@@ -24,79 +23,66 @@ void init_theta(Rice::Module& m) {
24
23
  .define_method("empty?", &theta_sketch::is_empty)
25
24
  .define_method("estimate", &theta_sketch::get_estimate)
26
25
  .define_method("lower_bound", &theta_sketch::get_lower_bound)
27
- .define_method("upper_bound", &theta_sketch::get_upper_bound)
28
- .define_method(
29
- "serialize",
30
- *[](theta_sketch& self) {
31
- std::ostringstream oss;
32
- self.serialize(oss);
33
- return oss.str();
26
+ .define_method("upper_bound", &theta_sketch::get_upper_bound);
27
+
28
+ Rice::define_class_under<compact_theta_sketch, theta_sketch>(m, "CompactThetaSketch")
29
+ .define_singleton_function(
30
+ "deserialize",
31
+ [](const std::string& is) {
32
+ std::istringstream iss(is);
33
+ return compact_theta_sketch::deserialize(iss);
34
34
  });
35
35
 
36
36
  Rice::define_class_under<update_theta_sketch, theta_sketch>(m, "UpdateThetaSketch")
37
- .define_singleton_method(
37
+ .define_singleton_function(
38
38
  "new",
39
- *[](uint8_t lg_k, double p, uint64_t seed) {
39
+ [](uint8_t lg_k, double p, uint64_t seed) {
40
40
  update_theta_sketch::builder builder;
41
41
  builder.set_lg_k(lg_k);
42
42
  builder.set_p(p);
43
43
  builder.set_seed(seed);
44
44
  return builder.build();
45
45
  },
46
- (Arg("lg_k")=update_theta_sketch::builder::DEFAULT_LG_K, Arg("p")=1.0, Arg("seed")=DEFAULT_SEED))
47
- .define_method("compact", &update_theta_sketch::compact, (Arg("ordered")=true))
46
+ Arg("lg_k")=update_theta_sketch::builder::DEFAULT_LG_K, Arg("p")=1.0, Arg("seed")=DEFAULT_SEED)
47
+ .define_method("compact", &update_theta_sketch::compact, Arg("ordered")=true)
48
48
  .define_method(
49
49
  "update",
50
- *[](update_theta_sketch& self, Rice::Object datum) {
50
+ [](update_theta_sketch& self, Rice::Object datum) {
51
51
  if (FIXNUM_P(datum.value())) {
52
- return self.update(from_ruby<int64_t>(datum));
52
+ return self.update(Rice::detail::From_Ruby<int64_t>().convert(datum));
53
53
  } else if (datum.is_a(rb_cNumeric)) {
54
- return self.update(from_ruby<double>(datum));
54
+ return self.update(Rice::detail::From_Ruby<double>().convert(datum));
55
55
  } else {
56
56
  return self.update(datum.to_s().str());
57
57
  }
58
58
  })
59
59
  .define_method(
60
60
  "estimate",
61
- *[](update_theta_sketch& self) {
61
+ [](update_theta_sketch& self) {
62
62
  return self.get_estimate();
63
- })
64
- .define_singleton_method(
65
- "deserialize",
66
- *[](std::string& is) {
67
- std::istringstream iss(is);
68
- return update_theta_sketch::deserialize(iss);
69
- });
70
-
71
- Rice::define_class_under<compact_theta_sketch, theta_sketch>(m, "CompactThetaSketch")
72
- .define_singleton_method(
73
- "deserialize",
74
- *[](std::string& is) {
75
- std::istringstream iss(is);
76
- return compact_theta_sketch::deserialize(iss);
77
63
  });
78
64
 
79
65
  Rice::define_class_under<theta_union>(m, "ThetaUnion")
80
- .define_singleton_method(
66
+ .define_singleton_function(
81
67
  "new",
82
- *[](uint8_t lg_k, double p, uint64_t seed) {
68
+ [](uint8_t lg_k, double p, uint64_t seed) {
83
69
  theta_union::builder builder;
84
70
  builder.set_lg_k(lg_k);
85
71
  builder.set_p(p);
86
72
  builder.set_seed(seed);
87
73
  return builder.build();
88
74
  },
89
- (Arg("lg_k")=update_theta_sketch::builder::DEFAULT_LG_K, Arg("p")=1.0, Arg("seed")=DEFAULT_SEED))
90
- .define_method("update", &theta_union::update)
91
- .define_method("result", &theta_union::get_result, (Arg("ordered")=true));
75
+ Arg("lg_k")=update_theta_sketch::builder::DEFAULT_LG_K, Arg("p")=1.0, Arg("seed")=DEFAULT_SEED)
76
+ .define_method("update", &theta_union::update<const theta_sketch&>)
77
+ .define_method("result", &theta_union::get_result, Arg("ordered")=true);
92
78
 
93
79
  Rice::define_class_under<theta_intersection>(m, "ThetaIntersection")
94
- .define_constructor(Rice::Constructor<theta_intersection, uint64_t>(), (Arg("seed")=DEFAULT_SEED))
95
- .define_method("update", &theta_intersection::update)
96
- .define_method("result", &theta_intersection::get_result, (Arg("ordered")=true))
80
+ .define_constructor(Rice::Constructor<theta_intersection, uint64_t>(), Arg("seed")=DEFAULT_SEED)
81
+ .define_method("update", &theta_intersection::update<const theta_sketch&>)
82
+ .define_method("result", &theta_intersection::get_result, Arg("ordered")=true)
97
83
  .define_method("result?", &theta_intersection::has_result);
98
84
 
99
85
  Rice::define_class_under<theta_a_not_b>(m, "ThetaANotB")
100
- .define_constructor(Rice::Constructor<theta_a_not_b, uint64_t>(), (Arg("seed")=DEFAULT_SEED))
101
- .define_method("compute", &theta_a_not_b::compute, (Arg("a"), Arg("b"), Arg("ordered")=true));
86
+ .define_constructor(Rice::Constructor<theta_a_not_b, uint64_t>(), Arg("seed")=DEFAULT_SEED)
87
+ .define_method("compute", &theta_a_not_b::compute<const theta_sketch&, const theta_sketch&>, Arg("a"), Arg("b"), Arg("ordered")=true);
102
88
  }
@@ -2,9 +2,7 @@
2
2
 
3
3
  #include <var_opt_sketch.hpp>
4
4
 
5
- #include <rice/Array.hpp>
6
- #include <rice/Constructor.hpp>
7
- #include <rice/Module.hpp>
5
+ #include "ext.h"
8
6
 
9
7
  using datasketches::var_opt_sketch;
10
8
 
@@ -19,7 +17,7 @@ void bind_vo_sketch(Rice::Module &m, const char* name) {
19
17
  .define_method("reset", &var_opt_sketch<T>::reset)
20
18
  .define_method(
21
19
  "samples",
22
- *[](var_opt_sketch<T>& self) {
20
+ [](var_opt_sketch<T>& self) {
23
21
  auto a = Rice::Array();
24
22
  for (auto item : self) {
25
23
  auto t = Rice::Array();
@@ -31,9 +29,9 @@ void bind_vo_sketch(Rice::Module &m, const char* name) {
31
29
  })
32
30
  .define_method(
33
31
  "update",
34
- *[](var_opt_sketch<T>& self, const T item) {
32
+ [](var_opt_sketch<T>& self, const T item) {
35
33
  self.update(item);
36
- });
34
+ }, Rice::Arg("item").keepAlive());
37
35
  }
38
36
 
39
37
  void init_vo(Rice::Module& m) {
@@ -1,3 +1,3 @@
1
1
  module DataSketches
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.3"
3
3
  end