numo-narray 0.9.0.1-x86-mingw32 → 0.9.0.3-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -7
  3. data/Rakefile +21 -6
  4. data/ext/numo/narray/array.c +3 -3
  5. data/ext/numo/narray/data.c +102 -81
  6. data/ext/numo/narray/depend.erb +9 -7
  7. data/ext/numo/narray/extconf.rb +5 -24
  8. data/ext/numo/narray/gen/cogen.rb +19 -4
  9. data/ext/numo/narray/gen/def/bit.rb +31 -0
  10. data/ext/numo/narray/gen/def/robject.rb +1 -1
  11. data/ext/numo/narray/gen/dtype.erb.c +11 -257
  12. data/ext/numo/narray/gen/spec.rb +294 -0
  13. data/ext/numo/narray/gen/tmpl/aset.c +1 -1
  14. data/ext/numo/narray/gen/tmpl/each_with_index.c +1 -1
  15. data/ext/numo/narray/gen/tmpl/eye.c +5 -5
  16. data/ext/numo/narray/gen/tmpl/logseq.c +82 -0
  17. data/ext/numo/narray/gen/tmpl/map_with_index.c +1 -1
  18. data/ext/numo/narray/gen/tmpl/rand.c +126 -5
  19. data/ext/numo/narray/gen/tmpl/seq.c +43 -12
  20. data/ext/numo/narray/gen/tmpl/store_bit.c +55 -0
  21. data/ext/numo/narray/gen/tmpl_bit/allocate.c +28 -0
  22. data/ext/numo/narray/gen/tmpl_bit/aref.c +53 -0
  23. data/ext/numo/narray/gen/tmpl_bit/aset.c +63 -0
  24. data/ext/numo/narray/gen/{tmpl/bit_binary.c → tmpl_bit/binary.c} +1 -1
  25. data/ext/numo/narray/gen/{tmpl → tmpl_bit}/bit_count.c +5 -3
  26. data/ext/numo/narray/gen/tmpl_bit/bit_reduce.c +128 -0
  27. data/ext/numo/narray/gen/tmpl_bit/cast.c +37 -0
  28. data/ext/numo/narray/gen/tmpl_bit/cast_array.c +80 -0
  29. data/ext/numo/narray/gen/tmpl_bit/cast_numeric.c +22 -0
  30. data/ext/numo/narray/gen/tmpl_bit/coerce_cast.c +8 -0
  31. data/ext/numo/narray/gen/tmpl_bit/each.c +44 -0
  32. data/ext/numo/narray/gen/tmpl_bit/each_with_index.c +66 -0
  33. data/ext/numo/narray/gen/tmpl_bit/extract.c +25 -0
  34. data/ext/numo/narray/gen/tmpl_bit/fill.c +65 -0
  35. data/ext/numo/narray/gen/tmpl_bit/format.c +61 -0
  36. data/ext/numo/narray/gen/tmpl_bit/format_to_a.c +48 -0
  37. data/ext/numo/narray/gen/tmpl_bit/inspect.c +18 -0
  38. data/ext/numo/narray/gen/tmpl_bit/map_with_index.c +94 -0
  39. data/ext/numo/narray/gen/tmpl_bit/mask.c +117 -0
  40. data/ext/numo/narray/gen/tmpl_bit/none_p.c +14 -0
  41. data/ext/numo/narray/gen/tmpl_bit/store.c +32 -0
  42. data/ext/numo/narray/gen/tmpl_bit/store_array.c +5 -0
  43. data/ext/numo/narray/gen/tmpl_bit/store_bit.c +66 -0
  44. data/ext/numo/narray/gen/tmpl_bit/store_from.c +56 -0
  45. data/ext/numo/narray/gen/tmpl_bit/store_numeric.c +22 -0
  46. data/ext/numo/narray/gen/tmpl_bit/to_a.c +43 -0
  47. data/ext/numo/narray/gen/{tmpl/bit_unary.c → tmpl_bit/unary.c} +1 -1
  48. data/ext/numo/narray/gen/tmpl_bit/where.c +102 -0
  49. data/ext/numo/narray/gen/tmpl_bit/where2.c +37 -0
  50. data/ext/numo/narray/index.c +9 -7
  51. data/ext/numo/narray/math.c +6 -1
  52. data/ext/numo/narray/narray.c +307 -103
  53. data/ext/numo/narray/ndloop.c +21 -36
  54. data/ext/numo/narray/numo/intern.h +3 -3
  55. data/ext/numo/narray/numo/narray.h +5 -41
  56. data/ext/numo/narray/numo/template.h +2 -2
  57. data/ext/numo/narray/numo/types/bit.h +27 -13
  58. data/ext/numo/narray/numo/types/complex.h +2 -2
  59. data/ext/numo/narray/numo/types/complex_macro.h +19 -7
  60. data/ext/numo/narray/numo/types/dcomplex.h +9 -0
  61. data/ext/numo/narray/numo/types/dfloat.h +6 -0
  62. data/ext/numo/narray/numo/types/float_macro.h +9 -2
  63. data/ext/numo/narray/numo/types/int16.h +0 -1
  64. data/ext/numo/narray/numo/types/int32.h +0 -1
  65. data/ext/numo/narray/numo/types/int64.h +0 -1
  66. data/ext/numo/narray/numo/types/int8.h +0 -1
  67. data/ext/numo/narray/numo/types/int_macro.h +2 -1
  68. data/ext/numo/narray/numo/types/robj_macro.h +9 -2
  69. data/ext/numo/narray/numo/types/robject.h +6 -0
  70. data/ext/numo/narray/numo/types/scomplex.h +9 -0
  71. data/ext/numo/narray/numo/types/sfloat.h +6 -0
  72. data/ext/numo/narray/numo/types/uint16.h +0 -1
  73. data/ext/numo/narray/numo/types/uint32.h +0 -1
  74. data/ext/numo/narray/numo/types/uint64.h +0 -1
  75. data/ext/numo/narray/numo/types/uint8.h +0 -1
  76. data/ext/numo/narray/numo/types/uint_macro.h +2 -1
  77. data/ext/numo/narray/numo/types/xint_macro.h +6 -1
  78. data/ext/numo/narray/rand.c +2 -2
  79. data/ext/numo/narray/step.c +7 -7
  80. data/ext/numo/narray/struct.c +11 -12
  81. data/lib/2.0/numo/narray.so +0 -0
  82. data/lib/2.1/numo/narray.so +0 -0
  83. data/lib/2.2/numo/narray.so +0 -0
  84. data/lib/2.3/numo/narray.so +0 -0
  85. data/lib/2.4/numo/narray.so +0 -0
  86. data/lib/erbpp.rb +6 -2
  87. data/lib/erbpp/line_number.rb +1 -1
  88. data/lib/erbpp/narray_def.rb +23 -19
  89. data/numo-narray.gemspec +2 -2
  90. metadata +45 -10
  91. data/ext/numo/narray/gen/bit.erb.c +0 -811
