numo-narray-alt 0.9.14 → 0.10.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.
@@ -24,8 +24,6 @@
24
24
  #define DBL_EPSILON 2.2204460492503131e-16
25
25
  #endif
26
26
 
27
- static ID id_beg, id_end, id_len, id_step;
28
-
29
27
  #define EXCL(r) RTEST(rb_funcall((r), rb_intern("exclude_end?"), 0))
30
28
 
31
29
  /*
@@ -44,36 +42,13 @@ void nary_step_array_index(
44
42
  VALUE vbeg, vend, vstep, vlen;
45
43
  ssize_t end = ary_size;
46
44
 
47
- #ifdef HAVE_RB_ARITHMETIC_SEQUENCE_EXTRACT
48
45
  rb_arithmetic_sequence_components_t x;
49
46
  rb_arithmetic_sequence_extract(obj, &x);
50
47
 
51
48
  vstep = x.step;
52
49
  vbeg = x.begin;
53
50
  vend = x.end;
54
- #else
55
- struct enumerator* e;
56
-
57
- if (rb_obj_is_kind_of(obj, rb_cRange)) {
58
- vstep = rb_ivar_get(obj, id_step);
59
- } else { // Enumerator
60
- na_parse_enumerator_step(obj, &vstep);
61
- e = RENUMERATOR_PTR(obj);
62
- obj = e->obj; // Range
63
- }
64
-
65
- vbeg = rb_funcall(obj, id_beg, 0);
66
- vend = rb_funcall(obj, id_end, 0);
67
- #endif
68
- // Range does not have a length instance variable, which causes rb_ivar_get
69
- // to output a warning when retrieving the length instance variable in Ruby 2.7.
70
- // Since Range is not frozen in Ruby 2.7, we set the length instance variable.
71
- if (RUBY_API_VERSION_MAJOR < 3) {
72
- if (!RTEST(rb_ivar_defined(obj, id_len))) {
73
- rb_ivar_set(obj, id_len, Qnil);
74
- }
75
- }
76
- vlen = rb_ivar_get(obj, id_len);
51
+ vlen = rb_ivar_get(obj, rb_intern("length"));
77
52
 
78
53
  if (RTEST(vbeg)) {
79
54
  beg = NUM2SSIZET(vbeg);
@@ -195,36 +170,13 @@ void nary_step_sequence(VALUE obj, size_t* plen, double* pbeg, double* pstep) {
195
170
  double dbeg, dend, dstep = 1, dsize, err;
196
171
  size_t size, n;
197
172
 
198
- #ifdef HAVE_RB_ARITHMETIC_SEQUENCE_EXTRACT
199
173
  rb_arithmetic_sequence_components_t x;
200
174
  rb_arithmetic_sequence_extract(obj, &x);
201
175
 
202
176
  vstep = x.step;
203
177
  dbeg = NUM2DBL(x.begin);
204
178
  vend = x.end;
205
- #else
206
- struct enumerator* e;
207
-
208
- if (rb_obj_is_kind_of(obj, rb_cRange)) {
209
- vstep = rb_ivar_get(obj, id_step);
210
- } else { // Enumerator
211
- na_parse_enumerator_step(obj, &vstep);
212
- e = RENUMERATOR_PTR(obj);
213
- obj = e->obj; // Range
214
- }
215
-
216
- dbeg = NUM2DBL(rb_funcall(obj, id_beg, 0));
217
- vend = rb_funcall(obj, id_end, 0);
218
- #endif
219
- // Range does not have a length instance variable, which causes rb_ivar_get
220
- // to output a warning when retrieving the length instance variable in Ruby 2.7.
221
- // Since Range is not frozen in Ruby 2.7, we set the length instance variable.
222
- if (RUBY_API_VERSION_MAJOR < 3) {
223
- if (!RTEST(rb_ivar_defined(obj, id_len))) {
224
- rb_ivar_set(obj, id_len, Qnil);
225
- }
226
- }
227
- vlen = rb_ivar_get(obj, id_len);
179
+ vlen = rb_ivar_get(obj, rb_intern("length"));
228
180
 
229
181
  if (RTEST(vlen)) {
230
182
  size = NUM2SIZET(vlen);
@@ -276,12 +228,3 @@ void nary_step_sequence(VALUE obj, size_t* plen, double* pbeg, double* pstep) {
276
228
  if (pbeg) *pbeg = dbeg;
277
229
  if (pstep) *pstep = dstep;
278
230
  }
279
-
280
- void Init_nary_step(void) {
281
- rb_define_alias(rb_cRange, "%", "step");
282
-
283
- id_beg = rb_intern("begin");
284
- id_end = rb_intern("end");
285
- id_len = rb_intern("length");
286
- id_step = rb_intern("step");
287
- }
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
27
27
  spec.summary = 'Numo::NArray Alternative is a project forked from Numo::NArray.'
28
28
  spec.homepage = 'https://github.com/yoshoku/numo-narray-alt'
29
29
  spec.license = 'BSD-3-Clause'
30
- spec.required_ruby_version = '>= 2.2'
30
+ spec.required_ruby_version = '>= 3.2.0'
31
31
 
32
32
  spec.metadata['homepage_uri'] = spec.homepage
33
33
  spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-narray-alt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
@@ -71,6 +71,7 @@ files:
71
71
  - ext/numo/narray/src/mh/arg.h
72
72
  - ext/numo/narray/src/mh/argmax.h
73
73
  - ext/numo/narray/src/mh/argmin.h
74
+ - ext/numo/narray/src/mh/aset.h
74
75
  - ext/numo/narray/src/mh/bincount.h
75
76
  - ext/numo/narray/src/mh/bit/and.h
76
77
  - ext/numo/narray/src/mh/bit/left_shift.h
@@ -146,6 +147,7 @@ files:
146
147
  - ext/numo/narray/src/mh/max_index.h
147
148
  - ext/numo/narray/src/mh/maximum.h
148
149
  - ext/numo/narray/src/mh/mean.h
150
+ - ext/numo/narray/src/mh/median.h
149
151
  - ext/numo/narray/src/mh/min.h
150
152
  - ext/numo/narray/src/mh/min_index.h
151
153
  - ext/numo/narray/src/mh/minimum.h
@@ -174,13 +176,16 @@ files:
174
176
  - ext/numo/narray/src/mh/round/round.h
175
177
  - ext/numo/narray/src/mh/round/trunc.h
176
178
  - ext/numo/narray/src/mh/round/unary_func.h
179
+ - ext/numo/narray/src/mh/s_cast.h
177
180
  - ext/numo/narray/src/mh/seq.h
178
181
  - ext/numo/narray/src/mh/set_imag.h
179
182
  - ext/numo/narray/src/mh/set_real.h
180
183
  - ext/numo/narray/src/mh/sign.h
181
184
  - ext/numo/narray/src/mh/signbit.h
185
+ - ext/numo/narray/src/mh/sort.h
182
186
  - ext/numo/narray/src/mh/square.h
183
187
  - ext/numo/narray/src/mh/stddev.h
188
+ - ext/numo/narray/src/mh/store.h
184
189
  - ext/numo/narray/src/mh/sum.h
185
190
  - ext/numo/narray/src/mh/to_a.h
186
191
  - ext/numo/narray/src/mh/var.h
@@ -210,7 +215,7 @@ licenses:
210
215
  metadata:
211
216
  homepage_uri: https://github.com/yoshoku/numo-narray-alt
212
217
  changelog_uri: https://github.com/yoshoku/numo-narray-alt/blob/main/CHANGELOG.md
213
- documentation_uri: https://gemdocs.org/gems/numo-narray-alt/0.9.14/
218
+ documentation_uri: https://gemdocs.org/gems/numo-narray-alt/0.10.0/
214
219
  rubygems_mfa_required: 'true'
215
220
  post_install_message: |
216
221
  ===
@@ -227,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
227
232
  requirements:
228
233
  - - ">="
229
234
  - !ruby/object:Gem::Version
230
- version: '2.2'
235
+ version: 3.2.0
231
236
  required_rubygems_version: !ruby/object:Gem::Requirement
232
237
  requirements:
233
238
  - - ">="