ruby_native_statistics 2.0.0.rc.1-aarch64-linux
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 +7 -0
- data/.ruby-version +1 -0
- data/README.md +64 -0
- data/Rakefile +18 -0
- data/UNLICENSE +24 -0
- data/changelog.md +50 -0
- data/lib/ruby_native_statistics/ruby_native_statistics.so +0 -0
- data/lib/ruby_native_statistics/version.rb +5 -0
- data/lib/ruby_native_statistics.rb +4 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d2c12ffe4c45a7f5fb1bb3cc58c542dc602296fdd9c5a2dc64b4d82cf5697341
|
4
|
+
data.tar.gz: 8ef1f584495a6f7dab48a1a5e112376a2d2d3dab4f0237a1cef90958f7479648
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 03a75a94a434e79bc5c59668e7d75471f3444119b2e184f5e7cdc31366bcac6166f178832b9d31cac1fb2f7852e0c50e70103e03a198c497a79c940fde25d554
|
7
|
+
data.tar.gz: 2f97cecdf1f0da003e922876c002c51af3715d41d9516099857006bb5b234fa0a8a9da45a7548b917d80288ced9f8426185fd7ef0d4c8c5523aa90fffb5eb162
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.4.4
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Ruby Native Statistics
|
2
|
+
|
3
|
+
[](https://github.com/corybuecker/ruby-native-statistics/actions)
|
4
|
+
|
5
|
+
This is a native extension to Ruby that adds native (Rust) statistical functions to the Array class. At present the following functions are provided:
|
6
|
+
|
7
|
+
- [Sample Standard Deviation](https://en.wikipedia.org/wiki/Standard_deviation#Corrected_sample_standard_deviation) (stdev, stdevs)
|
8
|
+
- [Population Standard Deviation](https://en.wikipedia.org/wiki/Standard_deviation#Uncorrected_sample_standard_deviation) (stdevp)
|
9
|
+
- [Sample Variance](https://en.wikipedia.org/wiki/Variance#Population_variance_and_sample_variance) (var)
|
10
|
+
- [Population Variance](https://en.wikipedia.org/wiki/Variance#Population_variance_and_sample_variance) (varp)
|
11
|
+
- [Median](https://en.wikipedia.org/wiki/Median) (median)
|
12
|
+
- [Mean](https://en.wikipedia.org/wiki/Arithmetic_mean) (mean)
|
13
|
+
- [Percentile](https://en.wikipedia.org/wiki/Quantile) (percentile)
|
14
|
+
|
15
|
+
Check the Github Actions build to see the currently supported versions of Ruby. This list will match whatever stable versions are specified at https://www.ruby-lang.org/en/downloads/.
|
16
|
+
|
17
|
+
It is generally more performant than calculating these values with pure Ruby. For a comparison, run the benchmarks with `rake benchmark`.
|
18
|
+
|
19
|
+
Here's the data converted to a Markdown table:
|
20
|
+
|
21
|
+
| Benchmark (Ruby 3.4.4) | Run 1 | Run 2 | Run 3 | Run 4 | Run 5 |
|
22
|
+
|--------------------------|----------|----------|----------|----------|----------|
|
23
|
+
| bench_ruby_median | 0.000676 | 0.000611 | 0.000619 | 0.000620 | 0.000583 |
|
24
|
+
| bench_native_median | 0.000179 | 0.000167 | 0.000127 | 0.000118 | 0.000188 |
|
25
|
+
| bench_ruby_stdev | 0.000780 | 0.000767 | 0.000730 | 0.000718 | 0.000733 |
|
26
|
+
| bench_native_stdev | 0.000046 | 0.000027 | 0.000034 | 0.000026 | 0.000043 |
|
27
|
+
| bench_ruby_mean | 0.000261 | 0.000240 | 0.000242 | 0.000250 | 0.000241 |
|
28
|
+
| bench_native_mean | 0.000033 | 0.000023 | 0.000022 | 0.000028 | 0.000022 |
|
29
|
+
|
30
|
+
## Found a bug? Need a function?
|
31
|
+
|
32
|
+
If you found a bug or need a particular function, please let me know! I work on this gem in my spare time, mainly for learning purposes. Feel free to open a PR or a Github issue and I'll take a look as soon as possible.
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
require 'ruby_native_statistics'
|
37
|
+
r = [1,3,21,32,42]
|
38
|
+
|
39
|
+
# calculate sample standard deviation, you can also use "stdevs"
|
40
|
+
p r.stdev
|
41
|
+
|
42
|
+
# calculate population standard deviation
|
43
|
+
p r.stdevp
|
44
|
+
|
45
|
+
# calculate sample variance
|
46
|
+
p r.var
|
47
|
+
|
48
|
+
# calculate population variance
|
49
|
+
p r.varp
|
50
|
+
|
51
|
+
# calculate mean
|
52
|
+
p r.mean
|
53
|
+
|
54
|
+
# calculate median
|
55
|
+
p r.median
|
56
|
+
|
57
|
+
# calculate percentile
|
58
|
+
p r.percentile(0.3333)
|
59
|
+
|
60
|
+
## Implementation notes
|
61
|
+
|
62
|
+
### Percentile
|
63
|
+
|
64
|
+
Percentile uses the same rounding method as Excel, sometimes called R7.
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minitest/test_task'
|
4
|
+
Minitest::TestTask.create
|
5
|
+
|
6
|
+
require 'rb_sys/extensiontask'
|
7
|
+
GEMSPEC = Gem::Specification.load('ruby_native_statistics.gemspec')
|
8
|
+
RbSys::ExtensionTask.new('ruby_native_statistics', GEMSPEC) do |ext|
|
9
|
+
ext.lib_dir = 'lib/ruby_native_statistics'
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rake/testtask'
|
13
|
+
Rake::TestTask.new benchmark: [:clean, :clobber, 'compile:release'] do |t|
|
14
|
+
t.libs << 'test'
|
15
|
+
t.test_files = ['test/**/*_benchmark.rb']
|
16
|
+
end
|
17
|
+
|
18
|
+
task :default => ['compile:dev', :test]
|
data/UNLICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
2
|
+
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
4
|
+
distribute this software, either in source code form or as a compiled
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
6
|
+
means.
|
7
|
+
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
9
|
+
of this software dedicate any and all copyright interest in the
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
11
|
+
of the public at large and to the detriment of our heirs and
|
12
|
+
successors. We intend this dedication to be an overt act of
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
14
|
+
software under copyright law.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
For more information, please refer to <http://unlicense.org>
|
data/changelog.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Version 2.0.0
|
2
|
+
|
3
|
+
- Replace the C-based implementation with a Rust-based implementation. The public API is mostly unchanged (see README.md) with the exception of the error messages.
|
4
|
+
- Test and publish cross-platform Gems for Linux x86_64, Linux aarch64, and macOS arm64.
|
5
|
+
|
6
|
+
# Version 1.1.1
|
7
|
+
|
8
|
+
- Update all supported Ruby versions
|
9
|
+
- Update all dependencies
|
10
|
+
|
11
|
+
# Version 1.1.0
|
12
|
+
|
13
|
+
- Fix percentile bug reported by @Gbird22
|
14
|
+
|
15
|
+
# Version 1.0.3
|
16
|
+
|
17
|
+
- Update all supported Ruby versions
|
18
|
+
- Update all dependencies
|
19
|
+
|
20
|
+
# Version 1.0.2
|
21
|
+
|
22
|
+
- Better differentiate `gemspec` and `Gemfile` between runtime and development dependencies
|
23
|
+
|
24
|
+
# Version 1.0.1
|
25
|
+
|
26
|
+
- Update all supported Ruby versions
|
27
|
+
- Update all dependencies
|
28
|
+
|
29
|
+
# Version 1.0.0
|
30
|
+
|
31
|
+
- Update all supported Ruby versions
|
32
|
+
- Update all dependencies
|
33
|
+
|
34
|
+
# Version 0.9.0
|
35
|
+
|
36
|
+
- Add median function
|
37
|
+
|
38
|
+
# Version 0.8.2
|
39
|
+
|
40
|
+
- Bug fix for build process
|
41
|
+
|
42
|
+
# Version 0.8.1
|
43
|
+
|
44
|
+
- Internal and build-related changes only
|
45
|
+
|
46
|
+
Yanked due to a bug introduced in the build.
|
47
|
+
|
48
|
+
# Version 0.8
|
49
|
+
|
50
|
+
- Added mean method
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_native_statistics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0.rc.1
|
5
|
+
platform: aarch64-linux
|
6
|
+
authors:
|
7
|
+
- Cory Buecker
|
8
|
+
bindir: bin
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: rake-compiler
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.3'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '1.3'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '13.0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '13.0'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: minitest
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '5.21'
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '5.21'
|
54
|
+
description: A Ruby gem providing high-performance statistical functions implemented
|
55
|
+
in Rust for better performance than pure Ruby implementations.
|
56
|
+
email:
|
57
|
+
- cory.buecker@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".ruby-version"
|
63
|
+
- README.md
|
64
|
+
- Rakefile
|
65
|
+
- UNLICENSE
|
66
|
+
- changelog.md
|
67
|
+
- lib/ruby_native_statistics.rb
|
68
|
+
- lib/ruby_native_statistics/ruby_native_statistics.so
|
69
|
+
- lib/ruby_native_statistics/version.rb
|
70
|
+
homepage: https://github.com/corybuecker/ruby-native-statistics
|
71
|
+
licenses:
|
72
|
+
- Unlicense
|
73
|
+
metadata:
|
74
|
+
allowed_push_host: https://rubygems.org
|
75
|
+
changelog_uri: https://github.com/corybuecker/ruby-native-statistics/CHANGELOG.md
|
76
|
+
source_code_uri: https://github.com/corybuecker/ruby-native-statistics
|
77
|
+
bug_tracker_uri: https://github.com/corybuecker/ruby-native-statistics/issues
|
78
|
+
documentation_uri: https://github.com/corybuecker/ruby-native-statistics/blob/main/README.md
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '3.4'
|
87
|
+
- - "<"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.5.dev
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubygems_version: 3.6.7
|
97
|
+
specification_version: 4
|
98
|
+
summary: High performance, native (Rust) implementations of various statistical functions.
|
99
|
+
test_files: []
|