enumerable-statistics 1.0.1 → 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +21 -8
- data/.yardopts +1 -0
- data/CHANGELOG.md +7 -0
- data/README.md +8 -0
- data/Rakefile +5 -3
- data/bench/array_value_counts.yml +42 -0
- data/bench/enum_value_counts.yml +42 -0
- data/bench/hash_value_counts.yml +42 -0
- data/bench/mean.yml +30 -0
- data/bench/sum.yml +29 -0
- data/bench/variance.yml +39 -0
- data/enumerable-statistics.gemspec +16 -7
- data/ext/-bench-/extconf.rb +3 -0
- data/ext/enumerable/statistics/extension/extconf.rb +12 -0
- data/ext/enumerable/statistics/extension/statistics.c +865 -29
- data/lib/enumerable/statistics.rb +1 -1
- data/lib/enumerable_statistics.rb +2 -0
- data/lib/enumerable_statistics/histogram.rb +5 -0
- data/lib/enumerable_statistics/version.rb +9 -0
- data/templates/default/layout/html/headers.erb +36 -0
- metadata +45 -24
- data/bench/mean.rb +0 -27
- data/bench/sum.rb +0 -26
- data/bench/variance.rb +0 -30
- data/lib/enumerable/statistics/version.rb +0 -5
@@ -0,0 +1,36 @@
|
|
1
|
+
<meta charset="<%= charset %>">
|
2
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
3
|
+
<title>
|
4
|
+
<%= h @page_title %>
|
5
|
+
<% if options.title && @page_title != options.title %>
|
6
|
+
— <%= h options.title %>
|
7
|
+
<% end %>
|
8
|
+
</title>
|
9
|
+
<% stylesheets.each do |stylesheet| %>
|
10
|
+
<link rel="stylesheet" href="<%= mtime_url(stylesheet) %>" type="text/css" charset="utf-8" />
|
11
|
+
<% end %>
|
12
|
+
<%= erb :script_setup %>
|
13
|
+
<% javascripts.each do |javascript| %>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="<%= mtime_url(javascript) %>"></script>
|
15
|
+
<% end %>
|
16
|
+
<%# KaTeX %>
|
17
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.css" integrity="sha384-9eLZqc9ds8eNjO3TmqPeYcDj8n+Qfa4nuSiGYa6DjLNcv9BtN69ZIulL9+8CqC9Y" crossorigin="anonymous">
|
18
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.js" integrity="sha384-K3vbOmF2BtaVai+Qk37uypf7VrgBubhQreNQe9aGsz9lB63dIFiQVlJbr92dw2Lx" crossorigin="anonymous"></script>
|
19
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/contrib/auto-render.min.js" integrity="sha384-kmZOZB5ObwgQnS/DuDg6TScgOiWWBiVt0plIRkZCmE6rDZGrEOQeHM5PcHi+nyqe" crossorigin="anonymous"></script>
|
20
|
+
<script>
|
21
|
+
document.addEventListener("DOMContentLoaded", function () {
|
22
|
+
var katex_options = {
|
23
|
+
delimiters: [
|
24
|
+
{left: "$$", right: "$$", display: true},
|
25
|
+
{left: "$", right: "$", display: false},
|
26
|
+
{left: "\\(", right: "\\)", display: false},
|
27
|
+
{left: "\\[", right: "\\]", display: true}
|
28
|
+
],
|
29
|
+
};
|
30
|
+
var elements = document.querySelectorAll('.summary_desc p, .docstring p');
|
31
|
+
elements.forEach(function (elem) {
|
32
|
+
console.log(elem);
|
33
|
+
renderMathInElement(elem, katex_options);
|
34
|
+
});
|
35
|
+
});
|
36
|
+
</script>
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumerable-statistics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.17.2
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.17.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake-compiler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.9.8
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.9.8
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.4'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -81,7 +81,21 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: benchmark-driver
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -100,6 +114,7 @@ email:
|
|
100
114
|
executables: []
|
101
115
|
extensions:
|
102
116
|
- ext/enumerable/statistics/extension/extconf.rb
|
117
|
+
- ext/-bench-/extconf.rb
|
103
118
|
extra_rdoc_files: []
|
104
119
|
files:
|
105
120
|
- ".gitignore"
|
@@ -111,18 +126,25 @@ files:
|
|
111
126
|
- LICENSE
|
112
127
|
- README.md
|
113
128
|
- Rakefile
|
114
|
-
- bench/
|
115
|
-
- bench/
|
116
|
-
- bench/
|
129
|
+
- bench/array_value_counts.yml
|
130
|
+
- bench/enum_value_counts.yml
|
131
|
+
- bench/hash_value_counts.yml
|
132
|
+
- bench/mean.yml
|
133
|
+
- bench/sum.yml
|
134
|
+
- bench/variance.yml
|
117
135
|
- bin/console
|
118
136
|
- bin/rspec
|
119
137
|
- bin/setup
|
120
138
|
- enumerable-statistics.gemspec
|
139
|
+
- ext/-bench-/extconf.rb
|
121
140
|
- ext/enumerable/statistics/extension/extconf.rb
|
122
141
|
- ext/enumerable/statistics/extension/statistics.c
|
123
142
|
- images/benchmark.png
|
124
143
|
- lib/enumerable/statistics.rb
|
125
|
-
- lib/
|
144
|
+
- lib/enumerable_statistics.rb
|
145
|
+
- lib/enumerable_statistics/histogram.rb
|
146
|
+
- lib/enumerable_statistics/version.rb
|
147
|
+
- templates/default/layout/html/headers.erb
|
126
148
|
- yard/templates/mathjax/class/dot/setup.rb
|
127
149
|
- yard/templates/mathjax/class/dot/superklass.erb
|
128
150
|
- yard/templates/mathjax/class/html/constructor_details.erb
|
@@ -246,15 +268,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
246
268
|
requirements:
|
247
269
|
- - ">="
|
248
270
|
- !ruby/object:Gem::Version
|
249
|
-
version: '
|
271
|
+
version: '2.4'
|
250
272
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
273
|
requirements:
|
252
|
-
- - "
|
274
|
+
- - ">"
|
253
275
|
- !ruby/object:Gem::Version
|
254
|
-
version:
|
276
|
+
version: 1.3.1
|
255
277
|
requirements: []
|
256
|
-
|
257
|
-
rubygems_version: 2.6.3
|
278
|
+
rubygems_version: 3.0.3
|
258
279
|
signing_key:
|
259
280
|
specification_version: 4
|
260
281
|
summary: Statistics features for Enumerable
|
data/bench/mean.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'enumerable/statistics'
|
2
|
-
require 'benchmark/ips'
|
3
|
-
|
4
|
-
Benchmark.ips do |x|
|
5
|
-
x.config(times: 5, warmup: 2)
|
6
|
-
|
7
|
-
n = 1_000
|
8
|
-
ary = Array.new(n) { rand }
|
9
|
-
|
10
|
-
x.report('inject') do
|
11
|
-
mean = ary.inject(:+) / n.to_f
|
12
|
-
end
|
13
|
-
|
14
|
-
x.report('while') do
|
15
|
-
i = 0
|
16
|
-
mean = 0
|
17
|
-
while i < n
|
18
|
-
mean += ary[i]
|
19
|
-
i += 1
|
20
|
-
end
|
21
|
-
mean /= n.to_f
|
22
|
-
end
|
23
|
-
|
24
|
-
x.report('mean') do
|
25
|
-
mean = ary.mean
|
26
|
-
end
|
27
|
-
end
|
data/bench/sum.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'enumerable/statistics'
|
2
|
-
require 'benchmark/ips'
|
3
|
-
|
4
|
-
Benchmark.ips do |x|
|
5
|
-
x.config(times: 5, warmup: 2)
|
6
|
-
|
7
|
-
n = 1_000
|
8
|
-
ary = Array.new(n) { rand }
|
9
|
-
|
10
|
-
x.report('inject') do
|
11
|
-
sum = ary.inject(:+)
|
12
|
-
end
|
13
|
-
|
14
|
-
x.report('while') do
|
15
|
-
i = 0
|
16
|
-
sum = 0
|
17
|
-
while i < n
|
18
|
-
sum += ary[i]
|
19
|
-
i += 1
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
x.report('sum') do
|
24
|
-
sum = ary.sum
|
25
|
-
end
|
26
|
-
end
|
data/bench/variance.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'enumerable/statistics'
|
2
|
-
require 'benchmark/ips'
|
3
|
-
|
4
|
-
Benchmark.ips do |x|
|
5
|
-
x.config(times: 5, warmup: 2)
|
6
|
-
|
7
|
-
n = 1_000
|
8
|
-
ary = Array.new(n) { rand }
|
9
|
-
mean = ary.inject(:+) / n.to_f
|
10
|
-
|
11
|
-
x.report('inject') do
|
12
|
-
var = ary.inject(0.0) { |sum, x|
|
13
|
-
sum += (x - mean) ** 2
|
14
|
-
} / (n - 1).to_f
|
15
|
-
end
|
16
|
-
|
17
|
-
x.report('while') do
|
18
|
-
i = 0
|
19
|
-
var = 0
|
20
|
-
while i < n
|
21
|
-
var += (ary[i] - mean) ** 2
|
22
|
-
i += 1
|
23
|
-
end
|
24
|
-
mean /= (n - 1).to_f
|
25
|
-
end
|
26
|
-
|
27
|
-
x.report('variance') do
|
28
|
-
var = ary.variance
|
29
|
-
end
|
30
|
-
end
|