ruby_native_statistics 2.0.0-arm64-darwin-24

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d0645cd55a971b17f1bfe3915f4581a991fc962c81a6b9f6769941396226a7c9
4
+ data.tar.gz: cc4016b3a78c659d488aa1b2d70624167d65de3d55d130ee722e200c7d83d384
5
+ SHA512:
6
+ metadata.gz: f28f153a614f28f22ab3acaca93a0cf74aa17c77e2b1d8568d02b709c42809cfab7bca2020082813fee84a02d3e69cca472ad5910e5ceef27d6dc67c17850541
7
+ data.tar.gz: f9c232a6d3186e806771599d6506872bcb8971e903094450cead61b916ee9f852911eb29646a47f349ae5595b2871b932af194a0598ade9298376bc0dc938a72
data/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # Ruby Native Statistics
2
+
3
+ [![Test status](https://github.com/corybuecker/ruby-native-statistics/workflows/Test%20suite/badge.svg)](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
+ ## Build notes
61
+
62
+ If you are installing the source vesion of the Gem, be sure to have libclang, e.g. `libclang-dev`, installed on your system.
63
+
64
+ ## Implementation notes
65
+
66
+ ### Percentile
67
+
68
+ 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
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyNativeStatistics
4
+ VERSION = '2.0.0'
5
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby_native_statistics/version'
4
+ require 'ruby_native_statistics/ruby_native_statistics'
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_native_statistics
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: arm64-darwin-24
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: :development
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
+ - README.md
63
+ - Rakefile
64
+ - UNLICENSE
65
+ - changelog.md
66
+ - lib/ruby_native_statistics.rb
67
+ - lib/ruby_native_statistics/ruby_native_statistics.bundle
68
+ - lib/ruby_native_statistics/version.rb
69
+ homepage: https://github.com/corybuecker/ruby-native-statistics
70
+ licenses:
71
+ - Unlicense
72
+ metadata:
73
+ allowed_push_host: https://rubygems.org
74
+ changelog_uri: https://github.com/corybuecker/ruby-native-statistics/CHANGELOG.md
75
+ source_code_uri: https://github.com/corybuecker/ruby-native-statistics
76
+ bug_tracker_uri: https://github.com/corybuecker/ruby-native-statistics/issues
77
+ documentation_uri: https://github.com/corybuecker/ruby-native-statistics/blob/main/README.md
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '3.4'
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: 3.5.dev
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubygems_version: 3.7.1
96
+ specification_version: 4
97
+ summary: High performance, native (Rust) implementations of various statistical functions.
98
+ test_files: []