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
@@ -237,8 +237,8 @@ static void iter_sfloat_store_bit(na_loop_t* const lp) {
|
|
237
237
|
}
|
238
238
|
|
239
239
|
static VALUE sfloat_store_bit(VALUE self, VALUE obj) {
|
240
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
241
|
-
ndfunc_t ndf = {iter_sfloat_store_bit, FULL_LOOP, 2, 0, ain, 0};
|
240
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
241
|
+
ndfunc_t ndf = { iter_sfloat_store_bit, FULL_LOOP, 2, 0, ain, 0 };
|
242
242
|
|
243
243
|
na_ndloop(&ndf, 2, self, obj);
|
244
244
|
return self;
|
@@ -286,8 +286,8 @@ static void iter_sfloat_store_dfloat(na_loop_t* const lp) {
|
|
286
286
|
}
|
287
287
|
|
288
288
|
static VALUE sfloat_store_dfloat(VALUE self, VALUE obj) {
|
289
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
290
|
-
ndfunc_t ndf = {iter_sfloat_store_dfloat, FULL_LOOP, 2, 0, ain, 0};
|
289
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
290
|
+
ndfunc_t ndf = { iter_sfloat_store_dfloat, FULL_LOOP, 2, 0, ain, 0 };
|
291
291
|
|
292
292
|
na_ndloop(&ndf, 2, self, obj);
|
293
293
|
return self;
|
@@ -335,8 +335,8 @@ static void iter_sfloat_store_sfloat(na_loop_t* const lp) {
|
|
335
335
|
}
|
336
336
|
|
337
337
|
static VALUE sfloat_store_sfloat(VALUE self, VALUE obj) {
|
338
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
339
|
-
ndfunc_t ndf = {iter_sfloat_store_sfloat, FULL_LOOP, 2, 0, ain, 0};
|
338
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
339
|
+
ndfunc_t ndf = { iter_sfloat_store_sfloat, FULL_LOOP, 2, 0, ain, 0 };
|
340
340
|
|
341
341
|
na_ndloop(&ndf, 2, self, obj);
|
342
342
|
return self;
|
@@ -384,8 +384,8 @@ static void iter_sfloat_store_int64(na_loop_t* const lp) {
|
|
384
384
|
}
|
385
385
|
|
386
386
|
static VALUE sfloat_store_int64(VALUE self, VALUE obj) {
|
387
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
388
|
-
ndfunc_t ndf = {iter_sfloat_store_int64, FULL_LOOP, 2, 0, ain, 0};
|
387
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
388
|
+
ndfunc_t ndf = { iter_sfloat_store_int64, FULL_LOOP, 2, 0, ain, 0 };
|
389
389
|
|
390
390
|
na_ndloop(&ndf, 2, self, obj);
|
391
391
|
return self;
|
@@ -433,8 +433,8 @@ static void iter_sfloat_store_int32(na_loop_t* const lp) {
|
|
433
433
|
}
|
434
434
|
|
435
435
|
static VALUE sfloat_store_int32(VALUE self, VALUE obj) {
|
436
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
437
|
-
ndfunc_t ndf = {iter_sfloat_store_int32, FULL_LOOP, 2, 0, ain, 0};
|
436
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
437
|
+
ndfunc_t ndf = { iter_sfloat_store_int32, FULL_LOOP, 2, 0, ain, 0 };
|
438
438
|
|
439
439
|
na_ndloop(&ndf, 2, self, obj);
|
440
440
|
return self;
|
@@ -482,8 +482,8 @@ static void iter_sfloat_store_int16(na_loop_t* const lp) {
|
|
482
482
|
}
|
483
483
|
|
484
484
|
static VALUE sfloat_store_int16(VALUE self, VALUE obj) {
|
485
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
486
|
-
ndfunc_t ndf = {iter_sfloat_store_int16, FULL_LOOP, 2, 0, ain, 0};
|
485
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
486
|
+
ndfunc_t ndf = { iter_sfloat_store_int16, FULL_LOOP, 2, 0, ain, 0 };
|
487
487
|
|
488
488
|
na_ndloop(&ndf, 2, self, obj);
|
489
489
|
return self;
|
@@ -531,8 +531,8 @@ static void iter_sfloat_store_int8(na_loop_t* const lp) {
|
|
531
531
|
}
|
532
532
|
|
533
533
|
static VALUE sfloat_store_int8(VALUE self, VALUE obj) {
|
534
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
535
|
-
ndfunc_t ndf = {iter_sfloat_store_int8, FULL_LOOP, 2, 0, ain, 0};
|
534
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
535
|
+
ndfunc_t ndf = { iter_sfloat_store_int8, FULL_LOOP, 2, 0, ain, 0 };
|
536
536
|
|
537
537
|
na_ndloop(&ndf, 2, self, obj);
|
538
538
|
return self;
|
@@ -580,8 +580,8 @@ static void iter_sfloat_store_uint64(na_loop_t* const lp) {
|
|
580
580
|
}
|
581
581
|
|
582
582
|
static VALUE sfloat_store_uint64(VALUE self, VALUE obj) {
|
583
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
584
|
-
ndfunc_t ndf = {iter_sfloat_store_uint64, FULL_LOOP, 2, 0, ain, 0};
|
583
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
584
|
+
ndfunc_t ndf = { iter_sfloat_store_uint64, FULL_LOOP, 2, 0, ain, 0 };
|
585
585
|
|
586
586
|
na_ndloop(&ndf, 2, self, obj);
|
587
587
|
return self;
|
@@ -629,8 +629,8 @@ static void iter_sfloat_store_uint32(na_loop_t* const lp) {
|
|
629
629
|
}
|
630
630
|
|
631
631
|
static VALUE sfloat_store_uint32(VALUE self, VALUE obj) {
|
632
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
633
|
-
ndfunc_t ndf = {iter_sfloat_store_uint32, FULL_LOOP, 2, 0, ain, 0};
|
632
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
633
|
+
ndfunc_t ndf = { iter_sfloat_store_uint32, FULL_LOOP, 2, 0, ain, 0 };
|
634
634
|
|
635
635
|
na_ndloop(&ndf, 2, self, obj);
|
636
636
|
return self;
|
@@ -678,8 +678,8 @@ static void iter_sfloat_store_uint16(na_loop_t* const lp) {
|
|
678
678
|
}
|
679
679
|
|
680
680
|
static VALUE sfloat_store_uint16(VALUE self, VALUE obj) {
|
681
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
682
|
-
ndfunc_t ndf = {iter_sfloat_store_uint16, FULL_LOOP, 2, 0, ain, 0};
|
681
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
682
|
+
ndfunc_t ndf = { iter_sfloat_store_uint16, FULL_LOOP, 2, 0, ain, 0 };
|
683
683
|
|
684
684
|
na_ndloop(&ndf, 2, self, obj);
|
685
685
|
return self;
|
@@ -727,8 +727,8 @@ static void iter_sfloat_store_uint8(na_loop_t* const lp) {
|
|
727
727
|
}
|
728
728
|
|
729
729
|
static VALUE sfloat_store_uint8(VALUE self, VALUE obj) {
|
730
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
731
|
-
ndfunc_t ndf = {iter_sfloat_store_uint8, FULL_LOOP, 2, 0, ain, 0};
|
730
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
731
|
+
ndfunc_t ndf = { iter_sfloat_store_uint8, FULL_LOOP, 2, 0, ain, 0 };
|
732
732
|
|
733
733
|
na_ndloop(&ndf, 2, self, obj);
|
734
734
|
return self;
|
@@ -776,8 +776,8 @@ static void iter_sfloat_store_robject(na_loop_t* const lp) {
|
|
776
776
|
}
|
777
777
|
|
778
778
|
static VALUE sfloat_store_robject(VALUE self, VALUE obj) {
|
779
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
780
|
-
ndfunc_t ndf = {iter_sfloat_store_robject, FULL_LOOP, 2, 0, ain, 0};
|
779
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
780
|
+
ndfunc_t ndf = { iter_sfloat_store_robject, FULL_LOOP, 2, 0, ain, 0 };
|
781
781
|
|
782
782
|
na_ndloop(&ndf, 2, self, obj);
|
783
783
|
return self;
|
@@ -885,8 +885,8 @@ loop_end:
|
|
885
885
|
}
|
886
886
|
|
887
887
|
static VALUE sfloat_store_array(VALUE self, VALUE rary) {
|
888
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {rb_cArray, 0}};
|
889
|
-
ndfunc_t ndf = {iter_sfloat_store_array, FULL_LOOP, 2, 0, ain, 0};
|
888
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { rb_cArray, 0 } };
|
889
|
+
ndfunc_t ndf = { iter_sfloat_store_array, FULL_LOOP, 2, 0, ain, 0 };
|
890
890
|
|
891
891
|
na_ndloop_store_rarray(&ndf, self, rary);
|
892
892
|
return self;
|
@@ -981,8 +981,10 @@ static VALUE sfloat_store(VALUE self, VALUE obj) {
|
|
981
981
|
}
|
982
982
|
}
|
983
983
|
|
984
|
-
rb_raise(
|
985
|
-
|
984
|
+
rb_raise(
|
985
|
+
nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
|
986
|
+
rb_class2name(rb_obj_class(self))
|
987
|
+
);
|
986
988
|
|
987
989
|
return self;
|
988
990
|
}
|
@@ -1076,7 +1078,10 @@ static dtype sfloat_extract_data(VALUE obj) {
|
|
1076
1078
|
return sfloat_extract_data(r);
|
1077
1079
|
}
|
1078
1080
|
|
1079
|
-
rb_raise(
|
1081
|
+
rb_raise(
|
1082
|
+
nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
|
1083
|
+
rb_class2name(cT)
|
1084
|
+
);
|
1080
1085
|
}
|
1081
1086
|
if (TYPE(obj) == T_ARRAY) {
|
1082
1087
|
if (RARRAY_LEN(obj) != 1) {
|
@@ -1145,8 +1150,8 @@ static VALUE sfloat_s_cast(VALUE type, VALUE obj) {
|
|
1145
1150
|
/*
|
1146
1151
|
Multi-dimensional element reference.
|
1147
1152
|
@overload [](dim0,...,dimL)
|
1148
|
-
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1149
|
-
indices.
|
1153
|
+
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1154
|
+
dim0,...,dimL multi-dimensional indices.
|
1150
1155
|
@return [Numeric,Numo::SFloat] an element or NArray view.
|
1151
1156
|
@see Numo::NArray#[]
|
1152
1157
|
@see #[]=
|
@@ -1168,8 +1173,8 @@ static VALUE sfloat_aref(int argc, VALUE* argv, VALUE self) {
|
|
1168
1173
|
/*
|
1169
1174
|
Multi-dimensional element assignment.
|
1170
1175
|
@overload []=(dim0,...,dimL,val)
|
1171
|
-
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1172
|
-
indices.
|
1176
|
+
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1177
|
+
dim0,...,dimL multi-dimensional indices.
|
1173
1178
|
@param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
|
1174
1179
|
@return [Numeric,Numo::NArray,Array] returns `val` (last argument).
|
1175
1180
|
@see Numo::NArray#[]=
|
@@ -1240,9 +1245,9 @@ static void iter_sfloat_to_a(na_loop_t* const lp) {
|
|
1240
1245
|
@return [Array]
|
1241
1246
|
*/
|
1242
1247
|
static VALUE sfloat_to_a(VALUE self) {
|
1243
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
|
1244
|
-
ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
|
1245
|
-
ndfunc_t ndf = {iter_sfloat_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
|
1248
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
|
1249
|
+
ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
|
1250
|
+
ndfunc_t ndf = { iter_sfloat_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
|
1246
1251
|
return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
|
1247
1252
|
}
|
1248
1253
|
|
@@ -1274,8 +1279,8 @@ static void iter_sfloat_fill(na_loop_t* const lp) {
|
|
1274
1279
|
@return [Numo::SFloat] self.
|
1275
1280
|
*/
|
1276
1281
|
static VALUE sfloat_fill(VALUE self, VALUE val) {
|
1277
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_option}};
|
1278
|
-
ndfunc_t ndf = {iter_sfloat_fill, FULL_LOOP, 2, 0, ain, 0};
|
1282
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
|
1283
|
+
ndfunc_t ndf = { iter_sfloat_fill, FULL_LOOP, 2, 0, ain, 0 };
|
1279
1284
|
|
1280
1285
|
na_ndloop(&ndf, 2, self, val);
|
1281
1286
|
return self;
|
@@ -1330,9 +1335,9 @@ static void iter_sfloat_format(na_loop_t* const lp) {
|
|
1330
1335
|
static VALUE sfloat_format(int argc, VALUE* argv, VALUE self) {
|
1331
1336
|
VALUE fmt = Qnil;
|
1332
1337
|
|
1333
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_option}};
|
1334
|
-
ndfunc_arg_out_t aout[1] = {{numo_cRObject, 0}};
|
1335
|
-
ndfunc_t ndf = {iter_sfloat_format, FULL_LOOP_NIP, 2, 1, ain, aout};
|
1338
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_option } };
|
1339
|
+
ndfunc_arg_out_t aout[1] = { { numo_cRObject, 0 } };
|
1340
|
+
ndfunc_t ndf = { iter_sfloat_format, FULL_LOOP_NIP, 2, 1, ain, aout };
|
1336
1341
|
|
1337
1342
|
rb_scan_args(argc, argv, "01", &fmt);
|
1338
1343
|
return na_ndloop(&ndf, 2, self, fmt);
|
@@ -1376,9 +1381,9 @@ static void iter_sfloat_format_to_a(na_loop_t* const lp) {
|
|
1376
1381
|
*/
|
1377
1382
|
static VALUE sfloat_format_to_a(int argc, VALUE* argv, VALUE self) {
|
1378
1383
|
VALUE fmt = Qnil;
|
1379
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
|
1380
|
-
ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
|
1381
|
-
ndfunc_t ndf = {iter_sfloat_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
|
1384
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
|
1385
|
+
ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
|
1386
|
+
ndfunc_t ndf = { iter_sfloat_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
|
1382
1387
|
|
1383
1388
|
rb_scan_args(argc, argv, "01", &fmt);
|
1384
1389
|
return na_ndloop_cast_narray_to_rarray(&ndf, self, fmt);
|
@@ -1432,8 +1437,8 @@ static void iter_sfloat_each(na_loop_t* const lp) {
|
|
1432
1437
|
@see #map
|
1433
1438
|
*/
|
1434
1439
|
static VALUE sfloat_each(VALUE self) {
|
1435
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1436
|
-
ndfunc_t ndf = {iter_sfloat_each, FULL_LOOP_NIP, 1, 0, ain, 0};
|
1440
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1441
|
+
ndfunc_t ndf = { iter_sfloat_each, FULL_LOOP_NIP, 1, 0, ain, 0 };
|
1437
1442
|
|
1438
1443
|
na_ndloop(&ndf, 1, self);
|
1439
1444
|
return self;
|
@@ -1507,9 +1512,9 @@ static void iter_sfloat_map(na_loop_t* const lp) {
|
|
1507
1512
|
@return [Numo::SFloat] map of self.
|
1508
1513
|
*/
|
1509
1514
|
static VALUE sfloat_map(VALUE self) {
|
1510
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
1511
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1512
|
-
ndfunc_t ndf = {iter_sfloat_map, FULL_LOOP, 1, 1, ain, aout};
|
1515
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
1516
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1517
|
+
ndfunc_t ndf = { iter_sfloat_map, FULL_LOOP, 1, 1, ain, aout };
|
1513
1518
|
|
1514
1519
|
return na_ndloop(&ndf, 1, self);
|
1515
1520
|
}
|
@@ -1571,8 +1576,8 @@ static void iter_sfloat_each_with_index(na_loop_t* const lp) {
|
|
1571
1576
|
@see #map_with_index
|
1572
1577
|
*/
|
1573
1578
|
static VALUE sfloat_each_with_index(VALUE self) {
|
1574
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1575
|
-
ndfunc_t ndf = {iter_sfloat_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0};
|
1579
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1580
|
+
ndfunc_t ndf = { iter_sfloat_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0 };
|
1576
1581
|
|
1577
1582
|
na_ndloop_with_index(&ndf, 1, self);
|
1578
1583
|
return self;
|
@@ -1662,9 +1667,9 @@ static void iter_sfloat_map_with_index(na_loop_t* const lp) {
|
|
1662
1667
|
@see #each_with_index
|
1663
1668
|
*/
|
1664
1669
|
static VALUE sfloat_map_with_index(VALUE self) {
|
1665
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1666
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1667
|
-
ndfunc_t ndf = {iter_sfloat_map_with_index, FULL_LOOP, 1, 1, ain, aout};
|
1670
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1671
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1672
|
+
ndfunc_t ndf = { iter_sfloat_map_with_index, FULL_LOOP, 1, 1, ain, aout };
|
1668
1673
|
|
1669
1674
|
return na_ndloop_with_index(&ndf, 1, self);
|
1670
1675
|
}
|
@@ -1716,14 +1721,14 @@ static void iter_sfloat_abs(na_loop_t* const lp) {
|
|
1716
1721
|
@return [Numo::SFloat] abs of self.
|
1717
1722
|
*/
|
1718
1723
|
static VALUE sfloat_abs(VALUE self) {
|
1719
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
1720
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
1721
|
-
ndfunc_t ndf = {iter_sfloat_abs, FULL_LOOP, 1, 1, ain, aout};
|
1724
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
1725
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
1726
|
+
ndfunc_t ndf = { iter_sfloat_abs, FULL_LOOP, 1, 1, ain, aout };
|
1722
1727
|
|
1723
1728
|
return na_ndloop(&ndf, 1, self);
|
1724
1729
|
}
|
1725
1730
|
|
1726
|
-
#define check_intdivzero(y)
|
1731
|
+
#define check_intdivzero(y) \
|
1727
1732
|
{}
|
1728
1733
|
|
1729
1734
|
static void iter_sfloat_add(na_loop_t* const lp) {
|
@@ -1748,14 +1753,20 @@ static void iter_sfloat_add(na_loop_t* const lp) {
|
|
1748
1753
|
INIT_PTR(lp, 2, p3, s3);
|
1749
1754
|
|
1750
1755
|
//
|
1751
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1756
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1757
|
+
is_aligned(p3, sizeof(dtype))) {
|
1752
1758
|
|
1753
1759
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
1754
1760
|
#ifdef __SSE2__
|
1755
1761
|
// Check number of elements. & Check same alignment.
|
1756
|
-
if ((n >= num_pack) &&
|
1762
|
+
if ((n >= num_pack) &&
|
1763
|
+
is_same_aligned3(
|
1764
|
+
&((dtype*)p1)[i], &((dtype*)p2)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE
|
1765
|
+
)) {
|
1757
1766
|
// Calculate up to the position just before the start of SIMD computation.
|
1758
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
1767
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
1768
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
1769
|
+
);
|
1759
1770
|
#endif
|
1760
1771
|
if (p1 == p3) { // inplace case
|
1761
1772
|
#ifdef __SSE2__
|
@@ -1817,7 +1828,8 @@ static void iter_sfloat_add(na_loop_t* const lp) {
|
|
1817
1828
|
return;
|
1818
1829
|
}
|
1819
1830
|
|
1820
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
1831
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
1832
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
1821
1833
|
//
|
1822
1834
|
|
1823
1835
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -1828,9 +1840,12 @@ static void iter_sfloat_add(na_loop_t* const lp) {
|
|
1828
1840
|
b = _mm_load1_ps(&((dtype*)p2)[0]);
|
1829
1841
|
|
1830
1842
|
// Check number of elements. & Check same alignment.
|
1831
|
-
if ((n >= num_pack) &&
|
1843
|
+
if ((n >= num_pack) &&
|
1844
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE)) {
|
1832
1845
|
// Calculate up to the position just before the start of SIMD computation.
|
1833
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
1846
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
1847
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
1848
|
+
);
|
1834
1849
|
#endif
|
1835
1850
|
if (p1 == p3) { // inplace case
|
1836
1851
|
#ifdef __SSE2__
|
@@ -1926,9 +1941,9 @@ static void iter_sfloat_add(na_loop_t* const lp) {
|
|
1926
1941
|
#undef check_intdivzero
|
1927
1942
|
|
1928
1943
|
static VALUE sfloat_add_self(VALUE self, VALUE other) {
|
1929
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
1930
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1931
|
-
ndfunc_t ndf = {iter_sfloat_add, STRIDE_LOOP, 2, 1, ain, aout};
|
1944
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
1945
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1946
|
+
ndfunc_t ndf = { iter_sfloat_add, STRIDE_LOOP, 2, 1, ain, aout };
|
1932
1947
|
|
1933
1948
|
return na_ndloop(&ndf, 2, self, other);
|
1934
1949
|
}
|
@@ -1952,7 +1967,7 @@ static VALUE sfloat_add(VALUE self, VALUE other) {
|
|
1952
1967
|
}
|
1953
1968
|
}
|
1954
1969
|
|
1955
|
-
#define check_intdivzero(y)
|
1970
|
+
#define check_intdivzero(y) \
|
1956
1971
|
{}
|
1957
1972
|
|
1958
1973
|
static void iter_sfloat_sub(na_loop_t* const lp) {
|
@@ -1977,14 +1992,20 @@ static void iter_sfloat_sub(na_loop_t* const lp) {
|
|
1977
1992
|
INIT_PTR(lp, 2, p3, s3);
|
1978
1993
|
|
1979
1994
|
//
|
1980
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1995
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1996
|
+
is_aligned(p3, sizeof(dtype))) {
|
1981
1997
|
|
1982
1998
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
1983
1999
|
#ifdef __SSE2__
|
1984
2000
|
// Check number of elements. & Check same alignment.
|
1985
|
-
if ((n >= num_pack) &&
|
2001
|
+
if ((n >= num_pack) &&
|
2002
|
+
is_same_aligned3(
|
2003
|
+
&((dtype*)p1)[i], &((dtype*)p2)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE
|
2004
|
+
)) {
|
1986
2005
|
// Calculate up to the position just before the start of SIMD computation.
|
1987
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2006
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2007
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2008
|
+
);
|
1988
2009
|
#endif
|
1989
2010
|
if (p1 == p3) { // inplace case
|
1990
2011
|
#ifdef __SSE2__
|
@@ -2046,7 +2067,8 @@ static void iter_sfloat_sub(na_loop_t* const lp) {
|
|
2046
2067
|
return;
|
2047
2068
|
}
|
2048
2069
|
|
2049
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2070
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2071
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2050
2072
|
//
|
2051
2073
|
|
2052
2074
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2057,9 +2079,12 @@ static void iter_sfloat_sub(na_loop_t* const lp) {
|
|
2057
2079
|
b = _mm_load1_ps(&((dtype*)p2)[0]);
|
2058
2080
|
|
2059
2081
|
// Check number of elements. & Check same alignment.
|
2060
|
-
if ((n >= num_pack) &&
|
2082
|
+
if ((n >= num_pack) &&
|
2083
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE)) {
|
2061
2084
|
// Calculate up to the position just before the start of SIMD computation.
|
2062
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2085
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2086
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2087
|
+
);
|
2063
2088
|
#endif
|
2064
2089
|
if (p1 == p3) { // inplace case
|
2065
2090
|
#ifdef __SSE2__
|
@@ -2155,9 +2180,9 @@ static void iter_sfloat_sub(na_loop_t* const lp) {
|
|
2155
2180
|
#undef check_intdivzero
|
2156
2181
|
|
2157
2182
|
static VALUE sfloat_sub_self(VALUE self, VALUE other) {
|
2158
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2159
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2160
|
-
ndfunc_t ndf = {iter_sfloat_sub, STRIDE_LOOP, 2, 1, ain, aout};
|
2183
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2184
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2185
|
+
ndfunc_t ndf = { iter_sfloat_sub, STRIDE_LOOP, 2, 1, ain, aout };
|
2161
2186
|
|
2162
2187
|
return na_ndloop(&ndf, 2, self, other);
|
2163
2188
|
}
|
@@ -2181,7 +2206,7 @@ static VALUE sfloat_sub(VALUE self, VALUE other) {
|
|
2181
2206
|
}
|
2182
2207
|
}
|
2183
2208
|
|
2184
|
-
#define check_intdivzero(y)
|
2209
|
+
#define check_intdivzero(y) \
|
2185
2210
|
{}
|
2186
2211
|
|
2187
2212
|
static void iter_sfloat_mul(na_loop_t* const lp) {
|
@@ -2206,14 +2231,20 @@ static void iter_sfloat_mul(na_loop_t* const lp) {
|
|
2206
2231
|
INIT_PTR(lp, 2, p3, s3);
|
2207
2232
|
|
2208
2233
|
//
|
2209
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2234
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2235
|
+
is_aligned(p3, sizeof(dtype))) {
|
2210
2236
|
|
2211
2237
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2212
2238
|
#ifdef __SSE2__
|
2213
2239
|
// Check number of elements. & Check same alignment.
|
2214
|
-
if ((n >= num_pack) &&
|
2240
|
+
if ((n >= num_pack) &&
|
2241
|
+
is_same_aligned3(
|
2242
|
+
&((dtype*)p1)[i], &((dtype*)p2)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE
|
2243
|
+
)) {
|
2215
2244
|
// Calculate up to the position just before the start of SIMD computation.
|
2216
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2245
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2246
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2247
|
+
);
|
2217
2248
|
#endif
|
2218
2249
|
if (p1 == p3) { // inplace case
|
2219
2250
|
#ifdef __SSE2__
|
@@ -2275,7 +2306,8 @@ static void iter_sfloat_mul(na_loop_t* const lp) {
|
|
2275
2306
|
return;
|
2276
2307
|
}
|
2277
2308
|
|
2278
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2309
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2310
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2279
2311
|
//
|
2280
2312
|
|
2281
2313
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2286,9 +2318,12 @@ static void iter_sfloat_mul(na_loop_t* const lp) {
|
|
2286
2318
|
b = _mm_load1_ps(&((dtype*)p2)[0]);
|
2287
2319
|
|
2288
2320
|
// Check number of elements. & Check same alignment.
|
2289
|
-
if ((n >= num_pack) &&
|
2321
|
+
if ((n >= num_pack) &&
|
2322
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE)) {
|
2290
2323
|
// Calculate up to the position just before the start of SIMD computation.
|
2291
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2324
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2325
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2326
|
+
);
|
2292
2327
|
#endif
|
2293
2328
|
if (p1 == p3) { // inplace case
|
2294
2329
|
#ifdef __SSE2__
|
@@ -2384,9 +2419,9 @@ static void iter_sfloat_mul(na_loop_t* const lp) {
|
|
2384
2419
|
#undef check_intdivzero
|
2385
2420
|
|
2386
2421
|
static VALUE sfloat_mul_self(VALUE self, VALUE other) {
|
2387
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2388
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2389
|
-
ndfunc_t ndf = {iter_sfloat_mul, STRIDE_LOOP, 2, 1, ain, aout};
|
2422
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2423
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2424
|
+
ndfunc_t ndf = { iter_sfloat_mul, STRIDE_LOOP, 2, 1, ain, aout };
|
2390
2425
|
|
2391
2426
|
return na_ndloop(&ndf, 2, self, other);
|
2392
2427
|
}
|
@@ -2410,7 +2445,7 @@ static VALUE sfloat_mul(VALUE self, VALUE other) {
|
|
2410
2445
|
}
|
2411
2446
|
}
|
2412
2447
|
|
2413
|
-
#define check_intdivzero(y)
|
2448
|
+
#define check_intdivzero(y) \
|
2414
2449
|
{}
|
2415
2450
|
|
2416
2451
|
static void iter_sfloat_div(na_loop_t* const lp) {
|
@@ -2435,14 +2470,20 @@ static void iter_sfloat_div(na_loop_t* const lp) {
|
|
2435
2470
|
INIT_PTR(lp, 2, p3, s3);
|
2436
2471
|
|
2437
2472
|
//
|
2438
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2473
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2474
|
+
is_aligned(p3, sizeof(dtype))) {
|
2439
2475
|
|
2440
2476
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2441
2477
|
#ifdef __SSE2__
|
2442
2478
|
// Check number of elements. & Check same alignment.
|
2443
|
-
if ((n >= num_pack) &&
|
2479
|
+
if ((n >= num_pack) &&
|
2480
|
+
is_same_aligned3(
|
2481
|
+
&((dtype*)p1)[i], &((dtype*)p2)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE
|
2482
|
+
)) {
|
2444
2483
|
// Calculate up to the position just before the start of SIMD computation.
|
2445
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2484
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2485
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2486
|
+
);
|
2446
2487
|
#endif
|
2447
2488
|
if (p1 == p3) { // inplace case
|
2448
2489
|
#ifdef __SSE2__
|
@@ -2504,7 +2545,8 @@ static void iter_sfloat_div(na_loop_t* const lp) {
|
|
2504
2545
|
return;
|
2505
2546
|
}
|
2506
2547
|
|
2507
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2548
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2549
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2508
2550
|
//
|
2509
2551
|
|
2510
2552
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2515,9 +2557,12 @@ static void iter_sfloat_div(na_loop_t* const lp) {
|
|
2515
2557
|
b = _mm_load1_ps(&((dtype*)p2)[0]);
|
2516
2558
|
|
2517
2559
|
// Check number of elements. & Check same alignment.
|
2518
|
-
if ((n >= num_pack) &&
|
2560
|
+
if ((n >= num_pack) &&
|
2561
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE)) {
|
2519
2562
|
// Calculate up to the position just before the start of SIMD computation.
|
2520
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2563
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2564
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2565
|
+
);
|
2521
2566
|
#endif
|
2522
2567
|
if (p1 == p3) { // inplace case
|
2523
2568
|
#ifdef __SSE2__
|
@@ -2613,9 +2658,9 @@ static void iter_sfloat_div(na_loop_t* const lp) {
|
|
2613
2658
|
#undef check_intdivzero
|
2614
2659
|
|
2615
2660
|
static VALUE sfloat_div_self(VALUE self, VALUE other) {
|
2616
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2617
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2618
|
-
ndfunc_t ndf = {iter_sfloat_div, STRIDE_LOOP, 2, 1, ain, aout};
|
2661
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2662
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2663
|
+
ndfunc_t ndf = { iter_sfloat_div, STRIDE_LOOP, 2, 1, ain, aout };
|
2619
2664
|
|
2620
2665
|
return na_ndloop(&ndf, 2, self, other);
|
2621
2666
|
}
|
@@ -2639,7 +2684,7 @@ static VALUE sfloat_div(VALUE self, VALUE other) {
|
|
2639
2684
|
}
|
2640
2685
|
}
|
2641
2686
|
|
2642
|
-
#define check_intdivzero(y)
|
2687
|
+
#define check_intdivzero(y) \
|
2643
2688
|
{}
|
2644
2689
|
|
2645
2690
|
static void iter_sfloat_mod(na_loop_t* const lp) {
|
@@ -2654,7 +2699,8 @@ static void iter_sfloat_mod(na_loop_t* const lp) {
|
|
2654
2699
|
INIT_PTR(lp, 2, p3, s3);
|
2655
2700
|
|
2656
2701
|
//
|
2657
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2702
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2703
|
+
is_aligned(p3, sizeof(dtype))) {
|
2658
2704
|
|
2659
2705
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2660
2706
|
if (p1 == p3) { // inplace case
|
@@ -2671,7 +2717,8 @@ static void iter_sfloat_mod(na_loop_t* const lp) {
|
|
2671
2717
|
return;
|
2672
2718
|
}
|
2673
2719
|
|
2674
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2720
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2721
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2675
2722
|
//
|
2676
2723
|
|
2677
2724
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2729,9 +2776,9 @@ static void iter_sfloat_mod(na_loop_t* const lp) {
|
|
2729
2776
|
#undef check_intdivzero
|
2730
2777
|
|
2731
2778
|
static VALUE sfloat_mod_self(VALUE self, VALUE other) {
|
2732
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2733
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2734
|
-
ndfunc_t ndf = {iter_sfloat_mod, STRIDE_LOOP, 2, 1, ain, aout};
|
2779
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2780
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2781
|
+
ndfunc_t ndf = { iter_sfloat_mod, STRIDE_LOOP, 2, 1, ain, aout };
|
2735
2782
|
|
2736
2783
|
return na_ndloop(&ndf, 2, self, other);
|
2737
2784
|
}
|
@@ -2775,9 +2822,9 @@ static void iter_sfloat_divmod(na_loop_t* const lp) {
|
|
2775
2822
|
}
|
2776
2823
|
|
2777
2824
|
static VALUE sfloat_divmod_self(VALUE self, VALUE other) {
|
2778
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2779
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
2780
|
-
ndfunc_t ndf = {iter_sfloat_divmod, STRIDE_LOOP, 2, 2, ain, aout};
|
2825
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2826
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
2827
|
+
ndfunc_t ndf = { iter_sfloat_divmod, STRIDE_LOOP, 2, 2, ain, aout };
|
2781
2828
|
|
2782
2829
|
return na_ndloop(&ndf, 2, self, other);
|
2783
2830
|
}
|
@@ -2836,11 +2883,11 @@ static void iter_sfloat_pow_int32(na_loop_t* const lp) {
|
|
2836
2883
|
}
|
2837
2884
|
|
2838
2885
|
static VALUE sfloat_pow_self(VALUE self, VALUE other) {
|
2839
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2840
|
-
ndfunc_arg_in_t ain_i[2] = {{cT, 0}, {numo_cInt32, 0}};
|
2841
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2842
|
-
ndfunc_t ndf = {iter_sfloat_pow, STRIDE_LOOP, 2, 1, ain, aout};
|
2843
|
-
ndfunc_t ndf_i = {iter_sfloat_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout};
|
2886
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2887
|
+
ndfunc_arg_in_t ain_i[2] = { { cT, 0 }, { numo_cInt32, 0 } };
|
2888
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2889
|
+
ndfunc_t ndf = { iter_sfloat_pow, STRIDE_LOOP, 2, 1, ain, aout };
|
2890
|
+
ndfunc_t ndf_i = { iter_sfloat_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout };
|
2844
2891
|
|
2845
2892
|
// fixme : use na.integer?
|
2846
2893
|
if (FIXNUM_P(other) || rb_obj_is_kind_of(other, numo_cInt32)) {
|
@@ -2936,9 +2983,9 @@ static void iter_sfloat_minus(na_loop_t* const lp) {
|
|
2936
2983
|
@return [Numo::SFloat] minus of self.
|
2937
2984
|
*/
|
2938
2985
|
static VALUE sfloat_minus(VALUE self) {
|
2939
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2940
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2941
|
-
ndfunc_t ndf = {iter_sfloat_minus, FULL_LOOP, 1, 1, ain, aout};
|
2986
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2987
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2988
|
+
ndfunc_t ndf = { iter_sfloat_minus, FULL_LOOP, 1, 1, ain, aout };
|
2942
2989
|
|
2943
2990
|
return na_ndloop(&ndf, 1, self);
|
2944
2991
|
}
|
@@ -3011,9 +3058,9 @@ static void iter_sfloat_reciprocal(na_loop_t* const lp) {
|
|
3011
3058
|
@return [Numo::SFloat] reciprocal of self.
|
3012
3059
|
*/
|
3013
3060
|
static VALUE sfloat_reciprocal(VALUE self) {
|
3014
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3015
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3016
|
-
ndfunc_t ndf = {iter_sfloat_reciprocal, FULL_LOOP, 1, 1, ain, aout};
|
3061
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3062
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3063
|
+
ndfunc_t ndf = { iter_sfloat_reciprocal, FULL_LOOP, 1, 1, ain, aout };
|
3017
3064
|
|
3018
3065
|
return na_ndloop(&ndf, 1, self);
|
3019
3066
|
}
|
@@ -3086,9 +3133,9 @@ static void iter_sfloat_sign(na_loop_t* const lp) {
|
|
3086
3133
|
@return [Numo::SFloat] sign of self.
|
3087
3134
|
*/
|
3088
3135
|
static VALUE sfloat_sign(VALUE self) {
|
3089
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3090
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3091
|
-
ndfunc_t ndf = {iter_sfloat_sign, FULL_LOOP, 1, 1, ain, aout};
|
3136
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3137
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3138
|
+
ndfunc_t ndf = { iter_sfloat_sign, FULL_LOOP, 1, 1, ain, aout };
|
3092
3139
|
|
3093
3140
|
return na_ndloop(&ndf, 1, self);
|
3094
3141
|
}
|
@@ -3161,9 +3208,9 @@ static void iter_sfloat_square(na_loop_t* const lp) {
|
|
3161
3208
|
@return [Numo::SFloat] square of self.
|
3162
3209
|
*/
|
3163
3210
|
static VALUE sfloat_square(VALUE self) {
|
3164
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3165
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3166
|
-
ndfunc_t ndf = {iter_sfloat_square, FULL_LOOP, 1, 1, ain, aout};
|
3211
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3212
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3213
|
+
ndfunc_t ndf = { iter_sfloat_square, FULL_LOOP, 1, 1, ain, aout };
|
3167
3214
|
|
3168
3215
|
return na_ndloop(&ndf, 1, self);
|
3169
3216
|
}
|
@@ -3190,9 +3237,9 @@ static void iter_sfloat_eq(na_loop_t* const lp) {
|
|
3190
3237
|
}
|
3191
3238
|
|
3192
3239
|
static VALUE sfloat_eq_self(VALUE self, VALUE other) {
|
3193
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3194
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3195
|
-
ndfunc_t ndf = {iter_sfloat_eq, STRIDE_LOOP, 2, 1, ain, aout};
|
3240
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3241
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3242
|
+
ndfunc_t ndf = { iter_sfloat_eq, STRIDE_LOOP, 2, 1, ain, aout };
|
3196
3243
|
|
3197
3244
|
return na_ndloop(&ndf, 2, self, other);
|
3198
3245
|
}
|
@@ -3237,9 +3284,9 @@ static void iter_sfloat_ne(na_loop_t* const lp) {
|
|
3237
3284
|
}
|
3238
3285
|
|
3239
3286
|
static VALUE sfloat_ne_self(VALUE self, VALUE other) {
|
3240
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3241
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3242
|
-
ndfunc_t ndf = {iter_sfloat_ne, STRIDE_LOOP, 2, 1, ain, aout};
|
3287
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3288
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3289
|
+
ndfunc_t ndf = { iter_sfloat_ne, STRIDE_LOOP, 2, 1, ain, aout };
|
3243
3290
|
|
3244
3291
|
return na_ndloop(&ndf, 2, self, other);
|
3245
3292
|
}
|
@@ -3284,9 +3331,9 @@ static void iter_sfloat_nearly_eq(na_loop_t* const lp) {
|
|
3284
3331
|
}
|
3285
3332
|
|
3286
3333
|
static VALUE sfloat_nearly_eq_self(VALUE self, VALUE other) {
|
3287
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3288
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3289
|
-
ndfunc_t ndf = {iter_sfloat_nearly_eq, STRIDE_LOOP, 2, 1, ain, aout};
|
3334
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3335
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3336
|
+
ndfunc_t ndf = { iter_sfloat_nearly_eq, STRIDE_LOOP, 2, 1, ain, aout };
|
3290
3337
|
|
3291
3338
|
return na_ndloop(&ndf, 2, self, other);
|
3292
3339
|
}
|
@@ -3377,9 +3424,9 @@ static void iter_sfloat_floor(na_loop_t* const lp) {
|
|
3377
3424
|
@return [Numo::SFloat] floor of self.
|
3378
3425
|
*/
|
3379
3426
|
static VALUE sfloat_floor(VALUE self) {
|
3380
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3381
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3382
|
-
ndfunc_t ndf = {iter_sfloat_floor, FULL_LOOP, 1, 1, ain, aout};
|
3427
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3428
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3429
|
+
ndfunc_t ndf = { iter_sfloat_floor, FULL_LOOP, 1, 1, ain, aout };
|
3383
3430
|
|
3384
3431
|
return na_ndloop(&ndf, 1, self);
|
3385
3432
|
}
|
@@ -3452,9 +3499,9 @@ static void iter_sfloat_round(na_loop_t* const lp) {
|
|
3452
3499
|
@return [Numo::SFloat] round of self.
|
3453
3500
|
*/
|
3454
3501
|
static VALUE sfloat_round(VALUE self) {
|
3455
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3456
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3457
|
-
ndfunc_t ndf = {iter_sfloat_round, FULL_LOOP, 1, 1, ain, aout};
|
3502
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3503
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3504
|
+
ndfunc_t ndf = { iter_sfloat_round, FULL_LOOP, 1, 1, ain, aout };
|
3458
3505
|
|
3459
3506
|
return na_ndloop(&ndf, 1, self);
|
3460
3507
|
}
|
@@ -3527,9 +3574,9 @@ static void iter_sfloat_ceil(na_loop_t* const lp) {
|
|
3527
3574
|
@return [Numo::SFloat] ceil of self.
|
3528
3575
|
*/
|
3529
3576
|
static VALUE sfloat_ceil(VALUE self) {
|
3530
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3531
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3532
|
-
ndfunc_t ndf = {iter_sfloat_ceil, FULL_LOOP, 1, 1, ain, aout};
|
3577
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3578
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3579
|
+
ndfunc_t ndf = { iter_sfloat_ceil, FULL_LOOP, 1, 1, ain, aout };
|
3533
3580
|
|
3534
3581
|
return na_ndloop(&ndf, 1, self);
|
3535
3582
|
}
|
@@ -3602,9 +3649,9 @@ static void iter_sfloat_trunc(na_loop_t* const lp) {
|
|
3602
3649
|
@return [Numo::SFloat] trunc of self.
|
3603
3650
|
*/
|
3604
3651
|
static VALUE sfloat_trunc(VALUE self) {
|
3605
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3606
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3607
|
-
ndfunc_t ndf = {iter_sfloat_trunc, FULL_LOOP, 1, 1, ain, aout};
|
3652
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3653
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3654
|
+
ndfunc_t ndf = { iter_sfloat_trunc, FULL_LOOP, 1, 1, ain, aout };
|
3608
3655
|
|
3609
3656
|
return na_ndloop(&ndf, 1, self);
|
3610
3657
|
}
|
@@ -3677,14 +3724,14 @@ static void iter_sfloat_rint(na_loop_t* const lp) {
|
|
3677
3724
|
@return [Numo::SFloat] rint of self.
|
3678
3725
|
*/
|
3679
3726
|
static VALUE sfloat_rint(VALUE self) {
|
3680
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3681
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3682
|
-
ndfunc_t ndf = {iter_sfloat_rint, FULL_LOOP, 1, 1, ain, aout};
|
3727
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3728
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3729
|
+
ndfunc_t ndf = { iter_sfloat_rint, FULL_LOOP, 1, 1, ain, aout };
|
3683
3730
|
|
3684
3731
|
return na_ndloop(&ndf, 1, self);
|
3685
3732
|
}
|
3686
3733
|
|
3687
|
-
#define check_intdivzero(y)
|
3734
|
+
#define check_intdivzero(y) \
|
3688
3735
|
{}
|
3689
3736
|
|
3690
3737
|
static void iter_sfloat_copysign(na_loop_t* const lp) {
|
@@ -3699,7 +3746,8 @@ static void iter_sfloat_copysign(na_loop_t* const lp) {
|
|
3699
3746
|
INIT_PTR(lp, 2, p3, s3);
|
3700
3747
|
|
3701
3748
|
//
|
3702
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3749
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3750
|
+
is_aligned(p3, sizeof(dtype))) {
|
3703
3751
|
|
3704
3752
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
3705
3753
|
if (p1 == p3) { // inplace case
|
@@ -3716,7 +3764,8 @@ static void iter_sfloat_copysign(na_loop_t* const lp) {
|
|
3716
3764
|
return;
|
3717
3765
|
}
|
3718
3766
|
|
3719
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3767
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3768
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
3720
3769
|
//
|
3721
3770
|
|
3722
3771
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -3774,9 +3823,9 @@ static void iter_sfloat_copysign(na_loop_t* const lp) {
|
|
3774
3823
|
#undef check_intdivzero
|
3775
3824
|
|
3776
3825
|
static VALUE sfloat_copysign_self(VALUE self, VALUE other) {
|
3777
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3778
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3779
|
-
ndfunc_t ndf = {iter_sfloat_copysign, STRIDE_LOOP, 2, 1, ain, aout};
|
3826
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3827
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3828
|
+
ndfunc_t ndf = { iter_sfloat_copysign, STRIDE_LOOP, 2, 1, ain, aout };
|
3780
3829
|
|
3781
3830
|
return na_ndloop(&ndf, 2, self, other);
|
3782
3831
|
}
|
@@ -3835,9 +3884,9 @@ static void iter_sfloat_signbit(na_loop_t* const lp) {
|
|
3835
3884
|
@return [Numo::Bit] Condition of signbit.
|
3836
3885
|
*/
|
3837
3886
|
static VALUE sfloat_signbit(VALUE self) {
|
3838
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3839
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3840
|
-
ndfunc_t ndf = {iter_sfloat_signbit, FULL_LOOP, 1, 1, ain, aout};
|
3887
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3888
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3889
|
+
ndfunc_t ndf = { iter_sfloat_signbit, FULL_LOOP, 1, 1, ain, aout };
|
3841
3890
|
|
3842
3891
|
return na_ndloop(&ndf, 1, self);
|
3843
3892
|
}
|
@@ -3865,9 +3914,9 @@ static void iter_sfloat_modf(na_loop_t* const lp) {
|
|
3865
3914
|
@return [Numo::SFloat] modf of self.
|
3866
3915
|
*/
|
3867
3916
|
static VALUE sfloat_modf(VALUE self) {
|
3868
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3869
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
3870
|
-
ndfunc_t ndf = {iter_sfloat_modf, STRIDE_LOOP, 1, 2, ain, aout};
|
3917
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3918
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
3919
|
+
ndfunc_t ndf = { iter_sfloat_modf, STRIDE_LOOP, 1, 2, ain, aout };
|
3871
3920
|
|
3872
3921
|
return na_ndloop(&ndf, 1, self);
|
3873
3922
|
}
|
@@ -3894,9 +3943,9 @@ static void iter_sfloat_gt(na_loop_t* const lp) {
|
|
3894
3943
|
}
|
3895
3944
|
|
3896
3945
|
static VALUE sfloat_gt_self(VALUE self, VALUE other) {
|
3897
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3898
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3899
|
-
ndfunc_t ndf = {iter_sfloat_gt, STRIDE_LOOP, 2, 1, ain, aout};
|
3946
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3947
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3948
|
+
ndfunc_t ndf = { iter_sfloat_gt, STRIDE_LOOP, 2, 1, ain, aout };
|
3900
3949
|
|
3901
3950
|
return na_ndloop(&ndf, 2, self, other);
|
3902
3951
|
}
|
@@ -3941,9 +3990,9 @@ static void iter_sfloat_ge(na_loop_t* const lp) {
|
|
3941
3990
|
}
|
3942
3991
|
|
3943
3992
|
static VALUE sfloat_ge_self(VALUE self, VALUE other) {
|
3944
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3945
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3946
|
-
ndfunc_t ndf = {iter_sfloat_ge, STRIDE_LOOP, 2, 1, ain, aout};
|
3993
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3994
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3995
|
+
ndfunc_t ndf = { iter_sfloat_ge, STRIDE_LOOP, 2, 1, ain, aout };
|
3947
3996
|
|
3948
3997
|
return na_ndloop(&ndf, 2, self, other);
|
3949
3998
|
}
|
@@ -3988,9 +4037,9 @@ static void iter_sfloat_lt(na_loop_t* const lp) {
|
|
3988
4037
|
}
|
3989
4038
|
|
3990
4039
|
static VALUE sfloat_lt_self(VALUE self, VALUE other) {
|
3991
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3992
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3993
|
-
ndfunc_t ndf = {iter_sfloat_lt, STRIDE_LOOP, 2, 1, ain, aout};
|
4040
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
4041
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4042
|
+
ndfunc_t ndf = { iter_sfloat_lt, STRIDE_LOOP, 2, 1, ain, aout };
|
3994
4043
|
|
3995
4044
|
return na_ndloop(&ndf, 2, self, other);
|
3996
4045
|
}
|
@@ -4035,9 +4084,9 @@ static void iter_sfloat_le(na_loop_t* const lp) {
|
|
4035
4084
|
}
|
4036
4085
|
|
4037
4086
|
static VALUE sfloat_le_self(VALUE self, VALUE other) {
|
4038
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
4039
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4040
|
-
ndfunc_t ndf = {iter_sfloat_le, STRIDE_LOOP, 2, 1, ain, aout};
|
4087
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
4088
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4089
|
+
ndfunc_t ndf = { iter_sfloat_le, STRIDE_LOOP, 2, 1, ain, aout };
|
4041
4090
|
|
4042
4091
|
return na_ndloop(&ndf, 2, self, other);
|
4043
4092
|
}
|
@@ -4156,11 +4205,11 @@ static void iter_sfloat_clip_max(na_loop_t* const lp) {
|
|
4156
4205
|
# [3, 4, 2, 3, 4, 5, 6, 7, 8, 8]
|
4157
4206
|
*/
|
4158
4207
|
static VALUE sfloat_clip(VALUE self, VALUE min, VALUE max) {
|
4159
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {cT, 0}, {cT, 0}};
|
4160
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4161
|
-
ndfunc_t ndf_min = {iter_sfloat_clip_min, STRIDE_LOOP, 2, 1, ain, aout};
|
4162
|
-
ndfunc_t ndf_max = {iter_sfloat_clip_max, STRIDE_LOOP, 2, 1, ain, aout};
|
4163
|
-
ndfunc_t ndf_both = {iter_sfloat_clip, STRIDE_LOOP, 3, 1, ain, aout};
|
4208
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { cT, 0 }, { cT, 0 } };
|
4209
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4210
|
+
ndfunc_t ndf_min = { iter_sfloat_clip_min, STRIDE_LOOP, 2, 1, ain, aout };
|
4211
|
+
ndfunc_t ndf_max = { iter_sfloat_clip_max, STRIDE_LOOP, 2, 1, ain, aout };
|
4212
|
+
ndfunc_t ndf_both = { iter_sfloat_clip, STRIDE_LOOP, 3, 1, ain, aout };
|
4164
4213
|
|
4165
4214
|
if (RTEST(min)) {
|
4166
4215
|
if (RTEST(max)) {
|
@@ -4212,9 +4261,9 @@ static void iter_sfloat_isnan(na_loop_t* const lp) {
|
|
4212
4261
|
@return [Numo::Bit] Condition of isnan.
|
4213
4262
|
*/
|
4214
4263
|
static VALUE sfloat_isnan(VALUE self) {
|
4215
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4216
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4217
|
-
ndfunc_t ndf = {iter_sfloat_isnan, FULL_LOOP, 1, 1, ain, aout};
|
4264
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4265
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4266
|
+
ndfunc_t ndf = { iter_sfloat_isnan, FULL_LOOP, 1, 1, ain, aout };
|
4218
4267
|
|
4219
4268
|
return na_ndloop(&ndf, 1, self);
|
4220
4269
|
}
|
@@ -4254,9 +4303,9 @@ static void iter_sfloat_isinf(na_loop_t* const lp) {
|
|
4254
4303
|
@return [Numo::Bit] Condition of isinf.
|
4255
4304
|
*/
|
4256
4305
|
static VALUE sfloat_isinf(VALUE self) {
|
4257
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4258
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4259
|
-
ndfunc_t ndf = {iter_sfloat_isinf, FULL_LOOP, 1, 1, ain, aout};
|
4306
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4307
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4308
|
+
ndfunc_t ndf = { iter_sfloat_isinf, FULL_LOOP, 1, 1, ain, aout };
|
4260
4309
|
|
4261
4310
|
return na_ndloop(&ndf, 1, self);
|
4262
4311
|
}
|
@@ -4296,9 +4345,9 @@ static void iter_sfloat_isposinf(na_loop_t* const lp) {
|
|
4296
4345
|
@return [Numo::Bit] Condition of isposinf.
|
4297
4346
|
*/
|
4298
4347
|
static VALUE sfloat_isposinf(VALUE self) {
|
4299
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4300
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4301
|
-
ndfunc_t ndf = {iter_sfloat_isposinf, FULL_LOOP, 1, 1, ain, aout};
|
4348
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4349
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4350
|
+
ndfunc_t ndf = { iter_sfloat_isposinf, FULL_LOOP, 1, 1, ain, aout };
|
4302
4351
|
|
4303
4352
|
return na_ndloop(&ndf, 1, self);
|
4304
4353
|
}
|
@@ -4338,9 +4387,9 @@ static void iter_sfloat_isneginf(na_loop_t* const lp) {
|
|
4338
4387
|
@return [Numo::Bit] Condition of isneginf.
|
4339
4388
|
*/
|
4340
4389
|
static VALUE sfloat_isneginf(VALUE self) {
|
4341
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4342
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4343
|
-
ndfunc_t ndf = {iter_sfloat_isneginf, FULL_LOOP, 1, 1, ain, aout};
|
4390
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4391
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4392
|
+
ndfunc_t ndf = { iter_sfloat_isneginf, FULL_LOOP, 1, 1, ain, aout };
|
4344
4393
|
|
4345
4394
|
return na_ndloop(&ndf, 1, self);
|
4346
4395
|
}
|
@@ -4380,9 +4429,9 @@ static void iter_sfloat_isfinite(na_loop_t* const lp) {
|
|
4380
4429
|
@return [Numo::Bit] Condition of isfinite.
|
4381
4430
|
*/
|
4382
4431
|
static VALUE sfloat_isfinite(VALUE self) {
|
4383
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4384
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4385
|
-
ndfunc_t ndf = {iter_sfloat_isfinite, FULL_LOOP, 1, 1, ain, aout};
|
4432
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4433
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4434
|
+
ndfunc_t ndf = { iter_sfloat_isfinite, FULL_LOOP, 1, 1, ain, aout };
|
4386
4435
|
|
4387
4436
|
return na_ndloop(&ndf, 1, self);
|
4388
4437
|
}
|
@@ -4413,16 +4462,18 @@ static void iter_sfloat_sum_nan(na_loop_t* const lp) {
|
|
4413
4462
|
/*
|
4414
4463
|
sum of self.
|
4415
4464
|
@overload sum(axis:nil, keepdims:false, nan:false)
|
4416
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4465
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4466
|
+
return NaN for min/max etc).
|
4417
4467
|
@param [Numeric,Array,Range] axis Performs sum along the axis.
|
4418
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4468
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4469
|
+
dimensions with size one.
|
4419
4470
|
@return [Numo::SFloat] returns result of sum.
|
4420
4471
|
*/
|
4421
4472
|
static VALUE sfloat_sum(int argc, VALUE* argv, VALUE self) {
|
4422
4473
|
VALUE v, reduce;
|
4423
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4424
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4425
|
-
ndfunc_t ndf = {iter_sfloat_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4474
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4475
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4476
|
+
ndfunc_t ndf = { iter_sfloat_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4426
4477
|
|
4427
4478
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_sum_nan);
|
4428
4479
|
|
@@ -4457,16 +4508,18 @@ static void iter_sfloat_prod_nan(na_loop_t* const lp) {
|
|
4457
4508
|
/*
|
4458
4509
|
prod of self.
|
4459
4510
|
@overload prod(axis:nil, keepdims:false, nan:false)
|
4460
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4511
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4512
|
+
return NaN for min/max etc).
|
4461
4513
|
@param [Numeric,Array,Range] axis Performs prod along the axis.
|
4462
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4514
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4515
|
+
dimensions with size one.
|
4463
4516
|
@return [Numo::SFloat] returns result of prod.
|
4464
4517
|
*/
|
4465
4518
|
static VALUE sfloat_prod(int argc, VALUE* argv, VALUE self) {
|
4466
4519
|
VALUE v, reduce;
|
4467
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4468
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4469
|
-
ndfunc_t ndf = {iter_sfloat_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4520
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4521
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4522
|
+
ndfunc_t ndf = { iter_sfloat_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4470
4523
|
|
4471
4524
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_prod_nan);
|
4472
4525
|
|
@@ -4501,16 +4554,18 @@ static void iter_sfloat_mean_nan(na_loop_t* const lp) {
|
|
4501
4554
|
/*
|
4502
4555
|
mean of self.
|
4503
4556
|
@overload mean(axis:nil, keepdims:false, nan:false)
|
4504
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4557
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4558
|
+
return NaN for min/max etc).
|
4505
4559
|
@param [Numeric,Array,Range] axis Performs mean along the axis.
|
4506
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4560
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4561
|
+
dimensions with size one.
|
4507
4562
|
@return [Numo::SFloat] returns result of mean.
|
4508
4563
|
*/
|
4509
4564
|
static VALUE sfloat_mean(int argc, VALUE* argv, VALUE self) {
|
4510
4565
|
VALUE v, reduce;
|
4511
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4512
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4513
|
-
ndfunc_t ndf = {iter_sfloat_mean, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4566
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4567
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4568
|
+
ndfunc_t ndf = { iter_sfloat_mean, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4514
4569
|
|
4515
4570
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_mean_nan);
|
4516
4571
|
|
@@ -4545,16 +4600,18 @@ static void iter_sfloat_stddev_nan(na_loop_t* const lp) {
|
|
4545
4600
|
/*
|
4546
4601
|
stddev of self.
|
4547
4602
|
@overload stddev(axis:nil, keepdims:false, nan:false)
|
4548
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4603
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4604
|
+
return NaN for min/max etc).
|
4549
4605
|
@param [Numeric,Array,Range] axis Performs stddev along the axis.
|
4550
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4606
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4607
|
+
dimensions with size one.
|
4551
4608
|
@return [Numo::SFloat] returns result of stddev.
|
4552
4609
|
*/
|
4553
4610
|
static VALUE sfloat_stddev(int argc, VALUE* argv, VALUE self) {
|
4554
4611
|
VALUE v, reduce;
|
4555
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4556
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
4557
|
-
ndfunc_t ndf = {iter_sfloat_stddev, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4612
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4613
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4614
|
+
ndfunc_t ndf = { iter_sfloat_stddev, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4558
4615
|
|
4559
4616
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_stddev_nan);
|
4560
4617
|
|
@@ -4589,16 +4646,18 @@ static void iter_sfloat_var_nan(na_loop_t* const lp) {
|
|
4589
4646
|
/*
|
4590
4647
|
var of self.
|
4591
4648
|
@overload var(axis:nil, keepdims:false, nan:false)
|
4592
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4649
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4650
|
+
return NaN for min/max etc).
|
4593
4651
|
@param [Numeric,Array,Range] axis Performs var along the axis.
|
4594
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4652
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4653
|
+
dimensions with size one.
|
4595
4654
|
@return [Numo::SFloat] returns result of var.
|
4596
4655
|
*/
|
4597
4656
|
static VALUE sfloat_var(int argc, VALUE* argv, VALUE self) {
|
4598
4657
|
VALUE v, reduce;
|
4599
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4600
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
4601
|
-
ndfunc_t ndf = {iter_sfloat_var, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4658
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4659
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4660
|
+
ndfunc_t ndf = { iter_sfloat_var, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4602
4661
|
|
4603
4662
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_var_nan);
|
4604
4663
|
|
@@ -4633,16 +4692,18 @@ static void iter_sfloat_rms_nan(na_loop_t* const lp) {
|
|
4633
4692
|
/*
|
4634
4693
|
rms of self.
|
4635
4694
|
@overload rms(axis:nil, keepdims:false, nan:false)
|
4636
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4695
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4696
|
+
return NaN for min/max etc).
|
4637
4697
|
@param [Numeric,Array,Range] axis Performs rms along the axis.
|
4638
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4698
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4699
|
+
dimensions with size one.
|
4639
4700
|
@return [Numo::SFloat] returns result of rms.
|
4640
4701
|
*/
|
4641
4702
|
static VALUE sfloat_rms(int argc, VALUE* argv, VALUE self) {
|
4642
4703
|
VALUE v, reduce;
|
4643
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4644
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
4645
|
-
ndfunc_t ndf = {iter_sfloat_rms, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4704
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4705
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4706
|
+
ndfunc_t ndf = { iter_sfloat_rms, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4646
4707
|
|
4647
4708
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_rms_nan);
|
4648
4709
|
|
@@ -4677,16 +4738,18 @@ static void iter_sfloat_min_nan(na_loop_t* const lp) {
|
|
4677
4738
|
/*
|
4678
4739
|
min of self.
|
4679
4740
|
@overload min(axis:nil, keepdims:false, nan:false)
|
4680
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4741
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4742
|
+
return NaN for min/max etc).
|
4681
4743
|
@param [Numeric,Array,Range] axis Performs min along the axis.
|
4682
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4744
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4745
|
+
dimensions with size one.
|
4683
4746
|
@return [Numo::SFloat] returns result of min.
|
4684
4747
|
*/
|
4685
4748
|
static VALUE sfloat_min(int argc, VALUE* argv, VALUE self) {
|
4686
4749
|
VALUE v, reduce;
|
4687
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4688
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4689
|
-
ndfunc_t ndf = {iter_sfloat_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4750
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4751
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4752
|
+
ndfunc_t ndf = { iter_sfloat_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4690
4753
|
|
4691
4754
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_min_nan);
|
4692
4755
|
|
@@ -4721,16 +4784,18 @@ static void iter_sfloat_max_nan(na_loop_t* const lp) {
|
|
4721
4784
|
/*
|
4722
4785
|
max of self.
|
4723
4786
|
@overload max(axis:nil, keepdims:false, nan:false)
|
4724
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4787
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4788
|
+
return NaN for min/max etc).
|
4725
4789
|
@param [Numeric,Array,Range] axis Performs max along the axis.
|
4726
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4790
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4791
|
+
dimensions with size one.
|
4727
4792
|
@return [Numo::SFloat] returns result of max.
|
4728
4793
|
*/
|
4729
4794
|
static VALUE sfloat_max(int argc, VALUE* argv, VALUE self) {
|
4730
4795
|
VALUE v, reduce;
|
4731
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4732
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4733
|
-
ndfunc_t ndf = {iter_sfloat_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4796
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4797
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4798
|
+
ndfunc_t ndf = { iter_sfloat_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4734
4799
|
|
4735
4800
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_max_nan);
|
4736
4801
|
|
@@ -4765,16 +4830,18 @@ static void iter_sfloat_ptp_nan(na_loop_t* const lp) {
|
|
4765
4830
|
/*
|
4766
4831
|
ptp of self.
|
4767
4832
|
@overload ptp(axis:nil, keepdims:false, nan:false)
|
4768
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4833
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4834
|
+
return NaN for min/max etc).
|
4769
4835
|
@param [Numeric,Array,Range] axis Performs ptp along the axis.
|
4770
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4836
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4837
|
+
dimensions with size one.
|
4771
4838
|
@return [Numo::SFloat] returns result of ptp.
|
4772
4839
|
*/
|
4773
4840
|
static VALUE sfloat_ptp(int argc, VALUE* argv, VALUE self) {
|
4774
4841
|
VALUE v, reduce;
|
4775
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4776
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4777
|
-
ndfunc_t ndf = {iter_sfloat_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4842
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4843
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4844
|
+
ndfunc_t ndf = { iter_sfloat_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4778
4845
|
|
4779
4846
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_ptp_nan);
|
4780
4847
|
|
@@ -4855,7 +4922,8 @@ static void iter_sfloat_max_index_index32_nan(na_loop_t* const lp) {
|
|
4855
4922
|
Index of the maximum value.
|
4856
4923
|
@overload max_index(axis:nil, nan:false)
|
4857
4924
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
4858
|
-
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d
|
4925
|
+
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d
|
4926
|
+
indices**.
|
4859
4927
|
@return [Integer,Numo::Int] returns result indices.
|
4860
4928
|
@see #argmax
|
4861
4929
|
@see #max
|
@@ -4873,9 +4941,9 @@ static void iter_sfloat_max_index_index32_nan(na_loop_t* const lp) {
|
|
4873
4941
|
static VALUE sfloat_max_index(int argc, VALUE* argv, VALUE self) {
|
4874
4942
|
narray_t* na;
|
4875
4943
|
VALUE idx, reduce;
|
4876
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
|
4877
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4878
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
|
4944
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
|
4945
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4946
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
|
4879
4947
|
|
4880
4948
|
GetNArray(self, na);
|
4881
4949
|
if (na->ndim == 0) {
|
@@ -4972,7 +5040,8 @@ static void iter_sfloat_min_index_index32_nan(na_loop_t* const lp) {
|
|
4972
5040
|
Index of the minimum value.
|
4973
5041
|
@overload min_index(axis:nil, nan:false)
|
4974
5042
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
4975
|
-
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d
|
5043
|
+
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d
|
5044
|
+
indices**.
|
4976
5045
|
@return [Integer,Numo::Int] returns result indices.
|
4977
5046
|
@see #argmin
|
4978
5047
|
@see #min
|
@@ -4990,9 +5059,9 @@ static void iter_sfloat_min_index_index32_nan(na_loop_t* const lp) {
|
|
4990
5059
|
static VALUE sfloat_min_index(int argc, VALUE* argv, VALUE self) {
|
4991
5060
|
narray_t* na;
|
4992
5061
|
VALUE idx, reduce;
|
4993
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
|
4994
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4995
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
|
5062
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
|
5063
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
5064
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
|
4996
5065
|
|
4997
5066
|
GetNArray(self, na);
|
4998
5067
|
if (na->ndim == 0) {
|
@@ -5085,7 +5154,8 @@ static void iter_sfloat_argmax_arg32_nan(na_loop_t* const lp) {
|
|
5085
5154
|
Index of the maximum value.
|
5086
5155
|
@overload argmax(axis:nil, nan:false)
|
5087
5156
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
5088
|
-
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
|
5157
|
+
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
|
5158
|
+
along the axis**.
|
5089
5159
|
@return [Integer,Numo::Int] returns the result indices.
|
5090
5160
|
@see #max_index
|
5091
5161
|
@see #max
|
@@ -5103,9 +5173,9 @@ static void iter_sfloat_argmax_arg32_nan(na_loop_t* const lp) {
|
|
5103
5173
|
static VALUE sfloat_argmax(int argc, VALUE* argv, VALUE self) {
|
5104
5174
|
narray_t* na;
|
5105
5175
|
VALUE reduce;
|
5106
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
|
5107
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
5108
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
|
5176
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
|
5177
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
5178
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
|
5109
5179
|
|
5110
5180
|
GetNArray(self, na);
|
5111
5181
|
if (na->ndim == 0) {
|
@@ -5195,7 +5265,8 @@ static void iter_sfloat_argmin_arg32_nan(na_loop_t* const lp) {
|
|
5195
5265
|
Index of the minimum value.
|
5196
5266
|
@overload argmin(axis:nil, nan:false)
|
5197
5267
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
5198
|
-
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
|
5268
|
+
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
|
5269
|
+
along the axis**.
|
5199
5270
|
@return [Integer,Numo::Int] returns the result indices.
|
5200
5271
|
@see #min_index
|
5201
5272
|
@see #min
|
@@ -5213,9 +5284,9 @@ static void iter_sfloat_argmin_arg32_nan(na_loop_t* const lp) {
|
|
5213
5284
|
static VALUE sfloat_argmin(int argc, VALUE* argv, VALUE self) {
|
5214
5285
|
narray_t* na;
|
5215
5286
|
VALUE reduce;
|
5216
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
|
5217
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
5218
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
|
5287
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
|
5288
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
5289
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
|
5219
5290
|
|
5220
5291
|
GetNArray(self, na);
|
5221
5292
|
if (na->ndim == 0) {
|
@@ -5271,14 +5342,17 @@ static void iter_sfloat_minmax_nan(na_loop_t* const lp) {
|
|
5271
5342
|
@overload minmax(axis:nil, keepdims:false, nan:false)
|
5272
5343
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN if exist).
|
5273
5344
|
@param [Numeric,Array,Range] axis Finds min-max along the axis.
|
5274
|
-
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5345
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5346
|
+
as dimensions with size one.
|
5275
5347
|
@return [Numo::SFloat,Numo::SFloat] min and max of self.
|
5276
5348
|
*/
|
5277
5349
|
static VALUE sfloat_minmax(int argc, VALUE* argv, VALUE self) {
|
5278
5350
|
VALUE reduce;
|
5279
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
5280
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
5281
|
-
ndfunc_t ndf = {
|
5351
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
5352
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
5353
|
+
ndfunc_t ndf = {
|
5354
|
+
iter_sfloat_minmax, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 2, ain, aout
|
5355
|
+
};
|
5282
5356
|
|
5283
5357
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_minmax_nan);
|
5284
5358
|
|
@@ -5337,13 +5411,13 @@ static void iter_sfloat_s_maximum_nan(na_loop_t* const lp) {
|
|
5337
5411
|
static VALUE sfloat_s_maximum(int argc, VALUE* argv, VALUE mod) {
|
5338
5412
|
VALUE a1 = Qnil;
|
5339
5413
|
VALUE a2 = Qnil;
|
5340
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
5341
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5342
|
-
ndfunc_t ndf = {iter_sfloat_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
|
5414
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
5415
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5416
|
+
ndfunc_t ndf = { iter_sfloat_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
|
5343
5417
|
|
5344
5418
|
VALUE kw_hash = Qnil;
|
5345
|
-
ID kw_table[1] = {id_nan};
|
5346
|
-
VALUE opts[1] = {Qundef};
|
5419
|
+
ID kw_table[1] = { id_nan };
|
5420
|
+
VALUE opts[1] = { Qundef };
|
5347
5421
|
|
5348
5422
|
rb_scan_args(argc, argv, "20:", &a1, &a2, &kw_hash);
|
5349
5423
|
rb_get_kwargs(kw_hash, kw_table, 0, 1, opts);
|
@@ -5406,13 +5480,13 @@ static void iter_sfloat_s_minimum_nan(na_loop_t* const lp) {
|
|
5406
5480
|
static VALUE sfloat_s_minimum(int argc, VALUE* argv, VALUE mod) {
|
5407
5481
|
VALUE a1 = Qnil;
|
5408
5482
|
VALUE a2 = Qnil;
|
5409
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
5410
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5411
|
-
ndfunc_t ndf = {iter_sfloat_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
|
5483
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
5484
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5485
|
+
ndfunc_t ndf = { iter_sfloat_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
|
5412
5486
|
|
5413
5487
|
VALUE kw_hash = Qnil;
|
5414
|
-
ID kw_table[1] = {id_nan};
|
5415
|
-
VALUE opts[1] = {Qundef};
|
5488
|
+
ID kw_table[1] = { id_nan };
|
5489
|
+
VALUE opts[1] = { Qundef };
|
5416
5490
|
|
5417
5491
|
rb_scan_args(argc, argv, "20:", &a1, &a2, &kw_hash);
|
5418
5492
|
rb_get_kwargs(kw_hash, kw_table, 0, 1, opts);
|
@@ -5432,16 +5506,13 @@ static void iter_sfloat_cumsum(na_loop_t* const lp) {
|
|
5432
5506
|
INIT_COUNTER(lp, i);
|
5433
5507
|
INIT_PTR(lp, 0, p1, s1);
|
5434
5508
|
INIT_PTR(lp, 1, p2, s2);
|
5435
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
5436
5509
|
|
5437
5510
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
5438
5511
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5439
|
-
// printf("i=%lu x=%f\n",i,x);
|
5440
5512
|
for (i--; i--;) {
|
5441
5513
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
5442
5514
|
m_cumsum(x, y);
|
5443
5515
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5444
|
-
// printf("i=%lu x=%f\n",i,x);
|
5445
5516
|
}
|
5446
5517
|
}
|
5447
5518
|
static void iter_sfloat_cumsum_nan(na_loop_t* const lp) {
|
@@ -5453,16 +5524,13 @@ static void iter_sfloat_cumsum_nan(na_loop_t* const lp) {
|
|
5453
5524
|
INIT_COUNTER(lp, i);
|
5454
5525
|
INIT_PTR(lp, 0, p1, s1);
|
5455
5526
|
INIT_PTR(lp, 1, p2, s2);
|
5456
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
5457
5527
|
|
5458
5528
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
5459
5529
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5460
|
-
// printf("i=%lu x=%f\n",i,x);
|
5461
5530
|
for (i--; i--;) {
|
5462
5531
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
5463
5532
|
m_cumsum_nan(x, y);
|
5464
5533
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5465
|
-
// printf("i=%lu x=%f\n",i,x);
|
5466
5534
|
}
|
5467
5535
|
}
|
5468
5536
|
|
@@ -5475,9 +5543,11 @@ static void iter_sfloat_cumsum_nan(na_loop_t* const lp) {
|
|
5475
5543
|
*/
|
5476
5544
|
static VALUE sfloat_cumsum(int argc, VALUE* argv, VALUE self) {
|
5477
5545
|
VALUE reduce;
|
5478
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
5479
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5480
|
-
ndfunc_t ndf = {
|
5546
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
5547
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5548
|
+
ndfunc_t ndf = {
|
5549
|
+
iter_sfloat_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
|
5550
|
+
};
|
5481
5551
|
|
5482
5552
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_cumsum_nan);
|
5483
5553
|
|
@@ -5493,16 +5563,13 @@ static void iter_sfloat_cumprod(na_loop_t* const lp) {
|
|
5493
5563
|
INIT_COUNTER(lp, i);
|
5494
5564
|
INIT_PTR(lp, 0, p1, s1);
|
5495
5565
|
INIT_PTR(lp, 1, p2, s2);
|
5496
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
5497
5566
|
|
5498
5567
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
5499
5568
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5500
|
-
// printf("i=%lu x=%f\n",i,x);
|
5501
5569
|
for (i--; i--;) {
|
5502
5570
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
5503
5571
|
m_cumprod(x, y);
|
5504
5572
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5505
|
-
// printf("i=%lu x=%f\n",i,x);
|
5506
5573
|
}
|
5507
5574
|
}
|
5508
5575
|
static void iter_sfloat_cumprod_nan(na_loop_t* const lp) {
|
@@ -5514,16 +5581,13 @@ static void iter_sfloat_cumprod_nan(na_loop_t* const lp) {
|
|
5514
5581
|
INIT_COUNTER(lp, i);
|
5515
5582
|
INIT_PTR(lp, 0, p1, s1);
|
5516
5583
|
INIT_PTR(lp, 1, p2, s2);
|
5517
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
5518
5584
|
|
5519
5585
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
5520
5586
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5521
|
-
// printf("i=%lu x=%f\n",i,x);
|
5522
5587
|
for (i--; i--;) {
|
5523
5588
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
5524
5589
|
m_cumprod_nan(x, y);
|
5525
5590
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5526
|
-
// printf("i=%lu x=%f\n",i,x);
|
5527
5591
|
}
|
5528
5592
|
}
|
5529
5593
|
|
@@ -5536,9 +5600,11 @@ static void iter_sfloat_cumprod_nan(na_loop_t* const lp) {
|
|
5536
5600
|
*/
|
5537
5601
|
static VALUE sfloat_cumprod(int argc, VALUE* argv, VALUE self) {
|
5538
5602
|
VALUE reduce;
|
5539
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
5540
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5541
|
-
ndfunc_t ndf = {
|
5603
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
5604
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5605
|
+
ndfunc_t ndf = {
|
5606
|
+
iter_sfloat_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
|
5607
|
+
};
|
5542
5608
|
|
5543
5609
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_sfloat_cumprod_nan);
|
5544
5610
|
|
@@ -5618,9 +5684,9 @@ static void iter_sfloat_mulsum_nan(na_loop_t* const lp) {
|
|
5618
5684
|
static VALUE sfloat_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
5619
5685
|
VALUE v, reduce;
|
5620
5686
|
VALUE naryv[2];
|
5621
|
-
ndfunc_arg_in_t ain[4] = {{cT, 0}, {cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
|
5622
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5623
|
-
ndfunc_t ndf = {iter_sfloat_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout};
|
5687
|
+
ndfunc_arg_in_t ain[4] = { { cT, 0 }, { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
|
5688
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5689
|
+
ndfunc_t ndf = { iter_sfloat_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout };
|
5624
5690
|
|
5625
5691
|
if (argc < 1) {
|
5626
5692
|
rb_raise(rb_eArgError, "wrong number of arguments (%d for >=1)", argc);
|
@@ -5642,7 +5708,8 @@ static VALUE sfloat_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
|
5642
5708
|
@overload mulsum(other, axis:nil, keepdims:false, nan:false)
|
5643
5709
|
@param [Numo::NArray,Numeric] other
|
5644
5710
|
@param [Numeric,Array,Range] axis Performs mulsum along the axis.
|
5645
|
-
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5711
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5712
|
+
as dimensions with size one.
|
5646
5713
|
@param [TrueClass] nan (keyword) If true, apply NaN-aware algorithm (avoid NaN if exists).
|
5647
5714
|
@return [Numo::NArray] mulsum of self and other.
|
5648
5715
|
*/
|
@@ -5728,8 +5795,8 @@ static void iter_sfloat_seq(na_loop_t* const lp) {
|
|
5728
5795
|
static VALUE sfloat_seq(int argc, VALUE* args, VALUE self) {
|
5729
5796
|
seq_opt_t* g;
|
5730
5797
|
VALUE vbeg = Qnil, vstep = Qnil;
|
5731
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
5732
|
-
ndfunc_t ndf = {iter_sfloat_seq, FULL_LOOP, 1, 0, ain, 0};
|
5798
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
5799
|
+
ndfunc_t ndf = { iter_sfloat_seq, FULL_LOOP, 1, 0, ain, 0 };
|
5733
5800
|
|
5734
5801
|
g = ALLOCA_N(seq_opt_t, 1);
|
5735
5802
|
g->beg = m_zero;
|
@@ -5811,8 +5878,8 @@ static void iter_sfloat_logseq(na_loop_t* const lp) {
|
|
5811
5878
|
static VALUE sfloat_logseq(int argc, VALUE* args, VALUE self) {
|
5812
5879
|
logseq_opt_t* g;
|
5813
5880
|
VALUE vbeg, vstep, vbase;
|
5814
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
5815
|
-
ndfunc_t ndf = {iter_sfloat_logseq, FULL_LOOP, 1, 0, ain, 0};
|
5881
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
5882
|
+
ndfunc_t ndf = { iter_sfloat_logseq, FULL_LOOP, 1, 0, ain, 0 };
|
5816
5883
|
|
5817
5884
|
g = ALLOCA_N(logseq_opt_t, 1);
|
5818
5885
|
rb_scan_args(argc, args, "21", &vbeg, &vstep, &vbase);
|
@@ -5866,8 +5933,8 @@ static void iter_sfloat_eye(na_loop_t* const lp) {
|
|
5866
5933
|
@return [Numo::SFloat] eye of self.
|
5867
5934
|
*/
|
5868
5935
|
static VALUE sfloat_eye(int argc, VALUE* argv, VALUE self) {
|
5869
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 2}};
|
5870
|
-
ndfunc_t ndf = {iter_sfloat_eye, NO_LOOP, 1, 0, ain, 0};
|
5936
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 2 } };
|
5937
|
+
ndfunc_t ndf = { iter_sfloat_eye, NO_LOOP, 1, 0, ain, 0 };
|
5871
5938
|
ssize_t kofs;
|
5872
5939
|
dtype data;
|
5873
5940
|
char* g;
|
@@ -5897,17 +5964,21 @@ static VALUE sfloat_eye(int argc, VALUE* argv, VALUE self) {
|
|
5897
5964
|
// Diagonal offset from the main diagonal.
|
5898
5965
|
if (kofs >= 0) {
|
5899
5966
|
if ((size_t)(kofs) >= na->shape[nd - 1]) {
|
5900
|
-
rb_raise(
|
5901
|
-
|
5902
|
-
|
5903
|
-
|
5967
|
+
rb_raise(
|
5968
|
+
rb_eArgError,
|
5969
|
+
"invalid diagonal offset(%" SZF "d) for "
|
5970
|
+
"last dimension size(%" SZF "d)",
|
5971
|
+
kofs, na->shape[nd - 1]
|
5972
|
+
);
|
5904
5973
|
}
|
5905
5974
|
} else {
|
5906
5975
|
if ((size_t)(-kofs) >= na->shape[nd - 2]) {
|
5907
|
-
rb_raise(
|
5908
|
-
|
5909
|
-
|
5910
|
-
|
5976
|
+
rb_raise(
|
5977
|
+
rb_eArgError,
|
5978
|
+
"invalid diagonal offset(%" SZF "d) for "
|
5979
|
+
"last-1 dimension size(%" SZF "d)",
|
5980
|
+
kofs, na->shape[nd - 2]
|
5981
|
+
);
|
5911
5982
|
}
|
5912
5983
|
}
|
5913
5984
|
|
@@ -5957,7 +6028,8 @@ static void iter_sfloat_rand(na_loop_t* const lp) {
|
|
5957
6028
|
Generate uniformly distributed random numbers on self narray.
|
5958
6029
|
@overload rand([[low],high])
|
5959
6030
|
@param [Numeric] low lower inclusive boundary of random numbers. (default=0)
|
5960
|
-
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
6031
|
+
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
6032
|
+
complex types)
|
5961
6033
|
@return [Numo::SFloat] self.
|
5962
6034
|
@example
|
5963
6035
|
Numo::DFloat.new(6).rand
|
@@ -5976,8 +6048,8 @@ static VALUE sfloat_rand(int argc, VALUE* args, VALUE self) {
|
|
5976
6048
|
rand_opt_t g;
|
5977
6049
|
VALUE v1 = Qnil, v2 = Qnil;
|
5978
6050
|
dtype high;
|
5979
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
5980
|
-
ndfunc_t ndf = {iter_sfloat_rand, FULL_LOOP, 1, 0, ain, 0};
|
6051
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
6052
|
+
ndfunc_t ndf = { iter_sfloat_rand, FULL_LOOP, 1, 0, ain, 0 };
|
5981
6053
|
|
5982
6054
|
rb_scan_args(argc, args, "02", &v1, &v2);
|
5983
6055
|
if (v2 == Qnil) {
|
@@ -6085,8 +6157,8 @@ static VALUE sfloat_rand_norm(int argc, VALUE* args, VALUE self) {
|
|
6085
6157
|
int n;
|
6086
6158
|
randn_opt_t g;
|
6087
6159
|
VALUE v1 = Qnil, v2 = Qnil;
|
6088
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
6089
|
-
ndfunc_t ndf = {iter_sfloat_rand_norm, FULL_LOOP, 1, 0, ain, 0};
|
6160
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
6161
|
+
ndfunc_t ndf = { iter_sfloat_rand_norm, FULL_LOOP, 1, 0, ain, 0 };
|
6090
6162
|
|
6091
6163
|
n = rb_scan_args(argc, args, "02", &v1, &v2);
|
6092
6164
|
if (n == 0) {
|
@@ -6130,8 +6202,8 @@ static VALUE sfloat_poly(VALUE self, VALUE args) {
|
|
6130
6202
|
int argc, i;
|
6131
6203
|
VALUE* argv;
|
6132
6204
|
volatile VALUE v, a;
|
6133
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
6134
|
-
ndfunc_t ndf = {iter_sfloat_poly, NO_LOOP, 0, 1, 0, aout};
|
6205
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
6206
|
+
ndfunc_t ndf = { iter_sfloat_poly, NO_LOOP, 0, 1, 0, aout };
|
6135
6207
|
|
6136
6208
|
argc = (int)RARRAY_LEN(args);
|
6137
6209
|
ndf.nin = argc + 1;
|
@@ -6211,23 +6283,28 @@ static VALUE sfloat_poly(VALUE self, VALUE args) {
|
|
6211
6283
|
* We have modified their original by adding a check for already-sorted input,
|
6212
6284
|
* which seems to be a win per discussions on pgsql-hackers around 2006-03-21.
|
6213
6285
|
*/
|
6214
|
-
#define swapcode(TYPE, parmi, parmj, n)
|
6215
|
-
do {
|
6216
|
-
size_t i = (n) / sizeof(TYPE);
|
6217
|
-
TYPE* pi = (TYPE*)(void*)(parmi);
|
6218
|
-
TYPE* pj = (TYPE*)(void*)(parmj);
|
6219
|
-
do {
|
6220
|
-
TYPE t = *pi;
|
6221
|
-
*pi++ = *pj;
|
6222
|
-
*pj++ = t;
|
6223
|
-
} while (--i > 0);
|
6286
|
+
#define swapcode(TYPE, parmi, parmj, n) \
|
6287
|
+
do { \
|
6288
|
+
size_t i = (n) / sizeof(TYPE); \
|
6289
|
+
TYPE* pi = (TYPE*)(void*)(parmi); \
|
6290
|
+
TYPE* pj = (TYPE*)(void*)(parmj); \
|
6291
|
+
do { \
|
6292
|
+
TYPE t = *pi; \
|
6293
|
+
*pi++ = *pj; \
|
6294
|
+
*pj++ = t; \
|
6295
|
+
} while (--i > 0); \
|
6224
6296
|
} while (0)
|
6225
6297
|
|
6226
6298
|
#ifdef HAVE_STDINT_H
|
6227
|
-
#define SWAPINIT(a, es)
|
6299
|
+
#define SWAPINIT(a, es) \
|
6300
|
+
swaptype = (uintptr_t)(a) % sizeof(long) || (es) % sizeof(long) ? 2 \
|
6301
|
+
: (es) == sizeof(long) ? 0 \
|
6302
|
+
: 1;
|
6228
6303
|
#else
|
6229
|
-
#define SWAPINIT(a, es)
|
6230
|
-
swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2
|
6304
|
+
#define SWAPINIT(a, es) \
|
6305
|
+
swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2 \
|
6306
|
+
: (es) == sizeof(long) ? 0 \
|
6307
|
+
: 1;
|
6231
6308
|
#endif
|
6232
6309
|
|
6233
6310
|
static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
|
@@ -6237,19 +6314,20 @@ static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
|
|
6237
6314
|
swapcode(char, a, b, n);
|
6238
6315
|
}
|
6239
6316
|
|
6240
|
-
#define swap(a, b)
|
6241
|
-
if (swaptype == 0) {
|
6242
|
-
long t = *(long*)(void*)(a);
|
6243
|
-
*(long*)(void*)(a) = *(long*)(void*)(b);
|
6244
|
-
*(long*)(void*)(b) = t;
|
6245
|
-
} else
|
6317
|
+
#define swap(a, b) \
|
6318
|
+
if (swaptype == 0) { \
|
6319
|
+
long t = *(long*)(void*)(a); \
|
6320
|
+
*(long*)(void*)(a) = *(long*)(void*)(b); \
|
6321
|
+
*(long*)(void*)(b) = t; \
|
6322
|
+
} else \
|
6246
6323
|
swapfunc(a, b, es, swaptype)
|
6247
6324
|
|
6248
|
-
#define vecswap(a, b, n)
|
6325
|
+
#define vecswap(a, b, n) \
|
6249
6326
|
if ((n) > 0) swapfunc((a), (b), (size_t)(n), swaptype)
|
6250
6327
|
|
6251
|
-
#define med3(a, b, c, _cmp)
|
6252
|
-
(cmpgt(b, a) ? (cmpgt(c, b) ? b : (cmpgt(c, a) ? c : a))
|
6328
|
+
#define med3(a, b, c, _cmp) \
|
6329
|
+
(cmpgt(b, a) ? (cmpgt(c, b) ? b : (cmpgt(c, a) ? c : a)) \
|
6330
|
+
: (cmpgt(b, c) ? b : (cmpgt(c, a) ? a : c)))
|
6253
6331
|
#endif
|
6254
6332
|
|
6255
6333
|
#undef qsort_dtype
|
@@ -6489,8 +6567,8 @@ static void iter_sfloat_sort_prnan(na_loop_t* const lp) {
|
|
6489
6567
|
*/
|
6490
6568
|
static VALUE sfloat_sort(int argc, VALUE* argv, VALUE self) {
|
6491
6569
|
VALUE reduce;
|
6492
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_reduce, 0}};
|
6493
|
-
ndfunc_t ndf = {0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 0, ain, 0};
|
6570
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
|
6571
|
+
ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 0, ain, 0 };
|
6494
6572
|
|
6495
6573
|
if (!TEST_INPLACE(self)) {
|
6496
6574
|
self = na_copy(self);
|
@@ -6595,7 +6673,8 @@ loop:
|
|
6595
6673
|
pm = med3(pl, pm, pn, cmp);
|
6596
6674
|
}
|
6597
6675
|
swap(a, pm);
|
6598
|
-
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
6676
|
+
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
6677
|
+
pb += es, pc -= es) {
|
6599
6678
|
while (pb <= pc && (r = cmp(pb, a)) <= 0) {
|
6600
6679
|
if (r == 0) {
|
6601
6680
|
swap(pa, pb);
|
@@ -6720,7 +6799,8 @@ loop:
|
|
6720
6799
|
pm = med3(pl, pm, pn, cmp);
|
6721
6800
|
}
|
6722
6801
|
swap(a, pm);
|
6723
|
-
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
6802
|
+
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
6803
|
+
pb += es, pc -= es) {
|
6724
6804
|
while (pb <= pc && (r = cmp(pb, a)) <= 0) {
|
6725
6805
|
if (r == 0) {
|
6726
6806
|
swap(pa, pb);
|
@@ -6767,7 +6847,6 @@ static void sfloat_index64_qsort_ignan(na_loop_t* const lp) {
|
|
6767
6847
|
|
6768
6848
|
ptr = (char**)(lp->opt_ptr);
|
6769
6849
|
|
6770
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
6771
6850
|
// 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);
|
6772
6851
|
|
6773
6852
|
if (n == 1) {
|
@@ -6777,21 +6856,17 @@ static void sfloat_index64_qsort_ignan(na_loop_t* const lp) {
|
|
6777
6856
|
|
6778
6857
|
for (i = 0; i < n; i++) {
|
6779
6858
|
ptr[i] = d_ptr + d_step * i;
|
6780
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
6781
6859
|
}
|
6782
6860
|
|
6783
6861
|
sfloat_index_qsort_ignan(ptr, n, sizeof(dtype*));
|
6784
6862
|
|
6785
6863
|
// d_ptr = lp->args[0].ptr;
|
6786
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
6787
6864
|
|
6788
6865
|
for (i = 0; i < n; i++) {
|
6789
6866
|
idx = (ptr[i] - d_ptr) / d_step;
|
6790
6867
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
6791
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
6792
6868
|
o_ptr += o_step;
|
6793
6869
|
}
|
6794
|
-
// printf("\n");
|
6795
6870
|
}
|
6796
6871
|
#undef idx_t
|
6797
6872
|
|
@@ -6809,7 +6884,6 @@ static void sfloat_index32_qsort_ignan(na_loop_t* const lp) {
|
|
6809
6884
|
|
6810
6885
|
ptr = (char**)(lp->opt_ptr);
|
6811
6886
|
|
6812
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
6813
6887
|
// 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);
|
6814
6888
|
|
6815
6889
|
if (n == 1) {
|
@@ -6819,21 +6893,17 @@ static void sfloat_index32_qsort_ignan(na_loop_t* const lp) {
|
|
6819
6893
|
|
6820
6894
|
for (i = 0; i < n; i++) {
|
6821
6895
|
ptr[i] = d_ptr + d_step * i;
|
6822
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
6823
6896
|
}
|
6824
6897
|
|
6825
6898
|
sfloat_index_qsort_ignan(ptr, n, sizeof(dtype*));
|
6826
6899
|
|
6827
6900
|
// d_ptr = lp->args[0].ptr;
|
6828
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
6829
6901
|
|
6830
6902
|
for (i = 0; i < n; i++) {
|
6831
6903
|
idx = (ptr[i] - d_ptr) / d_step;
|
6832
6904
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
6833
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
6834
6905
|
o_ptr += o_step;
|
6835
6906
|
}
|
6836
|
-
// printf("\n");
|
6837
6907
|
}
|
6838
6908
|
#undef idx_t
|
6839
6909
|
|
@@ -6851,7 +6921,6 @@ static void sfloat_index64_qsort_prnan(na_loop_t* const lp) {
|
|
6851
6921
|
|
6852
6922
|
ptr = (char**)(lp->opt_ptr);
|
6853
6923
|
|
6854
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
6855
6924
|
// 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);
|
6856
6925
|
|
6857
6926
|
if (n == 1) {
|
@@ -6861,21 +6930,17 @@ static void sfloat_index64_qsort_prnan(na_loop_t* const lp) {
|
|
6861
6930
|
|
6862
6931
|
for (i = 0; i < n; i++) {
|
6863
6932
|
ptr[i] = d_ptr + d_step * i;
|
6864
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
6865
6933
|
}
|
6866
6934
|
|
6867
6935
|
sfloat_index_qsort_prnan(ptr, n, sizeof(dtype*));
|
6868
6936
|
|
6869
6937
|
// d_ptr = lp->args[0].ptr;
|
6870
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
6871
6938
|
|
6872
6939
|
for (i = 0; i < n; i++) {
|
6873
6940
|
idx = (ptr[i] - d_ptr) / d_step;
|
6874
6941
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
6875
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
6876
6942
|
o_ptr += o_step;
|
6877
6943
|
}
|
6878
|
-
// printf("\n");
|
6879
6944
|
}
|
6880
6945
|
#undef idx_t
|
6881
6946
|
|
@@ -6893,7 +6958,6 @@ static void sfloat_index32_qsort_prnan(na_loop_t* const lp) {
|
|
6893
6958
|
|
6894
6959
|
ptr = (char**)(lp->opt_ptr);
|
6895
6960
|
|
6896
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
6897
6961
|
// 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);
|
6898
6962
|
|
6899
6963
|
if (n == 1) {
|
@@ -6903,21 +6967,17 @@ static void sfloat_index32_qsort_prnan(na_loop_t* const lp) {
|
|
6903
6967
|
|
6904
6968
|
for (i = 0; i < n; i++) {
|
6905
6969
|
ptr[i] = d_ptr + d_step * i;
|
6906
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
6907
6970
|
}
|
6908
6971
|
|
6909
6972
|
sfloat_index_qsort_prnan(ptr, n, sizeof(dtype*));
|
6910
6973
|
|
6911
6974
|
// d_ptr = lp->args[0].ptr;
|
6912
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
6913
6975
|
|
6914
6976
|
for (i = 0; i < n; i++) {
|
6915
6977
|
idx = (ptr[i] - d_ptr) / d_step;
|
6916
6978
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
6917
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
6918
6979
|
o_ptr += o_step;
|
6919
6980
|
}
|
6920
|
-
// printf("\n");
|
6921
6981
|
}
|
6922
6982
|
#undef idx_t
|
6923
6983
|
|
@@ -6935,9 +6995,9 @@ static VALUE sfloat_sort_index(int argc, VALUE* argv, VALUE self) {
|
|
6935
6995
|
narray_t* na;
|
6936
6996
|
VALUE idx, tmp, reduce, res;
|
6937
6997
|
char* buf;
|
6938
|
-
ndfunc_arg_in_t ain[3] = {{cT, 0}, {0, 0}, {sym_reduce, 0}};
|
6939
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
6940
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_CUM, 3, 1, ain, aout};
|
6998
|
+
ndfunc_arg_in_t ain[3] = { { cT, 0 }, { 0, 0 }, { sym_reduce, 0 } };
|
6999
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
7000
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_CUM, 3, 1, ain, aout };
|
6941
7001
|
|
6942
7002
|
GetNArray(self, na);
|
6943
7003
|
if (na->ndim == 0) {
|
@@ -7020,15 +7080,16 @@ static void iter_sfloat_median_prnan(na_loop_t* const lp) {
|
|
7020
7080
|
@overload median(axis:nil, keepdims:false, nan:false)
|
7021
7081
|
@param [TrueClass] nan (keyword) If true, propagete NaN. If false, ignore NaN.
|
7022
7082
|
@param [Numeric,Array,Range] axis Finds median along the axis.
|
7023
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
7083
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
7084
|
+
dimensions with size one.
|
7024
7085
|
@return [Numo::SFloat] returns median of self.
|
7025
7086
|
*/
|
7026
7087
|
|
7027
7088
|
static VALUE sfloat_median(int argc, VALUE* argv, VALUE self) {
|
7028
7089
|
VALUE v, reduce;
|
7029
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_reduce, 0}};
|
7030
|
-
ndfunc_arg_out_t aout[1] = {{INT2FIX(0), 0}};
|
7031
|
-
ndfunc_t ndf = {0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
7090
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
|
7091
|
+
ndfunc_arg_out_t aout[1] = { { INT2FIX(0), 0 } };
|
7092
|
+
ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
7032
7093
|
|
7033
7094
|
self = na_copy(self); // as temporary buffer
|
7034
7095
|
|
@@ -7093,9 +7154,12 @@ static void iter_sfloat_math_s_sqrt(na_loop_t* const lp) {
|
|
7093
7154
|
#ifdef __SSE2__
|
7094
7155
|
//
|
7095
7156
|
// Check number of elements. & Check same alignment.
|
7096
|
-
if ((n >= num_pack) &&
|
7157
|
+
if ((n >= num_pack) &&
|
7158
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p2)[i], SIMD_ALIGNMENT_SIZE)) {
|
7097
7159
|
// Calculate up to the position just before the start of SIMD computation.
|
7098
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
7160
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
7161
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
7162
|
+
);
|
7099
7163
|
#endif
|
7100
7164
|
#ifdef __SSE2__
|
7101
7165
|
for (i = 0; i < cnt; i++) {
|
@@ -7164,9 +7228,9 @@ static void iter_sfloat_math_s_sqrt(na_loop_t* const lp) {
|
|
7164
7228
|
@return [Numo::SFloat] result of sqrt(x).
|
7165
7229
|
*/
|
7166
7230
|
static VALUE sfloat_math_s_sqrt(VALUE mod, VALUE a1) {
|
7167
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7168
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7169
|
-
ndfunc_t ndf = {iter_sfloat_math_s_sqrt, FULL_LOOP, 1, 1, ain, aout};
|
7231
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7232
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7233
|
+
ndfunc_t ndf = { iter_sfloat_math_s_sqrt, FULL_LOOP, 1, 1, ain, aout };
|
7170
7234
|
|
7171
7235
|
return na_ndloop(&ndf, 1, a1);
|
7172
7236
|
}
|
@@ -7242,9 +7306,9 @@ static void iter_sfloat_math_s_cbrt(na_loop_t* const lp) {
|
|
7242
7306
|
@return [Numo::SFloat] result of cbrt(x).
|
7243
7307
|
*/
|
7244
7308
|
static VALUE sfloat_math_s_cbrt(VALUE mod, VALUE a1) {
|
7245
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7246
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7247
|
-
ndfunc_t ndf = {iter_sfloat_math_s_cbrt, FULL_LOOP, 1, 1, ain, aout};
|
7309
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7310
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7311
|
+
ndfunc_t ndf = { iter_sfloat_math_s_cbrt, FULL_LOOP, 1, 1, ain, aout };
|
7248
7312
|
|
7249
7313
|
return na_ndloop(&ndf, 1, a1);
|
7250
7314
|
}
|
@@ -7320,9 +7384,9 @@ static void iter_sfloat_math_s_log(na_loop_t* const lp) {
|
|
7320
7384
|
@return [Numo::SFloat] result of log(x).
|
7321
7385
|
*/
|
7322
7386
|
static VALUE sfloat_math_s_log(VALUE mod, VALUE a1) {
|
7323
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7324
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7325
|
-
ndfunc_t ndf = {iter_sfloat_math_s_log, FULL_LOOP, 1, 1, ain, aout};
|
7387
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7388
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7389
|
+
ndfunc_t ndf = { iter_sfloat_math_s_log, FULL_LOOP, 1, 1, ain, aout };
|
7326
7390
|
|
7327
7391
|
return na_ndloop(&ndf, 1, a1);
|
7328
7392
|
}
|
@@ -7398,9 +7462,9 @@ static void iter_sfloat_math_s_log2(na_loop_t* const lp) {
|
|
7398
7462
|
@return [Numo::SFloat] result of log2(x).
|
7399
7463
|
*/
|
7400
7464
|
static VALUE sfloat_math_s_log2(VALUE mod, VALUE a1) {
|
7401
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7402
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7403
|
-
ndfunc_t ndf = {iter_sfloat_math_s_log2, FULL_LOOP, 1, 1, ain, aout};
|
7465
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7466
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7467
|
+
ndfunc_t ndf = { iter_sfloat_math_s_log2, FULL_LOOP, 1, 1, ain, aout };
|
7404
7468
|
|
7405
7469
|
return na_ndloop(&ndf, 1, a1);
|
7406
7470
|
}
|
@@ -7476,9 +7540,9 @@ static void iter_sfloat_math_s_log10(na_loop_t* const lp) {
|
|
7476
7540
|
@return [Numo::SFloat] result of log10(x).
|
7477
7541
|
*/
|
7478
7542
|
static VALUE sfloat_math_s_log10(VALUE mod, VALUE a1) {
|
7479
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7480
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7481
|
-
ndfunc_t ndf = {iter_sfloat_math_s_log10, FULL_LOOP, 1, 1, ain, aout};
|
7543
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7544
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7545
|
+
ndfunc_t ndf = { iter_sfloat_math_s_log10, FULL_LOOP, 1, 1, ain, aout };
|
7482
7546
|
|
7483
7547
|
return na_ndloop(&ndf, 1, a1);
|
7484
7548
|
}
|
@@ -7554,9 +7618,9 @@ static void iter_sfloat_math_s_exp(na_loop_t* const lp) {
|
|
7554
7618
|
@return [Numo::SFloat] result of exp(x).
|
7555
7619
|
*/
|
7556
7620
|
static VALUE sfloat_math_s_exp(VALUE mod, VALUE a1) {
|
7557
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7558
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7559
|
-
ndfunc_t ndf = {iter_sfloat_math_s_exp, FULL_LOOP, 1, 1, ain, aout};
|
7621
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7622
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7623
|
+
ndfunc_t ndf = { iter_sfloat_math_s_exp, FULL_LOOP, 1, 1, ain, aout };
|
7560
7624
|
|
7561
7625
|
return na_ndloop(&ndf, 1, a1);
|
7562
7626
|
}
|
@@ -7632,9 +7696,9 @@ static void iter_sfloat_math_s_exp2(na_loop_t* const lp) {
|
|
7632
7696
|
@return [Numo::SFloat] result of exp2(x).
|
7633
7697
|
*/
|
7634
7698
|
static VALUE sfloat_math_s_exp2(VALUE mod, VALUE a1) {
|
7635
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7636
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7637
|
-
ndfunc_t ndf = {iter_sfloat_math_s_exp2, FULL_LOOP, 1, 1, ain, aout};
|
7699
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7700
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7701
|
+
ndfunc_t ndf = { iter_sfloat_math_s_exp2, FULL_LOOP, 1, 1, ain, aout };
|
7638
7702
|
|
7639
7703
|
return na_ndloop(&ndf, 1, a1);
|
7640
7704
|
}
|
@@ -7710,9 +7774,9 @@ static void iter_sfloat_math_s_exp10(na_loop_t* const lp) {
|
|
7710
7774
|
@return [Numo::SFloat] result of exp10(x).
|
7711
7775
|
*/
|
7712
7776
|
static VALUE sfloat_math_s_exp10(VALUE mod, VALUE a1) {
|
7713
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7714
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7715
|
-
ndfunc_t ndf = {iter_sfloat_math_s_exp10, FULL_LOOP, 1, 1, ain, aout};
|
7777
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7778
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7779
|
+
ndfunc_t ndf = { iter_sfloat_math_s_exp10, FULL_LOOP, 1, 1, ain, aout };
|
7716
7780
|
|
7717
7781
|
return na_ndloop(&ndf, 1, a1);
|
7718
7782
|
}
|
@@ -7788,9 +7852,9 @@ static void iter_sfloat_math_s_sin(na_loop_t* const lp) {
|
|
7788
7852
|
@return [Numo::SFloat] result of sin(x).
|
7789
7853
|
*/
|
7790
7854
|
static VALUE sfloat_math_s_sin(VALUE mod, VALUE a1) {
|
7791
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7792
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7793
|
-
ndfunc_t ndf = {iter_sfloat_math_s_sin, FULL_LOOP, 1, 1, ain, aout};
|
7855
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7856
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7857
|
+
ndfunc_t ndf = { iter_sfloat_math_s_sin, FULL_LOOP, 1, 1, ain, aout };
|
7794
7858
|
|
7795
7859
|
return na_ndloop(&ndf, 1, a1);
|
7796
7860
|
}
|
@@ -7866,9 +7930,9 @@ static void iter_sfloat_math_s_cos(na_loop_t* const lp) {
|
|
7866
7930
|
@return [Numo::SFloat] result of cos(x).
|
7867
7931
|
*/
|
7868
7932
|
static VALUE sfloat_math_s_cos(VALUE mod, VALUE a1) {
|
7869
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7870
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7871
|
-
ndfunc_t ndf = {iter_sfloat_math_s_cos, FULL_LOOP, 1, 1, ain, aout};
|
7933
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7934
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7935
|
+
ndfunc_t ndf = { iter_sfloat_math_s_cos, FULL_LOOP, 1, 1, ain, aout };
|
7872
7936
|
|
7873
7937
|
return na_ndloop(&ndf, 1, a1);
|
7874
7938
|
}
|
@@ -7944,9 +8008,9 @@ static void iter_sfloat_math_s_tan(na_loop_t* const lp) {
|
|
7944
8008
|
@return [Numo::SFloat] result of tan(x).
|
7945
8009
|
*/
|
7946
8010
|
static VALUE sfloat_math_s_tan(VALUE mod, VALUE a1) {
|
7947
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7948
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7949
|
-
ndfunc_t ndf = {iter_sfloat_math_s_tan, FULL_LOOP, 1, 1, ain, aout};
|
8011
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8012
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8013
|
+
ndfunc_t ndf = { iter_sfloat_math_s_tan, FULL_LOOP, 1, 1, ain, aout };
|
7950
8014
|
|
7951
8015
|
return na_ndloop(&ndf, 1, a1);
|
7952
8016
|
}
|
@@ -8022,9 +8086,9 @@ static void iter_sfloat_math_s_asin(na_loop_t* const lp) {
|
|
8022
8086
|
@return [Numo::SFloat] result of asin(x).
|
8023
8087
|
*/
|
8024
8088
|
static VALUE sfloat_math_s_asin(VALUE mod, VALUE a1) {
|
8025
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8026
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8027
|
-
ndfunc_t ndf = {iter_sfloat_math_s_asin, FULL_LOOP, 1, 1, ain, aout};
|
8089
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8090
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8091
|
+
ndfunc_t ndf = { iter_sfloat_math_s_asin, FULL_LOOP, 1, 1, ain, aout };
|
8028
8092
|
|
8029
8093
|
return na_ndloop(&ndf, 1, a1);
|
8030
8094
|
}
|
@@ -8100,9 +8164,9 @@ static void iter_sfloat_math_s_acos(na_loop_t* const lp) {
|
|
8100
8164
|
@return [Numo::SFloat] result of acos(x).
|
8101
8165
|
*/
|
8102
8166
|
static VALUE sfloat_math_s_acos(VALUE mod, VALUE a1) {
|
8103
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8104
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8105
|
-
ndfunc_t ndf = {iter_sfloat_math_s_acos, FULL_LOOP, 1, 1, ain, aout};
|
8167
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8168
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8169
|
+
ndfunc_t ndf = { iter_sfloat_math_s_acos, FULL_LOOP, 1, 1, ain, aout };
|
8106
8170
|
|
8107
8171
|
return na_ndloop(&ndf, 1, a1);
|
8108
8172
|
}
|
@@ -8178,9 +8242,9 @@ static void iter_sfloat_math_s_atan(na_loop_t* const lp) {
|
|
8178
8242
|
@return [Numo::SFloat] result of atan(x).
|
8179
8243
|
*/
|
8180
8244
|
static VALUE sfloat_math_s_atan(VALUE mod, VALUE a1) {
|
8181
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8182
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8183
|
-
ndfunc_t ndf = {iter_sfloat_math_s_atan, FULL_LOOP, 1, 1, ain, aout};
|
8245
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8246
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8247
|
+
ndfunc_t ndf = { iter_sfloat_math_s_atan, FULL_LOOP, 1, 1, ain, aout };
|
8184
8248
|
|
8185
8249
|
return na_ndloop(&ndf, 1, a1);
|
8186
8250
|
}
|
@@ -8256,9 +8320,9 @@ static void iter_sfloat_math_s_sinh(na_loop_t* const lp) {
|
|
8256
8320
|
@return [Numo::SFloat] result of sinh(x).
|
8257
8321
|
*/
|
8258
8322
|
static VALUE sfloat_math_s_sinh(VALUE mod, VALUE a1) {
|
8259
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8260
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8261
|
-
ndfunc_t ndf = {iter_sfloat_math_s_sinh, FULL_LOOP, 1, 1, ain, aout};
|
8323
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8324
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8325
|
+
ndfunc_t ndf = { iter_sfloat_math_s_sinh, FULL_LOOP, 1, 1, ain, aout };
|
8262
8326
|
|
8263
8327
|
return na_ndloop(&ndf, 1, a1);
|
8264
8328
|
}
|
@@ -8334,9 +8398,9 @@ static void iter_sfloat_math_s_cosh(na_loop_t* const lp) {
|
|
8334
8398
|
@return [Numo::SFloat] result of cosh(x).
|
8335
8399
|
*/
|
8336
8400
|
static VALUE sfloat_math_s_cosh(VALUE mod, VALUE a1) {
|
8337
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8338
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8339
|
-
ndfunc_t ndf = {iter_sfloat_math_s_cosh, FULL_LOOP, 1, 1, ain, aout};
|
8401
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8402
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8403
|
+
ndfunc_t ndf = { iter_sfloat_math_s_cosh, FULL_LOOP, 1, 1, ain, aout };
|
8340
8404
|
|
8341
8405
|
return na_ndloop(&ndf, 1, a1);
|
8342
8406
|
}
|
@@ -8412,9 +8476,9 @@ static void iter_sfloat_math_s_tanh(na_loop_t* const lp) {
|
|
8412
8476
|
@return [Numo::SFloat] result of tanh(x).
|
8413
8477
|
*/
|
8414
8478
|
static VALUE sfloat_math_s_tanh(VALUE mod, VALUE a1) {
|
8415
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8416
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8417
|
-
ndfunc_t ndf = {iter_sfloat_math_s_tanh, FULL_LOOP, 1, 1, ain, aout};
|
8479
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8480
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8481
|
+
ndfunc_t ndf = { iter_sfloat_math_s_tanh, FULL_LOOP, 1, 1, ain, aout };
|
8418
8482
|
|
8419
8483
|
return na_ndloop(&ndf, 1, a1);
|
8420
8484
|
}
|
@@ -8490,9 +8554,9 @@ static void iter_sfloat_math_s_asinh(na_loop_t* const lp) {
|
|
8490
8554
|
@return [Numo::SFloat] result of asinh(x).
|
8491
8555
|
*/
|
8492
8556
|
static VALUE sfloat_math_s_asinh(VALUE mod, VALUE a1) {
|
8493
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8494
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8495
|
-
ndfunc_t ndf = {iter_sfloat_math_s_asinh, FULL_LOOP, 1, 1, ain, aout};
|
8557
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8558
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8559
|
+
ndfunc_t ndf = { iter_sfloat_math_s_asinh, FULL_LOOP, 1, 1, ain, aout };
|
8496
8560
|
|
8497
8561
|
return na_ndloop(&ndf, 1, a1);
|
8498
8562
|
}
|
@@ -8568,9 +8632,9 @@ static void iter_sfloat_math_s_acosh(na_loop_t* const lp) {
|
|
8568
8632
|
@return [Numo::SFloat] result of acosh(x).
|
8569
8633
|
*/
|
8570
8634
|
static VALUE sfloat_math_s_acosh(VALUE mod, VALUE a1) {
|
8571
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8572
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8573
|
-
ndfunc_t ndf = {iter_sfloat_math_s_acosh, FULL_LOOP, 1, 1, ain, aout};
|
8635
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8636
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8637
|
+
ndfunc_t ndf = { iter_sfloat_math_s_acosh, FULL_LOOP, 1, 1, ain, aout };
|
8574
8638
|
|
8575
8639
|
return na_ndloop(&ndf, 1, a1);
|
8576
8640
|
}
|
@@ -8646,9 +8710,9 @@ static void iter_sfloat_math_s_atanh(na_loop_t* const lp) {
|
|
8646
8710
|
@return [Numo::SFloat] result of atanh(x).
|
8647
8711
|
*/
|
8648
8712
|
static VALUE sfloat_math_s_atanh(VALUE mod, VALUE a1) {
|
8649
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8650
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8651
|
-
ndfunc_t ndf = {iter_sfloat_math_s_atanh, FULL_LOOP, 1, 1, ain, aout};
|
8713
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8714
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8715
|
+
ndfunc_t ndf = { iter_sfloat_math_s_atanh, FULL_LOOP, 1, 1, ain, aout };
|
8652
8716
|
|
8653
8717
|
return na_ndloop(&ndf, 1, a1);
|
8654
8718
|
}
|
@@ -8724,9 +8788,9 @@ static void iter_sfloat_math_s_sinc(na_loop_t* const lp) {
|
|
8724
8788
|
@return [Numo::SFloat] result of sinc(x).
|
8725
8789
|
*/
|
8726
8790
|
static VALUE sfloat_math_s_sinc(VALUE mod, VALUE a1) {
|
8727
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8728
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8729
|
-
ndfunc_t ndf = {iter_sfloat_math_s_sinc, FULL_LOOP, 1, 1, ain, aout};
|
8791
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8792
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8793
|
+
ndfunc_t ndf = { iter_sfloat_math_s_sinc, FULL_LOOP, 1, 1, ain, aout };
|
8730
8794
|
|
8731
8795
|
return na_ndloop(&ndf, 1, a1);
|
8732
8796
|
}
|
@@ -8756,9 +8820,9 @@ static void iter_sfloat_math_s_atan2(na_loop_t* const lp) {
|
|
8756
8820
|
@return [Numo::SFloat] atan2(a1,a2).
|
8757
8821
|
*/
|
8758
8822
|
static VALUE sfloat_math_s_atan2(VALUE mod, VALUE a1, VALUE a2) {
|
8759
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
8760
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8761
|
-
ndfunc_t ndf = {iter_sfloat_math_s_atan2, STRIDE_LOOP, 2, 1, ain, aout};
|
8823
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
8824
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8825
|
+
ndfunc_t ndf = { iter_sfloat_math_s_atan2, STRIDE_LOOP, 2, 1, ain, aout };
|
8762
8826
|
return na_ndloop(&ndf, 2, a1, a2);
|
8763
8827
|
}
|
8764
8828
|
|
@@ -8787,9 +8851,9 @@ static void iter_sfloat_math_s_hypot(na_loop_t* const lp) {
|
|
8787
8851
|
@return [Numo::SFloat] hypot(a1,a2).
|
8788
8852
|
*/
|
8789
8853
|
static VALUE sfloat_math_s_hypot(VALUE mod, VALUE a1, VALUE a2) {
|
8790
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
8791
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8792
|
-
ndfunc_t ndf = {iter_sfloat_math_s_hypot, STRIDE_LOOP, 2, 1, ain, aout};
|
8854
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
8855
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8856
|
+
ndfunc_t ndf = { iter_sfloat_math_s_hypot, STRIDE_LOOP, 2, 1, ain, aout };
|
8793
8857
|
return na_ndloop(&ndf, 2, a1, a2);
|
8794
8858
|
}
|
8795
8859
|
|
@@ -8864,9 +8928,9 @@ static void iter_sfloat_math_s_erf(na_loop_t* const lp) {
|
|
8864
8928
|
@return [Numo::SFloat] result of erf(x).
|
8865
8929
|
*/
|
8866
8930
|
static VALUE sfloat_math_s_erf(VALUE mod, VALUE a1) {
|
8867
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8868
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8869
|
-
ndfunc_t ndf = {iter_sfloat_math_s_erf, FULL_LOOP, 1, 1, ain, aout};
|
8931
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8932
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8933
|
+
ndfunc_t ndf = { iter_sfloat_math_s_erf, FULL_LOOP, 1, 1, ain, aout };
|
8870
8934
|
|
8871
8935
|
return na_ndloop(&ndf, 1, a1);
|
8872
8936
|
}
|
@@ -8942,9 +9006,9 @@ static void iter_sfloat_math_s_erfc(na_loop_t* const lp) {
|
|
8942
9006
|
@return [Numo::SFloat] result of erfc(x).
|
8943
9007
|
*/
|
8944
9008
|
static VALUE sfloat_math_s_erfc(VALUE mod, VALUE a1) {
|
8945
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8946
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8947
|
-
ndfunc_t ndf = {iter_sfloat_math_s_erfc, FULL_LOOP, 1, 1, ain, aout};
|
9009
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
9010
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
9011
|
+
ndfunc_t ndf = { iter_sfloat_math_s_erfc, FULL_LOOP, 1, 1, ain, aout };
|
8948
9012
|
|
8949
9013
|
return na_ndloop(&ndf, 1, a1);
|
8950
9014
|
}
|
@@ -9020,9 +9084,9 @@ static void iter_sfloat_math_s_log1p(na_loop_t* const lp) {
|
|
9020
9084
|
@return [Numo::SFloat] result of log1p(x).
|
9021
9085
|
*/
|
9022
9086
|
static VALUE sfloat_math_s_log1p(VALUE mod, VALUE a1) {
|
9023
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
9024
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
9025
|
-
ndfunc_t ndf = {iter_sfloat_math_s_log1p, FULL_LOOP, 1, 1, ain, aout};
|
9087
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
9088
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
9089
|
+
ndfunc_t ndf = { iter_sfloat_math_s_log1p, FULL_LOOP, 1, 1, ain, aout };
|
9026
9090
|
|
9027
9091
|
return na_ndloop(&ndf, 1, a1);
|
9028
9092
|
}
|
@@ -9098,9 +9162,9 @@ static void iter_sfloat_math_s_expm1(na_loop_t* const lp) {
|
|
9098
9162
|
@return [Numo::SFloat] result of expm1(x).
|
9099
9163
|
*/
|
9100
9164
|
static VALUE sfloat_math_s_expm1(VALUE mod, VALUE a1) {
|
9101
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
9102
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
9103
|
-
ndfunc_t ndf = {iter_sfloat_math_s_expm1, FULL_LOOP, 1, 1, ain, aout};
|
9165
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
9166
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
9167
|
+
ndfunc_t ndf = { iter_sfloat_math_s_expm1, FULL_LOOP, 1, 1, ain, aout };
|
9104
9168
|
|
9105
9169
|
return na_ndloop(&ndf, 1, a1);
|
9106
9170
|
}
|
@@ -9130,9 +9194,9 @@ static void iter_sfloat_math_s_ldexp(na_loop_t* const lp) {
|
|
9130
9194
|
@return [Numo::SFloat] ldexp(a1,a2).
|
9131
9195
|
*/
|
9132
9196
|
static VALUE sfloat_math_s_ldexp(VALUE mod, VALUE a1, VALUE a2) {
|
9133
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
9134
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
9135
|
-
ndfunc_t ndf = {iter_sfloat_math_s_ldexp, STRIDE_LOOP, 2, 1, ain, aout};
|
9197
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
9198
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
9199
|
+
ndfunc_t ndf = { iter_sfloat_math_s_ldexp, STRIDE_LOOP, 2, 1, ain, aout };
|
9136
9200
|
return na_ndloop(&ndf, 2, a1, a2);
|
9137
9201
|
}
|
9138
9202
|
|
@@ -9164,9 +9228,9 @@ static void iter_sfloat_math_s_frexp(na_loop_t* const lp) {
|
|
9164
9228
|
|
9165
9229
|
*/
|
9166
9230
|
static VALUE sfloat_math_s_frexp(VALUE mod, VALUE a1) {
|
9167
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
9168
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {numo_cInt32, 0}};
|
9169
|
-
ndfunc_t ndf = {iter_sfloat_math_s_frexp, STRIDE_LOOP, 1, 2, ain, aout};
|
9231
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
9232
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { numo_cInt32, 0 } };
|
9233
|
+
ndfunc_t ndf = { iter_sfloat_math_s_frexp, STRIDE_LOOP, 1, 2, ain, aout };
|
9170
9234
|
return na_ndloop(&ndf, 1, a1);
|
9171
9235
|
}
|
9172
9236
|
|