carray 1.5.5 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/carray.gemspec +1 -1
- data/ext/carray.h +4 -0
- data/ext/carray_access.c +77 -45
- data/ext/carray_generate.c +3 -3
- data/ext/carray_utils.c +126 -47
- data/ext/extconf.rb +4 -0
- data/ext/ruby_carray.c +4 -1
- data/ext/version.h +4 -4
- data/lib/carray.rb +5 -5
- data/spec/Features/feature_attributes_spec.rb +6 -6
- data/spec/Features/feature_cast_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baf289b957e96d1df3156ea74f06a7bb44cbd856005f42a9f7531367413c9cff
|
4
|
+
data.tar.gz: 06feaeef398f1e130e658df742d370d54b003cd6af67bac47a2ae40b58e40007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f62fb53d5344bdc400c211d6938460f136215e0a629c60d047bef313e053d3500c2b0c02e30a77810fa4b6ed7e67ab52edbc93f7ebc264d3441a20bc01b4207
|
7
|
+
data.tar.gz: acb0098036a13fff4a483aa6fb5fe5fc0dc65bd0e8d356b6037a44b4aa285f231e98d39687090de73b225a540c3b946c3be5a75746e68194ca9b0d7bfdd823e4
|
data/carray.gemspec
CHANGED
data/ext/carray.h
CHANGED
data/ext/carray_access.c
CHANGED
@@ -10,35 +10,10 @@
|
|
10
10
|
|
11
11
|
#include "carray.h"
|
12
12
|
|
13
|
-
|
14
|
-
#define
|
15
|
-
|
16
|
-
|
17
|
-
RSTRUCT_ENUM_END
|
18
|
-
};
|
19
|
-
struct RStruct {
|
20
|
-
struct RBasic basic;
|
21
|
-
union {
|
22
|
-
struct {
|
23
|
-
long len;
|
24
|
-
const VALUE *ptr;
|
25
|
-
} heap;
|
26
|
-
const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
|
27
|
-
} as;
|
28
|
-
};
|
29
|
-
#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
|
30
|
-
#endif
|
31
|
-
|
32
|
-
#if RUBY_VERSION_CODE >= 190
|
33
|
-
#define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0])
|
34
|
-
#define RANGE_END(r) (RSTRUCT(r)->as.ary[1])
|
35
|
-
#define RANGE_EXCL(r) (RSTRUCT(r)->as.ary[2])
|
36
|
-
#else
|
37
|
-
static ID id_beg, id_end, id_excl;
|
38
|
-
#define RANGE_BEG(r) (rb_ivar_get(r, id_beg))
|
39
|
-
#define RANGE_END(r) (rb_ivar_get(r, id_end))
|
40
|
-
#define RANGE_EXCL(r) (rb_ivar_get(r, id_excl))
|
41
|
-
#endif
|
13
|
+
static ID id_begin, id_end, id_excl_end;
|
14
|
+
#define RANGE_BEG(r) (rb_funcall(r, id_begin, 0))
|
15
|
+
#define RANGE_END(r) (rb_funcall(r, id_end, 0))
|
16
|
+
#define RANGE_EXCL(r) (rb_funcall(r, id_excl_end, 0))
|
42
17
|
|
43
18
|
static ID id_ca, id_to_ca;
|
44
19
|
static VALUE sym_star, sym_perc;
|
@@ -614,17 +589,17 @@ rb_ca_scan_index (int ca_ndim, ca_size_t *ca_dim, ca_size_t ca_elements,
|
|
614
589
|
info->ndim = ca_ndim;
|
615
590
|
}
|
616
591
|
else if ( rb_obj_is_kind_of(arg, rb_cRange) ) { /* ca[--,i..j,--] */
|
617
|
-
ca_size_t
|
592
|
+
ca_size_t start, last, excl, count, step;
|
618
593
|
volatile VALUE iv_beg, iv_end, iv_excl;
|
619
594
|
iv_beg = RANGE_BEG(arg);
|
620
595
|
iv_end = RANGE_END(arg);
|
621
596
|
iv_excl = RANGE_EXCL(arg);
|
622
597
|
index_type[i] = CA_IDX_BLOCK; /* convert to block */
|
623
598
|
if ( NIL_P(iv_beg) ) {
|
624
|
-
|
599
|
+
start = 0;
|
625
600
|
}
|
626
601
|
else {
|
627
|
-
|
602
|
+
start = NUM2SIZE(iv_beg);
|
628
603
|
}
|
629
604
|
if ( NIL_P(iv_end) ) {
|
630
605
|
last = -1;
|
@@ -635,20 +610,20 @@ rb_ca_scan_index (int ca_ndim, ca_size_t *ca_dim, ca_size_t ca_elements,
|
|
635
610
|
excl = RTEST(iv_excl);
|
636
611
|
|
637
612
|
if ( info->range_check ) {
|
638
|
-
CA_CHECK_INDEX_AT(
|
613
|
+
CA_CHECK_INDEX_AT(start, ca_dim[i], i);
|
639
614
|
}
|
640
615
|
|
641
616
|
if ( last < 0 ) { /* don't use CA_CHECK_INDEX for excl */
|
642
617
|
last += ca_dim[i];
|
643
618
|
}
|
644
|
-
if ( excl && (
|
645
|
-
index[i].block.start =
|
619
|
+
if ( excl && ( start == last ) ) {
|
620
|
+
index[i].block.start = start;
|
646
621
|
index[i].block.count = 0;
|
647
622
|
index[i].block.step = 1;
|
648
623
|
}
|
649
624
|
else {
|
650
625
|
if ( excl ) {
|
651
|
-
last += ( (last>=
|
626
|
+
last += ( (last>=start) ? -1 : 1 );
|
652
627
|
}
|
653
628
|
if ( info->range_check ) {
|
654
629
|
if ( last < 0 || last >= ca_dim[i] ) {
|
@@ -657,11 +632,71 @@ rb_ca_scan_index (int ca_ndim, ca_size_t *ca_dim, ca_size_t ca_elements,
|
|
657
632
|
(ca_size_t) last, (ca_size_t) (ca_dim[i]-1), i);
|
658
633
|
}
|
659
634
|
}
|
660
|
-
index[i].block.start =
|
661
|
-
index[i].block.count = count = llabs(last -
|
662
|
-
index[i].block.step = step = ( last >=
|
635
|
+
index[i].block.start = start;
|
636
|
+
index[i].block.count = count = llabs(last - start) + 1;
|
637
|
+
index[i].block.step = step = ( last >= start ) ? 1 : -1;
|
663
638
|
}
|
664
639
|
}
|
640
|
+
#ifdef HAVE_RB_ARITHMETIC_SEQUENCE_EXTRACT
|
641
|
+
else if ( rb_obj_is_kind_of(arg, rb_cArithSeq) ) { /* ca[--,ArithSeq,--]*/
|
642
|
+
ca_size_t start, last, excl, count, step, bound;
|
643
|
+
volatile VALUE iv_beg, iv_end, iv_excl;
|
644
|
+
rb_arithmetic_sequence_components_t x;
|
645
|
+
rb_arithmetic_sequence_extract(arg, &x);
|
646
|
+
iv_beg = x.begin;
|
647
|
+
iv_end = x.end;
|
648
|
+
iv_excl = x.exclude_end;
|
649
|
+
step = NUM2SIZE(x.step);
|
650
|
+
if ( NIL_P(iv_beg) ) {
|
651
|
+
start = 0;
|
652
|
+
}
|
653
|
+
else {
|
654
|
+
start = NUM2SIZE(iv_beg);
|
655
|
+
}
|
656
|
+
if ( NIL_P(iv_end) ) {
|
657
|
+
last = -1;
|
658
|
+
}
|
659
|
+
else {
|
660
|
+
last = NUM2SIZE(iv_end);
|
661
|
+
}
|
662
|
+
excl = RTEST(iv_excl);
|
663
|
+
if ( step == 0 ) {
|
664
|
+
rb_raise(rb_eRuntimeError,
|
665
|
+
"step in index equals to 0 in block reference");
|
666
|
+
}
|
667
|
+
index_type[i] = CA_IDX_BLOCK;
|
668
|
+
CA_CHECK_INDEX_AT(start, ca_dim[i], i);
|
669
|
+
if ( last < 0 ) {
|
670
|
+
last += ca_dim[i];
|
671
|
+
}
|
672
|
+
if ( excl && ( start == last ) ) {
|
673
|
+
index[i].block.start = start;
|
674
|
+
index[i].block.count = 0;
|
675
|
+
index[i].block.step = 1;
|
676
|
+
}
|
677
|
+
else {
|
678
|
+
if ( excl ) {
|
679
|
+
last += ( (last>=start) ? -1 : 1 );
|
680
|
+
}
|
681
|
+
if ( last < 0 || last >= ca_dim[i] ) {
|
682
|
+
rb_raise(rb_eIndexError,
|
683
|
+
"index %lld is out of range (0..%lld) at %i-dim",
|
684
|
+
(ca_size_t) last, (ca_size_t) (ca_dim[i]-1), i);
|
685
|
+
}
|
686
|
+
if ( (last - start) * step < 0 ) {
|
687
|
+
count = 1;
|
688
|
+
}
|
689
|
+
else {
|
690
|
+
count = llabs(last - start)/llabs(step) + 1;
|
691
|
+
}
|
692
|
+
bound = start + (count - 1)*step;
|
693
|
+
CA_CHECK_INDEX_AT(bound, ca_dim[i], i);
|
694
|
+
index[i].block.start = start;
|
695
|
+
index[i].block.count = count;
|
696
|
+
index[i].block.step = step;
|
697
|
+
}
|
698
|
+
}
|
699
|
+
#endif
|
665
700
|
else if ( TYPE(arg) == T_ARRAY ) { /* ca[--,[array],--] */
|
666
701
|
if ( RARRAY_LEN(arg) == 1 ) {
|
667
702
|
VALUE arg0 = rb_ary_entry(arg, 0);
|
@@ -1914,12 +1949,9 @@ void
|
|
1914
1949
|
Init_carray_access ()
|
1915
1950
|
{
|
1916
1951
|
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
id_end = rb_intern("end");
|
1921
|
-
id_excl = rb_intern("excl");
|
1922
|
-
#endif
|
1952
|
+
id_begin = rb_intern("begin");
|
1953
|
+
id_end = rb_intern("end");
|
1954
|
+
id_excl_end = rb_intern("exclude_end?");
|
1923
1955
|
|
1924
1956
|
id_ca = rb_intern("ca");
|
1925
1957
|
id_to_ca = rb_intern("to_ca");
|
data/ext/carray_generate.c
CHANGED
@@ -62,15 +62,15 @@ Returns the 1d index array for non-zero elements of self
|
|
62
62
|
VALUE
|
63
63
|
rb_ca_where (VALUE self)
|
64
64
|
{
|
65
|
-
volatile VALUE
|
65
|
+
volatile VALUE bool0, obj;
|
66
66
|
CArray *ca, *co;
|
67
67
|
boolean8_t *p, *m;
|
68
68
|
ca_size_t *q;
|
69
69
|
ca_size_t i, count;
|
70
70
|
|
71
|
-
|
71
|
+
bool0 = ( ! rb_ca_is_boolean_type(self) ) ? rb_ca_to_boolean(self) : self;
|
72
72
|
|
73
|
-
Data_Get_Struct(
|
73
|
+
Data_Get_Struct(bool0, CArray, ca);
|
74
74
|
|
75
75
|
ca_attach(ca);
|
76
76
|
|
data/ext/carray_utils.c
CHANGED
@@ -18,36 +18,10 @@
|
|
18
18
|
#include "st.h"
|
19
19
|
#endif
|
20
20
|
|
21
|
-
|
22
|
-
#define
|
23
|
-
|
24
|
-
|
25
|
-
RSTRUCT_ENUM_END
|
26
|
-
};
|
27
|
-
struct RStruct {
|
28
|
-
struct RBasic basic;
|
29
|
-
union {
|
30
|
-
struct {
|
31
|
-
long len;
|
32
|
-
const VALUE *ptr;
|
33
|
-
} heap;
|
34
|
-
const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
|
35
|
-
} as;
|
36
|
-
};
|
37
|
-
#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
|
38
|
-
#endif
|
39
|
-
|
40
|
-
#if RUBY_VERSION_CODE >= 190
|
41
|
-
#define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0])
|
42
|
-
#define RANGE_END(r) (RSTRUCT(r)->as.ary[1])
|
43
|
-
#define RANGE_EXCL(r) (RSTRUCT(r)->as.ary[2])
|
44
|
-
#else
|
45
|
-
static ID id_beg, id_end, id_excl;
|
46
|
-
#define RANGE_BEG(r) (rb_ivar_get(r, id_beg))
|
47
|
-
#define RANGE_END(r) (rb_ivar_get(r, id_end))
|
48
|
-
#define RANGE_EXCL(r) (rb_ivar_get(r, id_excl))
|
49
|
-
#endif
|
50
|
-
|
21
|
+
static ID id_begin, id_end, id_excl_end;
|
22
|
+
#define RANGE_BEG(r) (rb_funcall(r, id_begin, 0))
|
23
|
+
#define RANGE_END(r) (rb_funcall(r, id_end, 0))
|
24
|
+
#define RANGE_EXCL(r) (rb_funcall(r, id_excl_end, 0))
|
51
25
|
|
52
26
|
/* ------------------------------------------------------------------- */
|
53
27
|
|
@@ -163,7 +137,7 @@ void
|
|
163
137
|
ca_parse_range (VALUE arg, ca_size_t size,
|
164
138
|
ca_size_t *poffset, ca_size_t *pcount, ca_size_t *pstep)
|
165
139
|
{
|
166
|
-
ca_size_t
|
140
|
+
ca_size_t start, last, count, step, bound, excl;
|
167
141
|
|
168
142
|
retry:
|
169
143
|
|
@@ -182,24 +156,59 @@ ca_parse_range (VALUE arg, ca_size_t size,
|
|
182
156
|
}
|
183
157
|
else if ( rb_obj_is_kind_of(arg, rb_cRange) ) {
|
184
158
|
/* i..j */
|
185
|
-
|
159
|
+
start = NUM2SIZE(RANGE_BEG(arg));
|
186
160
|
last = NUM2SIZE(RANGE_END(arg));
|
187
161
|
excl = RTEST(RANGE_EXCL(arg));
|
188
|
-
CA_CHECK_INDEX(
|
162
|
+
CA_CHECK_INDEX(start, size);
|
189
163
|
if ( last < 0 ) {
|
190
164
|
last += size;
|
191
165
|
}
|
192
166
|
if ( excl ) {
|
193
|
-
last += ( (last>=
|
167
|
+
last += ( (last>=start) ? -1 : 1 );
|
194
168
|
}
|
195
169
|
if ( last < 0 || last >= size ) {
|
196
170
|
rb_raise(rb_eIndexError,
|
197
171
|
"invalid index range");
|
198
172
|
}
|
199
|
-
*poffset =
|
200
|
-
*pcount = llabs(last -
|
173
|
+
*poffset = start;
|
174
|
+
*pcount = llabs(last - start) + 1;
|
201
175
|
*pstep = 1;
|
202
176
|
}
|
177
|
+
#ifdef HAVE_RB_ARITHMETIC_SEQUENCE_EXTRACT
|
178
|
+
else if ( rb_obj_is_kind_of(arg, rb_cArithSeq) ) { /* ca[--,ArithSeq,--]*/
|
179
|
+
rb_arithmetic_sequence_components_t x;
|
180
|
+
rb_arithmetic_sequence_extract(arg, &x);
|
181
|
+
|
182
|
+
start = NUM2SIZE(x.begin);
|
183
|
+
last = NUM2SIZE(x.end);
|
184
|
+
excl = RTEST(x.exclude_end);
|
185
|
+
step = NUM2SIZE(x.step);
|
186
|
+
if ( step == 0 ) {
|
187
|
+
rb_raise(rb_eRuntimeError, "step should not be 0");
|
188
|
+
}
|
189
|
+
if ( last < 0 ) {
|
190
|
+
last += size;
|
191
|
+
}
|
192
|
+
if ( excl ) {
|
193
|
+
last += ( (last>=start) ? -1 : 1 );
|
194
|
+
}
|
195
|
+
if ( last < 0 || last >= size ) {
|
196
|
+
rb_raise(rb_eIndexError, "index out of range");
|
197
|
+
}
|
198
|
+
CA_CHECK_INDEX(start, size);
|
199
|
+
if ( (last - start) * step < 0 ) {
|
200
|
+
count = 1;
|
201
|
+
}
|
202
|
+
else {
|
203
|
+
count = llabs(last - start)/llabs(step) + 1;
|
204
|
+
}
|
205
|
+
bound = start + (count - 1)*step;
|
206
|
+
CA_CHECK_INDEX(bound, size);
|
207
|
+
*poffset = start;
|
208
|
+
*pcount = count;
|
209
|
+
*pstep = step;
|
210
|
+
}
|
211
|
+
#endif
|
203
212
|
else if ( TYPE(arg) == T_ARRAY ) {
|
204
213
|
if ( RARRAY_LEN(arg) == 1 ) { /* [nil] or [i..j] or [i] */
|
205
214
|
arg = rb_ary_entry(arg, 0);
|
@@ -252,6 +261,41 @@ ca_parse_range (VALUE arg, ca_size_t size,
|
|
252
261
|
*pcount = count;
|
253
262
|
*pstep = step;
|
254
263
|
}
|
264
|
+
#ifdef HAVE_RB_ARITHMETIC_SEQUENCE_EXTRACT
|
265
|
+
else if ( rb_obj_is_kind_of(arg0, rb_cArithSeq) ) { /* ca[--,ArithSeq,--]*/
|
266
|
+
rb_arithmetic_sequence_components_t x;
|
267
|
+
rb_arithmetic_sequence_extract(arg0, &x);
|
268
|
+
|
269
|
+
start = NUM2SIZE(x.begin);
|
270
|
+
last = NUM2SIZE(x.end);
|
271
|
+
excl = RTEST(x.exclude_end);
|
272
|
+
step = NUM2SIZE(x.step);
|
273
|
+
if ( step == 0 ) {
|
274
|
+
rb_raise(rb_eRuntimeError, "step should not be 0");
|
275
|
+
}
|
276
|
+
if ( last < 0 ) {
|
277
|
+
last += size;
|
278
|
+
}
|
279
|
+
if ( excl ) {
|
280
|
+
last += ( (last>=start) ? -1 : 1 );
|
281
|
+
}
|
282
|
+
if ( last < 0 || last >= size ) {
|
283
|
+
rb_raise(rb_eIndexError, "index out of range");
|
284
|
+
}
|
285
|
+
CA_CHECK_INDEX(start, size);
|
286
|
+
if ( (last - start) * step < 0 ) {
|
287
|
+
count = 1;
|
288
|
+
}
|
289
|
+
else {
|
290
|
+
count = llabs(last - start)/llabs(step) + 1;
|
291
|
+
}
|
292
|
+
bound = start + (count - 1)*step;
|
293
|
+
CA_CHECK_INDEX(bound, size);
|
294
|
+
*poffset = start;
|
295
|
+
*pcount = count;
|
296
|
+
*pstep = step;
|
297
|
+
}
|
298
|
+
#endif
|
255
299
|
else { /* [i,n] */
|
256
300
|
start = NUM2SIZE(arg0);
|
257
301
|
count = NUM2SIZE(arg1);
|
@@ -290,7 +334,7 @@ void
|
|
290
334
|
ca_parse_range_without_check (VALUE arg, ca_size_t size,
|
291
335
|
ca_size_t *poffset, ca_size_t *pcount, ca_size_t *pstep)
|
292
336
|
{
|
293
|
-
ca_size_t
|
337
|
+
ca_size_t start, last, count, step, bound, excl;
|
294
338
|
|
295
339
|
retry:
|
296
340
|
|
@@ -308,16 +352,35 @@ ca_parse_range_without_check (VALUE arg, ca_size_t size,
|
|
308
352
|
}
|
309
353
|
else if ( rb_obj_is_kind_of(arg, rb_cRange) ) {
|
310
354
|
/* i..j */
|
311
|
-
|
355
|
+
start = NUM2SIZE(RANGE_BEG(arg));
|
312
356
|
last = NUM2SIZE(RANGE_END(arg));
|
313
357
|
excl = RTEST(RANGE_EXCL(arg));
|
314
358
|
if ( excl ) {
|
315
|
-
last += ( (last>=
|
359
|
+
last += ( (last>=start) ? -1 : 1 );
|
316
360
|
}
|
317
|
-
*poffset =
|
318
|
-
*pcount = last -
|
361
|
+
*poffset = start;
|
362
|
+
*pcount = last - start + 1;
|
319
363
|
*pstep = 1;
|
320
364
|
}
|
365
|
+
#ifdef HAVE_RB_ARITHMETIC_SEQUENCE_EXTRACT
|
366
|
+
else if ( rb_obj_is_kind_of(arg, rb_cArithSeq) ) { /* ca[--,ArithSeq,--]*/
|
367
|
+
rb_arithmetic_sequence_components_t x;
|
368
|
+
rb_arithmetic_sequence_extract(arg, &x);
|
369
|
+
|
370
|
+
start = NUM2SIZE(x.begin);
|
371
|
+
last = NUM2SIZE(x.end);
|
372
|
+
excl = RTEST(x.exclude_end);
|
373
|
+
step = NUM2SIZE(x.step);
|
374
|
+
if ( excl ) {
|
375
|
+
last += ( (last>=start) ? -1 : 1 );
|
376
|
+
}
|
377
|
+
count = (last - start)/llabs(step) + 1;
|
378
|
+
bound = start + (count - 1)*step;
|
379
|
+
*poffset = start;
|
380
|
+
*pcount = count;
|
381
|
+
*pstep = step;
|
382
|
+
}
|
383
|
+
#endif
|
321
384
|
else if ( TYPE(arg) == T_ARRAY ) {
|
322
385
|
if ( RARRAY_LEN(arg) == 1 ) { /* [nil] or [i..j] or [i] */
|
323
386
|
arg = rb_ary_entry(arg, 0);
|
@@ -349,6 +412,25 @@ ca_parse_range_without_check (VALUE arg, ca_size_t size,
|
|
349
412
|
*pcount = count;
|
350
413
|
*pstep = step;
|
351
414
|
}
|
415
|
+
#ifdef HAVE_RB_ARITHMETIC_SEQUENCE_EXTRACT
|
416
|
+
else if ( rb_obj_is_kind_of(arg0, rb_cArithSeq) ) { /* ca[--,ArithSeq,--]*/
|
417
|
+
rb_arithmetic_sequence_components_t x;
|
418
|
+
rb_arithmetic_sequence_extract(arg0, &x);
|
419
|
+
|
420
|
+
start = NUM2SIZE(x.begin);
|
421
|
+
last = NUM2SIZE(x.end);
|
422
|
+
excl = RTEST(x.exclude_end);
|
423
|
+
step = NUM2SIZE(x.step);
|
424
|
+
if ( excl ) {
|
425
|
+
last += ( (last>=start) ? -1 : 1 );
|
426
|
+
}
|
427
|
+
count = (last - start)/llabs(step) + 1;
|
428
|
+
bound = start + (count - 1)*step;
|
429
|
+
*poffset = start;
|
430
|
+
*pcount = count;
|
431
|
+
*pstep = step;
|
432
|
+
}
|
433
|
+
#endif
|
352
434
|
else { /* [i,n] */
|
353
435
|
start = NUM2SIZE(arg0);
|
354
436
|
count = NUM2SIZE(arg1);
|
@@ -750,12 +832,9 @@ rb_set_options (VALUE ropt, const char *spec_in, ...)
|
|
750
832
|
void
|
751
833
|
Init_carray_utils ()
|
752
834
|
{
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
id_end = rb_intern("end");
|
757
|
-
id_excl = rb_intern("excl");
|
758
|
-
#endif
|
835
|
+
id_begin = rb_intern("begin");
|
836
|
+
id_end = rb_intern("end");
|
837
|
+
id_excl_end = rb_intern("exclude_end?");
|
759
838
|
|
760
839
|
rb_define_singleton_method(rb_cCArray, "_scan_float",
|
761
840
|
rb_ca_s_scan_float, -1);
|
data/ext/extconf.rb
CHANGED
data/ext/ruby_carray.c
CHANGED
@@ -11,6 +11,8 @@
|
|
11
11
|
#include "carray.h"
|
12
12
|
#include "version.h"
|
13
13
|
|
14
|
+
VALUE rb_cArithSeq;
|
15
|
+
|
14
16
|
VALUE rb_eCADataTypeError;
|
15
17
|
VALUE rb_mCA;
|
16
18
|
|
@@ -70,13 +72,14 @@ void Init_ca_iter_window ();
|
|
70
72
|
|
71
73
|
void Init_carray_mathfunc ();
|
72
74
|
|
73
|
-
|
74
75
|
void
|
75
76
|
Init_carray_ext ()
|
76
77
|
{
|
77
78
|
|
78
79
|
/* Classes and Modules */
|
79
80
|
|
81
|
+
rb_cArithSeq = rb_const_get(rb_cEnumerator, rb_intern("ArithmeticSequence"));
|
82
|
+
|
80
83
|
/* -- CArray class -- */
|
81
84
|
|
82
85
|
rb_cCArray = rb_define_class("CArray", rb_cObject);
|
data/ext/version.h
CHANGED
@@ -8,9 +8,9 @@
|
|
8
8
|
|
9
9
|
---------------------------------------------------------------------------- */
|
10
10
|
|
11
|
-
#define CA_VERSION "1.5.
|
12
|
-
#define CA_VERSION_CODE
|
11
|
+
#define CA_VERSION "1.5.6"
|
12
|
+
#define CA_VERSION_CODE 156
|
13
13
|
#define CA_VERSION_MAJOR 1
|
14
14
|
#define CA_VERSION_MINOR 5
|
15
|
-
#define CA_VERSION_TEENY
|
16
|
-
#define CA_VERSION_DATE "2021/02/
|
15
|
+
#define CA_VERSION_TEENY 6
|
16
|
+
#define CA_VERSION_DATE "2021/02/25"
|
data/lib/carray.rb
CHANGED
@@ -59,12 +59,12 @@ unless $CARRAY_NO_AUTOLOAD
|
|
59
59
|
require 'carray/autoload/autoload_gem_gnuplot'
|
60
60
|
require 'carray/autoload/autoload_gem_narray'
|
61
61
|
require 'carray/autoload/autoload_gem_numo_narray'
|
62
|
-
require 'carray/autoload/autoload_gem_io_csv'
|
62
|
+
# require 'carray/autoload/autoload_gem_io_csv'
|
63
63
|
# require 'carray/autoload/autoload_gem_io_sqlite3'
|
64
|
-
require 'carray/autoload/autoload_gem_rmagick'
|
65
|
-
require 'carray/autoload/autoload_gem_cairo'
|
66
|
-
require 'carray/autoload/autoload_gem_opencv'
|
67
|
-
require 'carray/autoload/autoload_gem_ffi'
|
64
|
+
# require 'carray/autoload/autoload_gem_rmagick'
|
65
|
+
# require 'carray/autoload/autoload_gem_cairo'
|
66
|
+
# require 'carray/autoload/autoload_gem_opencv'
|
67
|
+
# require 'carray/autoload/autoload_gem_ffi'
|
68
68
|
|
69
69
|
undef autoload_method
|
70
70
|
end
|
@@ -255,19 +255,19 @@ describe "TestCArrayAttribute " do
|
|
255
255
|
a = CArray.int32(3,3)
|
256
256
|
is_asserted_by { true == a.valid_index?(2, 2) }
|
257
257
|
is_asserted_by { true == a.valid_index?(1, 1) }
|
258
|
-
is_asserted_by { true == a.valid_index?((-1), (-1)) }
|
259
|
-
is_asserted_by { true == a.valid_index?((-3), (-3)) }
|
258
|
+
# is_asserted_by { true == a.valid_index?((-1), (-1)) }
|
259
|
+
# is_asserted_by { true == a.valid_index?((-3), (-3)) }
|
260
260
|
|
261
261
|
is_asserted_by { true == a.valid_addr?(8) }
|
262
262
|
is_asserted_by { true == a.valid_addr?(4) }
|
263
|
-
is_asserted_by { true == a.valid_addr?((-4)) }
|
264
|
-
is_asserted_by { true == a.valid_addr?((-8)) }
|
263
|
+
# is_asserted_by { true == a.valid_addr?((-4)) }
|
264
|
+
# is_asserted_by { true == a.valid_addr?((-8)) }
|
265
265
|
|
266
266
|
is_asserted_by { false == a.valid_index?(1, 3) }
|
267
|
-
is_asserted_by { false == a.valid_index?((-4), 1) }
|
267
|
+
# is_asserted_by { false == a.valid_index?((-4), 1) }
|
268
268
|
|
269
269
|
is_asserted_by { false == a.valid_addr?(9) }
|
270
|
-
is_asserted_by { false == a.valid_addr?((-10)) }
|
270
|
+
# is_asserted_by { false == a.valid_addr?((-10)) }
|
271
271
|
end
|
272
272
|
|
273
273
|
example "same_shape?" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carray
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroki Motoyoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Ruby/CArray is an extension library for the multi-dimensional numerical array
|