more_math 1.3.0 → 1.5.0
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/CHANGES.md +82 -50
- data/README.md +93 -5
- data/Rakefile +3 -3
- data/lib/more_math/subset.rb +8 -1
- data/lib/more_math/version.rb +1 -1
- data/more_math.gemspec +6 -6
- data/tests/subset_test.rb +11 -0
- data/tests/test_helper.rb +2 -6
- metadata +7 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e49149cd5565cd37afbfbe28185a0fbd2a12b245fe19e81882b9df1a0808edb
|
4
|
+
data.tar.gz: be0a9ffffac8d705bc6aefb5643eb188abc35c38eefa905ce988c8369a5d676e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2afb5b0fd78fe1becb079a653354103cef2a02ecd854d73b7e749a03b4f9fc1aee79da76c81f6b1a30060d614b7a76b33d81050672f44aadbfe8bb748bb0090b
|
7
|
+
data.tar.gz: 53e00124977ced033913b519606110c5d75f747c96d84ad80afd35683754dd8c963704afda44ffb7a5fc2138c80d99347199cd9df5d16dc0767b18706c44bd7d
|
data/CHANGES.md
CHANGED
@@ -1,49 +1,81 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## 2025-09-11 v1.5.0
|
4
|
+
|
5
|
+
- Updated `VERSION` file and `lib/more_math/version.rb` from version **1.4.0** to **1.5.0**
|
6
|
+
- Added new `more_math.gemspec` file with version **1.5.0**
|
7
|
+
- Set required Ruby version to **>= 2.0**
|
8
|
+
- Added development dependencies including `gem_hadar` (**~> 2.4**) and `tins` (**~> 1**)
|
9
|
+
- Added runtime dependency on `mize` (">= 0")
|
10
|
+
- Set rubygems version to **3.6.9**
|
11
|
+
- Included all library files in `s.files` and `s.extra_rdoc_files`
|
12
|
+
- Set homepage to "https://github.com/flori/more_math"
|
13
|
+
- Set license to "MIT"
|
14
|
+
- Added `yaml-dev` to dockerfile build dependencies
|
15
|
+
- Installed `bundler` and `gem_hadar` gems in dockerfile
|
16
|
+
- Updated bundle command to `bundle update` and added `--jobs` option
|
17
|
+
- Added `fail_fast: true` to CI configuration
|
18
|
+
- Added `.bundle` to `.gitignore` file
|
19
|
+
- Included `.bundle` in Rakefile ignore list
|
20
|
+
- Replaced `Dir.glob('.github/**/*', File::FNM_DOTMATCH)` with `Dir['.github/**/*']`
|
21
|
+
- Updated `tins` dependency version from `~>1.0` to `~>1`
|
22
|
+
- Removed deprecated `more_math.gemspec` file
|
23
|
+
- Replaced simplecov setup with `gem_hadar/simplecov` require and start call
|
24
|
+
|
25
|
+
## 2025-07-12 v1.4.0
|
26
|
+
|
27
|
+
* Updated `project` method in Subset class with associated tests
|
28
|
+
+ Maps dataset elements based on subset indices
|
29
|
+
+ Ensures data size validation
|
30
|
+
+ Comprehensive test cases for `project` functionality
|
31
|
+
* Added a list of features and example usage of the library in README
|
32
|
+
* Updated bundler behavior to clean up Gemfile.lock before installing gems
|
33
|
+
* Removed obsolete `binary` option from discover block in utility functions
|
34
|
+
|
3
35
|
## 2024-09-30 v1.3.0
|
4
36
|
|
5
37
|
* **Added support for displaying histograms based on percentage of terminal width**
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
38
|
+
+ Added `terminal_width` method to `Histogram` class
|
39
|
+
+ Updated `display` method to take interpret the `width` parameter as a percentage string, e.g. `75%`
|
40
|
+
+ Updated test cases to use the new `display` method with different widths
|
41
|
+
+ Added a new test case for displaying histograms with counts and `75%` width
|
10
42
|
|
11
43
|
## 2024-09-30 v1.2.2
|
12
44
|
|
13
45
|
### Improvements
|
14
46
|
* Refactor Histogram display logic for better UTF-8 support:
|
15
|
-
|
16
|
-
|
47
|
+
+ Extracted `output_row_with_count` and `output_row_without_count` methods
|
48
|
+
+ Updated test cases for histogram display with counts and UTF-8 support
|
17
49
|
* Update Rakefile to ignore `.utilsrc` file:
|
18
|
-
|
50
|
+
- Add `.utilsrc` to `package_ignore` list in Rakefile
|
19
51
|
|
20
52
|
## 2024-09-30 v1.2.1
|
21
53
|
|
22
54
|
* Refactor histogram display logic for utf8 and ascii bars
|
23
|
-
|
24
|
-
|
55
|
+
+ *Improved `utf8_bar` method to handle fractional bar widths.*
|
56
|
+
+ *Updated test case in `histogram_test.rb` to reflect changes.*
|
25
57
|
|
26
58
|
## 2024-09-30 v1.2.0
|
27
59
|
|
28
60
|
#### Significant Changes
|
29
61
|
|
30
62
|
* Bumped version to **1.2.0**
|
31
|
-
|
32
|
-
|
33
|
-
|
63
|
+
+ Updated `VERSION` in `lib/more_math/version.rb`
|
64
|
+
+ Updated gemspec version and date
|
65
|
+
+ Bumped `gem_hadar` development dependency to **1.18.0**
|
34
66
|
* Update Ruby version check in `.all_images.yml`
|
35
|
-
|
67
|
+
+ Added `--full-index` to `bundle` command
|
36
68
|
* Add UTF-8 support to histogram display
|
37
|
-
|
38
|
-
|
39
|
-
|
69
|
+
+ Added `utf8?` method to Histogram class
|
70
|
+
+ Modified `output_row` method to use UTF-8 bars with braille when possible
|
71
|
+
+ Added tests for UTF-8 histogram display with and without counts
|
40
72
|
|
41
73
|
## 2024-08-28 v1.1.0
|
42
74
|
|
43
75
|
* **Added** `interquartile_range` method to `MoreMath::Sequence`
|
44
|
-
|
45
|
-
|
46
|
-
|
76
|
+
+ Significant changes:
|
77
|
+
- Added `interquartile_range` method to `MoreMath::Sequence`
|
78
|
+
- Updated test cases for `sequence_test.rb`
|
47
79
|
* **Updated** all_images.yml to include Ruby **3.3**
|
48
80
|
|
49
81
|
## 2024-07-03 v1.0.2
|
@@ -51,16 +83,16 @@
|
|
51
83
|
* Use github as homepage for rubygems
|
52
84
|
* Only test newer ruby versions
|
53
85
|
* Fine tune width settings a bit, and raise error when invalid arguments are provided:
|
54
|
-
|
55
|
-
|
86
|
+
+ Method: `code`**width_settings**
|
87
|
+
+ Variable: `code`**github_url**
|
56
88
|
|
57
89
|
## 2023-05-29 v1.0.1
|
58
90
|
|
59
91
|
* **Fine-tuned** the width settings:
|
60
|
-
|
92
|
+
+ Raised an error when invalid arguments were provided
|
61
93
|
* Significant changes:
|
62
|
-
|
63
|
-
|
94
|
+
* Raised error when `stupid` arguments are given to width settings
|
95
|
+
* Updated width settings (no specific details available)
|
64
96
|
|
65
97
|
## 2023-05-26 v1.0.0
|
66
98
|
|
@@ -76,8 +108,8 @@
|
|
76
108
|
* Use all_images instead of travis
|
77
109
|
* Be compatible to older rubies
|
78
110
|
* Adds predicate to check if ContinuedFraction is `#simple?` and add the standard […;…,…] notation for these.
|
79
|
-
|
80
|
-
|
111
|
+
+ Adds ContinuedFraction#reciprocal method.
|
112
|
+
+ Use keyword arguments for ContinuedFraction approximations instead of positional arguments.
|
81
113
|
* Add exp log functions as well
|
82
114
|
* Add erfc unless mixed in from Math already
|
83
115
|
* Convert number to float b4 calculation
|
@@ -93,8 +125,8 @@
|
|
93
125
|
## 2017-07-04 v0.3.3
|
94
126
|
|
95
127
|
* Added **1.0** version of the gem with a new feature:
|
96
|
-
|
97
|
-
|
128
|
+
+ Added `code`LICENSE = "MIT"` to Gemfile
|
129
|
+
+ Updated `code`gemspec.rb` with `code`SPDX-License-Identifier: MIT`
|
98
130
|
* No significant changes in this commit
|
99
131
|
|
100
132
|
## 2017-03-09 v0.3.2
|
@@ -111,20 +143,20 @@
|
|
111
143
|
## 2016-10-20 v0.3.1
|
112
144
|
|
113
145
|
* **Corrected method name**
|
114
|
-
|
146
|
+
+ Changed `code`**_method_name_** to `code`**_correct_method_name_**
|
115
147
|
|
116
148
|
## 2016-10-20 v0.3.0
|
117
149
|
|
118
150
|
* **Significant Changes**
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
151
|
+
+ Bump version to **1.0** (commit)
|
152
|
+
+ Implement n-element moving average for Sequence in `Sequence` class
|
153
|
+
+ Add functions to compute entropy of texts in `EntropyCalculator` class
|
154
|
+
+ Refactor some methods in `continued_fraction.rb`
|
155
|
+
+ Ignore `.DS_Store` files
|
124
156
|
* Other changes:
|
125
|
-
|
126
|
-
|
127
|
-
|
157
|
+
+ Test ruby **2.3.1**
|
158
|
+
+ Add codeclimate configuration files
|
159
|
+
+ Add code climate coverage token
|
128
160
|
|
129
161
|
## 2015-05-21 v0.2.1
|
130
162
|
|
@@ -141,10 +173,10 @@
|
|
141
173
|
#### New Features
|
142
174
|
|
143
175
|
* Added Permutation features:
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
176
|
+
+ `identity`: Returns a permutation that leaves all elements unchanged.
|
177
|
+
+ `power`: Raises a permutation to a given power.
|
178
|
+
+ `from_mapping`: Creates a permutation from a given mapping.
|
179
|
+
Contributed by Pramukta Kumar <prak@mac.com>.
|
148
180
|
|
149
181
|
#### Configuration Changes
|
150
182
|
|
@@ -155,24 +187,24 @@
|
|
155
187
|
## 2011-12-25 v0.0.4
|
156
188
|
|
157
189
|
* **Changes for Ruby 1.9.3 and 1.8**
|
158
|
-
|
159
|
-
|
190
|
+
+ Added support for `ruby 1.9.3` as a test target
|
191
|
+
+ Implemented `to_int` method for symbols in Ruby 1.8
|
160
192
|
* Renamed test files
|
161
193
|
|
162
194
|
## 2011-10-28 v0.0.3
|
163
195
|
|
164
196
|
* **Changes in version **bold**0.2.3**bold**:*
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
197
|
+
+ Added permutation class to more_math
|
198
|
+
+ Started power set implementation
|
199
|
+
+ Shared code between subset and permutation
|
200
|
+
+ Fixed small subset issues
|
201
|
+
+ Merged branch 'power_set' into power_set
|
202
|
+
+ Resolved conflicts in lib/more_math.rb, lib/more_math/ranking_common.rb, lib/more_math/subset.rb, and more_math.gemspec
|
171
203
|
|
172
204
|
## 2011-09-26 v0.0.2
|
173
205
|
|
174
206
|
* **Depend on tins library**
|
175
|
-
|
207
|
+
+ Added dependency on `tins` library.
|
176
208
|
|
177
209
|
## 2011-07-17 v0.0.1
|
178
210
|
|
data/README.md
CHANGED
@@ -2,20 +2,108 @@
|
|
2
2
|
|
3
3
|
## Description
|
4
4
|
|
5
|
-
Ruby library that contains various mathematical functions and algorithms
|
5
|
+
Ruby library that contains various mathematical functions and algorithms,
|
6
|
+
extending Ruby's capabilities in domains such as statistics, numerical
|
7
|
+
analysis, and combinatorics.
|
6
8
|
|
7
|
-
|
9
|
+
### Core Features
|
8
10
|
|
9
|
-
|
11
|
+
1. **Mathematical Functions**
|
12
|
+
- **Gamma Function**: Computes the gamma function for real numbers.
|
13
|
+
- **Beta Function**: Calculates the beta function and its regularized form.
|
14
|
+
- **Error Function (erf)**: Provides the error function used in probability
|
15
|
+
and statistics.
|
10
16
|
|
11
|
-
|
17
|
+
2. **Special Functions**
|
18
|
+
- **Lambert W Function**: Solves equations of the form `x = a * exp(x)`.
|
19
|
+
- **Continued Fractions**: Evaluates continued fractions for various
|
20
|
+
mathematical expressions.
|
12
21
|
|
22
|
+
3. **Statistical Tools**
|
23
|
+
- **Probability Distributions**: Implements distributions like Student's t,
|
24
|
+
chi-squared, and Fisher's z.
|
25
|
+
- **Random Number Generation**: Generates random numbers following specific
|
26
|
+
distributions.
|
27
|
+
- **Hypothesis Testing**: Performs tests like the Kolmogorov-Smirnov test
|
28
|
+
for distribution comparison.
|
29
|
+
|
30
|
+
4. **Sequence Analysis**
|
31
|
+
- **Moving Averages**: Computes simple moving averages for time series data.
|
32
|
+
- **Autocorrelation and Autovariance**: Analyzes the correlation structure
|
33
|
+
of sequences.
|
34
|
+
- **Histograms**: Visualizes data distributions with customizable bins.
|
35
|
+
|
36
|
+
5. **Combinatorics and Algorithms**
|
37
|
+
- **Permutations and Combinations**: Generates permutations, combinations,
|
38
|
+
and Cartesian products.
|
39
|
+
- **Graph Theory**: Includes algorithms for shortest paths (Dijkstra,
|
40
|
+
Floyd-Warshall) and minimum spanning trees.
|
41
|
+
- **Root Finding**: Uses Newton-Raphson and bisection methods to find roots
|
42
|
+
of functions.
|
43
|
+
|
44
|
+
### Specialized Modules
|
45
|
+
|
46
|
+
1. **String Numeral Conversion**
|
47
|
+
- Converts strings to Gödel numbers and vice versa using a specified
|
48
|
+
alphabet.
|
49
|
+
|
50
|
+
2. **Cantor Pairing Function**
|
51
|
+
- Encodes tuples into a single integer and decodes them back, useful in set
|
52
|
+
theory and combinatorics.
|
53
|
+
|
54
|
+
3. **Histograms**
|
55
|
+
- Creates histograms for data visualization with support for different
|
56
|
+
binning strategies.
|
57
|
+
|
58
|
+
## Example Usage
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
include MoreMath::Functions # include like you would ::Math
|
62
|
+
|
63
|
+
# Compute the gamma function at 0.5
|
64
|
+
puts gamma(0.5) # => 1.77245385091
|
65
|
+
|
66
|
+
# Define a continued fraction representation of the arctangent function (atan)
|
67
|
+
atan = ContinuedFraction.for_a do |n, x|
|
68
|
+
n == 0 ? 0 : 2 * n - 1
|
69
|
+
end.for_b do |n, x|
|
70
|
+
n <= 1 ? x : ((n - 1) * x) ** 2
|
71
|
+
end
|
72
|
+
pi = -> (epsilon: 1E-16) { 4 * atan.(1, epsilon:) }
|
73
|
+
puts pi.() # => 3.1415926535897936
|
74
|
+
|
75
|
+
# Compute the moving average of an array
|
76
|
+
sequence = [1, 2, 3, 4, 5]
|
77
|
+
ma = Sequence.new(sequence).simple_moving_average(2)
|
78
|
+
puts ma.inspect # => [1.5, 2.5, 3.5, 4.5]
|
79
|
+
|
80
|
+
# Create a histogram with 3 bins, display it in on STDOUT with a width of 80 characters
|
81
|
+
Histogram.new([1, 2, 3, 4, 5, 1], bins: 3).display(STDOUT, 80) ; nil
|
82
|
+
# 4.33333 -|⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
83
|
+
# 3.00000 -|⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇
|
84
|
+
# 1.66667 -|⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
85
|
+
```
|
86
|
+
|
87
|
+
## Installation
|
88
|
+
|
89
|
+
To install `more_math`, run:
|
90
|
+
|
91
|
+
```bash
|
92
|
+
gem install more_math
|
93
|
+
```
|
13
94
|
|
14
95
|
## Author
|
15
96
|
|
16
|
-
Florian Frank
|
97
|
+
Florian Frank
|
98
|
+
mailto:flori@ping.de
|
17
99
|
|
18
100
|
## License
|
19
101
|
|
20
102
|
This software is licensed under the X11 (or MIT) license:
|
21
103
|
http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3
|
104
|
+
|
105
|
+
## Homepage
|
106
|
+
|
107
|
+
The homepage of this library is located at:
|
108
|
+
|
109
|
+
* http://github.com/flori/more_math
|
data/Rakefile
CHANGED
@@ -11,14 +11,14 @@ GemHadar do
|
|
11
11
|
description 'Library that provides more mathematical functions/algorithms than standard Ruby.'
|
12
12
|
test_dir 'tests'
|
13
13
|
ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', 'coverage', '.rvmrc',
|
14
|
-
'.AppleDouble', 'tags', '.byebug_history', '.DS_Store'
|
14
|
+
'.AppleDouble', 'tags', '.byebug_history', '.DS_Store', '.bundle'
|
15
15
|
readme 'README.md'
|
16
16
|
title "#{name.camelize} -- More Math in Ruby"
|
17
17
|
package_ignore '.all_images.yml', '.gitignore', 'VERSION', '.utilsrc',
|
18
|
-
*Dir
|
18
|
+
*Dir['.github/**/*']
|
19
19
|
|
20
20
|
required_ruby_version '>= 2.0'
|
21
|
-
dependency 'tins', '~>1
|
21
|
+
dependency 'tins', '~>1'
|
22
22
|
dependency 'mize'
|
23
23
|
development_dependency 'rake'
|
24
24
|
development_dependency 'simplecov'
|
data/lib/more_math/subset.rb
CHANGED
@@ -41,6 +41,13 @@ module MoreMath
|
|
41
41
|
result
|
42
42
|
end
|
43
43
|
|
44
|
-
#
|
44
|
+
# This method maps elements from a given dataset based on the
|
45
|
+
# subset's indices determined by its rank and returns the result, while
|
46
|
+
# ensuring the input data size matches the subset's size.
|
47
|
+
def project(data = nil)
|
48
|
+
data ||= @collection || (0...size).to_a
|
49
|
+
raise ArgumentError, "data size is != #{size}!" if data.size != size
|
50
|
+
value.map { |i| data[i] }
|
51
|
+
end
|
45
52
|
end
|
46
53
|
end
|
data/lib/more_math/version.rb
CHANGED
data/more_math.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: more_math 1.
|
2
|
+
# stub: more_math 1.5.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "more_math".freeze
|
6
|
-
s.version = "1.
|
6
|
+
s.version = "1.5.0".freeze
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
11
|
-
s.date = "
|
11
|
+
s.date = "1980-01-02"
|
12
12
|
s.description = "Library that provides more mathematical functions/algorithms than standard Ruby.".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
14
|
s.extra_rdoc_files = ["README.md".freeze, "lib/more_math.rb".freeze, "lib/more_math/cantor_pairing_function.rb".freeze, "lib/more_math/constants/functions_constants.rb".freeze, "lib/more_math/continued_fraction.rb".freeze, "lib/more_math/distributions.rb".freeze, "lib/more_math/entropy.rb".freeze, "lib/more_math/exceptions.rb".freeze, "lib/more_math/functions.rb".freeze, "lib/more_math/histogram.rb".freeze, "lib/more_math/linear_regression.rb".freeze, "lib/more_math/newton_bisection.rb".freeze, "lib/more_math/numberify_string_function.rb".freeze, "lib/more_math/permutation.rb".freeze, "lib/more_math/ranking_common.rb".freeze, "lib/more_math/sequence.rb".freeze, "lib/more_math/sequence/moving_average.rb".freeze, "lib/more_math/sequence/refinement.rb".freeze, "lib/more_math/string_numeral.rb".freeze, "lib/more_math/subset.rb".freeze, "lib/more_math/version.rb".freeze]
|
@@ -17,18 +17,18 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.licenses = ["MIT".freeze]
|
18
18
|
s.rdoc_options = ["--title".freeze, "MoreMath -- More Math in Ruby".freeze, "--main".freeze, "README.md".freeze]
|
19
19
|
s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze)
|
20
|
-
s.rubygems_version = "3.
|
20
|
+
s.rubygems_version = "3.6.9".freeze
|
21
21
|
s.summary = "Library that provides more mathematics.".freeze
|
22
22
|
s.test_files = ["tests/cantor_pairing_function_test.rb".freeze, "tests/continued_fraction_test.rb".freeze, "tests/distribution_test.rb".freeze, "tests/entropy_test.rb".freeze, "tests/functions_test.rb".freeze, "tests/histogram_test.rb".freeze, "tests/newton_bisection_test.rb".freeze, "tests/numberify_string_function_test.rb".freeze, "tests/permutation_test.rb".freeze, "tests/sequence/refinement_test.rb".freeze, "tests/sequence_moving_average_test.rb".freeze, "tests/sequence_test.rb".freeze, "tests/string_numeral_test.rb".freeze, "tests/subset_test.rb".freeze, "tests/test_helper.rb".freeze]
|
23
23
|
|
24
24
|
s.specification_version = 4
|
25
25
|
|
26
|
-
s.add_development_dependency(%q<gem_hadar>.freeze, ["~>
|
26
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.4".freeze])
|
27
27
|
s.add_development_dependency(%q<rake>.freeze, [">= 0".freeze])
|
28
28
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
29
29
|
s.add_development_dependency(%q<test-unit>.freeze, [">= 0".freeze])
|
30
30
|
s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
|
31
31
|
s.add_development_dependency(%q<all_images>.freeze, [">= 0".freeze])
|
32
|
-
s.add_runtime_dependency(%q<tins>.freeze, ["~> 1
|
32
|
+
s.add_runtime_dependency(%q<tins>.freeze, ["~> 1".freeze])
|
33
33
|
s.add_runtime_dependency(%q<mize>.freeze, [">= 0".freeze])
|
34
34
|
end
|
data/tests/subset_test.rb
CHANGED
@@ -19,4 +19,15 @@ class SubsetTest < Test::Unit::TestCase
|
|
19
19
|
assert_equal expected, Subset.for([1, 2, 3]).map(&:value)
|
20
20
|
assert_equal expected, Subset.power_set([1, 2, 3])
|
21
21
|
end
|
22
|
+
|
23
|
+
def test_project
|
24
|
+
a = %i[ a b c d e ]
|
25
|
+
subset = Subset.new(a.size, 23)
|
26
|
+
assert_raises(ArgumentError) { subset.project a + %i[ f ] }
|
27
|
+
(2 ** a.size).times do |i|
|
28
|
+
subset = Subset.new(a.size, i)
|
29
|
+
projected = subset.project(a)
|
30
|
+
assert_equal(projected, Subset.power_set(a)[i])
|
31
|
+
end
|
32
|
+
end
|
22
33
|
end
|
data/tests/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: more_math
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: gem_hadar
|
@@ -16,14 +15,14 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
18
|
+
version: '2.4'
|
20
19
|
type: :development
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
25
|
+
version: '2.4'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: rake
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +99,14 @@ dependencies:
|
|
100
99
|
requirements:
|
101
100
|
- - "~>"
|
102
101
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1
|
102
|
+
version: '1'
|
104
103
|
type: :runtime
|
105
104
|
prerelease: false
|
106
105
|
version_requirements: !ruby/object:Gem::Requirement
|
107
106
|
requirements:
|
108
107
|
- - "~>"
|
109
108
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1
|
109
|
+
version: '1'
|
111
110
|
- !ruby/object:Gem::Dependency
|
112
111
|
name: mize
|
113
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -195,7 +194,6 @@ homepage: https://github.com/flori/more_math
|
|
195
194
|
licenses:
|
196
195
|
- MIT
|
197
196
|
metadata: {}
|
198
|
-
post_install_message:
|
199
197
|
rdoc_options:
|
200
198
|
- "--title"
|
201
199
|
- MoreMath -- More Math in Ruby
|
@@ -214,8 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
212
|
- !ruby/object:Gem::Version
|
215
213
|
version: '0'
|
216
214
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
218
|
-
signing_key:
|
215
|
+
rubygems_version: 3.6.9
|
219
216
|
specification_version: 4
|
220
217
|
summary: Library that provides more mathematics.
|
221
218
|
test_files:
|