@@ -0,0 +1,14 @@
1
+ VALUE
2
+ numo_bit_none_p(int argc, VALUE *argv, VALUE self)
3
+ {
4
+ VALUE v;
5
+
6
+ v = numo_bit_any_p(argc,argv,self);
7
+
8
+ if (v==Qtrue) {
9
+ return Qfalse;
10
+ } else if (v==Qfalse) {
11
+ return Qtrue;
12
+ }
13
+ return numo_bit_not(v);
14
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ Store elements to Numo::<%=class_name%> from other.
3
+ @overload store(other)
4
+ @param [Object] other
5
+ @return [Numo::<%=class_name%>] self
6
+ */
7
+ static VALUE
8
+ <%=c_func%>(VALUE self, VALUE obj)
9
+ {
10
+
11
+ VALUE r;
12
+
13
+ <% Store.definitions.each do |x| %>
14
+ if (<%=x.condition%>) {
15
+ <%=x.c_func%>(self,obj);
16
+ return self;
17
+ }
18
+ <% end %>
19
+
20
+ if (IsNArray(obj)) {
21
+ r = rb_funcall(obj, rb_intern("coerce_cast"), 1, cT);
22
+ if (CLASS_OF(r)==cT) {
23
+ <%=c_func%>(self,r);
24
+ return self;
25
+ }
26
+ }
27
+
28
+ rb_raise(nary_eCastError, "unknown conversion from %s to %s",
29
+ rb_class2name(CLASS_OF(obj)),
30
+ rb_class2name(CLASS_OF(self)));
31
+ return self;
32
+ }
@@ -0,0 +1,5 @@
1
+ static VALUE
2
+ <%=c_func%>(VALUE self, VALUE obj)
3
+ {
4
+ return <%=find_tmpl("store").c_func%>(self,<%=find_tmpl("cast_array").c_func%>(obj));
5
+ }
@@ -0,0 +1,66 @@
1
+ static void
2
+ <%=c_iter%>(na_loop_t *const lp)
3
+ {
4
+ size_t n;
5
+ size_t p1, p3;
6
+ ssize_t s1, s3;
7
+ size_t *idx1, *idx3;
8
+ int o1, l1, r1, len;
9
+ BIT_DIGIT *a1, *a3;
10
+ BIT_DIGIT x;
11
+
12
+ INIT_COUNTER(lp, n);
13
+ INIT_PTR_BIT_IDX(lp, 0, a3, p3, s3, idx3);
14
+ INIT_PTR_BIT_IDX(lp, 1, a1, p1, s1, idx1);
15
+ if (s1!=1 || s3!=1 || idx1 || idx3) {
16
+ for (; n--;) {
17
+ LOAD_BIT_STEP(a1, p1, s1, idx1, x);
18
+ STORE_BIT_STEP(a3, p3, s3, idx3, x);
19
+ }
20
+ } else {
21
+ o1 = p1 % NB;
22
+ o1 -= p3;
23
+ l1 = NB+o1;
24
+ r1 = NB-o1;
25
+ if (p3>0 || n<NB) {
26
+ len = NB - p3;
27
+ if ((int)n<len) len=n;
28
+ if (o1>=0) x = *a1>>o1;
29
+ else x = *a1<<-o1;
30
+ if (p1+len>NB) x |= *(a1+1)<<r1;
31
+ a1++;
32
+ *a3 = (x & (SLB(len)<<p3)) | (*a3 & ~(SLB(len)<<p3));
33
+ a3++;
34
+ n -= len;
35
+ }
36
+ if (o1==0) {
37
+ for (; n>=NB; n-=NB) {
38
+ x = *(a1++);
39
+ *(a3++) = x;
40
+ }
41
+ } else {
42
+ for (; n>=NB; n-=NB) {
43
+ x = *a1>>o1;
44
+ if (o1<0) x |= *(a1-1)>>l1;
45
+ if (o1>0) x |= *(a1+1)<<r1;
46
+ a1++;
47
+ *(a3++) = x;
48
+ }
49
+ }
50
+ if (n>0) {
51
+ x = *a1>>o1;
52
+ if (o1<0) x |= *(a1-1)>>l1;
53
+ *a3 = (x & SLB(n)) | (*a3 & BALL<<n);
54
+ }
55
+ }
56
+ }
57
+
58
+ static VALUE
59
+ <%=c_func%>(VALUE self, VALUE obj)
60
+ {
61
+ ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{Qnil,0}};
62
+ ndfunc_t ndf = {<%=c_iter%>, FULL_LOOP, 2,0, ain,0};
63
+
64
+ na_ndloop(&ndf, 2, self, obj);
65
+ return self;
66
+ }
@@ -0,0 +1,56 @@
1
+ static void
2
+ <%=c_iter%>(na_loop_t *const lp)
3
+ {
4
+ ssize_t i, s1, s2;
5
+ size_t p1;
6
+ char *p2;
7
+ size_t *idx1, *idx2;
8
+ <%=dtype%> x;
9
+ BIT_DIGIT *a1;
10
+ BIT_DIGIT y;
11
+
12
+ INIT_COUNTER(lp, i);
13
+ INIT_PTR_BIT_IDX(lp, 0, a1, p1, s1, idx1);
14
+ INIT_PTR_IDX(lp, 1, p2, s2, idx2);
15
+
16
+ if (idx2) {
17
+ if (idx1) {
18
+ for (; i--;) {
19
+ GET_DATA_INDEX(p2,idx2,<%=dtype%>,x);
20
+ y = <%=macro%>(x);
21
+ STORE_BIT(a1, p1+*idx1, y); idx1++;
22
+ }
23
+ } else {
24
+ for (; i--;) {
25
+ GET_DATA_INDEX(p2,idx2,<%=dtype%>,x);
26
+ y = <%=macro%>(x);
27
+ STORE_BIT(a1, p1, y); p1+=s1;
28
+ }
29
+ }
30
+ } else {
31
+ if (idx1) {
32
+ for (; i--;) {
33
+ GET_DATA_STRIDE(p2,s2,<%=dtype%>,x);
34
+ y = <%=macro%>(x);
35
+ STORE_BIT(a1, p1+*idx1, y); idx1++;
36
+ }
37
+ } else {
38
+ for (; i--;) {
39
+ GET_DATA_STRIDE(p2,s2,<%=dtype%>,x);
40
+ y = <%=macro%>(x);
41
+ STORE_BIT(a1, p1, y); p1+=s1;
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+
48
+ static VALUE
49
+ <%=c_func%>(VALUE self, VALUE obj)
50
+ {
51
+ ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{Qnil,0}};
52
+ ndfunc_t ndf = {<%=c_iter%>, FULL_LOOP, 2,0, ain,0};
53
+
54
+ na_ndloop(&ndf, 2, self, obj);
55
+ return self;
56
+ }
@@ -0,0 +1,22 @@
1
+ static VALUE
2
+ numo_<%=tp%>_new_dim0(dtype x)
3
+ {
4
+ VALUE v;
5
+ dtype *ptr;
6
+
7
+ v = rb_narray_new(cT, 0, NULL);
8
+ ptr = (dtype*)(char*)na_get_pointer_for_write(v);
9
+ *ptr = x;
10
+ na_release_lock(v);
11
+ return v;
12
+ }
13
+
14
+ static VALUE
15
+ <%=c_func%>(VALUE self, VALUE obj)
16
+ {
17
+ dtype x;
18
+ x = m_num_to_data(obj);
19
+ obj = numo_<%=tp%>_new_dim0(x);
20
+ <%=find_tmpl("store").c_func%>(self,obj);
21
+ return self;
22
+ }
@@ -0,0 +1,43 @@
1
+ void
2
+ <%=c_iter%>(na_loop_t *const lp)
3
+ {
4
+ size_t i;
5
+ BIT_DIGIT *a1;
6
+ size_t p1;
7
+ ssize_t s1;
8
+ size_t *idx1;
9
+ BIT_DIGIT x=0;
10
+ VALUE a, y;
11
+
12
+ INIT_COUNTER(lp, i);
13
+ INIT_PTR_BIT_IDX(lp, 0, a1, p1, s1, idx1);
14
+ a = rb_ary_new2(i);
15
+ rb_ary_push(lp->args[1].value, a);
16
+ if (idx1) {
17
+ for (; i--;) {
18
+ LOAD_BIT(a1,p1+*idx1,x); idx1++;
19
+ y = m_data_to_num(x);
20
+ rb_ary_push(a,y);
21
+ }
22
+ } else {
23
+ for (; i--;) {
24
+ LOAD_BIT(a1,p1,x); p1+=s1;
25
+ y = m_data_to_num(x);
26
+ rb_ary_push(a,y);
27
+ }
28
+ }
29
+ }
30
+
31
+ /*
32
+ Convert self to Array.
33
+ @overload <%=method%>
34
+ @return [Array]
35
+ */
36
+ static VALUE
37
+ <%=c_func%>(VALUE self)
38
+ {
39
+ ndfunc_arg_in_t ain[3] = {{Qnil,0},{sym_loop_opt},{sym_option}};
40
+ ndfunc_arg_out_t aout[1] = {{rb_cArray,0}}; // dummy?
41
+ ndfunc_t ndf = {<%=c_iter%>, FULL_LOOP_NIP, 3,1, ain,aout};
42
+ return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
43
+ }
@@ -71,7 +71,7 @@ static VALUE
71
71
  {
72
72
  ndfunc_arg_in_t ain[1] = {{cT,0}};
73
73
  ndfunc_arg_out_t aout[1] = {{cT,0}};
74
- ndfunc_t ndf = { <%=c_iter%>, STRIDE_LOOP, 1, 1, ain, aout };
74
+ ndfunc_t ndf = {<%=c_iter%>, FULL_LOOP, 1,1, ain,aout};
75
75
 
76
76
  return na_ndloop(&ndf, 1, self);
77
77
  }
@@ -0,0 +1,102 @@
1
+ typedef struct {
2
+ size_t count;
3
+ char *idx0;
4
+ char *idx1;
5
+ size_t elmsz;
6
+ } where_opt_t;
7
+
8
+ #define STORE_INT(ptr, esz, x) memcpy(ptr,&(x),esz)
9
+
10
+ static void
11
+ iter_bit_where(na_loop_t *const lp)
12
+ {
13
+ size_t i;
14
+ BIT_DIGIT *a;
15
+ size_t p;
16
+ ssize_t s;
17
+ size_t *idx;
18
+ BIT_DIGIT x=0;
19
+ char *idx0, *idx1;
20
+ size_t count;
21
+ size_t e;
22
+ where_opt_t *g;
23
+
24
+ g = (where_opt_t*)(lp->opt_ptr);
25
+ count = g->count;
26
+ idx0 = g->idx0;
27
+ idx1 = g->idx1;
28
+ e = g->elmsz;
29
+ INIT_COUNTER(lp, i);
30
+ INIT_PTR_BIT_IDX(lp, 0, a, p, s, idx);
31
+ if (idx) {
32
+ for (; i--;) {
33
+ LOAD_BIT(a, p+*idx, x);
34
+ idx++;
35
+ if (x==0) {
36
+ if (idx0) {
37
+ STORE_INT(idx0,e,count);
38
+ idx0 += e;
39
+ }
40
+ } else {
41
+ if (idx1) {
42
+ STORE_INT(idx1,e,count);
43
+ idx1 += e;
44
+ }
45
+ }
46
+ count++;
47
+ }
48
+ } else {
49
+ for (; i--;) {
50
+ LOAD_BIT(a, p, x);
51
+ p+=s;
52
+ if (x==0) {
53
+ if (idx0) {
54
+ STORE_INT(idx0,e,count);
55
+ idx0 += e;
56
+ }
57
+ } else {
58
+ if (idx1) {
59
+ STORE_INT(idx1,e,count);
60
+ idx1 += e;
61
+ }
62
+ }
63
+ count++;
64
+ }
65
+ }
66
+ g->count = count;
67
+ g->idx0 = idx0;
68
+ g->idx1 = idx1;
69
+ }
70
+
71
+ /*
72
+ Returns the array of index where the bit is one (true).
73
+ @overload <%=op_map%>
74
+ @return [Numo::Int32,Numo::Int64]
75
+ */
76
+ static VALUE
77
+ numo_bit_where(VALUE self)
78
+ {
79
+ volatile VALUE idx_1;
80
+ size_t size, n_1;
81
+ where_opt_t *g;
82
+
83
+ ndfunc_arg_in_t ain[1] = {{cT,0}};
84
+ ndfunc_t ndf = { iter_bit_where, FULL_LOOP, 1, 0, ain, 0 };
85
+
86
+ size = RNARRAY_SIZE(self);
87
+ n_1 = NUM2SIZET(numo_bit_count_true(0, NULL, self));
88
+ g = ALLOCA_N(where_opt_t,1);
89
+ g->count = 0;
90
+ if (size>4294967295ul) {
91
+ idx_1 = rb_narray_new(numo_cInt64, 1, &n_1);
92
+ g->elmsz = 8;
93
+ } else {
94
+ idx_1 = rb_narray_new(numo_cInt32, 1, &n_1);
95
+ g->elmsz = 4;
96
+ }
97
+ g->idx1 = na_get_pointer_for_write(idx_1);
98
+ g->idx0 = NULL;
99
+ na_ndloop3(&ndf, g, 1, self);
100
+ na_release_lock(idx_1);
101
+ return idx_1;
102
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ Returns two index arrays.
3
+ The first array contains index where the bit is one (true).
4
+ The second array contains index where the bit is zero (false).
5
+ @overload <%=op_map%>
6
+ @return [Numo::Int32,Numo::Int64]*2
7
+ */
8
+ static VALUE
9
+ numo_bit_where2(VALUE self)
10
+ {
11
+ VALUE idx_1, idx_0;
12
+ size_t size, n_1;
13
+ where_opt_t *g;
14
+
15
+ ndfunc_arg_in_t ain[1] = {{cT,0}};
16
+ ndfunc_t ndf = { iter_bit_where, FULL_LOOP, 1, 0, ain, 0 };
17
+
18
+ size = RNARRAY_SIZE(self);
19
+ n_1 = NUM2SIZET(numo_bit_count_true(0, NULL, self));
20
+ g = ALLOCA_N(where_opt_t,1);
21
+ g->count = 0;
22
+ if (size>4294967295ul) {
23
+ idx_1 = rb_narray_new(numo_cInt64, 1, &n_1);
24
+ idx_0 = rb_narray_new(numo_cInt64, 1, &n_1);
25
+ g->elmsz = 8;
26
+ } else {
27
+ idx_1 = rb_narray_new(numo_cInt32, 1, &n_1);
28
+ idx_0 = rb_narray_new(numo_cInt32, 1, &n_1);
29
+ g->elmsz = 4;
30
+ }
31
+ g->idx1 = na_get_pointer_for_write(idx_1);
32
+ g->idx0 = na_get_pointer_for_write(idx_0);
33
+ na_ndloop3(&ndf, g, 1, self);
34
+ na_release_lock(idx_0);
35
+ na_release_lock(idx_1);
36
+ return rb_assoc_new(idx_1,idx_0);
37
+ }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  index.c
3
3
  Numerical Array Extension for Ruby
4
- (C) Copyright 1999-2011 by Masahiro TANAKA
4
+ (C) Copyright 1999-2016 by Masahiro TANAKA
5
5
 
6
6
  This program is free software.
7
7
  You can distribute/modify this program
@@ -152,7 +152,7 @@ na_parse_array(VALUE ary, int orig_dim, ssize_t size, na_index_arg_t *q)
152
152
  int n = RARRAY_LEN(ary);
153
153
  q->idx = ALLOC_N(size_t, n);
154
154
  for (k=0; k<n; k++) {
155
- q->idx[k] = na_range_check(NUM2SSIZE(RARRAY_AREF(ary,k)), size, orig_dim);
155
+ q->idx[k] = na_range_check(NUM2SSIZET(RARRAY_AREF(ary,k)), size, orig_dim);
156
156
  }
157
157
  q->n = n;
158
158
  q->beg = 0;
@@ -207,7 +207,7 @@ na_parse_range(VALUE range, int orig_dim, ssize_t size, na_index_arg_t *q)
207
207
  if (beg < -size || beg >= size ||
208
208
  end < -size || end >= size) {
209
209
  rb_raise(rb_eRangeError,
210
- "beg=%ld,end=%ld is out of array size (%ld)",
210
+ "beg=%"SZF"d,end=%"SZF"d is out of array size (%"SZF"d)",
211
211
  beg, end, size);
212
212
  }
213
213
  n = end-beg+1;
@@ -232,11 +232,11 @@ na_index_parse_each(volatile VALUE a, ssize_t size, int i, na_index_arg_t *q)
232
232
  break;
233
233
 
234
234
  case T_BIGNUM:
235
- na_index_set_scalar(q,i,size,NUM2SSIZE(a));
235
+ na_index_set_scalar(q,i,size,NUM2SSIZET(a));
236
236
  break;
237
237
 
238
238
  case T_FLOAT:
239
- na_index_set_scalar(q,i,size,NUM2SSIZE(a));
239
+ na_index_set_scalar(q,i,size,NUM2SSIZET(a));
240
240
  break;
241
241
 
242
242
  case T_NIL:
@@ -257,6 +257,8 @@ na_index_parse_each(volatile VALUE a, ssize_t size, int i, na_index_arg_t *q)
257
257
  else if (a==sym_reduce || a==sym_sum || a==sym_plus) {
258
258
  na_index_set_step(q,i,size,0,1);
259
259
  q->reduce = 1;
260
+ } else {
261
+ rb_raise(rb_eIndexError, "invalid symbol for index");
260
262
  }
261
263
  break;
262
264
 
@@ -636,7 +638,7 @@ na_aref_main(int nidx, VALUE *idx, VALUE self, int keep_dim)
636
638
  na_index_arg_to_internal_order(nidx, idx, self);
637
639
 
638
640
  if (nidx==0) {
639
- return na_copy(self);
641
+ return rb_funcall(self,rb_intern("copy"),0);
640
642
  }
641
643
  if (nidx==1) {
642
644
  if (CLASS_OF(*idx)==numo_cBit) {
@@ -744,7 +746,7 @@ na_get_scalar_position(VALUE self, int argc, VALUE *argv, ssize_t stride)
744
746
  break;
745
747
  case T_BIGNUM:
746
748
  case T_FLOAT:
747
- idx[i] = NUM2SSIZE(argv[i]);
749
+ idx[i] = NUM2SSIZET(argv[i]);
748
750
  break;
749
751
  default:
750
752
  return -1;