datasketches 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/ext/datasketches/cpc_wrapper.cpp +3 -4
- data/ext/datasketches/ext.cpp +2 -3
- data/ext/datasketches/fi_wrapper.cpp +4 -2
- data/ext/datasketches/hll_wrapper.cpp +3 -2
- data/ext/datasketches/kll_wrapper.cpp +15 -9
- data/ext/datasketches/theta_wrapper.cpp +11 -12
- data/ext/datasketches/vo_wrapper.cpp +5 -5
- data/lib/datasketches/version.rb +1 -1
- metadata +5 -6
- data/ext/datasketches/ext.h +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a130c4ac282887b6cd406512ab071baa7c26f6c375ed3a2c0d48dac400b7572e
|
|
4
|
+
data.tar.gz: c08742aa7121718f1459096fecc5c7a62f87ba540264082c00021dfe30eadfe6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1453845a086ed9b2069e53a1a4dd47af5f3529507e41886fdd7b6728baae52164a645dc9a6f4895b74b392ef086d7873ccf36b23f49728cb73bf73428384d79
|
|
7
|
+
data.tar.gz: 423d9134d4dc134daa0c93dfe79c455e8abf5b5d95b67b8d05bf0e105a1746b60ddbfb06ff461137f6645553074db9104e940fc6f84f2bf410448a3b7671d56c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#include <sstream>
|
|
2
|
+
#include <string>
|
|
2
3
|
|
|
3
4
|
#include <cpc_sketch.hpp>
|
|
4
5
|
#include <cpc_union.hpp>
|
|
5
|
-
|
|
6
|
-
#include
|
|
6
|
+
#include <rice/rice.hpp>
|
|
7
|
+
#include <rice/stl.hpp>
|
|
7
8
|
|
|
8
9
|
using datasketches::cpc_sketch;
|
|
9
10
|
using datasketches::cpc_union;
|
|
@@ -11,8 +12,6 @@ using datasketches::cpc_union;
|
|
|
11
12
|
using datasketches::cpc_constants::DEFAULT_LG_K;
|
|
12
13
|
using datasketches::DEFAULT_SEED;
|
|
13
14
|
|
|
14
|
-
using Rice::Arg;
|
|
15
|
-
|
|
16
15
|
void init_cpc(Rice::Module& m) {
|
|
17
16
|
Rice::define_class_under<cpc_sketch>(m, "CpcSketch")
|
|
18
17
|
.define_constructor(Rice::Constructor<cpc_sketch, uint8_t, uint64_t>(), Rice::Arg("lg_k")=DEFAULT_LG_K, Rice::Arg("seed")=DEFAULT_SEED)
|
data/ext/datasketches/ext.cpp
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#include
|
|
1
|
+
#include <rice/rice.hpp>
|
|
2
2
|
|
|
3
3
|
void init_cpc(Rice::Module& m);
|
|
4
4
|
void init_fi(Rice::Module& m);
|
|
@@ -8,8 +8,7 @@ void init_theta(Rice::Module& m);
|
|
|
8
8
|
void init_vo(Rice::Module& m);
|
|
9
9
|
|
|
10
10
|
extern "C"
|
|
11
|
-
void Init_ext()
|
|
12
|
-
{
|
|
11
|
+
void Init_ext() {
|
|
13
12
|
Rice::Module m = Rice::define_module("DataSketches");
|
|
14
13
|
init_cpc(m);
|
|
15
14
|
init_fi(m);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
#include <cstdint>
|
|
1
2
|
#include <sstream>
|
|
3
|
+
#include <string>
|
|
2
4
|
|
|
3
5
|
#include <frequent_items_sketch.hpp>
|
|
4
|
-
|
|
5
|
-
#include
|
|
6
|
+
#include <rice/rice.hpp>
|
|
7
|
+
#include <rice/stl.hpp>
|
|
6
8
|
|
|
7
9
|
template<typename T>
|
|
8
10
|
void bind_fi_sketch(Rice::Module& m, const char* name) {
|
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
#include <sstream>
|
|
2
|
+
#include <string>
|
|
3
|
+
#include <vector>
|
|
2
4
|
|
|
3
5
|
#include <kll_sketch.hpp>
|
|
4
|
-
|
|
5
|
-
#include
|
|
6
|
+
#include <rice/rice.hpp>
|
|
7
|
+
#include <rice/stl.hpp>
|
|
6
8
|
|
|
7
9
|
using datasketches::kll_sketch;
|
|
8
10
|
|
|
9
|
-
namespace Rice::detail
|
|
10
|
-
{
|
|
11
|
+
namespace Rice::detail {
|
|
11
12
|
template<typename T>
|
|
12
|
-
class To_Ruby<std::vector<T>>
|
|
13
|
-
{
|
|
13
|
+
class To_Ruby<std::vector<T>> {
|
|
14
14
|
public:
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
To_Ruby() = default;
|
|
16
|
+
|
|
17
|
+
explicit To_Ruby(Arg* arg) : arg_(arg) { }
|
|
18
|
+
|
|
19
|
+
VALUE convert(std::vector<T> const & x) {
|
|
17
20
|
auto a = rb_ary_new2(x.size());
|
|
18
21
|
for (const auto& v : x) {
|
|
19
22
|
detail::protect(rb_ary_push, a, To_Ruby<T>().convert(v));
|
|
20
23
|
}
|
|
21
24
|
return a;
|
|
22
25
|
}
|
|
26
|
+
|
|
27
|
+
private:
|
|
28
|
+
Arg* arg_ = nullptr;
|
|
23
29
|
};
|
|
24
|
-
}
|
|
30
|
+
} // namespace Rice::detail
|
|
25
31
|
|
|
26
32
|
template<typename T>
|
|
27
33
|
void bind_kll_sketch(Rice::Module& m, const char* name) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#include <sstream>
|
|
2
|
+
#include <string>
|
|
2
3
|
|
|
4
|
+
#include <rice/rice.hpp>
|
|
5
|
+
#include <rice/stl.hpp>
|
|
3
6
|
#include <theta_sketch.hpp>
|
|
4
7
|
#include <theta_union.hpp>
|
|
5
8
|
#include <theta_intersection.hpp>
|
|
6
9
|
#include <theta_a_not_b.hpp>
|
|
7
10
|
|
|
8
|
-
#include "ext.h"
|
|
9
|
-
|
|
10
11
|
using datasketches::theta_sketch;
|
|
11
12
|
using datasketches::update_theta_sketch;
|
|
12
13
|
using datasketches::compact_theta_sketch;
|
|
@@ -16,8 +17,6 @@ using datasketches::theta_a_not_b;
|
|
|
16
17
|
|
|
17
18
|
using datasketches::DEFAULT_SEED;
|
|
18
19
|
|
|
19
|
-
using Rice::Arg;
|
|
20
|
-
|
|
21
20
|
void init_theta(Rice::Module& m) {
|
|
22
21
|
Rice::define_class_under<theta_sketch>(m, "ThetaSketch")
|
|
23
22
|
.define_method(
|
|
@@ -59,8 +58,8 @@ void init_theta(Rice::Module& m) {
|
|
|
59
58
|
builder.set_seed(seed);
|
|
60
59
|
return builder.build();
|
|
61
60
|
},
|
|
62
|
-
Arg("lg_k")=datasketches::theta_constants::DEFAULT_LG_K, Arg("p")=1.0, Arg("seed")=DEFAULT_SEED)
|
|
63
|
-
.define_method("compact", &update_theta_sketch::compact, Arg("ordered")=true)
|
|
61
|
+
Rice::Arg("lg_k")=datasketches::theta_constants::DEFAULT_LG_K, Rice::Arg("p")=1.0, Rice::Arg("seed")=DEFAULT_SEED)
|
|
62
|
+
.define_method("compact", &update_theta_sketch::compact, Rice::Arg("ordered")=true)
|
|
64
63
|
.define_method(
|
|
65
64
|
"update",
|
|
66
65
|
[](update_theta_sketch& self, Rice::Object datum) {
|
|
@@ -88,17 +87,17 @@ void init_theta(Rice::Module& m) {
|
|
|
88
87
|
builder.set_seed(seed);
|
|
89
88
|
return builder.build();
|
|
90
89
|
},
|
|
91
|
-
Arg("lg_k")=datasketches::theta_constants::DEFAULT_LG_K, Arg("p")=1.0, Arg("seed")=DEFAULT_SEED)
|
|
90
|
+
Rice::Arg("lg_k")=datasketches::theta_constants::DEFAULT_LG_K, Rice::Arg("p")=1.0, Rice::Arg("seed")=DEFAULT_SEED)
|
|
92
91
|
.define_method("update", &theta_union::update<const theta_sketch&>)
|
|
93
|
-
.define_method("result", &theta_union::get_result, Arg("ordered")=true);
|
|
92
|
+
.define_method("result", &theta_union::get_result, Rice::Arg("ordered")=true);
|
|
94
93
|
|
|
95
94
|
Rice::define_class_under<theta_intersection>(m, "ThetaIntersection")
|
|
96
|
-
.define_constructor(Rice::Constructor<theta_intersection, uint64_t>(), Arg("seed")=DEFAULT_SEED)
|
|
95
|
+
.define_constructor(Rice::Constructor<theta_intersection, uint64_t>(), Rice::Arg("seed")=DEFAULT_SEED)
|
|
97
96
|
.define_method("update", &theta_intersection::update<const theta_sketch&>)
|
|
98
|
-
.define_method("result", &theta_intersection::get_result, Arg("ordered")=true)
|
|
97
|
+
.define_method("result", &theta_intersection::get_result, Rice::Arg("ordered")=true)
|
|
99
98
|
.define_method("result?", &theta_intersection::has_result);
|
|
100
99
|
|
|
101
100
|
Rice::define_class_under<theta_a_not_b>(m, "ThetaANotB")
|
|
102
|
-
.define_constructor(Rice::Constructor<theta_a_not_b, uint64_t>(), Arg("seed")=DEFAULT_SEED)
|
|
103
|
-
.define_method("compute", &theta_a_not_b::compute<const theta_sketch&, const theta_sketch&>, Arg("a"), Arg("b"), Arg("ordered")=true);
|
|
101
|
+
.define_constructor(Rice::Constructor<theta_a_not_b, uint64_t>(), Rice::Arg("seed")=DEFAULT_SEED)
|
|
102
|
+
.define_method("compute", &theta_a_not_b::compute<const theta_sketch&, const theta_sketch&>, Rice::Arg("a"), Rice::Arg("b"), Rice::Arg("ordered")=true);
|
|
104
103
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#include <sstream>
|
|
2
2
|
|
|
3
|
+
#include <rice/rice.hpp>
|
|
4
|
+
#include <rice/stl.hpp>
|
|
3
5
|
#include <var_opt_sketch.hpp>
|
|
4
6
|
|
|
5
|
-
#include "ext.h"
|
|
6
|
-
|
|
7
7
|
using datasketches::var_opt_sketch;
|
|
8
8
|
|
|
9
9
|
template<typename T>
|
|
@@ -21,9 +21,9 @@ void bind_vo_sketch(Rice::Module &m, const char* name) {
|
|
|
21
21
|
auto a = Rice::Array();
|
|
22
22
|
for (auto item : self) {
|
|
23
23
|
auto t = Rice::Array();
|
|
24
|
-
t.push(item.first);
|
|
25
|
-
t.push(item.second);
|
|
26
|
-
a.push(t);
|
|
24
|
+
t.push(item.first, false);
|
|
25
|
+
t.push(item.second, false);
|
|
26
|
+
a.push(t, false);
|
|
27
27
|
}
|
|
28
28
|
return a;
|
|
29
29
|
})
|
data/lib/datasketches/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datasketches
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rice
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 4.
|
|
18
|
+
version: '4.7'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 4.
|
|
25
|
+
version: '4.7'
|
|
26
26
|
email: andrew@ankane.org
|
|
27
27
|
executables: []
|
|
28
28
|
extensions:
|
|
@@ -35,7 +35,6 @@ files:
|
|
|
35
35
|
- README.md
|
|
36
36
|
- ext/datasketches/cpc_wrapper.cpp
|
|
37
37
|
- ext/datasketches/ext.cpp
|
|
38
|
-
- ext/datasketches/ext.h
|
|
39
38
|
- ext/datasketches/extconf.rb
|
|
40
39
|
- ext/datasketches/fi_wrapper.cpp
|
|
41
40
|
- ext/datasketches/hll_wrapper.cpp
|
|
@@ -343,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
343
342
|
- !ruby/object:Gem::Version
|
|
344
343
|
version: '0'
|
|
345
344
|
requirements: []
|
|
346
|
-
rubygems_version: 3.6.
|
|
345
|
+
rubygems_version: 3.6.9
|
|
347
346
|
specification_version: 4
|
|
348
347
|
summary: Sketch data structures for Ruby
|
|
349
348
|
test_files: []
|
data/ext/datasketches/ext.h
DELETED