numo-narray-alt 0.9.4 → 0.9.5
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/README.md +9 -3
- data/Rakefile +8 -0
- data/ext/numo/narray/SFMT-params19937.h +16 -12
- data/ext/numo/narray/SFMT.c +12 -5
- data/ext/numo/narray/array.c +25 -19
- data/ext/numo/narray/data.c +74 -70
- data/ext/numo/narray/extconf.rb +1 -0
- data/ext/numo/narray/index.c +49 -26
- data/ext/numo/narray/kwargs.c +11 -9
- data/ext/numo/narray/math.c +4 -2
- data/ext/numo/narray/narray.c +17 -10
- data/ext/numo/narray/ndloop.c +52 -63
- data/ext/numo/narray/numo/intern.h +9 -3
- data/ext/numo/narray/numo/narray.h +20 -20
- data/ext/numo/narray/numo/ndloop.h +1 -1
- data/ext/numo/narray/numo/template.h +85 -81
- data/ext/numo/narray/numo/types/complex.h +7 -3
- data/ext/numo/narray/numo/types/complex_macro.h +27 -25
- data/ext/numo/narray/numo/types/float_macro.h +20 -17
- data/ext/numo/narray/numo/types/real_accum.h +22 -22
- data/ext/numo/narray/numo/types/robj_macro.h +19 -12
- data/ext/numo/narray/numo/types/xint_macro.h +9 -8
- data/ext/numo/narray/src/t_bit.c +97 -88
- data/ext/numo/narray/src/t_dcomplex.c +336 -307
- data/ext/numo/narray/src/t_dfloat.c +522 -456
- data/ext/numo/narray/src/t_int16.c +351 -308
- data/ext/numo/narray/src/t_int32.c +351 -308
- data/ext/numo/narray/src/t_int64.c +351 -308
- data/ext/numo/narray/src/t_int8.c +309 -288
- data/ext/numo/narray/src/t_mean.c +105 -0
- data/ext/numo/narray/src/t_robject.c +323 -296
- data/ext/numo/narray/src/t_scomplex.c +327 -302
- data/ext/numo/narray/src/t_sfloat.c +515 -451
- data/ext/numo/narray/src/t_uint16.c +351 -308
- data/ext/numo/narray/src/t_uint32.c +351 -308
- data/ext/numo/narray/src/t_uint64.c +351 -308
- data/ext/numo/narray/src/t_uint8.c +311 -288
- data/ext/numo/narray/step.c +7 -2
- data/ext/numo/narray/struct.c +24 -22
- data/lib/numo/narray/extra.rb +66 -25
- data/numo-narray-alt.gemspec +38 -0
- metadata +7 -1
@@ -238,8 +238,8 @@ static void iter_uint16_store_bit(na_loop_t* const lp) {
|
|
238
238
|
}
|
239
239
|
|
240
240
|
static VALUE uint16_store_bit(VALUE self, VALUE obj) {
|
241
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
242
|
-
ndfunc_t ndf = {iter_uint16_store_bit, FULL_LOOP, 2, 0, ain, 0};
|
241
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
242
|
+
ndfunc_t ndf = { iter_uint16_store_bit, FULL_LOOP, 2, 0, ain, 0 };
|
243
243
|
|
244
244
|
na_ndloop(&ndf, 2, self, obj);
|
245
245
|
return self;
|
@@ -287,8 +287,8 @@ static void iter_uint16_store_dfloat(na_loop_t* const lp) {
|
|
287
287
|
}
|
288
288
|
|
289
289
|
static VALUE uint16_store_dfloat(VALUE self, VALUE obj) {
|
290
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
291
|
-
ndfunc_t ndf = {iter_uint16_store_dfloat, FULL_LOOP, 2, 0, ain, 0};
|
290
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
291
|
+
ndfunc_t ndf = { iter_uint16_store_dfloat, FULL_LOOP, 2, 0, ain, 0 };
|
292
292
|
|
293
293
|
na_ndloop(&ndf, 2, self, obj);
|
294
294
|
return self;
|
@@ -336,8 +336,8 @@ static void iter_uint16_store_sfloat(na_loop_t* const lp) {
|
|
336
336
|
}
|
337
337
|
|
338
338
|
static VALUE uint16_store_sfloat(VALUE self, VALUE obj) {
|
339
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
340
|
-
ndfunc_t ndf = {iter_uint16_store_sfloat, FULL_LOOP, 2, 0, ain, 0};
|
339
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
340
|
+
ndfunc_t ndf = { iter_uint16_store_sfloat, FULL_LOOP, 2, 0, ain, 0 };
|
341
341
|
|
342
342
|
na_ndloop(&ndf, 2, self, obj);
|
343
343
|
return self;
|
@@ -385,8 +385,8 @@ static void iter_uint16_store_int64(na_loop_t* const lp) {
|
|
385
385
|
}
|
386
386
|
|
387
387
|
static VALUE uint16_store_int64(VALUE self, VALUE obj) {
|
388
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
389
|
-
ndfunc_t ndf = {iter_uint16_store_int64, FULL_LOOP, 2, 0, ain, 0};
|
388
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
389
|
+
ndfunc_t ndf = { iter_uint16_store_int64, FULL_LOOP, 2, 0, ain, 0 };
|
390
390
|
|
391
391
|
na_ndloop(&ndf, 2, self, obj);
|
392
392
|
return self;
|
@@ -434,8 +434,8 @@ static void iter_uint16_store_int32(na_loop_t* const lp) {
|
|
434
434
|
}
|
435
435
|
|
436
436
|
static VALUE uint16_store_int32(VALUE self, VALUE obj) {
|
437
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
438
|
-
ndfunc_t ndf = {iter_uint16_store_int32, FULL_LOOP, 2, 0, ain, 0};
|
437
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
438
|
+
ndfunc_t ndf = { iter_uint16_store_int32, FULL_LOOP, 2, 0, ain, 0 };
|
439
439
|
|
440
440
|
na_ndloop(&ndf, 2, self, obj);
|
441
441
|
return self;
|
@@ -483,8 +483,8 @@ static void iter_uint16_store_int16(na_loop_t* const lp) {
|
|
483
483
|
}
|
484
484
|
|
485
485
|
static VALUE uint16_store_int16(VALUE self, VALUE obj) {
|
486
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
487
|
-
ndfunc_t ndf = {iter_uint16_store_int16, FULL_LOOP, 2, 0, ain, 0};
|
486
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
487
|
+
ndfunc_t ndf = { iter_uint16_store_int16, FULL_LOOP, 2, 0, ain, 0 };
|
488
488
|
|
489
489
|
na_ndloop(&ndf, 2, self, obj);
|
490
490
|
return self;
|
@@ -532,8 +532,8 @@ static void iter_uint16_store_int8(na_loop_t* const lp) {
|
|
532
532
|
}
|
533
533
|
|
534
534
|
static VALUE uint16_store_int8(VALUE self, VALUE obj) {
|
535
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
536
|
-
ndfunc_t ndf = {iter_uint16_store_int8, FULL_LOOP, 2, 0, ain, 0};
|
535
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
536
|
+
ndfunc_t ndf = { iter_uint16_store_int8, FULL_LOOP, 2, 0, ain, 0 };
|
537
537
|
|
538
538
|
na_ndloop(&ndf, 2, self, obj);
|
539
539
|
return self;
|
@@ -581,8 +581,8 @@ static void iter_uint16_store_uint64(na_loop_t* const lp) {
|
|
581
581
|
}
|
582
582
|
|
583
583
|
static VALUE uint16_store_uint64(VALUE self, VALUE obj) {
|
584
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
585
|
-
ndfunc_t ndf = {iter_uint16_store_uint64, FULL_LOOP, 2, 0, ain, 0};
|
584
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
585
|
+
ndfunc_t ndf = { iter_uint16_store_uint64, FULL_LOOP, 2, 0, ain, 0 };
|
586
586
|
|
587
587
|
na_ndloop(&ndf, 2, self, obj);
|
588
588
|
return self;
|
@@ -630,8 +630,8 @@ static void iter_uint16_store_uint32(na_loop_t* const lp) {
|
|
630
630
|
}
|
631
631
|
|
632
632
|
static VALUE uint16_store_uint32(VALUE self, VALUE obj) {
|
633
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
634
|
-
ndfunc_t ndf = {iter_uint16_store_uint32, FULL_LOOP, 2, 0, ain, 0};
|
633
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
634
|
+
ndfunc_t ndf = { iter_uint16_store_uint32, FULL_LOOP, 2, 0, ain, 0 };
|
635
635
|
|
636
636
|
na_ndloop(&ndf, 2, self, obj);
|
637
637
|
return self;
|
@@ -679,8 +679,8 @@ static void iter_uint16_store_uint16(na_loop_t* const lp) {
|
|
679
679
|
}
|
680
680
|
|
681
681
|
static VALUE uint16_store_uint16(VALUE self, VALUE obj) {
|
682
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
683
|
-
ndfunc_t ndf = {iter_uint16_store_uint16, FULL_LOOP, 2, 0, ain, 0};
|
682
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
683
|
+
ndfunc_t ndf = { iter_uint16_store_uint16, FULL_LOOP, 2, 0, ain, 0 };
|
684
684
|
|
685
685
|
na_ndloop(&ndf, 2, self, obj);
|
686
686
|
return self;
|
@@ -728,8 +728,8 @@ static void iter_uint16_store_uint8(na_loop_t* const lp) {
|
|
728
728
|
}
|
729
729
|
|
730
730
|
static VALUE uint16_store_uint8(VALUE self, VALUE obj) {
|
731
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
732
|
-
ndfunc_t ndf = {iter_uint16_store_uint8, FULL_LOOP, 2, 0, ain, 0};
|
731
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
732
|
+
ndfunc_t ndf = { iter_uint16_store_uint8, FULL_LOOP, 2, 0, ain, 0 };
|
733
733
|
|
734
734
|
na_ndloop(&ndf, 2, self, obj);
|
735
735
|
return self;
|
@@ -777,8 +777,8 @@ static void iter_uint16_store_robject(na_loop_t* const lp) {
|
|
777
777
|
}
|
778
778
|
|
779
779
|
static VALUE uint16_store_robject(VALUE self, VALUE obj) {
|
780
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
781
|
-
ndfunc_t ndf = {iter_uint16_store_robject, FULL_LOOP, 2, 0, ain, 0};
|
780
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
781
|
+
ndfunc_t ndf = { iter_uint16_store_robject, FULL_LOOP, 2, 0, ain, 0 };
|
782
782
|
|
783
783
|
na_ndloop(&ndf, 2, self, obj);
|
784
784
|
return self;
|
@@ -886,8 +886,8 @@ loop_end:
|
|
886
886
|
}
|
887
887
|
|
888
888
|
static VALUE uint16_store_array(VALUE self, VALUE rary) {
|
889
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {rb_cArray, 0}};
|
890
|
-
ndfunc_t ndf = {iter_uint16_store_array, FULL_LOOP, 2, 0, ain, 0};
|
889
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { rb_cArray, 0 } };
|
890
|
+
ndfunc_t ndf = { iter_uint16_store_array, FULL_LOOP, 2, 0, ain, 0 };
|
891
891
|
|
892
892
|
na_ndloop_store_rarray(&ndf, self, rary);
|
893
893
|
return self;
|
@@ -982,8 +982,10 @@ static VALUE uint16_store(VALUE self, VALUE obj) {
|
|
982
982
|
}
|
983
983
|
}
|
984
984
|
|
985
|
-
rb_raise(
|
986
|
-
|
985
|
+
rb_raise(
|
986
|
+
nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
|
987
|
+
rb_class2name(rb_obj_class(self))
|
988
|
+
);
|
987
989
|
|
988
990
|
return self;
|
989
991
|
}
|
@@ -1077,7 +1079,10 @@ static dtype uint16_extract_data(VALUE obj) {
|
|
1077
1079
|
return uint16_extract_data(r);
|
1078
1080
|
}
|
1079
1081
|
|
1080
|
-
rb_raise(
|
1082
|
+
rb_raise(
|
1083
|
+
nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
|
1084
|
+
rb_class2name(cT)
|
1085
|
+
);
|
1081
1086
|
}
|
1082
1087
|
if (TYPE(obj) == T_ARRAY) {
|
1083
1088
|
if (RARRAY_LEN(obj) != 1) {
|
@@ -1146,8 +1151,8 @@ static VALUE uint16_s_cast(VALUE type, VALUE obj) {
|
|
1146
1151
|
/*
|
1147
1152
|
Multi-dimensional element reference.
|
1148
1153
|
@overload [](dim0,...,dimL)
|
1149
|
-
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1150
|
-
indices.
|
1154
|
+
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1155
|
+
dim0,...,dimL multi-dimensional indices.
|
1151
1156
|
@return [Numeric,Numo::UInt16] an element or NArray view.
|
1152
1157
|
@see Numo::NArray#[]
|
1153
1158
|
@see #[]=
|
@@ -1169,8 +1174,8 @@ static VALUE uint16_aref(int argc, VALUE* argv, VALUE self) {
|
|
1169
1174
|
/*
|
1170
1175
|
Multi-dimensional element assignment.
|
1171
1176
|
@overload []=(dim0,...,dimL,val)
|
1172
|
-
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1173
|
-
indices.
|
1177
|
+
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1178
|
+
dim0,...,dimL multi-dimensional indices.
|
1174
1179
|
@param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
|
1175
1180
|
@return [Numeric,Numo::NArray,Array] returns `val` (last argument).
|
1176
1181
|
@see Numo::NArray#[]=
|
@@ -1241,9 +1246,9 @@ static void iter_uint16_to_a(na_loop_t* const lp) {
|
|
1241
1246
|
@return [Array]
|
1242
1247
|
*/
|
1243
1248
|
static VALUE uint16_to_a(VALUE self) {
|
1244
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
|
1245
|
-
ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
|
1246
|
-
ndfunc_t ndf = {iter_uint16_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
|
1249
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
|
1250
|
+
ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
|
1251
|
+
ndfunc_t ndf = { iter_uint16_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
|
1247
1252
|
return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
|
1248
1253
|
}
|
1249
1254
|
|
@@ -1275,8 +1280,8 @@ static void iter_uint16_fill(na_loop_t* const lp) {
|
|
1275
1280
|
@return [Numo::UInt16] self.
|
1276
1281
|
*/
|
1277
1282
|
static VALUE uint16_fill(VALUE self, VALUE val) {
|
1278
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_option}};
|
1279
|
-
ndfunc_t ndf = {iter_uint16_fill, FULL_LOOP, 2, 0, ain, 0};
|
1283
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
|
1284
|
+
ndfunc_t ndf = { iter_uint16_fill, FULL_LOOP, 2, 0, ain, 0 };
|
1280
1285
|
|
1281
1286
|
na_ndloop(&ndf, 2, self, val);
|
1282
1287
|
return self;
|
@@ -1331,9 +1336,9 @@ static void iter_uint16_format(na_loop_t* const lp) {
|
|
1331
1336
|
static VALUE uint16_format(int argc, VALUE* argv, VALUE self) {
|
1332
1337
|
VALUE fmt = Qnil;
|
1333
1338
|
|
1334
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_option}};
|
1335
|
-
ndfunc_arg_out_t aout[1] = {{numo_cRObject, 0}};
|
1336
|
-
ndfunc_t ndf = {iter_uint16_format, FULL_LOOP_NIP, 2, 1, ain, aout};
|
1339
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_option } };
|
1340
|
+
ndfunc_arg_out_t aout[1] = { { numo_cRObject, 0 } };
|
1341
|
+
ndfunc_t ndf = { iter_uint16_format, FULL_LOOP_NIP, 2, 1, ain, aout };
|
1337
1342
|
|
1338
1343
|
rb_scan_args(argc, argv, "01", &fmt);
|
1339
1344
|
return na_ndloop(&ndf, 2, self, fmt);
|
@@ -1377,9 +1382,9 @@ static void iter_uint16_format_to_a(na_loop_t* const lp) {
|
|
1377
1382
|
*/
|
1378
1383
|
static VALUE uint16_format_to_a(int argc, VALUE* argv, VALUE self) {
|
1379
1384
|
VALUE fmt = Qnil;
|
1380
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
|
1381
|
-
ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
|
1382
|
-
ndfunc_t ndf = {iter_uint16_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
|
1385
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
|
1386
|
+
ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
|
1387
|
+
ndfunc_t ndf = { iter_uint16_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
|
1383
1388
|
|
1384
1389
|
rb_scan_args(argc, argv, "01", &fmt);
|
1385
1390
|
return na_ndloop_cast_narray_to_rarray(&ndf, self, fmt);
|
@@ -1433,8 +1438,8 @@ static void iter_uint16_each(na_loop_t* const lp) {
|
|
1433
1438
|
@see #map
|
1434
1439
|
*/
|
1435
1440
|
static VALUE uint16_each(VALUE self) {
|
1436
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1437
|
-
ndfunc_t ndf = {iter_uint16_each, FULL_LOOP_NIP, 1, 0, ain, 0};
|
1441
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1442
|
+
ndfunc_t ndf = { iter_uint16_each, FULL_LOOP_NIP, 1, 0, ain, 0 };
|
1438
1443
|
|
1439
1444
|
na_ndloop(&ndf, 1, self);
|
1440
1445
|
return self;
|
@@ -1508,9 +1513,9 @@ static void iter_uint16_map(na_loop_t* const lp) {
|
|
1508
1513
|
@return [Numo::UInt16] map of self.
|
1509
1514
|
*/
|
1510
1515
|
static VALUE uint16_map(VALUE self) {
|
1511
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
1512
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1513
|
-
ndfunc_t ndf = {iter_uint16_map, FULL_LOOP, 1, 1, ain, aout};
|
1516
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
1517
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1518
|
+
ndfunc_t ndf = { iter_uint16_map, FULL_LOOP, 1, 1, ain, aout };
|
1514
1519
|
|
1515
1520
|
return na_ndloop(&ndf, 1, self);
|
1516
1521
|
}
|
@@ -1572,8 +1577,8 @@ static void iter_uint16_each_with_index(na_loop_t* const lp) {
|
|
1572
1577
|
@see #map_with_index
|
1573
1578
|
*/
|
1574
1579
|
static VALUE uint16_each_with_index(VALUE self) {
|
1575
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1576
|
-
ndfunc_t ndf = {iter_uint16_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0};
|
1580
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1581
|
+
ndfunc_t ndf = { iter_uint16_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0 };
|
1577
1582
|
|
1578
1583
|
na_ndloop_with_index(&ndf, 1, self);
|
1579
1584
|
return self;
|
@@ -1663,9 +1668,9 @@ static void iter_uint16_map_with_index(na_loop_t* const lp) {
|
|
1663
1668
|
@see #each_with_index
|
1664
1669
|
*/
|
1665
1670
|
static VALUE uint16_map_with_index(VALUE self) {
|
1666
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1667
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1668
|
-
ndfunc_t ndf = {iter_uint16_map_with_index, FULL_LOOP, 1, 1, ain, aout};
|
1671
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1672
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1673
|
+
ndfunc_t ndf = { iter_uint16_map_with_index, FULL_LOOP, 1, 1, ain, aout };
|
1669
1674
|
|
1670
1675
|
return na_ndloop_with_index(&ndf, 1, self);
|
1671
1676
|
}
|
@@ -1717,14 +1722,14 @@ static void iter_uint16_abs(na_loop_t* const lp) {
|
|
1717
1722
|
@return [Numo::UInt16] abs of self.
|
1718
1723
|
*/
|
1719
1724
|
static VALUE uint16_abs(VALUE self) {
|
1720
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
1721
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
1722
|
-
ndfunc_t ndf = {iter_uint16_abs, FULL_LOOP, 1, 1, ain, aout};
|
1725
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
1726
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
1727
|
+
ndfunc_t ndf = { iter_uint16_abs, FULL_LOOP, 1, 1, ain, aout };
|
1723
1728
|
|
1724
1729
|
return na_ndloop(&ndf, 1, self);
|
1725
1730
|
}
|
1726
1731
|
|
1727
|
-
#define check_intdivzero(y)
|
1732
|
+
#define check_intdivzero(y) \
|
1728
1733
|
{}
|
1729
1734
|
|
1730
1735
|
static void iter_uint16_add(na_loop_t* const lp) {
|
@@ -1739,7 +1744,8 @@ static void iter_uint16_add(na_loop_t* const lp) {
|
|
1739
1744
|
INIT_PTR(lp, 2, p3, s3);
|
1740
1745
|
|
1741
1746
|
//
|
1742
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1747
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1748
|
+
is_aligned(p3, sizeof(dtype))) {
|
1743
1749
|
|
1744
1750
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
1745
1751
|
if (p1 == p3) { // inplace case
|
@@ -1756,7 +1762,8 @@ static void iter_uint16_add(na_loop_t* const lp) {
|
|
1756
1762
|
return;
|
1757
1763
|
}
|
1758
1764
|
|
1759
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
1765
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
1766
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
1760
1767
|
//
|
1761
1768
|
|
1762
1769
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -1814,9 +1821,9 @@ static void iter_uint16_add(na_loop_t* const lp) {
|
|
1814
1821
|
#undef check_intdivzero
|
1815
1822
|
|
1816
1823
|
static VALUE uint16_add_self(VALUE self, VALUE other) {
|
1817
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
1818
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1819
|
-
ndfunc_t ndf = {iter_uint16_add, STRIDE_LOOP, 2, 1, ain, aout};
|
1824
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
1825
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1826
|
+
ndfunc_t ndf = { iter_uint16_add, STRIDE_LOOP, 2, 1, ain, aout };
|
1820
1827
|
|
1821
1828
|
return na_ndloop(&ndf, 2, self, other);
|
1822
1829
|
}
|
@@ -1840,7 +1847,7 @@ static VALUE uint16_add(VALUE self, VALUE other) {
|
|
1840
1847
|
}
|
1841
1848
|
}
|
1842
1849
|
|
1843
|
-
#define check_intdivzero(y)
|
1850
|
+
#define check_intdivzero(y) \
|
1844
1851
|
{}
|
1845
1852
|
|
1846
1853
|
static void iter_uint16_sub(na_loop_t* const lp) {
|
@@ -1855,7 +1862,8 @@ static void iter_uint16_sub(na_loop_t* const lp) {
|
|
1855
1862
|
INIT_PTR(lp, 2, p3, s3);
|
1856
1863
|
|
1857
1864
|
//
|
1858
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1865
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1866
|
+
is_aligned(p3, sizeof(dtype))) {
|
1859
1867
|
|
1860
1868
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
1861
1869
|
if (p1 == p3) { // inplace case
|
@@ -1872,7 +1880,8 @@ static void iter_uint16_sub(na_loop_t* const lp) {
|
|
1872
1880
|
return;
|
1873
1881
|
}
|
1874
1882
|
|
1875
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
1883
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
1884
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
1876
1885
|
//
|
1877
1886
|
|
1878
1887
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -1930,9 +1939,9 @@ static void iter_uint16_sub(na_loop_t* const lp) {
|
|
1930
1939
|
#undef check_intdivzero
|
1931
1940
|
|
1932
1941
|
static VALUE uint16_sub_self(VALUE self, VALUE other) {
|
1933
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
1934
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1935
|
-
ndfunc_t ndf = {iter_uint16_sub, STRIDE_LOOP, 2, 1, ain, aout};
|
1942
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
1943
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1944
|
+
ndfunc_t ndf = { iter_uint16_sub, STRIDE_LOOP, 2, 1, ain, aout };
|
1936
1945
|
|
1937
1946
|
return na_ndloop(&ndf, 2, self, other);
|
1938
1947
|
}
|
@@ -1956,7 +1965,7 @@ static VALUE uint16_sub(VALUE self, VALUE other) {
|
|
1956
1965
|
}
|
1957
1966
|
}
|
1958
1967
|
|
1959
|
-
#define check_intdivzero(y)
|
1968
|
+
#define check_intdivzero(y) \
|
1960
1969
|
{}
|
1961
1970
|
|
1962
1971
|
static void iter_uint16_mul(na_loop_t* const lp) {
|
@@ -1971,7 +1980,8 @@ static void iter_uint16_mul(na_loop_t* const lp) {
|
|
1971
1980
|
INIT_PTR(lp, 2, p3, s3);
|
1972
1981
|
|
1973
1982
|
//
|
1974
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1983
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1984
|
+
is_aligned(p3, sizeof(dtype))) {
|
1975
1985
|
|
1976
1986
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
1977
1987
|
if (p1 == p3) { // inplace case
|
@@ -1988,7 +1998,8 @@ static void iter_uint16_mul(na_loop_t* const lp) {
|
|
1988
1998
|
return;
|
1989
1999
|
}
|
1990
2000
|
|
1991
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2001
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2002
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
1992
2003
|
//
|
1993
2004
|
|
1994
2005
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2046,9 +2057,9 @@ static void iter_uint16_mul(na_loop_t* const lp) {
|
|
2046
2057
|
#undef check_intdivzero
|
2047
2058
|
|
2048
2059
|
static VALUE uint16_mul_self(VALUE self, VALUE other) {
|
2049
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2050
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2051
|
-
ndfunc_t ndf = {iter_uint16_mul, STRIDE_LOOP, 2, 1, ain, aout};
|
2060
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2061
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2062
|
+
ndfunc_t ndf = { iter_uint16_mul, STRIDE_LOOP, 2, 1, ain, aout };
|
2052
2063
|
|
2053
2064
|
return na_ndloop(&ndf, 2, self, other);
|
2054
2065
|
}
|
@@ -2072,10 +2083,10 @@ static VALUE uint16_mul(VALUE self, VALUE other) {
|
|
2072
2083
|
}
|
2073
2084
|
}
|
2074
2085
|
|
2075
|
-
#define check_intdivzero(y)
|
2076
|
-
if ((y) == 0) {
|
2077
|
-
lp->err_type = rb_eZeroDivError;
|
2078
|
-
return;
|
2086
|
+
#define check_intdivzero(y) \
|
2087
|
+
if ((y) == 0) { \
|
2088
|
+
lp->err_type = rb_eZeroDivError; \
|
2089
|
+
return; \
|
2079
2090
|
}
|
2080
2091
|
|
2081
2092
|
static void iter_uint16_div(na_loop_t* const lp) {
|
@@ -2090,7 +2101,8 @@ static void iter_uint16_div(na_loop_t* const lp) {
|
|
2090
2101
|
INIT_PTR(lp, 2, p3, s3);
|
2091
2102
|
|
2092
2103
|
//
|
2093
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2104
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2105
|
+
is_aligned(p3, sizeof(dtype))) {
|
2094
2106
|
|
2095
2107
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2096
2108
|
if (p1 == p3) { // inplace case
|
@@ -2107,7 +2119,8 @@ static void iter_uint16_div(na_loop_t* const lp) {
|
|
2107
2119
|
return;
|
2108
2120
|
}
|
2109
2121
|
|
2110
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2122
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2123
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2111
2124
|
//
|
2112
2125
|
|
2113
2126
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2165,9 +2178,9 @@ static void iter_uint16_div(na_loop_t* const lp) {
|
|
2165
2178
|
#undef check_intdivzero
|
2166
2179
|
|
2167
2180
|
static VALUE uint16_div_self(VALUE self, VALUE other) {
|
2168
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2169
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2170
|
-
ndfunc_t ndf = {iter_uint16_div, STRIDE_LOOP, 2, 1, ain, aout};
|
2181
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2182
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2183
|
+
ndfunc_t ndf = { iter_uint16_div, STRIDE_LOOP, 2, 1, ain, aout };
|
2171
2184
|
|
2172
2185
|
return na_ndloop(&ndf, 2, self, other);
|
2173
2186
|
}
|
@@ -2191,10 +2204,10 @@ static VALUE uint16_div(VALUE self, VALUE other) {
|
|
2191
2204
|
}
|
2192
2205
|
}
|
2193
2206
|
|
2194
|
-
#define check_intdivzero(y)
|
2195
|
-
if ((y) == 0) {
|
2196
|
-
lp->err_type = rb_eZeroDivError;
|
2197
|
-
return;
|
2207
|
+
#define check_intdivzero(y) \
|
2208
|
+
if ((y) == 0) { \
|
2209
|
+
lp->err_type = rb_eZeroDivError; \
|
2210
|
+
return; \
|
2198
2211
|
}
|
2199
2212
|
|
2200
2213
|
static void iter_uint16_mod(na_loop_t* const lp) {
|
@@ -2209,7 +2222,8 @@ static void iter_uint16_mod(na_loop_t* const lp) {
|
|
2209
2222
|
INIT_PTR(lp, 2, p3, s3);
|
2210
2223
|
|
2211
2224
|
//
|
2212
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2225
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2226
|
+
is_aligned(p3, sizeof(dtype))) {
|
2213
2227
|
|
2214
2228
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2215
2229
|
if (p1 == p3) { // inplace case
|
@@ -2226,7 +2240,8 @@ static void iter_uint16_mod(na_loop_t* const lp) {
|
|
2226
2240
|
return;
|
2227
2241
|
}
|
2228
2242
|
|
2229
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2243
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2244
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2230
2245
|
//
|
2231
2246
|
|
2232
2247
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2284,9 +2299,9 @@ static void iter_uint16_mod(na_loop_t* const lp) {
|
|
2284
2299
|
#undef check_intdivzero
|
2285
2300
|
|
2286
2301
|
static VALUE uint16_mod_self(VALUE self, VALUE other) {
|
2287
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2288
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2289
|
-
ndfunc_t ndf = {iter_uint16_mod, STRIDE_LOOP, 2, 1, ain, aout};
|
2302
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2303
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2304
|
+
ndfunc_t ndf = { iter_uint16_mod, STRIDE_LOOP, 2, 1, ain, aout };
|
2290
2305
|
|
2291
2306
|
return na_ndloop(&ndf, 2, self, other);
|
2292
2307
|
}
|
@@ -2334,9 +2349,9 @@ static void iter_uint16_divmod(na_loop_t* const lp) {
|
|
2334
2349
|
}
|
2335
2350
|
|
2336
2351
|
static VALUE uint16_divmod_self(VALUE self, VALUE other) {
|
2337
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2338
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
2339
|
-
ndfunc_t ndf = {iter_uint16_divmod, STRIDE_LOOP, 2, 2, ain, aout};
|
2352
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2353
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
2354
|
+
ndfunc_t ndf = { iter_uint16_divmod, STRIDE_LOOP, 2, 2, ain, aout };
|
2340
2355
|
|
2341
2356
|
return na_ndloop(&ndf, 2, self, other);
|
2342
2357
|
}
|
@@ -2395,11 +2410,11 @@ static void iter_uint16_pow_int32(na_loop_t* const lp) {
|
|
2395
2410
|
}
|
2396
2411
|
|
2397
2412
|
static VALUE uint16_pow_self(VALUE self, VALUE other) {
|
2398
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2399
|
-
ndfunc_arg_in_t ain_i[2] = {{cT, 0}, {numo_cInt32, 0}};
|
2400
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2401
|
-
ndfunc_t ndf = {iter_uint16_pow, STRIDE_LOOP, 2, 1, ain, aout};
|
2402
|
-
ndfunc_t ndf_i = {iter_uint16_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout};
|
2413
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2414
|
+
ndfunc_arg_in_t ain_i[2] = { { cT, 0 }, { numo_cInt32, 0 } };
|
2415
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2416
|
+
ndfunc_t ndf = { iter_uint16_pow, STRIDE_LOOP, 2, 1, ain, aout };
|
2417
|
+
ndfunc_t ndf_i = { iter_uint16_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout };
|
2403
2418
|
|
2404
2419
|
// fixme : use na.integer?
|
2405
2420
|
if (FIXNUM_P(other) || rb_obj_is_kind_of(other, numo_cInt32)) {
|
@@ -2495,9 +2510,9 @@ static void iter_uint16_minus(na_loop_t* const lp) {
|
|
2495
2510
|
@return [Numo::UInt16] minus of self.
|
2496
2511
|
*/
|
2497
2512
|
static VALUE uint16_minus(VALUE self) {
|
2498
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2499
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2500
|
-
ndfunc_t ndf = {iter_uint16_minus, FULL_LOOP, 1, 1, ain, aout};
|
2513
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2514
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2515
|
+
ndfunc_t ndf = { iter_uint16_minus, FULL_LOOP, 1, 1, ain, aout };
|
2501
2516
|
|
2502
2517
|
return na_ndloop(&ndf, 1, self);
|
2503
2518
|
}
|
@@ -2570,9 +2585,9 @@ static void iter_uint16_reciprocal(na_loop_t* const lp) {
|
|
2570
2585
|
@return [Numo::UInt16] reciprocal of self.
|
2571
2586
|
*/
|
2572
2587
|
static VALUE uint16_reciprocal(VALUE self) {
|
2573
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2574
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2575
|
-
ndfunc_t ndf = {iter_uint16_reciprocal, FULL_LOOP, 1, 1, ain, aout};
|
2588
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2589
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2590
|
+
ndfunc_t ndf = { iter_uint16_reciprocal, FULL_LOOP, 1, 1, ain, aout };
|
2576
2591
|
|
2577
2592
|
return na_ndloop(&ndf, 1, self);
|
2578
2593
|
}
|
@@ -2645,9 +2660,9 @@ static void iter_uint16_sign(na_loop_t* const lp) {
|
|
2645
2660
|
@return [Numo::UInt16] sign of self.
|
2646
2661
|
*/
|
2647
2662
|
static VALUE uint16_sign(VALUE self) {
|
2648
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2649
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2650
|
-
ndfunc_t ndf = {iter_uint16_sign, FULL_LOOP, 1, 1, ain, aout};
|
2663
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2664
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2665
|
+
ndfunc_t ndf = { iter_uint16_sign, FULL_LOOP, 1, 1, ain, aout };
|
2651
2666
|
|
2652
2667
|
return na_ndloop(&ndf, 1, self);
|
2653
2668
|
}
|
@@ -2720,9 +2735,9 @@ static void iter_uint16_square(na_loop_t* const lp) {
|
|
2720
2735
|
@return [Numo::UInt16] square of self.
|
2721
2736
|
*/
|
2722
2737
|
static VALUE uint16_square(VALUE self) {
|
2723
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2724
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2725
|
-
ndfunc_t ndf = {iter_uint16_square, FULL_LOOP, 1, 1, ain, aout};
|
2738
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2739
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2740
|
+
ndfunc_t ndf = { iter_uint16_square, FULL_LOOP, 1, 1, ain, aout };
|
2726
2741
|
|
2727
2742
|
return na_ndloop(&ndf, 1, self);
|
2728
2743
|
}
|
@@ -2749,9 +2764,9 @@ static void iter_uint16_eq(na_loop_t* const lp) {
|
|
2749
2764
|
}
|
2750
2765
|
|
2751
2766
|
static VALUE uint16_eq_self(VALUE self, VALUE other) {
|
2752
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2753
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
2754
|
-
ndfunc_t ndf = {iter_uint16_eq, STRIDE_LOOP, 2, 1, ain, aout};
|
2767
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2768
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
2769
|
+
ndfunc_t ndf = { iter_uint16_eq, STRIDE_LOOP, 2, 1, ain, aout };
|
2755
2770
|
|
2756
2771
|
return na_ndloop(&ndf, 2, self, other);
|
2757
2772
|
}
|
@@ -2796,9 +2811,9 @@ static void iter_uint16_ne(na_loop_t* const lp) {
|
|
2796
2811
|
}
|
2797
2812
|
|
2798
2813
|
static VALUE uint16_ne_self(VALUE self, VALUE other) {
|
2799
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2800
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
2801
|
-
ndfunc_t ndf = {iter_uint16_ne, STRIDE_LOOP, 2, 1, ain, aout};
|
2814
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2815
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
2816
|
+
ndfunc_t ndf = { iter_uint16_ne, STRIDE_LOOP, 2, 1, ain, aout };
|
2802
2817
|
|
2803
2818
|
return na_ndloop(&ndf, 2, self, other);
|
2804
2819
|
}
|
@@ -2821,7 +2836,7 @@ static VALUE uint16_ne(VALUE self, VALUE other) {
|
|
2821
2836
|
}
|
2822
2837
|
}
|
2823
2838
|
|
2824
|
-
#define check_intdivzero(y)
|
2839
|
+
#define check_intdivzero(y) \
|
2825
2840
|
{}
|
2826
2841
|
|
2827
2842
|
static void iter_uint16_bit_and(na_loop_t* const lp) {
|
@@ -2836,7 +2851,8 @@ static void iter_uint16_bit_and(na_loop_t* const lp) {
|
|
2836
2851
|
INIT_PTR(lp, 2, p3, s3);
|
2837
2852
|
|
2838
2853
|
//
|
2839
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2854
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2855
|
+
is_aligned(p3, sizeof(dtype))) {
|
2840
2856
|
|
2841
2857
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2842
2858
|
if (p1 == p3) { // inplace case
|
@@ -2853,7 +2869,8 @@ static void iter_uint16_bit_and(na_loop_t* const lp) {
|
|
2853
2869
|
return;
|
2854
2870
|
}
|
2855
2871
|
|
2856
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2872
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2873
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2857
2874
|
//
|
2858
2875
|
|
2859
2876
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2911,9 +2928,9 @@ static void iter_uint16_bit_and(na_loop_t* const lp) {
|
|
2911
2928
|
#undef check_intdivzero
|
2912
2929
|
|
2913
2930
|
static VALUE uint16_bit_and_self(VALUE self, VALUE other) {
|
2914
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2915
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2916
|
-
ndfunc_t ndf = {iter_uint16_bit_and, STRIDE_LOOP, 2, 1, ain, aout};
|
2931
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2932
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2933
|
+
ndfunc_t ndf = { iter_uint16_bit_and, STRIDE_LOOP, 2, 1, ain, aout };
|
2917
2934
|
|
2918
2935
|
return na_ndloop(&ndf, 2, self, other);
|
2919
2936
|
}
|
@@ -2937,7 +2954,7 @@ static VALUE uint16_bit_and(VALUE self, VALUE other) {
|
|
2937
2954
|
}
|
2938
2955
|
}
|
2939
2956
|
|
2940
|
-
#define check_intdivzero(y)
|
2957
|
+
#define check_intdivzero(y) \
|
2941
2958
|
{}
|
2942
2959
|
|
2943
2960
|
static void iter_uint16_bit_or(na_loop_t* const lp) {
|
@@ -2952,7 +2969,8 @@ static void iter_uint16_bit_or(na_loop_t* const lp) {
|
|
2952
2969
|
INIT_PTR(lp, 2, p3, s3);
|
2953
2970
|
|
2954
2971
|
//
|
2955
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2972
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2973
|
+
is_aligned(p3, sizeof(dtype))) {
|
2956
2974
|
|
2957
2975
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2958
2976
|
if (p1 == p3) { // inplace case
|
@@ -2969,7 +2987,8 @@ static void iter_uint16_bit_or(na_loop_t* const lp) {
|
|
2969
2987
|
return;
|
2970
2988
|
}
|
2971
2989
|
|
2972
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2990
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2991
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2973
2992
|
//
|
2974
2993
|
|
2975
2994
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -3027,9 +3046,9 @@ static void iter_uint16_bit_or(na_loop_t* const lp) {
|
|
3027
3046
|
#undef check_intdivzero
|
3028
3047
|
|
3029
3048
|
static VALUE uint16_bit_or_self(VALUE self, VALUE other) {
|
3030
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3031
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3032
|
-
ndfunc_t ndf = {iter_uint16_bit_or, STRIDE_LOOP, 2, 1, ain, aout};
|
3049
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3050
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3051
|
+
ndfunc_t ndf = { iter_uint16_bit_or, STRIDE_LOOP, 2, 1, ain, aout };
|
3033
3052
|
|
3034
3053
|
return na_ndloop(&ndf, 2, self, other);
|
3035
3054
|
}
|
@@ -3053,7 +3072,7 @@ static VALUE uint16_bit_or(VALUE self, VALUE other) {
|
|
3053
3072
|
}
|
3054
3073
|
}
|
3055
3074
|
|
3056
|
-
#define check_intdivzero(y)
|
3075
|
+
#define check_intdivzero(y) \
|
3057
3076
|
{}
|
3058
3077
|
|
3059
3078
|
static void iter_uint16_bit_xor(na_loop_t* const lp) {
|
@@ -3068,7 +3087,8 @@ static void iter_uint16_bit_xor(na_loop_t* const lp) {
|
|
3068
3087
|
INIT_PTR(lp, 2, p3, s3);
|
3069
3088
|
|
3070
3089
|
//
|
3071
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3090
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3091
|
+
is_aligned(p3, sizeof(dtype))) {
|
3072
3092
|
|
3073
3093
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
3074
3094
|
if (p1 == p3) { // inplace case
|
@@ -3085,7 +3105,8 @@ static void iter_uint16_bit_xor(na_loop_t* const lp) {
|
|
3085
3105
|
return;
|
3086
3106
|
}
|
3087
3107
|
|
3088
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3108
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3109
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
3089
3110
|
//
|
3090
3111
|
|
3091
3112
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -3143,9 +3164,9 @@ static void iter_uint16_bit_xor(na_loop_t* const lp) {
|
|
3143
3164
|
#undef check_intdivzero
|
3144
3165
|
|
3145
3166
|
static VALUE uint16_bit_xor_self(VALUE self, VALUE other) {
|
3146
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3147
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3148
|
-
ndfunc_t ndf = {iter_uint16_bit_xor, STRIDE_LOOP, 2, 1, ain, aout};
|
3167
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3168
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3169
|
+
ndfunc_t ndf = { iter_uint16_bit_xor, STRIDE_LOOP, 2, 1, ain, aout };
|
3149
3170
|
|
3150
3171
|
return na_ndloop(&ndf, 2, self, other);
|
3151
3172
|
}
|
@@ -3237,14 +3258,14 @@ static void iter_uint16_bit_not(na_loop_t* const lp) {
|
|
3237
3258
|
@return [Numo::UInt16] bit_not of self.
|
3238
3259
|
*/
|
3239
3260
|
static VALUE uint16_bit_not(VALUE self) {
|
3240
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3241
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3242
|
-
ndfunc_t ndf = {iter_uint16_bit_not, FULL_LOOP, 1, 1, ain, aout};
|
3261
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3262
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3263
|
+
ndfunc_t ndf = { iter_uint16_bit_not, FULL_LOOP, 1, 1, ain, aout };
|
3243
3264
|
|
3244
3265
|
return na_ndloop(&ndf, 1, self);
|
3245
3266
|
}
|
3246
3267
|
|
3247
|
-
#define check_intdivzero(y)
|
3268
|
+
#define check_intdivzero(y) \
|
3248
3269
|
{}
|
3249
3270
|
|
3250
3271
|
static void iter_uint16_left_shift(na_loop_t* const lp) {
|
@@ -3259,7 +3280,8 @@ static void iter_uint16_left_shift(na_loop_t* const lp) {
|
|
3259
3280
|
INIT_PTR(lp, 2, p3, s3);
|
3260
3281
|
|
3261
3282
|
//
|
3262
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3283
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3284
|
+
is_aligned(p3, sizeof(dtype))) {
|
3263
3285
|
|
3264
3286
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
3265
3287
|
if (p1 == p3) { // inplace case
|
@@ -3276,7 +3298,8 @@ static void iter_uint16_left_shift(na_loop_t* const lp) {
|
|
3276
3298
|
return;
|
3277
3299
|
}
|
3278
3300
|
|
3279
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3301
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3302
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
3280
3303
|
//
|
3281
3304
|
|
3282
3305
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -3334,9 +3357,9 @@ static void iter_uint16_left_shift(na_loop_t* const lp) {
|
|
3334
3357
|
#undef check_intdivzero
|
3335
3358
|
|
3336
3359
|
static VALUE uint16_left_shift_self(VALUE self, VALUE other) {
|
3337
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3338
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3339
|
-
ndfunc_t ndf = {iter_uint16_left_shift, STRIDE_LOOP, 2, 1, ain, aout};
|
3360
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3361
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3362
|
+
ndfunc_t ndf = { iter_uint16_left_shift, STRIDE_LOOP, 2, 1, ain, aout };
|
3340
3363
|
|
3341
3364
|
return na_ndloop(&ndf, 2, self, other);
|
3342
3365
|
}
|
@@ -3360,7 +3383,7 @@ static VALUE uint16_left_shift(VALUE self, VALUE other) {
|
|
3360
3383
|
}
|
3361
3384
|
}
|
3362
3385
|
|
3363
|
-
#define check_intdivzero(y)
|
3386
|
+
#define check_intdivzero(y) \
|
3364
3387
|
{}
|
3365
3388
|
|
3366
3389
|
static void iter_uint16_right_shift(na_loop_t* const lp) {
|
@@ -3375,7 +3398,8 @@ static void iter_uint16_right_shift(na_loop_t* const lp) {
|
|
3375
3398
|
INIT_PTR(lp, 2, p3, s3);
|
3376
3399
|
|
3377
3400
|
//
|
3378
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3401
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3402
|
+
is_aligned(p3, sizeof(dtype))) {
|
3379
3403
|
|
3380
3404
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
3381
3405
|
if (p1 == p3) { // inplace case
|
@@ -3392,7 +3416,8 @@ static void iter_uint16_right_shift(na_loop_t* const lp) {
|
|
3392
3416
|
return;
|
3393
3417
|
}
|
3394
3418
|
|
3395
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3419
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3420
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
3396
3421
|
//
|
3397
3422
|
|
3398
3423
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -3450,9 +3475,9 @@ static void iter_uint16_right_shift(na_loop_t* const lp) {
|
|
3450
3475
|
#undef check_intdivzero
|
3451
3476
|
|
3452
3477
|
static VALUE uint16_right_shift_self(VALUE self, VALUE other) {
|
3453
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3454
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3455
|
-
ndfunc_t ndf = {iter_uint16_right_shift, STRIDE_LOOP, 2, 1, ain, aout};
|
3478
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3479
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3480
|
+
ndfunc_t ndf = { iter_uint16_right_shift, STRIDE_LOOP, 2, 1, ain, aout };
|
3456
3481
|
|
3457
3482
|
return na_ndloop(&ndf, 2, self, other);
|
3458
3483
|
}
|
@@ -3498,9 +3523,9 @@ static void iter_uint16_gt(na_loop_t* const lp) {
|
|
3498
3523
|
}
|
3499
3524
|
|
3500
3525
|
static VALUE uint16_gt_self(VALUE self, VALUE other) {
|
3501
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3502
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3503
|
-
ndfunc_t ndf = {iter_uint16_gt, STRIDE_LOOP, 2, 1, ain, aout};
|
3526
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3527
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3528
|
+
ndfunc_t ndf = { iter_uint16_gt, STRIDE_LOOP, 2, 1, ain, aout };
|
3504
3529
|
|
3505
3530
|
return na_ndloop(&ndf, 2, self, other);
|
3506
3531
|
}
|
@@ -3545,9 +3570,9 @@ static void iter_uint16_ge(na_loop_t* const lp) {
|
|
3545
3570
|
}
|
3546
3571
|
|
3547
3572
|
static VALUE uint16_ge_self(VALUE self, VALUE other) {
|
3548
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3549
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3550
|
-
ndfunc_t ndf = {iter_uint16_ge, STRIDE_LOOP, 2, 1, ain, aout};
|
3573
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3574
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3575
|
+
ndfunc_t ndf = { iter_uint16_ge, STRIDE_LOOP, 2, 1, ain, aout };
|
3551
3576
|
|
3552
3577
|
return na_ndloop(&ndf, 2, self, other);
|
3553
3578
|
}
|
@@ -3592,9 +3617,9 @@ static void iter_uint16_lt(na_loop_t* const lp) {
|
|
3592
3617
|
}
|
3593
3618
|
|
3594
3619
|
static VALUE uint16_lt_self(VALUE self, VALUE other) {
|
3595
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3596
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3597
|
-
ndfunc_t ndf = {iter_uint16_lt, STRIDE_LOOP, 2, 1, ain, aout};
|
3620
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3621
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3622
|
+
ndfunc_t ndf = { iter_uint16_lt, STRIDE_LOOP, 2, 1, ain, aout };
|
3598
3623
|
|
3599
3624
|
return na_ndloop(&ndf, 2, self, other);
|
3600
3625
|
}
|
@@ -3639,9 +3664,9 @@ static void iter_uint16_le(na_loop_t* const lp) {
|
|
3639
3664
|
}
|
3640
3665
|
|
3641
3666
|
static VALUE uint16_le_self(VALUE self, VALUE other) {
|
3642
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3643
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3644
|
-
ndfunc_t ndf = {iter_uint16_le, STRIDE_LOOP, 2, 1, ain, aout};
|
3667
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3668
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3669
|
+
ndfunc_t ndf = { iter_uint16_le, STRIDE_LOOP, 2, 1, ain, aout };
|
3645
3670
|
|
3646
3671
|
return na_ndloop(&ndf, 2, self, other);
|
3647
3672
|
}
|
@@ -3760,11 +3785,11 @@ static void iter_uint16_clip_max(na_loop_t* const lp) {
|
|
3760
3785
|
# [3, 4, 2, 3, 4, 5, 6, 7, 8, 8]
|
3761
3786
|
*/
|
3762
3787
|
static VALUE uint16_clip(VALUE self, VALUE min, VALUE max) {
|
3763
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {cT, 0}, {cT, 0}};
|
3764
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3765
|
-
ndfunc_t ndf_min = {iter_uint16_clip_min, STRIDE_LOOP, 2, 1, ain, aout};
|
3766
|
-
ndfunc_t ndf_max = {iter_uint16_clip_max, STRIDE_LOOP, 2, 1, ain, aout};
|
3767
|
-
ndfunc_t ndf_both = {iter_uint16_clip, STRIDE_LOOP, 3, 1, ain, aout};
|
3788
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { cT, 0 }, { cT, 0 } };
|
3789
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3790
|
+
ndfunc_t ndf_min = { iter_uint16_clip_min, STRIDE_LOOP, 2, 1, ain, aout };
|
3791
|
+
ndfunc_t ndf_max = { iter_uint16_clip_max, STRIDE_LOOP, 2, 1, ain, aout };
|
3792
|
+
ndfunc_t ndf_both = { iter_uint16_clip, STRIDE_LOOP, 3, 1, ain, aout };
|
3768
3793
|
|
3769
3794
|
if (RTEST(min)) {
|
3770
3795
|
if (RTEST(max)) {
|
@@ -3797,14 +3822,15 @@ static void iter_uint16_sum(na_loop_t* const lp) {
|
|
3797
3822
|
sum of self.
|
3798
3823
|
@overload sum(axis:nil, keepdims:false)
|
3799
3824
|
@param [Numeric,Array,Range] axis Performs sum along the axis.
|
3800
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3825
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3826
|
+
dimensions with size one.
|
3801
3827
|
@return [Numo::UInt16] returns result of sum.
|
3802
3828
|
*/
|
3803
3829
|
static VALUE uint16_sum(int argc, VALUE* argv, VALUE self) {
|
3804
3830
|
VALUE v, reduce;
|
3805
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3806
|
-
ndfunc_arg_out_t aout[1] = {{numo_cUInt64, 0}};
|
3807
|
-
ndfunc_t ndf = {iter_uint16_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3831
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3832
|
+
ndfunc_arg_out_t aout[1] = { { numo_cUInt64, 0 } };
|
3833
|
+
ndfunc_t ndf = { iter_uint16_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3808
3834
|
|
3809
3835
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
|
3810
3836
|
|
@@ -3829,14 +3855,15 @@ static void iter_uint16_prod(na_loop_t* const lp) {
|
|
3829
3855
|
prod of self.
|
3830
3856
|
@overload prod(axis:nil, keepdims:false)
|
3831
3857
|
@param [Numeric,Array,Range] axis Performs prod along the axis.
|
3832
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3858
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3859
|
+
dimensions with size one.
|
3833
3860
|
@return [Numo::UInt16] returns result of prod.
|
3834
3861
|
*/
|
3835
3862
|
static VALUE uint16_prod(int argc, VALUE* argv, VALUE self) {
|
3836
3863
|
VALUE v, reduce;
|
3837
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3838
|
-
ndfunc_arg_out_t aout[1] = {{numo_cUInt64, 0}};
|
3839
|
-
ndfunc_t ndf = {iter_uint16_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3864
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3865
|
+
ndfunc_arg_out_t aout[1] = { { numo_cUInt64, 0 } };
|
3866
|
+
ndfunc_t ndf = { iter_uint16_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3840
3867
|
|
3841
3868
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
|
3842
3869
|
|
@@ -3861,14 +3888,15 @@ static void iter_uint16_min(na_loop_t* const lp) {
|
|
3861
3888
|
min of self.
|
3862
3889
|
@overload min(axis:nil, keepdims:false)
|
3863
3890
|
@param [Numeric,Array,Range] axis Performs min along the axis.
|
3864
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3891
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3892
|
+
dimensions with size one.
|
3865
3893
|
@return [Numo::UInt16] returns result of min.
|
3866
3894
|
*/
|
3867
3895
|
static VALUE uint16_min(int argc, VALUE* argv, VALUE self) {
|
3868
3896
|
VALUE v, reduce;
|
3869
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3870
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3871
|
-
ndfunc_t ndf = {iter_uint16_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3897
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3898
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3899
|
+
ndfunc_t ndf = { iter_uint16_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3872
3900
|
|
3873
3901
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
|
3874
3902
|
|
@@ -3893,14 +3921,15 @@ static void iter_uint16_max(na_loop_t* const lp) {
|
|
3893
3921
|
max of self.
|
3894
3922
|
@overload max(axis:nil, keepdims:false)
|
3895
3923
|
@param [Numeric,Array,Range] axis Performs max along the axis.
|
3896
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3924
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3925
|
+
dimensions with size one.
|
3897
3926
|
@return [Numo::UInt16] returns result of max.
|
3898
3927
|
*/
|
3899
3928
|
static VALUE uint16_max(int argc, VALUE* argv, VALUE self) {
|
3900
3929
|
VALUE v, reduce;
|
3901
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3902
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3903
|
-
ndfunc_t ndf = {iter_uint16_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3930
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3931
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3932
|
+
ndfunc_t ndf = { iter_uint16_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3904
3933
|
|
3905
3934
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
|
3906
3935
|
|
@@ -3925,14 +3954,15 @@ static void iter_uint16_ptp(na_loop_t* const lp) {
|
|
3925
3954
|
ptp of self.
|
3926
3955
|
@overload ptp(axis:nil, keepdims:false)
|
3927
3956
|
@param [Numeric,Array,Range] axis Performs ptp along the axis.
|
3928
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3957
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3958
|
+
dimensions with size one.
|
3929
3959
|
@return [Numo::UInt16] returns result of ptp.
|
3930
3960
|
*/
|
3931
3961
|
static VALUE uint16_ptp(int argc, VALUE* argv, VALUE self) {
|
3932
3962
|
VALUE v, reduce;
|
3933
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3934
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3935
|
-
ndfunc_t ndf = {iter_uint16_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3963
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3964
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3965
|
+
ndfunc_t ndf = { iter_uint16_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3936
3966
|
|
3937
3967
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
|
3938
3968
|
|
@@ -3978,7 +4008,8 @@ static void iter_uint16_max_index_index32(na_loop_t* const lp) {
|
|
3978
4008
|
/*
|
3979
4009
|
Index of the maximum value.
|
3980
4010
|
@overload max_index(axis:nil)
|
3981
|
-
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d
|
4011
|
+
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d
|
4012
|
+
indices**.
|
3982
4013
|
@return [Integer,Numo::Int] returns result indices.
|
3983
4014
|
@see #argmax
|
3984
4015
|
@see #max
|
@@ -3996,9 +4027,9 @@ static void iter_uint16_max_index_index32(na_loop_t* const lp) {
|
|
3996
4027
|
static VALUE uint16_max_index(int argc, VALUE* argv, VALUE self) {
|
3997
4028
|
narray_t* na;
|
3998
4029
|
VALUE idx, reduce;
|
3999
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
|
4000
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4001
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
|
4030
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
|
4031
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4032
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
|
4002
4033
|
|
4003
4034
|
GetNArray(self, na);
|
4004
4035
|
if (na->ndim == 0) {
|
@@ -4060,7 +4091,8 @@ static void iter_uint16_min_index_index32(na_loop_t* const lp) {
|
|
4060
4091
|
/*
|
4061
4092
|
Index of the minimum value.
|
4062
4093
|
@overload min_index(axis:nil)
|
4063
|
-
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d
|
4094
|
+
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d
|
4095
|
+
indices**.
|
4064
4096
|
@return [Integer,Numo::Int] returns result indices.
|
4065
4097
|
@see #argmin
|
4066
4098
|
@see #min
|
@@ -4078,9 +4110,9 @@ static void iter_uint16_min_index_index32(na_loop_t* const lp) {
|
|
4078
4110
|
static VALUE uint16_min_index(int argc, VALUE* argv, VALUE self) {
|
4079
4111
|
narray_t* na;
|
4080
4112
|
VALUE idx, reduce;
|
4081
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
|
4082
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4083
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
|
4113
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
|
4114
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4115
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
|
4084
4116
|
|
4085
4117
|
GetNArray(self, na);
|
4086
4118
|
if (na->ndim == 0) {
|
@@ -4140,7 +4172,8 @@ static void iter_uint16_argmax_arg32(na_loop_t* const lp) {
|
|
4140
4172
|
/*
|
4141
4173
|
Index of the maximum value.
|
4142
4174
|
@overload argmax(axis:nil)
|
4143
|
-
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
|
4175
|
+
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
|
4176
|
+
along the axis**.
|
4144
4177
|
@return [Integer,Numo::Int] returns the result indices.
|
4145
4178
|
@see #max_index
|
4146
4179
|
@see #max
|
@@ -4158,9 +4191,9 @@ static void iter_uint16_argmax_arg32(na_loop_t* const lp) {
|
|
4158
4191
|
static VALUE uint16_argmax(int argc, VALUE* argv, VALUE self) {
|
4159
4192
|
narray_t* na;
|
4160
4193
|
VALUE reduce;
|
4161
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
|
4162
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4163
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
|
4194
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
|
4195
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4196
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
|
4164
4197
|
|
4165
4198
|
GetNArray(self, na);
|
4166
4199
|
if (na->ndim == 0) {
|
@@ -4217,7 +4250,8 @@ static void iter_uint16_argmin_arg32(na_loop_t* const lp) {
|
|
4217
4250
|
/*
|
4218
4251
|
Index of the minimum value.
|
4219
4252
|
@overload argmin(axis:nil)
|
4220
|
-
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
|
4253
|
+
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
|
4254
|
+
along the axis**.
|
4221
4255
|
@return [Integer,Numo::Int] returns the result indices.
|
4222
4256
|
@see #min_index
|
4223
4257
|
@see #min
|
@@ -4235,9 +4269,9 @@ static void iter_uint16_argmin_arg32(na_loop_t* const lp) {
|
|
4235
4269
|
static VALUE uint16_argmin(int argc, VALUE* argv, VALUE self) {
|
4236
4270
|
narray_t* na;
|
4237
4271
|
VALUE reduce;
|
4238
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
|
4239
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4240
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
|
4272
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
|
4273
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4274
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
|
4241
4275
|
|
4242
4276
|
GetNArray(self, na);
|
4243
4277
|
if (na->ndim == 0) {
|
@@ -4278,14 +4312,17 @@ static void iter_uint16_minmax(na_loop_t* const lp) {
|
|
4278
4312
|
minmax of self.
|
4279
4313
|
@overload minmax(axis:nil, keepdims:false)
|
4280
4314
|
@param [Numeric,Array,Range] axis Finds min-max along the axis.
|
4281
|
-
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
4315
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
4316
|
+
as dimensions with size one.
|
4282
4317
|
@return [Numo::UInt16,Numo::UInt16] min and max of self.
|
4283
4318
|
*/
|
4284
4319
|
static VALUE uint16_minmax(int argc, VALUE* argv, VALUE self) {
|
4285
4320
|
VALUE reduce;
|
4286
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4287
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
4288
|
-
ndfunc_t ndf = {
|
4321
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4322
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
4323
|
+
ndfunc_t ndf = {
|
4324
|
+
iter_uint16_minmax, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 2, ain, aout
|
4325
|
+
};
|
4289
4326
|
|
4290
4327
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
|
4291
4328
|
|
@@ -4323,9 +4360,9 @@ static void iter_uint16_s_maximum(na_loop_t* const lp) {
|
|
4323
4360
|
static VALUE uint16_s_maximum(int argc, VALUE* argv, VALUE mod) {
|
4324
4361
|
VALUE a1 = Qnil;
|
4325
4362
|
VALUE a2 = Qnil;
|
4326
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
4327
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4328
|
-
ndfunc_t ndf = {iter_uint16_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
|
4363
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
4364
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4365
|
+
ndfunc_t ndf = { iter_uint16_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
|
4329
4366
|
|
4330
4367
|
rb_scan_args(argc, argv, "20", &a1, &a2);
|
4331
4368
|
|
@@ -4363,9 +4400,9 @@ static void iter_uint16_s_minimum(na_loop_t* const lp) {
|
|
4363
4400
|
static VALUE uint16_s_minimum(int argc, VALUE* argv, VALUE mod) {
|
4364
4401
|
VALUE a1 = Qnil;
|
4365
4402
|
VALUE a2 = Qnil;
|
4366
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
4367
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4368
|
-
ndfunc_t ndf = {iter_uint16_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
|
4403
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
4404
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4405
|
+
ndfunc_t ndf = { iter_uint16_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
|
4369
4406
|
|
4370
4407
|
rb_scan_args(argc, argv, "20", &a1, &a2);
|
4371
4408
|
|
@@ -4404,10 +4441,12 @@ static void iter_uint16_bincount_32(na_loop_t* const lp) {
|
|
4404
4441
|
}
|
4405
4442
|
|
4406
4443
|
static VALUE uint16_bincount_32(VALUE self, size_t length) {
|
4407
|
-
size_t shape_out[1] = {length};
|
4408
|
-
ndfunc_arg_in_t ain[1] = {{cT, 1}};
|
4409
|
-
ndfunc_arg_out_t aout[1] = {{numo_cUInt32, 1, shape_out}};
|
4410
|
-
ndfunc_t ndf = {
|
4444
|
+
size_t shape_out[1] = { length };
|
4445
|
+
ndfunc_arg_in_t ain[1] = { { cT, 1 } };
|
4446
|
+
ndfunc_arg_out_t aout[1] = { { numo_cUInt32, 1, shape_out } };
|
4447
|
+
ndfunc_t ndf = {
|
4448
|
+
iter_uint16_bincount_32, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout
|
4449
|
+
};
|
4411
4450
|
|
4412
4451
|
return na_ndloop(&ndf, 1, self);
|
4413
4452
|
}
|
@@ -4442,10 +4481,12 @@ static void iter_uint16_bincount_64(na_loop_t* const lp) {
|
|
4442
4481
|
}
|
4443
4482
|
|
4444
4483
|
static VALUE uint16_bincount_64(VALUE self, size_t length) {
|
4445
|
-
size_t shape_out[1] = {length};
|
4446
|
-
ndfunc_arg_in_t ain[1] = {{cT, 1}};
|
4447
|
-
ndfunc_arg_out_t aout[1] = {{numo_cUInt64, 1, shape_out}};
|
4448
|
-
ndfunc_t ndf = {
|
4484
|
+
size_t shape_out[1] = { length };
|
4485
|
+
ndfunc_arg_in_t ain[1] = { { cT, 1 } };
|
4486
|
+
ndfunc_arg_out_t aout[1] = { { numo_cUInt64, 1, shape_out } };
|
4487
|
+
ndfunc_t ndf = {
|
4488
|
+
iter_uint16_bincount_64, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout
|
4489
|
+
};
|
4449
4490
|
|
4450
4491
|
return na_ndloop(&ndf, 1, self);
|
4451
4492
|
}
|
@@ -4482,10 +4523,10 @@ static void iter_uint16_bincount_sf(na_loop_t* const lp) {
|
|
4482
4523
|
}
|
4483
4524
|
|
4484
4525
|
static VALUE uint16_bincount_sf(VALUE self, VALUE weight, size_t length) {
|
4485
|
-
size_t shape_out[1] = {length};
|
4486
|
-
ndfunc_arg_in_t ain[2] = {{cT, 1}, {numo_cSFloat, 1}};
|
4487
|
-
ndfunc_arg_out_t aout[1] = {{numo_cSFloat, 1, shape_out}};
|
4488
|
-
ndfunc_t ndf = {iter_uint16_bincount_sf, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout};
|
4526
|
+
size_t shape_out[1] = { length };
|
4527
|
+
ndfunc_arg_in_t ain[2] = { { cT, 1 }, { numo_cSFloat, 1 } };
|
4528
|
+
ndfunc_arg_out_t aout[1] = { { numo_cSFloat, 1, shape_out } };
|
4529
|
+
ndfunc_t ndf = { iter_uint16_bincount_sf, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout };
|
4489
4530
|
|
4490
4531
|
return na_ndloop(&ndf, 2, self, weight);
|
4491
4532
|
}
|
@@ -4519,10 +4560,10 @@ static void iter_uint16_bincount_df(na_loop_t* const lp) {
|
|
4519
4560
|
}
|
4520
4561
|
|
4521
4562
|
static VALUE uint16_bincount_df(VALUE self, VALUE weight, size_t length) {
|
4522
|
-
size_t shape_out[1] = {length};
|
4523
|
-
ndfunc_arg_in_t ain[2] = {{cT, 1}, {numo_cDFloat, 1}};
|
4524
|
-
ndfunc_arg_out_t aout[1] = {{numo_cDFloat, 1, shape_out}};
|
4525
|
-
ndfunc_t ndf = {iter_uint16_bincount_df, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout};
|
4563
|
+
size_t shape_out[1] = { length };
|
4564
|
+
ndfunc_arg_in_t ain[2] = { { cT, 1 }, { numo_cDFloat, 1 } };
|
4565
|
+
ndfunc_arg_out_t aout[1] = { { numo_cDFloat, 1, shape_out } };
|
4566
|
+
ndfunc_t ndf = { iter_uint16_bincount_df, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout };
|
4526
4567
|
|
4527
4568
|
return na_ndloop(&ndf, 2, self, weight);
|
4528
4569
|
}
|
@@ -4562,9 +4603,9 @@ static VALUE uint16_bincount_df(VALUE self, VALUE weight, size_t length) {
|
|
4562
4603
|
*/
|
4563
4604
|
static VALUE uint16_bincount(int argc, VALUE* argv, VALUE self) {
|
4564
4605
|
VALUE weight = Qnil, kw = Qnil;
|
4565
|
-
VALUE opts[1] = {Qundef};
|
4606
|
+
VALUE opts[1] = { Qundef };
|
4566
4607
|
VALUE v, wclass;
|
4567
|
-
ID table[1] = {id_minlength};
|
4608
|
+
ID table[1] = { id_minlength };
|
4568
4609
|
size_t length, minlength;
|
4569
4610
|
|
4570
4611
|
rb_scan_args(argc, argv, "01:", &weight, &kw);
|
@@ -4606,16 +4647,13 @@ static void iter_uint16_cumsum(na_loop_t* const lp) {
|
|
4606
4647
|
INIT_COUNTER(lp, i);
|
4607
4648
|
INIT_PTR(lp, 0, p1, s1);
|
4608
4649
|
INIT_PTR(lp, 1, p2, s2);
|
4609
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
4610
4650
|
|
4611
4651
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
4612
4652
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4613
|
-
// printf("i=%lu x=%f\n",i,x);
|
4614
4653
|
for (i--; i--;) {
|
4615
4654
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
4616
4655
|
m_cumsum(x, y);
|
4617
4656
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4618
|
-
// printf("i=%lu x=%f\n",i,x);
|
4619
4657
|
}
|
4620
4658
|
}
|
4621
4659
|
|
@@ -4628,9 +4666,11 @@ static void iter_uint16_cumsum(na_loop_t* const lp) {
|
|
4628
4666
|
*/
|
4629
4667
|
static VALUE uint16_cumsum(int argc, VALUE* argv, VALUE self) {
|
4630
4668
|
VALUE reduce;
|
4631
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4632
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4633
|
-
ndfunc_t ndf = {
|
4669
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4670
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4671
|
+
ndfunc_t ndf = {
|
4672
|
+
iter_uint16_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
|
4673
|
+
};
|
4634
4674
|
|
4635
4675
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
|
4636
4676
|
|
@@ -4646,16 +4686,13 @@ static void iter_uint16_cumprod(na_loop_t* const lp) {
|
|
4646
4686
|
INIT_COUNTER(lp, i);
|
4647
4687
|
INIT_PTR(lp, 0, p1, s1);
|
4648
4688
|
INIT_PTR(lp, 1, p2, s2);
|
4649
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
4650
4689
|
|
4651
4690
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
4652
4691
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4653
|
-
// printf("i=%lu x=%f\n",i,x);
|
4654
4692
|
for (i--; i--;) {
|
4655
4693
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
4656
4694
|
m_cumprod(x, y);
|
4657
4695
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4658
|
-
// printf("i=%lu x=%f\n",i,x);
|
4659
4696
|
}
|
4660
4697
|
}
|
4661
4698
|
|
@@ -4668,9 +4705,11 @@ static void iter_uint16_cumprod(na_loop_t* const lp) {
|
|
4668
4705
|
*/
|
4669
4706
|
static VALUE uint16_cumprod(int argc, VALUE* argv, VALUE self) {
|
4670
4707
|
VALUE reduce;
|
4671
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4672
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4673
|
-
ndfunc_t ndf = {
|
4708
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4709
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4710
|
+
ndfunc_t ndf = {
|
4711
|
+
iter_uint16_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
|
4712
|
+
};
|
4674
4713
|
|
4675
4714
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
|
4676
4715
|
|
@@ -4716,9 +4755,9 @@ static void iter_uint16_mulsum(na_loop_t* const lp) {
|
|
4716
4755
|
static VALUE uint16_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
4717
4756
|
VALUE v, reduce;
|
4718
4757
|
VALUE naryv[2];
|
4719
|
-
ndfunc_arg_in_t ain[4] = {{cT, 0}, {cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
|
4720
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4721
|
-
ndfunc_t ndf = {iter_uint16_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout};
|
4758
|
+
ndfunc_arg_in_t ain[4] = { { cT, 0 }, { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
|
4759
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4760
|
+
ndfunc_t ndf = { iter_uint16_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout };
|
4722
4761
|
|
4723
4762
|
if (argc < 1) {
|
4724
4763
|
rb_raise(rb_eArgError, "wrong number of arguments (%d for >=1)", argc);
|
@@ -4740,7 +4779,8 @@ static VALUE uint16_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
|
4740
4779
|
@overload mulsum(other, axis:nil, keepdims:false)
|
4741
4780
|
@param [Numo::NArray,Numeric] other
|
4742
4781
|
@param [Numeric,Array,Range] axis Performs mulsum along the axis.
|
4743
|
-
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
4782
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
4783
|
+
as dimensions with size one.
|
4744
4784
|
@return [Numo::NArray] mulsum of self and other.
|
4745
4785
|
*/
|
4746
4786
|
static VALUE uint16_mulsum(int argc, VALUE* argv, VALUE self) {
|
@@ -4825,8 +4865,8 @@ static void iter_uint16_seq(na_loop_t* const lp) {
|
|
4825
4865
|
static VALUE uint16_seq(int argc, VALUE* args, VALUE self) {
|
4826
4866
|
seq_opt_t* g;
|
4827
4867
|
VALUE vbeg = Qnil, vstep = Qnil;
|
4828
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
4829
|
-
ndfunc_t ndf = {iter_uint16_seq, FULL_LOOP, 1, 0, ain, 0};
|
4868
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
4869
|
+
ndfunc_t ndf = { iter_uint16_seq, FULL_LOOP, 1, 0, ain, 0 };
|
4830
4870
|
|
4831
4871
|
g = ALLOCA_N(seq_opt_t, 1);
|
4832
4872
|
g->beg = m_zero;
|
@@ -4883,8 +4923,8 @@ static void iter_uint16_eye(na_loop_t* const lp) {
|
|
4883
4923
|
@return [Numo::UInt16] eye of self.
|
4884
4924
|
*/
|
4885
4925
|
static VALUE uint16_eye(int argc, VALUE* argv, VALUE self) {
|
4886
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 2}};
|
4887
|
-
ndfunc_t ndf = {iter_uint16_eye, NO_LOOP, 1, 0, ain, 0};
|
4926
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 2 } };
|
4927
|
+
ndfunc_t ndf = { iter_uint16_eye, NO_LOOP, 1, 0, ain, 0 };
|
4888
4928
|
ssize_t kofs;
|
4889
4929
|
dtype data;
|
4890
4930
|
char* g;
|
@@ -4914,17 +4954,21 @@ static VALUE uint16_eye(int argc, VALUE* argv, VALUE self) {
|
|
4914
4954
|
// Diagonal offset from the main diagonal.
|
4915
4955
|
if (kofs >= 0) {
|
4916
4956
|
if ((size_t)(kofs) >= na->shape[nd - 1]) {
|
4917
|
-
rb_raise(
|
4918
|
-
|
4919
|
-
|
4920
|
-
|
4957
|
+
rb_raise(
|
4958
|
+
rb_eArgError,
|
4959
|
+
"invalid diagonal offset(%" SZF "d) for "
|
4960
|
+
"last dimension size(%" SZF "d)",
|
4961
|
+
kofs, na->shape[nd - 1]
|
4962
|
+
);
|
4921
4963
|
}
|
4922
4964
|
} else {
|
4923
4965
|
if ((size_t)(-kofs) >= na->shape[nd - 2]) {
|
4924
|
-
rb_raise(
|
4925
|
-
|
4926
|
-
|
4927
|
-
|
4966
|
+
rb_raise(
|
4967
|
+
rb_eArgError,
|
4968
|
+
"invalid diagonal offset(%" SZF "d) for "
|
4969
|
+
"last-1 dimension size(%" SZF "d)",
|
4970
|
+
kofs, na->shape[nd - 2]
|
4971
|
+
);
|
4928
4972
|
}
|
4929
4973
|
}
|
4930
4974
|
|
@@ -5009,7 +5053,8 @@ static void iter_uint16_rand(na_loop_t* const lp) {
|
|
5009
5053
|
Generate uniformly distributed random numbers on self narray.
|
5010
5054
|
@overload rand([[low],high])
|
5011
5055
|
@param [Numeric] low lower inclusive boundary of random numbers. (default=0)
|
5012
|
-
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
5056
|
+
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
5057
|
+
complex types)
|
5013
5058
|
@return [Numo::UInt16] self.
|
5014
5059
|
@example
|
5015
5060
|
Numo::DFloat.new(6).rand
|
@@ -5028,8 +5073,8 @@ static VALUE uint16_rand(int argc, VALUE* args, VALUE self) {
|
|
5028
5073
|
rand_opt_t g;
|
5029
5074
|
VALUE v1 = Qnil, v2 = Qnil;
|
5030
5075
|
dtype high;
|
5031
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
5032
|
-
ndfunc_t ndf = {iter_uint16_rand, FULL_LOOP, 1, 0, ain, 0};
|
5076
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
5077
|
+
ndfunc_t ndf = { iter_uint16_rand, FULL_LOOP, 1, 0, ain, 0 };
|
5033
5078
|
|
5034
5079
|
rb_scan_args(argc, args, "11", &v1, &v2);
|
5035
5080
|
if (v2 == Qnil) {
|
@@ -5077,8 +5122,8 @@ static VALUE uint16_poly(VALUE self, VALUE args) {
|
|
5077
5122
|
int argc, i;
|
5078
5123
|
VALUE* argv;
|
5079
5124
|
volatile VALUE v, a;
|
5080
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5081
|
-
ndfunc_t ndf = {iter_uint16_poly, NO_LOOP, 0, 1, 0, aout};
|
5125
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5126
|
+
ndfunc_t ndf = { iter_uint16_poly, NO_LOOP, 0, 1, 0, aout };
|
5082
5127
|
|
5083
5128
|
argc = (int)RARRAY_LEN(args);
|
5084
5129
|
ndf.nin = argc + 1;
|
@@ -5158,23 +5203,28 @@ static VALUE uint16_poly(VALUE self, VALUE args) {
|
|
5158
5203
|
* We have modified their original by adding a check for already-sorted input,
|
5159
5204
|
* which seems to be a win per discussions on pgsql-hackers around 2006-03-21.
|
5160
5205
|
*/
|
5161
|
-
#define swapcode(TYPE, parmi, parmj, n)
|
5162
|
-
do {
|
5163
|
-
size_t i = (n) / sizeof(TYPE);
|
5164
|
-
TYPE* pi = (TYPE*)(void*)(parmi);
|
5165
|
-
TYPE* pj = (TYPE*)(void*)(parmj);
|
5166
|
-
do {
|
5167
|
-
TYPE t = *pi;
|
5168
|
-
*pi++ = *pj;
|
5169
|
-
*pj++ = t;
|
5170
|
-
} while (--i > 0);
|
5206
|
+
#define swapcode(TYPE, parmi, parmj, n) \
|
5207
|
+
do { \
|
5208
|
+
size_t i = (n) / sizeof(TYPE); \
|
5209
|
+
TYPE* pi = (TYPE*)(void*)(parmi); \
|
5210
|
+
TYPE* pj = (TYPE*)(void*)(parmj); \
|
5211
|
+
do { \
|
5212
|
+
TYPE t = *pi; \
|
5213
|
+
*pi++ = *pj; \
|
5214
|
+
*pj++ = t; \
|
5215
|
+
} while (--i > 0); \
|
5171
5216
|
} while (0)
|
5172
5217
|
|
5173
5218
|
#ifdef HAVE_STDINT_H
|
5174
|
-
#define SWAPINIT(a, es)
|
5219
|
+
#define SWAPINIT(a, es) \
|
5220
|
+
swaptype = (uintptr_t)(a) % sizeof(long) || (es) % sizeof(long) ? 2 \
|
5221
|
+
: (es) == sizeof(long) ? 0 \
|
5222
|
+
: 1;
|
5175
5223
|
#else
|
5176
|
-
#define SWAPINIT(a, es)
|
5177
|
-
swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2
|
5224
|
+
#define SWAPINIT(a, es) \
|
5225
|
+
swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2 \
|
5226
|
+
: (es) == sizeof(long) ? 0 \
|
5227
|
+
: 1;
|
5178
5228
|
#endif
|
5179
5229
|
|
5180
5230
|
static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
|
@@ -5184,19 +5234,20 @@ static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
|
|
5184
5234
|
swapcode(char, a, b, n);
|
5185
5235
|
}
|
5186
5236
|
|
5187
|
-
#define swap(a, b)
|
5188
|
-
if (swaptype == 0) {
|
5189
|
-
long t = *(long*)(void*)(a);
|
5190
|
-
*(long*)(void*)(a) = *(long*)(void*)(b);
|
5191
|
-
*(long*)(void*)(b) = t;
|
5192
|
-
} else
|
5237
|
+
#define swap(a, b) \
|
5238
|
+
if (swaptype == 0) { \
|
5239
|
+
long t = *(long*)(void*)(a); \
|
5240
|
+
*(long*)(void*)(a) = *(long*)(void*)(b); \
|
5241
|
+
*(long*)(void*)(b) = t; \
|
5242
|
+
} else \
|
5193
5243
|
swapfunc(a, b, es, swaptype)
|
5194
5244
|
|
5195
|
-
#define vecswap(a, b, n)
|
5245
|
+
#define vecswap(a, b, n) \
|
5196
5246
|
if ((n) > 0) swapfunc((a), (b), (size_t)(n), swaptype)
|
5197
5247
|
|
5198
|
-
#define med3(a, b, c, _cmp)
|
5199
|
-
(cmpgt(b, a) ? (cmpgt(c, b) ? b : (cmpgt(c, a) ? c : a))
|
5248
|
+
#define med3(a, b, c, _cmp) \
|
5249
|
+
(cmpgt(b, a) ? (cmpgt(c, b) ? b : (cmpgt(c, a) ? c : a)) \
|
5250
|
+
: (cmpgt(b, c) ? b : (cmpgt(c, a) ? a : c)))
|
5200
5251
|
#endif
|
5201
5252
|
|
5202
5253
|
#undef qsort_dtype
|
@@ -5293,8 +5344,8 @@ static void iter_uint16_sort(na_loop_t* const lp) {
|
|
5293
5344
|
*/
|
5294
5345
|
static VALUE uint16_sort(int argc, VALUE* argv, VALUE self) {
|
5295
5346
|
VALUE reduce;
|
5296
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_reduce, 0}};
|
5297
|
-
ndfunc_t ndf = {0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 0, ain, 0};
|
5347
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
|
5348
|
+
ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 0, ain, 0 };
|
5298
5349
|
|
5299
5350
|
if (!TEST_INPLACE(self)) {
|
5300
5351
|
self = na_copy(self);
|
@@ -5395,7 +5446,8 @@ loop:
|
|
5395
5446
|
pm = med3(pl, pm, pn, cmp);
|
5396
5447
|
}
|
5397
5448
|
swap(a, pm);
|
5398
|
-
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
5449
|
+
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
5450
|
+
pb += es, pc -= es) {
|
5399
5451
|
while (pb <= pc && (r = cmp(pb, a)) <= 0) {
|
5400
5452
|
if (r == 0) {
|
5401
5453
|
swap(pa, pb);
|
@@ -5442,7 +5494,6 @@ static void uint16_index64_qsort(na_loop_t* const lp) {
|
|
5442
5494
|
|
5443
5495
|
ptr = (char**)(lp->opt_ptr);
|
5444
5496
|
|
5445
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
5446
5497
|
// o_ptr=%lx,o_step=%ld)\n",(size_t)ptr,(size_t)d_ptr,(ssize_t)d_step,(size_t)i_ptr,(ssize_t)i_step,(size_t)o_ptr,(ssize_t)o_step);
|
5447
5498
|
|
5448
5499
|
if (n == 1) {
|
@@ -5452,21 +5503,17 @@ static void uint16_index64_qsort(na_loop_t* const lp) {
|
|
5452
5503
|
|
5453
5504
|
for (i = 0; i < n; i++) {
|
5454
5505
|
ptr[i] = d_ptr + d_step * i;
|
5455
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
5456
5506
|
}
|
5457
5507
|
|
5458
5508
|
uint16_index_qsort(ptr, n, sizeof(dtype*));
|
5459
5509
|
|
5460
5510
|
// d_ptr = lp->args[0].ptr;
|
5461
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
5462
5511
|
|
5463
5512
|
for (i = 0; i < n; i++) {
|
5464
5513
|
idx = (ptr[i] - d_ptr) / d_step;
|
5465
5514
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
5466
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
5467
5515
|
o_ptr += o_step;
|
5468
5516
|
}
|
5469
|
-
// printf("\n");
|
5470
5517
|
}
|
5471
5518
|
#undef idx_t
|
5472
5519
|
|
@@ -5484,7 +5531,6 @@ static void uint16_index32_qsort(na_loop_t* const lp) {
|
|
5484
5531
|
|
5485
5532
|
ptr = (char**)(lp->opt_ptr);
|
5486
5533
|
|
5487
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
5488
5534
|
// o_ptr=%lx,o_step=%ld)\n",(size_t)ptr,(size_t)d_ptr,(ssize_t)d_step,(size_t)i_ptr,(ssize_t)i_step,(size_t)o_ptr,(ssize_t)o_step);
|
5489
5535
|
|
5490
5536
|
if (n == 1) {
|
@@ -5494,21 +5540,17 @@ static void uint16_index32_qsort(na_loop_t* const lp) {
|
|
5494
5540
|
|
5495
5541
|
for (i = 0; i < n; i++) {
|
5496
5542
|
ptr[i] = d_ptr + d_step * i;
|
5497
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
5498
5543
|
}
|
5499
5544
|
|
5500
5545
|
uint16_index_qsort(ptr, n, sizeof(dtype*));
|
5501
5546
|
|
5502
5547
|
// d_ptr = lp->args[0].ptr;
|
5503
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
5504
5548
|
|
5505
5549
|
for (i = 0; i < n; i++) {
|
5506
5550
|
idx = (ptr[i] - d_ptr) / d_step;
|
5507
5551
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
5508
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
5509
5552
|
o_ptr += o_step;
|
5510
5553
|
}
|
5511
|
-
// printf("\n");
|
5512
5554
|
}
|
5513
5555
|
#undef idx_t
|
5514
5556
|
|
@@ -5525,9 +5567,9 @@ static VALUE uint16_sort_index(int argc, VALUE* argv, VALUE self) {
|
|
5525
5567
|
narray_t* na;
|
5526
5568
|
VALUE idx, tmp, reduce, res;
|
5527
5569
|
char* buf;
|
5528
|
-
ndfunc_arg_in_t ain[3] = {{cT, 0}, {0, 0}, {sym_reduce, 0}};
|
5529
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
5530
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_CUM, 3, 1, ain, aout};
|
5570
|
+
ndfunc_arg_in_t ain[3] = { { cT, 0 }, { 0, 0 }, { sym_reduce, 0 } };
|
5571
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
5572
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_CUM, 3, 1, ain, aout };
|
5531
5573
|
|
5532
5574
|
GetNArray(self, na);
|
5533
5575
|
if (na->ndim == 0) {
|
@@ -5581,15 +5623,16 @@ static void iter_uint16_median(na_loop_t* const lp) {
|
|
5581
5623
|
median of self.
|
5582
5624
|
@overload median(axis:nil, keepdims:false)
|
5583
5625
|
@param [Numeric,Array,Range] axis Finds median along the axis.
|
5584
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
5626
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
5627
|
+
dimensions with size one.
|
5585
5628
|
@return [Numo::UInt16] returns median of self.
|
5586
5629
|
*/
|
5587
5630
|
|
5588
5631
|
static VALUE uint16_median(int argc, VALUE* argv, VALUE self) {
|
5589
5632
|
VALUE v, reduce;
|
5590
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_reduce, 0}};
|
5591
|
-
ndfunc_arg_out_t aout[1] = {{INT2FIX(0), 0}};
|
5592
|
-
ndfunc_t ndf = {0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
5633
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
|
5634
|
+
ndfunc_arg_out_t aout[1] = { { INT2FIX(0), 0 } };
|
5635
|
+
ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
5593
5636
|
|
5594
5637
|
self = na_copy(self); // as temporary buffer
|
5595
5638
|
|