numo-narray 0.9.1.7 → 0.9.1.8
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/ext/numo/narray/array.c +9 -17
- data/ext/numo/narray/data.c +1 -7
- data/ext/numo/narray/numo/narray.h +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 596c9ece21d3e9d75cf78a7b6d60b3fbda065a23718763bb3632cc8cae45fab6
|
4
|
+
data.tar.gz: bf03dd10e983d362a233bab2ec356e6a68e9dc3e27edccdf40018e661a15fe87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58ef93f8200db87e99012b56bd7f8ccf22cb97abc77b1596e16a855f509fab498e33859b78f6b9626347ed83769eeb9011a7d59a93b3a8527131cad657b58d17
|
7
|
+
data.tar.gz: ac72e280b35ee08eb3b9faf5880355ccdeb4f39d521ba3f9d6067e96102e55561433eff16ed0b0b512da63057dca18d8eb6d72a4687a6d75321e5c29068c70fd
|
data/ext/numo/narray/array.c
CHANGED
@@ -30,6 +30,9 @@ static ID id_step;
|
|
30
30
|
static ID id_abs;
|
31
31
|
static ID id_cast;
|
32
32
|
static ID id_le;
|
33
|
+
#if SIZEOF_LONG <= 4
|
34
|
+
static ID id_ge;
|
35
|
+
#endif
|
33
36
|
static ID id_Complex;
|
34
37
|
static VALUE int32_max = Qnil;
|
35
38
|
static VALUE int32_min = Qnil;
|
@@ -45,7 +48,7 @@ static VALUE
|
|
45
48
|
return NA_BIT;
|
46
49
|
return type;
|
47
50
|
|
48
|
-
#if SIZEOF_LONG
|
51
|
+
#if SIZEOF_LONG <= 4
|
49
52
|
case T_FIXNUM:
|
50
53
|
if (type<NA_INT32)
|
51
54
|
return NA_INT32;
|
@@ -61,12 +64,11 @@ static VALUE
|
|
61
64
|
}
|
62
65
|
}
|
63
66
|
return type;
|
64
|
-
|
65
|
-
#elif SIZEOF_LONG == 8
|
67
|
+
#else
|
66
68
|
case T_FIXNUM:
|
67
69
|
if (type<NA_INT64) {
|
68
70
|
long x = NUM2LONG(v);
|
69
|
-
if (x<=
|
71
|
+
if (x<=2147483647L && x>=-2147483648L) {
|
70
72
|
if (type<NA_INT32)
|
71
73
|
return NA_INT32;
|
72
74
|
} else {
|
@@ -78,19 +80,6 @@ static VALUE
|
|
78
80
|
if (type<NA_INT64)
|
79
81
|
return NA_INT64;
|
80
82
|
return type;
|
81
|
-
#else
|
82
|
-
case T_FIXNUM:
|
83
|
-
case T_BIGNUM:
|
84
|
-
if (type<NA_INT64) {
|
85
|
-
if (RTEST(rb_funcall(v,id_le,1,int32_max)) &&
|
86
|
-
RTEST(rb_funcall(v,id_ge,1,int32_min))) {
|
87
|
-
if (type<NA_INT32)
|
88
|
-
return NA_INT32;
|
89
|
-
} else {
|
90
|
-
return NA_INT64;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
return type;
|
94
83
|
#endif
|
95
84
|
|
96
85
|
case T_FLOAT:
|
@@ -645,6 +634,9 @@ Init_nary_array()
|
|
645
634
|
id_cast = rb_intern("cast");
|
646
635
|
id_abs = rb_intern("abs");
|
647
636
|
id_le = rb_intern("<=");
|
637
|
+
#if SIZEOF_LONG <= 4
|
638
|
+
id_ge = rb_intern(">=");
|
639
|
+
#endif
|
648
640
|
id_Complex = rb_intern("Complex");
|
649
641
|
|
650
642
|
rb_global_variable(&int32_max);
|
data/ext/numo/narray/data.c
CHANGED
@@ -8,9 +8,7 @@
|
|
8
8
|
#include "numo/narray.h"
|
9
9
|
#include "numo/template.h"
|
10
10
|
|
11
|
-
static VALUE sym_mulsum;
|
12
11
|
static ID id_mulsum;
|
13
|
-
static ID id_respond_to_p;
|
14
12
|
static ID id_store;
|
15
13
|
static ID id_swap_byte;
|
16
14
|
|
@@ -921,12 +919,10 @@ na_new_dimension_for_dot(VALUE self, int pos, int len, bool transpose)
|
|
921
919
|
static VALUE
|
922
920
|
numo_na_dot(VALUE self, VALUE other)
|
923
921
|
{
|
924
|
-
VALUE test;
|
925
922
|
volatile VALUE a1=self, a2=other;
|
926
923
|
narray_t *na1, *na2;
|
927
924
|
|
928
|
-
|
929
|
-
if (!RTEST(test)) {
|
925
|
+
if (!rb_respond_to(a1, id_mulsum)) {
|
930
926
|
rb_raise(rb_eNoMethodError,"requires mulsum method for dot method");
|
931
927
|
}
|
932
928
|
GetNArray(a1,na1);
|
@@ -983,8 +979,6 @@ Init_nary_data()
|
|
983
979
|
//rb_define_method(cNArray, "dot", numo_na_dot, 1);
|
984
980
|
|
985
981
|
id_mulsum = rb_intern("mulsum");
|
986
|
-
sym_mulsum = ID2SYM(id_mulsum);
|
987
|
-
id_respond_to_p = rb_intern("respond_to?");
|
988
982
|
id_store = rb_intern("store");
|
989
983
|
id_swap_byte = rb_intern("swap_byte");
|
990
984
|
}
|