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_dfloat_store_bit(na_loop_t* const lp) {
|
|
237
237
|
}
|
238
238
|
|
239
239
|
static VALUE dfloat_store_bit(VALUE self, VALUE obj) {
|
240
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
241
|
-
ndfunc_t ndf = {iter_dfloat_store_bit, FULL_LOOP, 2, 0, ain, 0};
|
240
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
241
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_dfloat(na_loop_t* const lp) {
|
|
286
286
|
}
|
287
287
|
|
288
288
|
static VALUE dfloat_store_dfloat(VALUE self, VALUE obj) {
|
289
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
290
|
-
ndfunc_t ndf = {iter_dfloat_store_dfloat, FULL_LOOP, 2, 0, ain, 0};
|
289
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
290
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_sfloat(na_loop_t* const lp) {
|
|
335
335
|
}
|
336
336
|
|
337
337
|
static VALUE dfloat_store_sfloat(VALUE self, VALUE obj) {
|
338
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
339
|
-
ndfunc_t ndf = {iter_dfloat_store_sfloat, FULL_LOOP, 2, 0, ain, 0};
|
338
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
339
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_int64(na_loop_t* const lp) {
|
|
384
384
|
}
|
385
385
|
|
386
386
|
static VALUE dfloat_store_int64(VALUE self, VALUE obj) {
|
387
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
388
|
-
ndfunc_t ndf = {iter_dfloat_store_int64, FULL_LOOP, 2, 0, ain, 0};
|
387
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
388
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_int32(na_loop_t* const lp) {
|
|
433
433
|
}
|
434
434
|
|
435
435
|
static VALUE dfloat_store_int32(VALUE self, VALUE obj) {
|
436
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
437
|
-
ndfunc_t ndf = {iter_dfloat_store_int32, FULL_LOOP, 2, 0, ain, 0};
|
436
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
437
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_int16(na_loop_t* const lp) {
|
|
482
482
|
}
|
483
483
|
|
484
484
|
static VALUE dfloat_store_int16(VALUE self, VALUE obj) {
|
485
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
486
|
-
ndfunc_t ndf = {iter_dfloat_store_int16, FULL_LOOP, 2, 0, ain, 0};
|
485
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
486
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_int8(na_loop_t* const lp) {
|
|
531
531
|
}
|
532
532
|
|
533
533
|
static VALUE dfloat_store_int8(VALUE self, VALUE obj) {
|
534
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
535
|
-
ndfunc_t ndf = {iter_dfloat_store_int8, FULL_LOOP, 2, 0, ain, 0};
|
534
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
535
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_uint64(na_loop_t* const lp) {
|
|
580
580
|
}
|
581
581
|
|
582
582
|
static VALUE dfloat_store_uint64(VALUE self, VALUE obj) {
|
583
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
584
|
-
ndfunc_t ndf = {iter_dfloat_store_uint64, FULL_LOOP, 2, 0, ain, 0};
|
583
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
584
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_uint32(na_loop_t* const lp) {
|
|
629
629
|
}
|
630
630
|
|
631
631
|
static VALUE dfloat_store_uint32(VALUE self, VALUE obj) {
|
632
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
633
|
-
ndfunc_t ndf = {iter_dfloat_store_uint32, FULL_LOOP, 2, 0, ain, 0};
|
632
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
633
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_uint16(na_loop_t* const lp) {
|
|
678
678
|
}
|
679
679
|
|
680
680
|
static VALUE dfloat_store_uint16(VALUE self, VALUE obj) {
|
681
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
682
|
-
ndfunc_t ndf = {iter_dfloat_store_uint16, FULL_LOOP, 2, 0, ain, 0};
|
681
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
682
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_uint8(na_loop_t* const lp) {
|
|
727
727
|
}
|
728
728
|
|
729
729
|
static VALUE dfloat_store_uint8(VALUE self, VALUE obj) {
|
730
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
731
|
-
ndfunc_t ndf = {iter_dfloat_store_uint8, FULL_LOOP, 2, 0, ain, 0};
|
730
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
731
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_store_robject(na_loop_t* const lp) {
|
|
776
776
|
}
|
777
777
|
|
778
778
|
static VALUE dfloat_store_robject(VALUE self, VALUE obj) {
|
779
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
780
|
-
ndfunc_t ndf = {iter_dfloat_store_robject, FULL_LOOP, 2, 0, ain, 0};
|
779
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
780
|
+
ndfunc_t ndf = { iter_dfloat_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 dfloat_store_array(VALUE self, VALUE rary) {
|
888
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {rb_cArray, 0}};
|
889
|
-
ndfunc_t ndf = {iter_dfloat_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_dfloat_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 dfloat_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 dfloat_extract_data(VALUE obj) {
|
|
1076
1078
|
return dfloat_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 dfloat_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::DFloat] an element or NArray view.
|
1151
1156
|
@see Numo::NArray#[]
|
1152
1157
|
@see #[]=
|
@@ -1168,8 +1173,8 @@ static VALUE dfloat_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_dfloat_to_a(na_loop_t* const lp) {
|
|
1240
1245
|
@return [Array]
|
1241
1246
|
*/
|
1242
1247
|
static VALUE dfloat_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_dfloat_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_dfloat_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_dfloat_fill(na_loop_t* const lp) {
|
|
1274
1279
|
@return [Numo::DFloat] self.
|
1275
1280
|
*/
|
1276
1281
|
static VALUE dfloat_fill(VALUE self, VALUE val) {
|
1277
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_option}};
|
1278
|
-
ndfunc_t ndf = {iter_dfloat_fill, FULL_LOOP, 2, 0, ain, 0};
|
1282
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
|
1283
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_format(na_loop_t* const lp) {
|
|
1330
1335
|
static VALUE dfloat_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_dfloat_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_dfloat_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_dfloat_format_to_a(na_loop_t* const lp) {
|
|
1376
1381
|
*/
|
1377
1382
|
static VALUE dfloat_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_dfloat_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_dfloat_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_dfloat_each(na_loop_t* const lp) {
|
|
1432
1437
|
@see #map
|
1433
1438
|
*/
|
1434
1439
|
static VALUE dfloat_each(VALUE self) {
|
1435
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1436
|
-
ndfunc_t ndf = {iter_dfloat_each, FULL_LOOP_NIP, 1, 0, ain, 0};
|
1440
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1441
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_map(na_loop_t* const lp) {
|
|
1507
1512
|
@return [Numo::DFloat] map of self.
|
1508
1513
|
*/
|
1509
1514
|
static VALUE dfloat_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_dfloat_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_dfloat_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_dfloat_each_with_index(na_loop_t* const lp) {
|
|
1571
1576
|
@see #map_with_index
|
1572
1577
|
*/
|
1573
1578
|
static VALUE dfloat_each_with_index(VALUE self) {
|
1574
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1575
|
-
ndfunc_t ndf = {iter_dfloat_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0};
|
1579
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1580
|
+
ndfunc_t ndf = { iter_dfloat_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_dfloat_map_with_index(na_loop_t* const lp) {
|
|
1662
1667
|
@see #each_with_index
|
1663
1668
|
*/
|
1664
1669
|
static VALUE dfloat_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_dfloat_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_dfloat_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_dfloat_abs(na_loop_t* const lp) {
|
|
1716
1721
|
@return [Numo::DFloat] abs of self.
|
1717
1722
|
*/
|
1718
1723
|
static VALUE dfloat_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_dfloat_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_dfloat_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_dfloat_add(na_loop_t* const lp) {
|
@@ -1748,14 +1753,20 @@ static void iter_dfloat_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__
|
@@ -1816,7 +1827,8 @@ static void iter_dfloat_add(na_loop_t* const lp) {
|
|
1816
1827
|
return;
|
1817
1828
|
}
|
1818
1829
|
|
1819
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
1830
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
1831
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
1820
1832
|
//
|
1821
1833
|
|
1822
1834
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -1827,9 +1839,12 @@ static void iter_dfloat_add(na_loop_t* const lp) {
|
|
1827
1839
|
b = _mm_load1_pd(&((dtype*)p2)[0]);
|
1828
1840
|
|
1829
1841
|
// Check number of elements. & Check same alignment.
|
1830
|
-
if ((n >= num_pack) &&
|
1842
|
+
if ((n >= num_pack) &&
|
1843
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE)) {
|
1831
1844
|
// Calculate up to the position just before the start of SIMD computation.
|
1832
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
1845
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
1846
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
1847
|
+
);
|
1833
1848
|
#endif
|
1834
1849
|
if (p1 == p3) { // inplace case
|
1835
1850
|
#ifdef __SSE2__
|
@@ -1924,9 +1939,9 @@ static void iter_dfloat_add(na_loop_t* const lp) {
|
|
1924
1939
|
#undef check_intdivzero
|
1925
1940
|
|
1926
1941
|
static VALUE dfloat_add_self(VALUE self, VALUE other) {
|
1927
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
1928
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1929
|
-
ndfunc_t ndf = {iter_dfloat_add, STRIDE_LOOP, 2, 1, ain, aout};
|
1942
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
1943
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1944
|
+
ndfunc_t ndf = { iter_dfloat_add, STRIDE_LOOP, 2, 1, ain, aout };
|
1930
1945
|
|
1931
1946
|
return na_ndloop(&ndf, 2, self, other);
|
1932
1947
|
}
|
@@ -1950,7 +1965,7 @@ static VALUE dfloat_add(VALUE self, VALUE other) {
|
|
1950
1965
|
}
|
1951
1966
|
}
|
1952
1967
|
|
1953
|
-
#define check_intdivzero(y)
|
1968
|
+
#define check_intdivzero(y) \
|
1954
1969
|
{}
|
1955
1970
|
|
1956
1971
|
static void iter_dfloat_sub(na_loop_t* const lp) {
|
@@ -1975,14 +1990,20 @@ static void iter_dfloat_sub(na_loop_t* const lp) {
|
|
1975
1990
|
INIT_PTR(lp, 2, p3, s3);
|
1976
1991
|
|
1977
1992
|
//
|
1978
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1993
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
1994
|
+
is_aligned(p3, sizeof(dtype))) {
|
1979
1995
|
|
1980
1996
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
1981
1997
|
#ifdef __SSE2__
|
1982
1998
|
// Check number of elements. & Check same alignment.
|
1983
|
-
if ((n >= num_pack) &&
|
1999
|
+
if ((n >= num_pack) &&
|
2000
|
+
is_same_aligned3(
|
2001
|
+
&((dtype*)p1)[i], &((dtype*)p2)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE
|
2002
|
+
)) {
|
1984
2003
|
// Calculate up to the position just before the start of SIMD computation.
|
1985
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2004
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2005
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2006
|
+
);
|
1986
2007
|
#endif
|
1987
2008
|
if (p1 == p3) { // inplace case
|
1988
2009
|
#ifdef __SSE2__
|
@@ -2044,7 +2065,8 @@ static void iter_dfloat_sub(na_loop_t* const lp) {
|
|
2044
2065
|
return;
|
2045
2066
|
}
|
2046
2067
|
|
2047
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2068
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2069
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2048
2070
|
//
|
2049
2071
|
|
2050
2072
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2055,9 +2077,12 @@ static void iter_dfloat_sub(na_loop_t* const lp) {
|
|
2055
2077
|
b = _mm_load1_pd(&((dtype*)p2)[0]);
|
2056
2078
|
|
2057
2079
|
// Check number of elements. & Check same alignment.
|
2058
|
-
if ((n >= num_pack) &&
|
2080
|
+
if ((n >= num_pack) &&
|
2081
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE)) {
|
2059
2082
|
// Calculate up to the position just before the start of SIMD computation.
|
2060
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2083
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2084
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2085
|
+
);
|
2061
2086
|
#endif
|
2062
2087
|
if (p1 == p3) { // inplace case
|
2063
2088
|
#ifdef __SSE2__
|
@@ -2153,9 +2178,9 @@ static void iter_dfloat_sub(na_loop_t* const lp) {
|
|
2153
2178
|
#undef check_intdivzero
|
2154
2179
|
|
2155
2180
|
static VALUE dfloat_sub_self(VALUE self, VALUE other) {
|
2156
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2157
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2158
|
-
ndfunc_t ndf = {iter_dfloat_sub, STRIDE_LOOP, 2, 1, ain, aout};
|
2181
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2182
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2183
|
+
ndfunc_t ndf = { iter_dfloat_sub, STRIDE_LOOP, 2, 1, ain, aout };
|
2159
2184
|
|
2160
2185
|
return na_ndloop(&ndf, 2, self, other);
|
2161
2186
|
}
|
@@ -2179,7 +2204,7 @@ static VALUE dfloat_sub(VALUE self, VALUE other) {
|
|
2179
2204
|
}
|
2180
2205
|
}
|
2181
2206
|
|
2182
|
-
#define check_intdivzero(y)
|
2207
|
+
#define check_intdivzero(y) \
|
2183
2208
|
{}
|
2184
2209
|
|
2185
2210
|
static void iter_dfloat_mul(na_loop_t* const lp) {
|
@@ -2204,14 +2229,20 @@ static void iter_dfloat_mul(na_loop_t* const lp) {
|
|
2204
2229
|
INIT_PTR(lp, 2, p3, s3);
|
2205
2230
|
|
2206
2231
|
//
|
2207
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2232
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2233
|
+
is_aligned(p3, sizeof(dtype))) {
|
2208
2234
|
|
2209
2235
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2210
2236
|
#ifdef __SSE2__
|
2211
2237
|
// Check number of elements. & Check same alignment.
|
2212
|
-
if ((n >= num_pack) &&
|
2238
|
+
if ((n >= num_pack) &&
|
2239
|
+
is_same_aligned3(
|
2240
|
+
&((dtype*)p1)[i], &((dtype*)p2)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE
|
2241
|
+
)) {
|
2213
2242
|
// Calculate up to the position just before the start of SIMD computation.
|
2214
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2243
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2244
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2245
|
+
);
|
2215
2246
|
#endif
|
2216
2247
|
if (p1 == p3) { // inplace case
|
2217
2248
|
#ifdef __SSE2__
|
@@ -2273,7 +2304,8 @@ static void iter_dfloat_mul(na_loop_t* const lp) {
|
|
2273
2304
|
return;
|
2274
2305
|
}
|
2275
2306
|
|
2276
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2307
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2308
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2277
2309
|
//
|
2278
2310
|
|
2279
2311
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2284,9 +2316,12 @@ static void iter_dfloat_mul(na_loop_t* const lp) {
|
|
2284
2316
|
b = _mm_load1_pd(&((dtype*)p2)[0]);
|
2285
2317
|
|
2286
2318
|
// Check number of elements. & Check same alignment.
|
2287
|
-
if ((n >= num_pack) &&
|
2319
|
+
if ((n >= num_pack) &&
|
2320
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE)) {
|
2288
2321
|
// Calculate up to the position just before the start of SIMD computation.
|
2289
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2322
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2323
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2324
|
+
);
|
2290
2325
|
#endif
|
2291
2326
|
if (p1 == p3) { // inplace case
|
2292
2327
|
#ifdef __SSE2__
|
@@ -2382,9 +2417,9 @@ static void iter_dfloat_mul(na_loop_t* const lp) {
|
|
2382
2417
|
#undef check_intdivzero
|
2383
2418
|
|
2384
2419
|
static VALUE dfloat_mul_self(VALUE self, VALUE other) {
|
2385
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2386
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2387
|
-
ndfunc_t ndf = {iter_dfloat_mul, STRIDE_LOOP, 2, 1, ain, aout};
|
2420
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2421
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2422
|
+
ndfunc_t ndf = { iter_dfloat_mul, STRIDE_LOOP, 2, 1, ain, aout };
|
2388
2423
|
|
2389
2424
|
return na_ndloop(&ndf, 2, self, other);
|
2390
2425
|
}
|
@@ -2408,7 +2443,7 @@ static VALUE dfloat_mul(VALUE self, VALUE other) {
|
|
2408
2443
|
}
|
2409
2444
|
}
|
2410
2445
|
|
2411
|
-
#define check_intdivzero(y)
|
2446
|
+
#define check_intdivzero(y) \
|
2412
2447
|
{}
|
2413
2448
|
|
2414
2449
|
static void iter_dfloat_div(na_loop_t* const lp) {
|
@@ -2433,14 +2468,20 @@ static void iter_dfloat_div(na_loop_t* const lp) {
|
|
2433
2468
|
INIT_PTR(lp, 2, p3, s3);
|
2434
2469
|
|
2435
2470
|
//
|
2436
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2471
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2472
|
+
is_aligned(p3, sizeof(dtype))) {
|
2437
2473
|
|
2438
2474
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2439
2475
|
#ifdef __SSE2__
|
2440
2476
|
// Check number of elements. & Check same alignment.
|
2441
|
-
if ((n >= num_pack) &&
|
2477
|
+
if ((n >= num_pack) &&
|
2478
|
+
is_same_aligned3(
|
2479
|
+
&((dtype*)p1)[i], &((dtype*)p2)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE
|
2480
|
+
)) {
|
2442
2481
|
// Calculate up to the position just before the start of SIMD computation.
|
2443
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2482
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2483
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2484
|
+
);
|
2444
2485
|
#endif
|
2445
2486
|
if (p1 == p3) { // inplace case
|
2446
2487
|
#ifdef __SSE2__
|
@@ -2500,7 +2541,8 @@ static void iter_dfloat_div(na_loop_t* const lp) {
|
|
2500
2541
|
return;
|
2501
2542
|
}
|
2502
2543
|
|
2503
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2544
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2545
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2504
2546
|
//
|
2505
2547
|
|
2506
2548
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2511,9 +2553,12 @@ static void iter_dfloat_div(na_loop_t* const lp) {
|
|
2511
2553
|
b = _mm_load1_pd(&((dtype*)p2)[0]);
|
2512
2554
|
|
2513
2555
|
// Check number of elements. & Check same alignment.
|
2514
|
-
if ((n >= num_pack) &&
|
2556
|
+
if ((n >= num_pack) &&
|
2557
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p3)[i], SIMD_ALIGNMENT_SIZE)) {
|
2515
2558
|
// Calculate up to the position just before the start of SIMD computation.
|
2516
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2559
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
2560
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
2561
|
+
);
|
2517
2562
|
#endif
|
2518
2563
|
if (p1 == p3) { // inplace case
|
2519
2564
|
#ifdef __SSE2__
|
@@ -2611,9 +2656,9 @@ static void iter_dfloat_div(na_loop_t* const lp) {
|
|
2611
2656
|
#undef check_intdivzero
|
2612
2657
|
|
2613
2658
|
static VALUE dfloat_div_self(VALUE self, VALUE other) {
|
2614
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2615
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2616
|
-
ndfunc_t ndf = {iter_dfloat_div, STRIDE_LOOP, 2, 1, ain, aout};
|
2659
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2660
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2661
|
+
ndfunc_t ndf = { iter_dfloat_div, STRIDE_LOOP, 2, 1, ain, aout };
|
2617
2662
|
|
2618
2663
|
return na_ndloop(&ndf, 2, self, other);
|
2619
2664
|
}
|
@@ -2637,7 +2682,7 @@ static VALUE dfloat_div(VALUE self, VALUE other) {
|
|
2637
2682
|
}
|
2638
2683
|
}
|
2639
2684
|
|
2640
|
-
#define check_intdivzero(y)
|
2685
|
+
#define check_intdivzero(y) \
|
2641
2686
|
{}
|
2642
2687
|
|
2643
2688
|
static void iter_dfloat_mod(na_loop_t* const lp) {
|
@@ -2652,7 +2697,8 @@ static void iter_dfloat_mod(na_loop_t* const lp) {
|
|
2652
2697
|
INIT_PTR(lp, 2, p3, s3);
|
2653
2698
|
|
2654
2699
|
//
|
2655
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2700
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
2701
|
+
is_aligned(p3, sizeof(dtype))) {
|
2656
2702
|
|
2657
2703
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
2658
2704
|
if (p1 == p3) { // inplace case
|
@@ -2669,7 +2715,8 @@ static void iter_dfloat_mod(na_loop_t* const lp) {
|
|
2669
2715
|
return;
|
2670
2716
|
}
|
2671
2717
|
|
2672
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2718
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
2719
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
2673
2720
|
//
|
2674
2721
|
|
2675
2722
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -2727,9 +2774,9 @@ static void iter_dfloat_mod(na_loop_t* const lp) {
|
|
2727
2774
|
#undef check_intdivzero
|
2728
2775
|
|
2729
2776
|
static VALUE dfloat_mod_self(VALUE self, VALUE other) {
|
2730
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2731
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2732
|
-
ndfunc_t ndf = {iter_dfloat_mod, STRIDE_LOOP, 2, 1, ain, aout};
|
2777
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2778
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2779
|
+
ndfunc_t ndf = { iter_dfloat_mod, STRIDE_LOOP, 2, 1, ain, aout };
|
2733
2780
|
|
2734
2781
|
return na_ndloop(&ndf, 2, self, other);
|
2735
2782
|
}
|
@@ -2773,9 +2820,9 @@ static void iter_dfloat_divmod(na_loop_t* const lp) {
|
|
2773
2820
|
}
|
2774
2821
|
|
2775
2822
|
static VALUE dfloat_divmod_self(VALUE self, VALUE other) {
|
2776
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2777
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
2778
|
-
ndfunc_t ndf = {iter_dfloat_divmod, STRIDE_LOOP, 2, 2, ain, aout};
|
2823
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2824
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
2825
|
+
ndfunc_t ndf = { iter_dfloat_divmod, STRIDE_LOOP, 2, 2, ain, aout };
|
2779
2826
|
|
2780
2827
|
return na_ndloop(&ndf, 2, self, other);
|
2781
2828
|
}
|
@@ -2834,11 +2881,11 @@ static void iter_dfloat_pow_int32(na_loop_t* const lp) {
|
|
2834
2881
|
}
|
2835
2882
|
|
2836
2883
|
static VALUE dfloat_pow_self(VALUE self, VALUE other) {
|
2837
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2838
|
-
ndfunc_arg_in_t ain_i[2] = {{cT, 0}, {numo_cInt32, 0}};
|
2839
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2840
|
-
ndfunc_t ndf = {iter_dfloat_pow, STRIDE_LOOP, 2, 1, ain, aout};
|
2841
|
-
ndfunc_t ndf_i = {iter_dfloat_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout};
|
2884
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2885
|
+
ndfunc_arg_in_t ain_i[2] = { { cT, 0 }, { numo_cInt32, 0 } };
|
2886
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2887
|
+
ndfunc_t ndf = { iter_dfloat_pow, STRIDE_LOOP, 2, 1, ain, aout };
|
2888
|
+
ndfunc_t ndf_i = { iter_dfloat_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout };
|
2842
2889
|
|
2843
2890
|
// fixme : use na.integer?
|
2844
2891
|
if (FIXNUM_P(other) || rb_obj_is_kind_of(other, numo_cInt32)) {
|
@@ -2934,9 +2981,9 @@ static void iter_dfloat_minus(na_loop_t* const lp) {
|
|
2934
2981
|
@return [Numo::DFloat] minus of self.
|
2935
2982
|
*/
|
2936
2983
|
static VALUE dfloat_minus(VALUE self) {
|
2937
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2938
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2939
|
-
ndfunc_t ndf = {iter_dfloat_minus, FULL_LOOP, 1, 1, ain, aout};
|
2984
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2985
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2986
|
+
ndfunc_t ndf = { iter_dfloat_minus, FULL_LOOP, 1, 1, ain, aout };
|
2940
2987
|
|
2941
2988
|
return na_ndloop(&ndf, 1, self);
|
2942
2989
|
}
|
@@ -3009,9 +3056,9 @@ static void iter_dfloat_reciprocal(na_loop_t* const lp) {
|
|
3009
3056
|
@return [Numo::DFloat] reciprocal of self.
|
3010
3057
|
*/
|
3011
3058
|
static VALUE dfloat_reciprocal(VALUE self) {
|
3012
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3013
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3014
|
-
ndfunc_t ndf = {iter_dfloat_reciprocal, FULL_LOOP, 1, 1, ain, aout};
|
3059
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3060
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3061
|
+
ndfunc_t ndf = { iter_dfloat_reciprocal, FULL_LOOP, 1, 1, ain, aout };
|
3015
3062
|
|
3016
3063
|
return na_ndloop(&ndf, 1, self);
|
3017
3064
|
}
|
@@ -3084,9 +3131,9 @@ static void iter_dfloat_sign(na_loop_t* const lp) {
|
|
3084
3131
|
@return [Numo::DFloat] sign of self.
|
3085
3132
|
*/
|
3086
3133
|
static VALUE dfloat_sign(VALUE self) {
|
3087
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3088
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3089
|
-
ndfunc_t ndf = {iter_dfloat_sign, FULL_LOOP, 1, 1, ain, aout};
|
3134
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3135
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3136
|
+
ndfunc_t ndf = { iter_dfloat_sign, FULL_LOOP, 1, 1, ain, aout };
|
3090
3137
|
|
3091
3138
|
return na_ndloop(&ndf, 1, self);
|
3092
3139
|
}
|
@@ -3159,9 +3206,9 @@ static void iter_dfloat_square(na_loop_t* const lp) {
|
|
3159
3206
|
@return [Numo::DFloat] square of self.
|
3160
3207
|
*/
|
3161
3208
|
static VALUE dfloat_square(VALUE self) {
|
3162
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3163
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3164
|
-
ndfunc_t ndf = {iter_dfloat_square, FULL_LOOP, 1, 1, ain, aout};
|
3209
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3210
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3211
|
+
ndfunc_t ndf = { iter_dfloat_square, FULL_LOOP, 1, 1, ain, aout };
|
3165
3212
|
|
3166
3213
|
return na_ndloop(&ndf, 1, self);
|
3167
3214
|
}
|
@@ -3188,9 +3235,9 @@ static void iter_dfloat_eq(na_loop_t* const lp) {
|
|
3188
3235
|
}
|
3189
3236
|
|
3190
3237
|
static VALUE dfloat_eq_self(VALUE self, VALUE other) {
|
3191
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3192
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3193
|
-
ndfunc_t ndf = {iter_dfloat_eq, STRIDE_LOOP, 2, 1, ain, aout};
|
3238
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3239
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3240
|
+
ndfunc_t ndf = { iter_dfloat_eq, STRIDE_LOOP, 2, 1, ain, aout };
|
3194
3241
|
|
3195
3242
|
return na_ndloop(&ndf, 2, self, other);
|
3196
3243
|
}
|
@@ -3235,9 +3282,9 @@ static void iter_dfloat_ne(na_loop_t* const lp) {
|
|
3235
3282
|
}
|
3236
3283
|
|
3237
3284
|
static VALUE dfloat_ne_self(VALUE self, VALUE other) {
|
3238
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3239
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3240
|
-
ndfunc_t ndf = {iter_dfloat_ne, STRIDE_LOOP, 2, 1, ain, aout};
|
3285
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3286
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3287
|
+
ndfunc_t ndf = { iter_dfloat_ne, STRIDE_LOOP, 2, 1, ain, aout };
|
3241
3288
|
|
3242
3289
|
return na_ndloop(&ndf, 2, self, other);
|
3243
3290
|
}
|
@@ -3282,9 +3329,9 @@ static void iter_dfloat_nearly_eq(na_loop_t* const lp) {
|
|
3282
3329
|
}
|
3283
3330
|
|
3284
3331
|
static VALUE dfloat_nearly_eq_self(VALUE self, VALUE other) {
|
3285
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3286
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3287
|
-
ndfunc_t ndf = {iter_dfloat_nearly_eq, STRIDE_LOOP, 2, 1, ain, aout};
|
3332
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3333
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3334
|
+
ndfunc_t ndf = { iter_dfloat_nearly_eq, STRIDE_LOOP, 2, 1, ain, aout };
|
3288
3335
|
|
3289
3336
|
return na_ndloop(&ndf, 2, self, other);
|
3290
3337
|
}
|
@@ -3375,9 +3422,9 @@ static void iter_dfloat_floor(na_loop_t* const lp) {
|
|
3375
3422
|
@return [Numo::DFloat] floor of self.
|
3376
3423
|
*/
|
3377
3424
|
static VALUE dfloat_floor(VALUE self) {
|
3378
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3379
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3380
|
-
ndfunc_t ndf = {iter_dfloat_floor, FULL_LOOP, 1, 1, ain, aout};
|
3425
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3426
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3427
|
+
ndfunc_t ndf = { iter_dfloat_floor, FULL_LOOP, 1, 1, ain, aout };
|
3381
3428
|
|
3382
3429
|
return na_ndloop(&ndf, 1, self);
|
3383
3430
|
}
|
@@ -3450,9 +3497,9 @@ static void iter_dfloat_round(na_loop_t* const lp) {
|
|
3450
3497
|
@return [Numo::DFloat] round of self.
|
3451
3498
|
*/
|
3452
3499
|
static VALUE dfloat_round(VALUE self) {
|
3453
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3454
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3455
|
-
ndfunc_t ndf = {iter_dfloat_round, FULL_LOOP, 1, 1, ain, aout};
|
3500
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3501
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3502
|
+
ndfunc_t ndf = { iter_dfloat_round, FULL_LOOP, 1, 1, ain, aout };
|
3456
3503
|
|
3457
3504
|
return na_ndloop(&ndf, 1, self);
|
3458
3505
|
}
|
@@ -3525,9 +3572,9 @@ static void iter_dfloat_ceil(na_loop_t* const lp) {
|
|
3525
3572
|
@return [Numo::DFloat] ceil of self.
|
3526
3573
|
*/
|
3527
3574
|
static VALUE dfloat_ceil(VALUE self) {
|
3528
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3529
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3530
|
-
ndfunc_t ndf = {iter_dfloat_ceil, FULL_LOOP, 1, 1, ain, aout};
|
3575
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3576
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3577
|
+
ndfunc_t ndf = { iter_dfloat_ceil, FULL_LOOP, 1, 1, ain, aout };
|
3531
3578
|
|
3532
3579
|
return na_ndloop(&ndf, 1, self);
|
3533
3580
|
}
|
@@ -3600,9 +3647,9 @@ static void iter_dfloat_trunc(na_loop_t* const lp) {
|
|
3600
3647
|
@return [Numo::DFloat] trunc of self.
|
3601
3648
|
*/
|
3602
3649
|
static VALUE dfloat_trunc(VALUE self) {
|
3603
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3604
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3605
|
-
ndfunc_t ndf = {iter_dfloat_trunc, FULL_LOOP, 1, 1, ain, aout};
|
3650
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3651
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3652
|
+
ndfunc_t ndf = { iter_dfloat_trunc, FULL_LOOP, 1, 1, ain, aout };
|
3606
3653
|
|
3607
3654
|
return na_ndloop(&ndf, 1, self);
|
3608
3655
|
}
|
@@ -3675,14 +3722,14 @@ static void iter_dfloat_rint(na_loop_t* const lp) {
|
|
3675
3722
|
@return [Numo::DFloat] rint of self.
|
3676
3723
|
*/
|
3677
3724
|
static VALUE dfloat_rint(VALUE self) {
|
3678
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3679
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3680
|
-
ndfunc_t ndf = {iter_dfloat_rint, FULL_LOOP, 1, 1, ain, aout};
|
3725
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3726
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3727
|
+
ndfunc_t ndf = { iter_dfloat_rint, FULL_LOOP, 1, 1, ain, aout };
|
3681
3728
|
|
3682
3729
|
return na_ndloop(&ndf, 1, self);
|
3683
3730
|
}
|
3684
3731
|
|
3685
|
-
#define check_intdivzero(y)
|
3732
|
+
#define check_intdivzero(y) \
|
3686
3733
|
{}
|
3687
3734
|
|
3688
3735
|
static void iter_dfloat_copysign(na_loop_t* const lp) {
|
@@ -3697,7 +3744,8 @@ static void iter_dfloat_copysign(na_loop_t* const lp) {
|
|
3697
3744
|
INIT_PTR(lp, 2, p3, s3);
|
3698
3745
|
|
3699
3746
|
//
|
3700
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3747
|
+
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
|
3748
|
+
is_aligned(p3, sizeof(dtype))) {
|
3701
3749
|
|
3702
3750
|
if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
|
3703
3751
|
if (p1 == p3) { // inplace case
|
@@ -3714,7 +3762,8 @@ static void iter_dfloat_copysign(na_loop_t* const lp) {
|
|
3714
3762
|
return;
|
3715
3763
|
}
|
3716
3764
|
|
3717
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3765
|
+
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
|
3766
|
+
is_aligned_step(s3, sizeof(dtype))) {
|
3718
3767
|
//
|
3719
3768
|
|
3720
3769
|
if (s2 == 0) { // Broadcasting from scalar value.
|
@@ -3772,9 +3821,9 @@ static void iter_dfloat_copysign(na_loop_t* const lp) {
|
|
3772
3821
|
#undef check_intdivzero
|
3773
3822
|
|
3774
3823
|
static VALUE dfloat_copysign_self(VALUE self, VALUE other) {
|
3775
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3776
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3777
|
-
ndfunc_t ndf = {iter_dfloat_copysign, STRIDE_LOOP, 2, 1, ain, aout};
|
3824
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3825
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3826
|
+
ndfunc_t ndf = { iter_dfloat_copysign, STRIDE_LOOP, 2, 1, ain, aout };
|
3778
3827
|
|
3779
3828
|
return na_ndloop(&ndf, 2, self, other);
|
3780
3829
|
}
|
@@ -3833,9 +3882,9 @@ static void iter_dfloat_signbit(na_loop_t* const lp) {
|
|
3833
3882
|
@return [Numo::Bit] Condition of signbit.
|
3834
3883
|
*/
|
3835
3884
|
static VALUE dfloat_signbit(VALUE self) {
|
3836
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3837
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3838
|
-
ndfunc_t ndf = {iter_dfloat_signbit, FULL_LOOP, 1, 1, ain, aout};
|
3885
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3886
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3887
|
+
ndfunc_t ndf = { iter_dfloat_signbit, FULL_LOOP, 1, 1, ain, aout };
|
3839
3888
|
|
3840
3889
|
return na_ndloop(&ndf, 1, self);
|
3841
3890
|
}
|
@@ -3863,9 +3912,9 @@ static void iter_dfloat_modf(na_loop_t* const lp) {
|
|
3863
3912
|
@return [Numo::DFloat] modf of self.
|
3864
3913
|
*/
|
3865
3914
|
static VALUE dfloat_modf(VALUE self) {
|
3866
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3867
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
3868
|
-
ndfunc_t ndf = {iter_dfloat_modf, STRIDE_LOOP, 1, 2, ain, aout};
|
3915
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3916
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
3917
|
+
ndfunc_t ndf = { iter_dfloat_modf, STRIDE_LOOP, 1, 2, ain, aout };
|
3869
3918
|
|
3870
3919
|
return na_ndloop(&ndf, 1, self);
|
3871
3920
|
}
|
@@ -3892,9 +3941,9 @@ static void iter_dfloat_gt(na_loop_t* const lp) {
|
|
3892
3941
|
}
|
3893
3942
|
|
3894
3943
|
static VALUE dfloat_gt_self(VALUE self, VALUE other) {
|
3895
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3896
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3897
|
-
ndfunc_t ndf = {iter_dfloat_gt, STRIDE_LOOP, 2, 1, ain, aout};
|
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_dfloat_gt, STRIDE_LOOP, 2, 1, ain, aout };
|
3898
3947
|
|
3899
3948
|
return na_ndloop(&ndf, 2, self, other);
|
3900
3949
|
}
|
@@ -3939,9 +3988,9 @@ static void iter_dfloat_ge(na_loop_t* const lp) {
|
|
3939
3988
|
}
|
3940
3989
|
|
3941
3990
|
static VALUE dfloat_ge_self(VALUE self, VALUE other) {
|
3942
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3943
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3944
|
-
ndfunc_t ndf = {iter_dfloat_ge, STRIDE_LOOP, 2, 1, ain, aout};
|
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_dfloat_ge, STRIDE_LOOP, 2, 1, ain, aout };
|
3945
3994
|
|
3946
3995
|
return na_ndloop(&ndf, 2, self, other);
|
3947
3996
|
}
|
@@ -3986,9 +4035,9 @@ static void iter_dfloat_lt(na_loop_t* const lp) {
|
|
3986
4035
|
}
|
3987
4036
|
|
3988
4037
|
static VALUE dfloat_lt_self(VALUE self, VALUE other) {
|
3989
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3990
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3991
|
-
ndfunc_t ndf = {iter_dfloat_lt, STRIDE_LOOP, 2, 1, ain, aout};
|
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_dfloat_lt, STRIDE_LOOP, 2, 1, ain, aout };
|
3992
4041
|
|
3993
4042
|
return na_ndloop(&ndf, 2, self, other);
|
3994
4043
|
}
|
@@ -4033,9 +4082,9 @@ static void iter_dfloat_le(na_loop_t* const lp) {
|
|
4033
4082
|
}
|
4034
4083
|
|
4035
4084
|
static VALUE dfloat_le_self(VALUE self, VALUE other) {
|
4036
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
4037
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4038
|
-
ndfunc_t ndf = {iter_dfloat_le, STRIDE_LOOP, 2, 1, ain, aout};
|
4085
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
4086
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4087
|
+
ndfunc_t ndf = { iter_dfloat_le, STRIDE_LOOP, 2, 1, ain, aout };
|
4039
4088
|
|
4040
4089
|
return na_ndloop(&ndf, 2, self, other);
|
4041
4090
|
}
|
@@ -4154,11 +4203,11 @@ static void iter_dfloat_clip_max(na_loop_t* const lp) {
|
|
4154
4203
|
# [3, 4, 2, 3, 4, 5, 6, 7, 8, 8]
|
4155
4204
|
*/
|
4156
4205
|
static VALUE dfloat_clip(VALUE self, VALUE min, VALUE max) {
|
4157
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {cT, 0}, {cT, 0}};
|
4158
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4159
|
-
ndfunc_t ndf_min = {iter_dfloat_clip_min, STRIDE_LOOP, 2, 1, ain, aout};
|
4160
|
-
ndfunc_t ndf_max = {iter_dfloat_clip_max, STRIDE_LOOP, 2, 1, ain, aout};
|
4161
|
-
ndfunc_t ndf_both = {iter_dfloat_clip, STRIDE_LOOP, 3, 1, ain, aout};
|
4206
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { cT, 0 }, { cT, 0 } };
|
4207
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4208
|
+
ndfunc_t ndf_min = { iter_dfloat_clip_min, STRIDE_LOOP, 2, 1, ain, aout };
|
4209
|
+
ndfunc_t ndf_max = { iter_dfloat_clip_max, STRIDE_LOOP, 2, 1, ain, aout };
|
4210
|
+
ndfunc_t ndf_both = { iter_dfloat_clip, STRIDE_LOOP, 3, 1, ain, aout };
|
4162
4211
|
|
4163
4212
|
if (RTEST(min)) {
|
4164
4213
|
if (RTEST(max)) {
|
@@ -4210,9 +4259,9 @@ static void iter_dfloat_isnan(na_loop_t* const lp) {
|
|
4210
4259
|
@return [Numo::Bit] Condition of isnan.
|
4211
4260
|
*/
|
4212
4261
|
static VALUE dfloat_isnan(VALUE self) {
|
4213
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4214
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4215
|
-
ndfunc_t ndf = {iter_dfloat_isnan, FULL_LOOP, 1, 1, ain, aout};
|
4262
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4263
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4264
|
+
ndfunc_t ndf = { iter_dfloat_isnan, FULL_LOOP, 1, 1, ain, aout };
|
4216
4265
|
|
4217
4266
|
return na_ndloop(&ndf, 1, self);
|
4218
4267
|
}
|
@@ -4252,9 +4301,9 @@ static void iter_dfloat_isinf(na_loop_t* const lp) {
|
|
4252
4301
|
@return [Numo::Bit] Condition of isinf.
|
4253
4302
|
*/
|
4254
4303
|
static VALUE dfloat_isinf(VALUE self) {
|
4255
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4256
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4257
|
-
ndfunc_t ndf = {iter_dfloat_isinf, FULL_LOOP, 1, 1, ain, aout};
|
4304
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4305
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4306
|
+
ndfunc_t ndf = { iter_dfloat_isinf, FULL_LOOP, 1, 1, ain, aout };
|
4258
4307
|
|
4259
4308
|
return na_ndloop(&ndf, 1, self);
|
4260
4309
|
}
|
@@ -4294,9 +4343,9 @@ static void iter_dfloat_isposinf(na_loop_t* const lp) {
|
|
4294
4343
|
@return [Numo::Bit] Condition of isposinf.
|
4295
4344
|
*/
|
4296
4345
|
static VALUE dfloat_isposinf(VALUE self) {
|
4297
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4298
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4299
|
-
ndfunc_t ndf = {iter_dfloat_isposinf, FULL_LOOP, 1, 1, ain, aout};
|
4346
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4347
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4348
|
+
ndfunc_t ndf = { iter_dfloat_isposinf, FULL_LOOP, 1, 1, ain, aout };
|
4300
4349
|
|
4301
4350
|
return na_ndloop(&ndf, 1, self);
|
4302
4351
|
}
|
@@ -4336,9 +4385,9 @@ static void iter_dfloat_isneginf(na_loop_t* const lp) {
|
|
4336
4385
|
@return [Numo::Bit] Condition of isneginf.
|
4337
4386
|
*/
|
4338
4387
|
static VALUE dfloat_isneginf(VALUE self) {
|
4339
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4340
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4341
|
-
ndfunc_t ndf = {iter_dfloat_isneginf, FULL_LOOP, 1, 1, ain, aout};
|
4388
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4389
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4390
|
+
ndfunc_t ndf = { iter_dfloat_isneginf, FULL_LOOP, 1, 1, ain, aout };
|
4342
4391
|
|
4343
4392
|
return na_ndloop(&ndf, 1, self);
|
4344
4393
|
}
|
@@ -4378,9 +4427,9 @@ static void iter_dfloat_isfinite(na_loop_t* const lp) {
|
|
4378
4427
|
@return [Numo::Bit] Condition of isfinite.
|
4379
4428
|
*/
|
4380
4429
|
static VALUE dfloat_isfinite(VALUE self) {
|
4381
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
4382
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
4383
|
-
ndfunc_t ndf = {iter_dfloat_isfinite, FULL_LOOP, 1, 1, ain, aout};
|
4430
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
4431
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
4432
|
+
ndfunc_t ndf = { iter_dfloat_isfinite, FULL_LOOP, 1, 1, ain, aout };
|
4384
4433
|
|
4385
4434
|
return na_ndloop(&ndf, 1, self);
|
4386
4435
|
}
|
@@ -4411,16 +4460,18 @@ static void iter_dfloat_sum_nan(na_loop_t* const lp) {
|
|
4411
4460
|
/*
|
4412
4461
|
sum of self.
|
4413
4462
|
@overload sum(axis:nil, keepdims:false, nan:false)
|
4414
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4463
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4464
|
+
return NaN for min/max etc).
|
4415
4465
|
@param [Numeric,Array,Range] axis Performs sum along the axis.
|
4416
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4466
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4467
|
+
dimensions with size one.
|
4417
4468
|
@return [Numo::DFloat] returns result of sum.
|
4418
4469
|
*/
|
4419
4470
|
static VALUE dfloat_sum(int argc, VALUE* argv, VALUE self) {
|
4420
4471
|
VALUE v, reduce;
|
4421
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4422
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4423
|
-
ndfunc_t ndf = {iter_dfloat_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4472
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4473
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4474
|
+
ndfunc_t ndf = { iter_dfloat_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4424
4475
|
|
4425
4476
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_sum_nan);
|
4426
4477
|
|
@@ -4455,16 +4506,18 @@ static void iter_dfloat_prod_nan(na_loop_t* const lp) {
|
|
4455
4506
|
/*
|
4456
4507
|
prod of self.
|
4457
4508
|
@overload prod(axis:nil, keepdims:false, nan:false)
|
4458
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4509
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4510
|
+
return NaN for min/max etc).
|
4459
4511
|
@param [Numeric,Array,Range] axis Performs prod along the axis.
|
4460
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4512
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4513
|
+
dimensions with size one.
|
4461
4514
|
@return [Numo::DFloat] returns result of prod.
|
4462
4515
|
*/
|
4463
4516
|
static VALUE dfloat_prod(int argc, VALUE* argv, VALUE self) {
|
4464
4517
|
VALUE v, reduce;
|
4465
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4466
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4467
|
-
ndfunc_t ndf = {iter_dfloat_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4518
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4519
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4520
|
+
ndfunc_t ndf = { iter_dfloat_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4468
4521
|
|
4469
4522
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_prod_nan);
|
4470
4523
|
|
@@ -4499,16 +4552,18 @@ static void iter_dfloat_kahan_sum_nan(na_loop_t* const lp) {
|
|
4499
4552
|
/*
|
4500
4553
|
kahan_sum of self.
|
4501
4554
|
@overload kahan_sum(axis:nil, keepdims:false, nan:false)
|
4502
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4555
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4556
|
+
return NaN for min/max etc).
|
4503
4557
|
@param [Numeric,Array,Range] axis Performs kahan_sum along the axis.
|
4504
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4558
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4559
|
+
dimensions with size one.
|
4505
4560
|
@return [Numo::DFloat] returns result of kahan_sum.
|
4506
4561
|
*/
|
4507
4562
|
static VALUE dfloat_kahan_sum(int argc, VALUE* argv, VALUE self) {
|
4508
4563
|
VALUE v, reduce;
|
4509
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4510
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4511
|
-
ndfunc_t ndf = {iter_dfloat_kahan_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4564
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4565
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4566
|
+
ndfunc_t ndf = { iter_dfloat_kahan_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4512
4567
|
|
4513
4568
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_kahan_sum_nan);
|
4514
4569
|
|
@@ -4543,16 +4598,18 @@ static void iter_dfloat_mean_nan(na_loop_t* const lp) {
|
|
4543
4598
|
/*
|
4544
4599
|
mean of self.
|
4545
4600
|
@overload mean(axis:nil, keepdims:false, nan:false)
|
4546
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4601
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4602
|
+
return NaN for min/max etc).
|
4547
4603
|
@param [Numeric,Array,Range] axis Performs mean along the axis.
|
4548
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4604
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4605
|
+
dimensions with size one.
|
4549
4606
|
@return [Numo::DFloat] returns result of mean.
|
4550
4607
|
*/
|
4551
4608
|
static VALUE dfloat_mean(int argc, VALUE* argv, VALUE self) {
|
4552
4609
|
VALUE v, reduce;
|
4553
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4554
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4555
|
-
ndfunc_t ndf = {iter_dfloat_mean, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4610
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4611
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4612
|
+
ndfunc_t ndf = { iter_dfloat_mean, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4556
4613
|
|
4557
4614
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_mean_nan);
|
4558
4615
|
|
@@ -4587,16 +4644,18 @@ static void iter_dfloat_stddev_nan(na_loop_t* const lp) {
|
|
4587
4644
|
/*
|
4588
4645
|
stddev of self.
|
4589
4646
|
@overload stddev(axis:nil, keepdims:false, nan:false)
|
4590
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4647
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4648
|
+
return NaN for min/max etc).
|
4591
4649
|
@param [Numeric,Array,Range] axis Performs stddev along the axis.
|
4592
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4650
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4651
|
+
dimensions with size one.
|
4593
4652
|
@return [Numo::DFloat] returns result of stddev.
|
4594
4653
|
*/
|
4595
4654
|
static VALUE dfloat_stddev(int argc, VALUE* argv, VALUE self) {
|
4596
4655
|
VALUE v, reduce;
|
4597
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4598
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
4599
|
-
ndfunc_t ndf = {iter_dfloat_stddev, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4656
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4657
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4658
|
+
ndfunc_t ndf = { iter_dfloat_stddev, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4600
4659
|
|
4601
4660
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_stddev_nan);
|
4602
4661
|
|
@@ -4631,16 +4690,18 @@ static void iter_dfloat_var_nan(na_loop_t* const lp) {
|
|
4631
4690
|
/*
|
4632
4691
|
var of self.
|
4633
4692
|
@overload var(axis:nil, keepdims:false, nan:false)
|
4634
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4693
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4694
|
+
return NaN for min/max etc).
|
4635
4695
|
@param [Numeric,Array,Range] axis Performs var along the axis.
|
4636
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4696
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4697
|
+
dimensions with size one.
|
4637
4698
|
@return [Numo::DFloat] returns result of var.
|
4638
4699
|
*/
|
4639
4700
|
static VALUE dfloat_var(int argc, VALUE* argv, VALUE self) {
|
4640
4701
|
VALUE v, reduce;
|
4641
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4642
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
4643
|
-
ndfunc_t ndf = {iter_dfloat_var, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4702
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4703
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4704
|
+
ndfunc_t ndf = { iter_dfloat_var, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4644
4705
|
|
4645
4706
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_var_nan);
|
4646
4707
|
|
@@ -4675,16 +4736,18 @@ static void iter_dfloat_rms_nan(na_loop_t* const lp) {
|
|
4675
4736
|
/*
|
4676
4737
|
rms of self.
|
4677
4738
|
@overload rms(axis:nil, keepdims:false, nan:false)
|
4678
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4739
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4740
|
+
return NaN for min/max etc).
|
4679
4741
|
@param [Numeric,Array,Range] axis Performs rms along the axis.
|
4680
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4742
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4743
|
+
dimensions with size one.
|
4681
4744
|
@return [Numo::DFloat] returns result of rms.
|
4682
4745
|
*/
|
4683
4746
|
static VALUE dfloat_rms(int argc, VALUE* argv, VALUE self) {
|
4684
4747
|
VALUE v, reduce;
|
4685
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4686
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
4687
|
-
ndfunc_t ndf = {iter_dfloat_rms, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4748
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4749
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4750
|
+
ndfunc_t ndf = { iter_dfloat_rms, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4688
4751
|
|
4689
4752
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_rms_nan);
|
4690
4753
|
|
@@ -4719,16 +4782,18 @@ static void iter_dfloat_min_nan(na_loop_t* const lp) {
|
|
4719
4782
|
/*
|
4720
4783
|
min of self.
|
4721
4784
|
@overload min(axis:nil, keepdims:false, nan:false)
|
4722
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4785
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4786
|
+
return NaN for min/max etc).
|
4723
4787
|
@param [Numeric,Array,Range] axis Performs min along the axis.
|
4724
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4788
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4789
|
+
dimensions with size one.
|
4725
4790
|
@return [Numo::DFloat] returns result of min.
|
4726
4791
|
*/
|
4727
4792
|
static VALUE dfloat_min(int argc, VALUE* argv, VALUE self) {
|
4728
4793
|
VALUE v, reduce;
|
4729
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4730
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4731
|
-
ndfunc_t ndf = {iter_dfloat_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4794
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4795
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4796
|
+
ndfunc_t ndf = { iter_dfloat_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4732
4797
|
|
4733
4798
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_min_nan);
|
4734
4799
|
|
@@ -4763,16 +4828,18 @@ static void iter_dfloat_max_nan(na_loop_t* const lp) {
|
|
4763
4828
|
/*
|
4764
4829
|
max of self.
|
4765
4830
|
@overload max(axis:nil, keepdims:false, nan:false)
|
4766
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4831
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4832
|
+
return NaN for min/max etc).
|
4767
4833
|
@param [Numeric,Array,Range] axis Performs max along the axis.
|
4768
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4834
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4835
|
+
dimensions with size one.
|
4769
4836
|
@return [Numo::DFloat] returns result of max.
|
4770
4837
|
*/
|
4771
4838
|
static VALUE dfloat_max(int argc, VALUE* argv, VALUE self) {
|
4772
4839
|
VALUE v, reduce;
|
4773
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4774
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4775
|
-
ndfunc_t ndf = {iter_dfloat_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4840
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4841
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4842
|
+
ndfunc_t ndf = { iter_dfloat_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4776
4843
|
|
4777
4844
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_max_nan);
|
4778
4845
|
|
@@ -4807,16 +4874,18 @@ static void iter_dfloat_ptp_nan(na_loop_t* const lp) {
|
|
4807
4874
|
/*
|
4808
4875
|
ptp of self.
|
4809
4876
|
@overload ptp(axis:nil, keepdims:false, nan:false)
|
4810
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4877
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4878
|
+
return NaN for min/max etc).
|
4811
4879
|
@param [Numeric,Array,Range] axis Performs ptp along the axis.
|
4812
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4880
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4881
|
+
dimensions with size one.
|
4813
4882
|
@return [Numo::DFloat] returns result of ptp.
|
4814
4883
|
*/
|
4815
4884
|
static VALUE dfloat_ptp(int argc, VALUE* argv, VALUE self) {
|
4816
4885
|
VALUE v, reduce;
|
4817
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4818
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4819
|
-
ndfunc_t ndf = {iter_dfloat_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4886
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4887
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4888
|
+
ndfunc_t ndf = { iter_dfloat_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4820
4889
|
|
4821
4890
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_ptp_nan);
|
4822
4891
|
|
@@ -4897,7 +4966,8 @@ static void iter_dfloat_max_index_index32_nan(na_loop_t* const lp) {
|
|
4897
4966
|
Index of the maximum value.
|
4898
4967
|
@overload max_index(axis:nil, nan:false)
|
4899
4968
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
4900
|
-
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d
|
4969
|
+
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d
|
4970
|
+
indices**.
|
4901
4971
|
@return [Integer,Numo::Int] returns result indices.
|
4902
4972
|
@see #argmax
|
4903
4973
|
@see #max
|
@@ -4915,9 +4985,9 @@ static void iter_dfloat_max_index_index32_nan(na_loop_t* const lp) {
|
|
4915
4985
|
static VALUE dfloat_max_index(int argc, VALUE* argv, VALUE self) {
|
4916
4986
|
narray_t* na;
|
4917
4987
|
VALUE idx, reduce;
|
4918
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
|
4919
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4920
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
|
4988
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
|
4989
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4990
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
|
4921
4991
|
|
4922
4992
|
GetNArray(self, na);
|
4923
4993
|
if (na->ndim == 0) {
|
@@ -5014,7 +5084,8 @@ static void iter_dfloat_min_index_index32_nan(na_loop_t* const lp) {
|
|
5014
5084
|
Index of the minimum value.
|
5015
5085
|
@overload min_index(axis:nil, nan:false)
|
5016
5086
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
5017
|
-
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d
|
5087
|
+
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d
|
5088
|
+
indices**.
|
5018
5089
|
@return [Integer,Numo::Int] returns result indices.
|
5019
5090
|
@see #argmin
|
5020
5091
|
@see #min
|
@@ -5032,9 +5103,9 @@ static void iter_dfloat_min_index_index32_nan(na_loop_t* const lp) {
|
|
5032
5103
|
static VALUE dfloat_min_index(int argc, VALUE* argv, VALUE self) {
|
5033
5104
|
narray_t* na;
|
5034
5105
|
VALUE idx, reduce;
|
5035
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
|
5036
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
5037
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
|
5106
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { 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, 3, 1, ain, aout };
|
5038
5109
|
|
5039
5110
|
GetNArray(self, na);
|
5040
5111
|
if (na->ndim == 0) {
|
@@ -5127,7 +5198,8 @@ static void iter_dfloat_argmax_arg32_nan(na_loop_t* const lp) {
|
|
5127
5198
|
Index of the maximum value.
|
5128
5199
|
@overload argmax(axis:nil, nan:false)
|
5129
5200
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
5130
|
-
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
|
5201
|
+
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
|
5202
|
+
along the axis**.
|
5131
5203
|
@return [Integer,Numo::Int] returns the result indices.
|
5132
5204
|
@see #max_index
|
5133
5205
|
@see #max
|
@@ -5145,9 +5217,9 @@ static void iter_dfloat_argmax_arg32_nan(na_loop_t* const lp) {
|
|
5145
5217
|
static VALUE dfloat_argmax(int argc, VALUE* argv, VALUE self) {
|
5146
5218
|
narray_t* na;
|
5147
5219
|
VALUE reduce;
|
5148
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
|
5149
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
5150
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
|
5220
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
|
5221
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
5222
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
|
5151
5223
|
|
5152
5224
|
GetNArray(self, na);
|
5153
5225
|
if (na->ndim == 0) {
|
@@ -5237,7 +5309,8 @@ static void iter_dfloat_argmin_arg32_nan(na_loop_t* const lp) {
|
|
5237
5309
|
Index of the minimum value.
|
5238
5310
|
@overload argmin(axis:nil, nan:false)
|
5239
5311
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
5240
|
-
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
|
5312
|
+
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
|
5313
|
+
along the axis**.
|
5241
5314
|
@return [Integer,Numo::Int] returns the result indices.
|
5242
5315
|
@see #min_index
|
5243
5316
|
@see #min
|
@@ -5255,9 +5328,9 @@ static void iter_dfloat_argmin_arg32_nan(na_loop_t* const lp) {
|
|
5255
5328
|
static VALUE dfloat_argmin(int argc, VALUE* argv, VALUE self) {
|
5256
5329
|
narray_t* na;
|
5257
5330
|
VALUE reduce;
|
5258
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
|
5259
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
5260
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
|
5331
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
|
5332
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
5333
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
|
5261
5334
|
|
5262
5335
|
GetNArray(self, na);
|
5263
5336
|
if (na->ndim == 0) {
|
@@ -5313,14 +5386,17 @@ static void iter_dfloat_minmax_nan(na_loop_t* const lp) {
|
|
5313
5386
|
@overload minmax(axis:nil, keepdims:false, nan:false)
|
5314
5387
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN if exist).
|
5315
5388
|
@param [Numeric,Array,Range] axis Finds min-max along the axis.
|
5316
|
-
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5389
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5390
|
+
as dimensions with size one.
|
5317
5391
|
@return [Numo::DFloat,Numo::DFloat] min and max of self.
|
5318
5392
|
*/
|
5319
5393
|
static VALUE dfloat_minmax(int argc, VALUE* argv, VALUE self) {
|
5320
5394
|
VALUE reduce;
|
5321
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
5322
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
5323
|
-
ndfunc_t ndf = {
|
5395
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
5396
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
5397
|
+
ndfunc_t ndf = {
|
5398
|
+
iter_dfloat_minmax, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 2, ain, aout
|
5399
|
+
};
|
5324
5400
|
|
5325
5401
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_minmax_nan);
|
5326
5402
|
|
@@ -5379,13 +5455,13 @@ static void iter_dfloat_s_maximum_nan(na_loop_t* const lp) {
|
|
5379
5455
|
static VALUE dfloat_s_maximum(int argc, VALUE* argv, VALUE mod) {
|
5380
5456
|
VALUE a1 = Qnil;
|
5381
5457
|
VALUE a2 = Qnil;
|
5382
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
5383
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5384
|
-
ndfunc_t ndf = {iter_dfloat_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
|
5458
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
5459
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5460
|
+
ndfunc_t ndf = { iter_dfloat_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
|
5385
5461
|
|
5386
5462
|
VALUE kw_hash = Qnil;
|
5387
|
-
ID kw_table[1] = {id_nan};
|
5388
|
-
VALUE opts[1] = {Qundef};
|
5463
|
+
ID kw_table[1] = { id_nan };
|
5464
|
+
VALUE opts[1] = { Qundef };
|
5389
5465
|
|
5390
5466
|
rb_scan_args(argc, argv, "20:", &a1, &a2, &kw_hash);
|
5391
5467
|
rb_get_kwargs(kw_hash, kw_table, 0, 1, opts);
|
@@ -5448,13 +5524,13 @@ static void iter_dfloat_s_minimum_nan(na_loop_t* const lp) {
|
|
5448
5524
|
static VALUE dfloat_s_minimum(int argc, VALUE* argv, VALUE mod) {
|
5449
5525
|
VALUE a1 = Qnil;
|
5450
5526
|
VALUE a2 = Qnil;
|
5451
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
5452
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5453
|
-
ndfunc_t ndf = {iter_dfloat_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
|
5527
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
5528
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5529
|
+
ndfunc_t ndf = { iter_dfloat_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
|
5454
5530
|
|
5455
5531
|
VALUE kw_hash = Qnil;
|
5456
|
-
ID kw_table[1] = {id_nan};
|
5457
|
-
VALUE opts[1] = {Qundef};
|
5532
|
+
ID kw_table[1] = { id_nan };
|
5533
|
+
VALUE opts[1] = { Qundef };
|
5458
5534
|
|
5459
5535
|
rb_scan_args(argc, argv, "20:", &a1, &a2, &kw_hash);
|
5460
5536
|
rb_get_kwargs(kw_hash, kw_table, 0, 1, opts);
|
@@ -5474,16 +5550,13 @@ static void iter_dfloat_cumsum(na_loop_t* const lp) {
|
|
5474
5550
|
INIT_COUNTER(lp, i);
|
5475
5551
|
INIT_PTR(lp, 0, p1, s1);
|
5476
5552
|
INIT_PTR(lp, 1, p2, s2);
|
5477
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
5478
5553
|
|
5479
5554
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
5480
5555
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5481
|
-
// printf("i=%lu x=%f\n",i,x);
|
5482
5556
|
for (i--; i--;) {
|
5483
5557
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
5484
5558
|
m_cumsum(x, y);
|
5485
5559
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5486
|
-
// printf("i=%lu x=%f\n",i,x);
|
5487
5560
|
}
|
5488
5561
|
}
|
5489
5562
|
static void iter_dfloat_cumsum_nan(na_loop_t* const lp) {
|
@@ -5495,16 +5568,13 @@ static void iter_dfloat_cumsum_nan(na_loop_t* const lp) {
|
|
5495
5568
|
INIT_COUNTER(lp, i);
|
5496
5569
|
INIT_PTR(lp, 0, p1, s1);
|
5497
5570
|
INIT_PTR(lp, 1, p2, s2);
|
5498
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
5499
5571
|
|
5500
5572
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
5501
5573
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5502
|
-
// printf("i=%lu x=%f\n",i,x);
|
5503
5574
|
for (i--; i--;) {
|
5504
5575
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
5505
5576
|
m_cumsum_nan(x, y);
|
5506
5577
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5507
|
-
// printf("i=%lu x=%f\n",i,x);
|
5508
5578
|
}
|
5509
5579
|
}
|
5510
5580
|
|
@@ -5517,9 +5587,11 @@ static void iter_dfloat_cumsum_nan(na_loop_t* const lp) {
|
|
5517
5587
|
*/
|
5518
5588
|
static VALUE dfloat_cumsum(int argc, VALUE* argv, VALUE self) {
|
5519
5589
|
VALUE reduce;
|
5520
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
5521
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5522
|
-
ndfunc_t ndf = {
|
5590
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
5591
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5592
|
+
ndfunc_t ndf = {
|
5593
|
+
iter_dfloat_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
|
5594
|
+
};
|
5523
5595
|
|
5524
5596
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_cumsum_nan);
|
5525
5597
|
|
@@ -5535,16 +5607,13 @@ static void iter_dfloat_cumprod(na_loop_t* const lp) {
|
|
5535
5607
|
INIT_COUNTER(lp, i);
|
5536
5608
|
INIT_PTR(lp, 0, p1, s1);
|
5537
5609
|
INIT_PTR(lp, 1, p2, s2);
|
5538
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
5539
5610
|
|
5540
5611
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
5541
5612
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5542
|
-
// printf("i=%lu x=%f\n",i,x);
|
5543
5613
|
for (i--; i--;) {
|
5544
5614
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
5545
5615
|
m_cumprod(x, y);
|
5546
5616
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5547
|
-
// printf("i=%lu x=%f\n",i,x);
|
5548
5617
|
}
|
5549
5618
|
}
|
5550
5619
|
static void iter_dfloat_cumprod_nan(na_loop_t* const lp) {
|
@@ -5556,16 +5625,13 @@ static void iter_dfloat_cumprod_nan(na_loop_t* const lp) {
|
|
5556
5625
|
INIT_COUNTER(lp, i);
|
5557
5626
|
INIT_PTR(lp, 0, p1, s1);
|
5558
5627
|
INIT_PTR(lp, 1, p2, s2);
|
5559
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
5560
5628
|
|
5561
5629
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
5562
5630
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5563
|
-
// printf("i=%lu x=%f\n",i,x);
|
5564
5631
|
for (i--; i--;) {
|
5565
5632
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
5566
5633
|
m_cumprod_nan(x, y);
|
5567
5634
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
5568
|
-
// printf("i=%lu x=%f\n",i,x);
|
5569
5635
|
}
|
5570
5636
|
}
|
5571
5637
|
|
@@ -5578,9 +5644,11 @@ static void iter_dfloat_cumprod_nan(na_loop_t* const lp) {
|
|
5578
5644
|
*/
|
5579
5645
|
static VALUE dfloat_cumprod(int argc, VALUE* argv, VALUE self) {
|
5580
5646
|
VALUE reduce;
|
5581
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
5582
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5583
|
-
ndfunc_t ndf = {
|
5647
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
5648
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5649
|
+
ndfunc_t ndf = {
|
5650
|
+
iter_dfloat_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
|
5651
|
+
};
|
5584
5652
|
|
5585
5653
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dfloat_cumprod_nan);
|
5586
5654
|
|
@@ -5660,9 +5728,9 @@ static void iter_dfloat_mulsum_nan(na_loop_t* const lp) {
|
|
5660
5728
|
static VALUE dfloat_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
5661
5729
|
VALUE v, reduce;
|
5662
5730
|
VALUE naryv[2];
|
5663
|
-
ndfunc_arg_in_t ain[4] = {{cT, 0}, {cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
|
5664
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5665
|
-
ndfunc_t ndf = {iter_dfloat_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout};
|
5731
|
+
ndfunc_arg_in_t ain[4] = { { cT, 0 }, { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
|
5732
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5733
|
+
ndfunc_t ndf = { iter_dfloat_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout };
|
5666
5734
|
|
5667
5735
|
if (argc < 1) {
|
5668
5736
|
rb_raise(rb_eArgError, "wrong number of arguments (%d for >=1)", argc);
|
@@ -5684,7 +5752,8 @@ static VALUE dfloat_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
|
5684
5752
|
@overload mulsum(other, axis:nil, keepdims:false, nan:false)
|
5685
5753
|
@param [Numo::NArray,Numeric] other
|
5686
5754
|
@param [Numeric,Array,Range] axis Performs mulsum along the axis.
|
5687
|
-
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5755
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5756
|
+
as dimensions with size one.
|
5688
5757
|
@param [TrueClass] nan (keyword) If true, apply NaN-aware algorithm (avoid NaN if exists).
|
5689
5758
|
@return [Numo::NArray] mulsum of self and other.
|
5690
5759
|
*/
|
@@ -5770,8 +5839,8 @@ static void iter_dfloat_seq(na_loop_t* const lp) {
|
|
5770
5839
|
static VALUE dfloat_seq(int argc, VALUE* args, VALUE self) {
|
5771
5840
|
seq_opt_t* g;
|
5772
5841
|
VALUE vbeg = Qnil, vstep = Qnil;
|
5773
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
5774
|
-
ndfunc_t ndf = {iter_dfloat_seq, FULL_LOOP, 1, 0, ain, 0};
|
5842
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
5843
|
+
ndfunc_t ndf = { iter_dfloat_seq, FULL_LOOP, 1, 0, ain, 0 };
|
5775
5844
|
|
5776
5845
|
g = ALLOCA_N(seq_opt_t, 1);
|
5777
5846
|
g->beg = m_zero;
|
@@ -5853,8 +5922,8 @@ static void iter_dfloat_logseq(na_loop_t* const lp) {
|
|
5853
5922
|
static VALUE dfloat_logseq(int argc, VALUE* args, VALUE self) {
|
5854
5923
|
logseq_opt_t* g;
|
5855
5924
|
VALUE vbeg, vstep, vbase;
|
5856
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
5857
|
-
ndfunc_t ndf = {iter_dfloat_logseq, FULL_LOOP, 1, 0, ain, 0};
|
5925
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
5926
|
+
ndfunc_t ndf = { iter_dfloat_logseq, FULL_LOOP, 1, 0, ain, 0 };
|
5858
5927
|
|
5859
5928
|
g = ALLOCA_N(logseq_opt_t, 1);
|
5860
5929
|
rb_scan_args(argc, args, "21", &vbeg, &vstep, &vbase);
|
@@ -5908,8 +5977,8 @@ static void iter_dfloat_eye(na_loop_t* const lp) {
|
|
5908
5977
|
@return [Numo::DFloat] eye of self.
|
5909
5978
|
*/
|
5910
5979
|
static VALUE dfloat_eye(int argc, VALUE* argv, VALUE self) {
|
5911
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 2}};
|
5912
|
-
ndfunc_t ndf = {iter_dfloat_eye, NO_LOOP, 1, 0, ain, 0};
|
5980
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 2 } };
|
5981
|
+
ndfunc_t ndf = { iter_dfloat_eye, NO_LOOP, 1, 0, ain, 0 };
|
5913
5982
|
ssize_t kofs;
|
5914
5983
|
dtype data;
|
5915
5984
|
char* g;
|
@@ -5939,17 +6008,21 @@ static VALUE dfloat_eye(int argc, VALUE* argv, VALUE self) {
|
|
5939
6008
|
// Diagonal offset from the main diagonal.
|
5940
6009
|
if (kofs >= 0) {
|
5941
6010
|
if ((size_t)(kofs) >= na->shape[nd - 1]) {
|
5942
|
-
rb_raise(
|
5943
|
-
|
5944
|
-
|
5945
|
-
|
6011
|
+
rb_raise(
|
6012
|
+
rb_eArgError,
|
6013
|
+
"invalid diagonal offset(%" SZF "d) for "
|
6014
|
+
"last dimension size(%" SZF "d)",
|
6015
|
+
kofs, na->shape[nd - 1]
|
6016
|
+
);
|
5946
6017
|
}
|
5947
6018
|
} else {
|
5948
6019
|
if ((size_t)(-kofs) >= na->shape[nd - 2]) {
|
5949
|
-
rb_raise(
|
5950
|
-
|
5951
|
-
|
5952
|
-
|
6020
|
+
rb_raise(
|
6021
|
+
rb_eArgError,
|
6022
|
+
"invalid diagonal offset(%" SZF "d) for "
|
6023
|
+
"last-1 dimension size(%" SZF "d)",
|
6024
|
+
kofs, na->shape[nd - 2]
|
6025
|
+
);
|
5953
6026
|
}
|
5954
6027
|
}
|
5955
6028
|
|
@@ -5999,7 +6072,8 @@ static void iter_dfloat_rand(na_loop_t* const lp) {
|
|
5999
6072
|
Generate uniformly distributed random numbers on self narray.
|
6000
6073
|
@overload rand([[low],high])
|
6001
6074
|
@param [Numeric] low lower inclusive boundary of random numbers. (default=0)
|
6002
|
-
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
6075
|
+
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
6076
|
+
complex types)
|
6003
6077
|
@return [Numo::DFloat] self.
|
6004
6078
|
@example
|
6005
6079
|
Numo::DFloat.new(6).rand
|
@@ -6018,8 +6092,8 @@ static VALUE dfloat_rand(int argc, VALUE* args, VALUE self) {
|
|
6018
6092
|
rand_opt_t g;
|
6019
6093
|
VALUE v1 = Qnil, v2 = Qnil;
|
6020
6094
|
dtype high;
|
6021
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
6022
|
-
ndfunc_t ndf = {iter_dfloat_rand, FULL_LOOP, 1, 0, ain, 0};
|
6095
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
6096
|
+
ndfunc_t ndf = { iter_dfloat_rand, FULL_LOOP, 1, 0, ain, 0 };
|
6023
6097
|
|
6024
6098
|
rb_scan_args(argc, args, "02", &v1, &v2);
|
6025
6099
|
if (v2 == Qnil) {
|
@@ -6127,8 +6201,8 @@ static VALUE dfloat_rand_norm(int argc, VALUE* args, VALUE self) {
|
|
6127
6201
|
int n;
|
6128
6202
|
randn_opt_t g;
|
6129
6203
|
VALUE v1 = Qnil, v2 = Qnil;
|
6130
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
6131
|
-
ndfunc_t ndf = {iter_dfloat_rand_norm, FULL_LOOP, 1, 0, ain, 0};
|
6204
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
6205
|
+
ndfunc_t ndf = { iter_dfloat_rand_norm, FULL_LOOP, 1, 0, ain, 0 };
|
6132
6206
|
|
6133
6207
|
n = rb_scan_args(argc, args, "02", &v1, &v2);
|
6134
6208
|
if (n == 0) {
|
@@ -6172,8 +6246,8 @@ static VALUE dfloat_poly(VALUE self, VALUE args) {
|
|
6172
6246
|
int argc, i;
|
6173
6247
|
VALUE* argv;
|
6174
6248
|
volatile VALUE v, a;
|
6175
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
6176
|
-
ndfunc_t ndf = {iter_dfloat_poly, NO_LOOP, 0, 1, 0, aout};
|
6249
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
6250
|
+
ndfunc_t ndf = { iter_dfloat_poly, NO_LOOP, 0, 1, 0, aout };
|
6177
6251
|
|
6178
6252
|
argc = (int)RARRAY_LEN(args);
|
6179
6253
|
ndf.nin = argc + 1;
|
@@ -6253,23 +6327,28 @@ static VALUE dfloat_poly(VALUE self, VALUE args) {
|
|
6253
6327
|
* We have modified their original by adding a check for already-sorted input,
|
6254
6328
|
* which seems to be a win per discussions on pgsql-hackers around 2006-03-21.
|
6255
6329
|
*/
|
6256
|
-
#define swapcode(TYPE, parmi, parmj, n)
|
6257
|
-
do {
|
6258
|
-
size_t i = (n) / sizeof(TYPE);
|
6259
|
-
TYPE* pi = (TYPE*)(void*)(parmi);
|
6260
|
-
TYPE* pj = (TYPE*)(void*)(parmj);
|
6261
|
-
do {
|
6262
|
-
TYPE t = *pi;
|
6263
|
-
*pi++ = *pj;
|
6264
|
-
*pj++ = t;
|
6265
|
-
} while (--i > 0);
|
6330
|
+
#define swapcode(TYPE, parmi, parmj, n) \
|
6331
|
+
do { \
|
6332
|
+
size_t i = (n) / sizeof(TYPE); \
|
6333
|
+
TYPE* pi = (TYPE*)(void*)(parmi); \
|
6334
|
+
TYPE* pj = (TYPE*)(void*)(parmj); \
|
6335
|
+
do { \
|
6336
|
+
TYPE t = *pi; \
|
6337
|
+
*pi++ = *pj; \
|
6338
|
+
*pj++ = t; \
|
6339
|
+
} while (--i > 0); \
|
6266
6340
|
} while (0)
|
6267
6341
|
|
6268
6342
|
#ifdef HAVE_STDINT_H
|
6269
|
-
#define SWAPINIT(a, es)
|
6343
|
+
#define SWAPINIT(a, es) \
|
6344
|
+
swaptype = (uintptr_t)a % sizeof(long) || (es) % sizeof(long) ? 2 \
|
6345
|
+
: (es) == sizeof(long) ? 0 \
|
6346
|
+
: 1;
|
6270
6347
|
#else
|
6271
|
-
#define SWAPINIT(a, es)
|
6272
|
-
swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2
|
6348
|
+
#define SWAPINIT(a, es) \
|
6349
|
+
swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2 \
|
6350
|
+
: (es) == sizeof(long) ? 0 \
|
6351
|
+
: 1;
|
6273
6352
|
#endif
|
6274
6353
|
|
6275
6354
|
static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
|
@@ -6279,19 +6358,20 @@ static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
|
|
6279
6358
|
swapcode(char, a, b, n);
|
6280
6359
|
}
|
6281
6360
|
|
6282
|
-
#define swap(a, b)
|
6283
|
-
if (swaptype == 0) {
|
6284
|
-
long t = *(long*)(void*)(a);
|
6285
|
-
*(long*)(void*)(a) = *(long*)(void*)(b);
|
6286
|
-
*(long*)(void*)(b) = t;
|
6287
|
-
} else
|
6361
|
+
#define swap(a, b) \
|
6362
|
+
if (swaptype == 0) { \
|
6363
|
+
long t = *(long*)(void*)(a); \
|
6364
|
+
*(long*)(void*)(a) = *(long*)(void*)(b); \
|
6365
|
+
*(long*)(void*)(b) = t; \
|
6366
|
+
} else \
|
6288
6367
|
swapfunc(a, b, es, swaptype)
|
6289
6368
|
|
6290
|
-
#define vecswap(a, b, n)
|
6369
|
+
#define vecswap(a, b, n) \
|
6291
6370
|
if ((n) > 0) swapfunc((a), (b), (size_t)(n), swaptype)
|
6292
6371
|
|
6293
|
-
#define med3(a, b, c, _cmp)
|
6294
|
-
(cmpgt(b, a) ? (cmpgt(c, b) ? b : (cmpgt(c, a) ? c : a))
|
6372
|
+
#define med3(a, b, c, _cmp) \
|
6373
|
+
(cmpgt(b, a) ? (cmpgt(c, b) ? b : (cmpgt(c, a) ? c : a)) \
|
6374
|
+
: (cmpgt(b, c) ? b : (cmpgt(c, a) ? a : c)))
|
6295
6375
|
#endif
|
6296
6376
|
|
6297
6377
|
#undef qsort_dtype
|
@@ -6531,8 +6611,8 @@ static void iter_dfloat_sort_prnan(na_loop_t* const lp) {
|
|
6531
6611
|
*/
|
6532
6612
|
static VALUE dfloat_sort(int argc, VALUE* argv, VALUE self) {
|
6533
6613
|
VALUE reduce;
|
6534
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_reduce, 0}};
|
6535
|
-
ndfunc_t ndf = {0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 0, ain, 0};
|
6614
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
|
6615
|
+
ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 0, ain, 0 };
|
6536
6616
|
|
6537
6617
|
if (!TEST_INPLACE(self)) {
|
6538
6618
|
self = na_copy(self);
|
@@ -6637,7 +6717,8 @@ loop:
|
|
6637
6717
|
pm = med3(pl, pm, pn, cmp);
|
6638
6718
|
}
|
6639
6719
|
swap(a, pm);
|
6640
|
-
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
6720
|
+
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
6721
|
+
pb += es, pc -= es) {
|
6641
6722
|
while (pb <= pc && (r = cmp(pb, a)) <= 0) {
|
6642
6723
|
if (r == 0) {
|
6643
6724
|
swap(pa, pb);
|
@@ -6762,7 +6843,8 @@ loop:
|
|
6762
6843
|
pm = med3(pl, pm, pn, cmp);
|
6763
6844
|
}
|
6764
6845
|
swap(a, pm);
|
6765
|
-
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
6846
|
+
for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
|
6847
|
+
pb += es, pc -= es) {
|
6766
6848
|
while (pb <= pc && (r = cmp(pb, a)) <= 0) {
|
6767
6849
|
if (r == 0) {
|
6768
6850
|
swap(pa, pb);
|
@@ -6809,7 +6891,6 @@ static void dfloat_index64_qsort_ignan(na_loop_t* const lp) {
|
|
6809
6891
|
|
6810
6892
|
ptr = (char**)(lp->opt_ptr);
|
6811
6893
|
|
6812
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
6813
6894
|
// 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
6895
|
|
6815
6896
|
if (n == 1) {
|
@@ -6819,21 +6900,17 @@ static void dfloat_index64_qsort_ignan(na_loop_t* const lp) {
|
|
6819
6900
|
|
6820
6901
|
for (i = 0; i < n; i++) {
|
6821
6902
|
ptr[i] = d_ptr + d_step * i;
|
6822
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
6823
6903
|
}
|
6824
6904
|
|
6825
6905
|
dfloat_index_qsort_ignan(ptr, n, sizeof(dtype*));
|
6826
6906
|
|
6827
6907
|
// d_ptr = lp->args[0].ptr;
|
6828
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
6829
6908
|
|
6830
6909
|
for (i = 0; i < n; i++) {
|
6831
6910
|
idx = (ptr[i] - d_ptr) / d_step;
|
6832
6911
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
6833
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
6834
6912
|
o_ptr += o_step;
|
6835
6913
|
}
|
6836
|
-
// printf("\n");
|
6837
6914
|
}
|
6838
6915
|
#undef idx_t
|
6839
6916
|
|
@@ -6851,7 +6928,6 @@ static void dfloat_index32_qsort_ignan(na_loop_t* const lp) {
|
|
6851
6928
|
|
6852
6929
|
ptr = (char**)(lp->opt_ptr);
|
6853
6930
|
|
6854
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
6855
6931
|
// 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
6932
|
|
6857
6933
|
if (n == 1) {
|
@@ -6861,21 +6937,17 @@ static void dfloat_index32_qsort_ignan(na_loop_t* const lp) {
|
|
6861
6937
|
|
6862
6938
|
for (i = 0; i < n; i++) {
|
6863
6939
|
ptr[i] = d_ptr + d_step * i;
|
6864
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
6865
6940
|
}
|
6866
6941
|
|
6867
6942
|
dfloat_index_qsort_ignan(ptr, n, sizeof(dtype*));
|
6868
6943
|
|
6869
6944
|
// d_ptr = lp->args[0].ptr;
|
6870
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
6871
6945
|
|
6872
6946
|
for (i = 0; i < n; i++) {
|
6873
6947
|
idx = (ptr[i] - d_ptr) / d_step;
|
6874
6948
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
6875
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
6876
6949
|
o_ptr += o_step;
|
6877
6950
|
}
|
6878
|
-
// printf("\n");
|
6879
6951
|
}
|
6880
6952
|
#undef idx_t
|
6881
6953
|
|
@@ -6893,7 +6965,6 @@ static void dfloat_index64_qsort_prnan(na_loop_t* const lp) {
|
|
6893
6965
|
|
6894
6966
|
ptr = (char**)(lp->opt_ptr);
|
6895
6967
|
|
6896
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
6897
6968
|
// 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
6969
|
|
6899
6970
|
if (n == 1) {
|
@@ -6903,21 +6974,17 @@ static void dfloat_index64_qsort_prnan(na_loop_t* const lp) {
|
|
6903
6974
|
|
6904
6975
|
for (i = 0; i < n; i++) {
|
6905
6976
|
ptr[i] = d_ptr + d_step * i;
|
6906
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
6907
6977
|
}
|
6908
6978
|
|
6909
6979
|
dfloat_index_qsort_prnan(ptr, n, sizeof(dtype*));
|
6910
6980
|
|
6911
6981
|
// d_ptr = lp->args[0].ptr;
|
6912
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
6913
6982
|
|
6914
6983
|
for (i = 0; i < n; i++) {
|
6915
6984
|
idx = (ptr[i] - d_ptr) / d_step;
|
6916
6985
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
6917
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
6918
6986
|
o_ptr += o_step;
|
6919
6987
|
}
|
6920
|
-
// printf("\n");
|
6921
6988
|
}
|
6922
6989
|
#undef idx_t
|
6923
6990
|
|
@@ -6935,7 +7002,6 @@ static void dfloat_index32_qsort_prnan(na_loop_t* const lp) {
|
|
6935
7002
|
|
6936
7003
|
ptr = (char**)(lp->opt_ptr);
|
6937
7004
|
|
6938
|
-
// printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
|
6939
7005
|
// 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);
|
6940
7006
|
|
6941
7007
|
if (n == 1) {
|
@@ -6945,21 +7011,17 @@ static void dfloat_index32_qsort_prnan(na_loop_t* const lp) {
|
|
6945
7011
|
|
6946
7012
|
for (i = 0; i < n; i++) {
|
6947
7013
|
ptr[i] = d_ptr + d_step * i;
|
6948
|
-
// printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
6949
7014
|
}
|
6950
7015
|
|
6951
7016
|
dfloat_index_qsort_prnan(ptr, n, sizeof(dtype*));
|
6952
7017
|
|
6953
7018
|
// d_ptr = lp->args[0].ptr;
|
6954
|
-
// printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
6955
7019
|
|
6956
7020
|
for (i = 0; i < n; i++) {
|
6957
7021
|
idx = (ptr[i] - d_ptr) / d_step;
|
6958
7022
|
*(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
|
6959
|
-
// printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
|
6960
7023
|
o_ptr += o_step;
|
6961
7024
|
}
|
6962
|
-
// printf("\n");
|
6963
7025
|
}
|
6964
7026
|
#undef idx_t
|
6965
7027
|
|
@@ -6977,9 +7039,9 @@ static VALUE dfloat_sort_index(int argc, VALUE* argv, VALUE self) {
|
|
6977
7039
|
narray_t* na;
|
6978
7040
|
VALUE idx, tmp, reduce, res;
|
6979
7041
|
char* buf;
|
6980
|
-
ndfunc_arg_in_t ain[3] = {{cT, 0}, {0, 0}, {sym_reduce, 0}};
|
6981
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
6982
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_CUM, 3, 1, ain, aout};
|
7042
|
+
ndfunc_arg_in_t ain[3] = { { cT, 0 }, { 0, 0 }, { sym_reduce, 0 } };
|
7043
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
7044
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_CUM, 3, 1, ain, aout };
|
6983
7045
|
|
6984
7046
|
GetNArray(self, na);
|
6985
7047
|
if (na->ndim == 0) {
|
@@ -7062,15 +7124,16 @@ static void iter_dfloat_median_prnan(na_loop_t* const lp) {
|
|
7062
7124
|
@overload median(axis:nil, keepdims:false, nan:false)
|
7063
7125
|
@param [TrueClass] nan (keyword) If true, propagete NaN. If false, ignore NaN.
|
7064
7126
|
@param [Numeric,Array,Range] axis Finds median along the axis.
|
7065
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
7127
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
7128
|
+
dimensions with size one.
|
7066
7129
|
@return [Numo::DFloat] returns median of self.
|
7067
7130
|
*/
|
7068
7131
|
|
7069
7132
|
static VALUE dfloat_median(int argc, VALUE* argv, VALUE self) {
|
7070
7133
|
VALUE v, reduce;
|
7071
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_reduce, 0}};
|
7072
|
-
ndfunc_arg_out_t aout[1] = {{INT2FIX(0), 0}};
|
7073
|
-
ndfunc_t ndf = {0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
7134
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
|
7135
|
+
ndfunc_arg_out_t aout[1] = { { INT2FIX(0), 0 } };
|
7136
|
+
ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
7074
7137
|
|
7075
7138
|
self = na_copy(self); // as temporary buffer
|
7076
7139
|
|
@@ -7135,9 +7198,12 @@ static void iter_dfloat_math_s_sqrt(na_loop_t* const lp) {
|
|
7135
7198
|
#ifdef __SSE2__
|
7136
7199
|
//
|
7137
7200
|
// Check number of elements. & Check same alignment.
|
7138
|
-
if ((n >= num_pack) &&
|
7201
|
+
if ((n >= num_pack) &&
|
7202
|
+
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p2)[i], SIMD_ALIGNMENT_SIZE)) {
|
7139
7203
|
// Calculate up to the position just before the start of SIMD computation.
|
7140
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
7204
|
+
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
7205
|
+
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
7206
|
+
);
|
7141
7207
|
#endif
|
7142
7208
|
#ifdef __SSE2__
|
7143
7209
|
for (i = 0; i < cnt; i++) {
|
@@ -7206,9 +7272,9 @@ static void iter_dfloat_math_s_sqrt(na_loop_t* const lp) {
|
|
7206
7272
|
@return [Numo::DFloat] result of sqrt(x).
|
7207
7273
|
*/
|
7208
7274
|
static VALUE dfloat_math_s_sqrt(VALUE mod, VALUE a1) {
|
7209
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7210
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7211
|
-
ndfunc_t ndf = {iter_dfloat_math_s_sqrt, FULL_LOOP, 1, 1, ain, aout};
|
7275
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7276
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7277
|
+
ndfunc_t ndf = { iter_dfloat_math_s_sqrt, FULL_LOOP, 1, 1, ain, aout };
|
7212
7278
|
|
7213
7279
|
return na_ndloop(&ndf, 1, a1);
|
7214
7280
|
}
|
@@ -7284,9 +7350,9 @@ static void iter_dfloat_math_s_cbrt(na_loop_t* const lp) {
|
|
7284
7350
|
@return [Numo::DFloat] result of cbrt(x).
|
7285
7351
|
*/
|
7286
7352
|
static VALUE dfloat_math_s_cbrt(VALUE mod, VALUE a1) {
|
7287
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7288
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7289
|
-
ndfunc_t ndf = {iter_dfloat_math_s_cbrt, FULL_LOOP, 1, 1, ain, aout};
|
7353
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7354
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7355
|
+
ndfunc_t ndf = { iter_dfloat_math_s_cbrt, FULL_LOOP, 1, 1, ain, aout };
|
7290
7356
|
|
7291
7357
|
return na_ndloop(&ndf, 1, a1);
|
7292
7358
|
}
|
@@ -7362,9 +7428,9 @@ static void iter_dfloat_math_s_log(na_loop_t* const lp) {
|
|
7362
7428
|
@return [Numo::DFloat] result of log(x).
|
7363
7429
|
*/
|
7364
7430
|
static VALUE dfloat_math_s_log(VALUE mod, VALUE a1) {
|
7365
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7366
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7367
|
-
ndfunc_t ndf = {iter_dfloat_math_s_log, FULL_LOOP, 1, 1, ain, aout};
|
7431
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7432
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7433
|
+
ndfunc_t ndf = { iter_dfloat_math_s_log, FULL_LOOP, 1, 1, ain, aout };
|
7368
7434
|
|
7369
7435
|
return na_ndloop(&ndf, 1, a1);
|
7370
7436
|
}
|
@@ -7440,9 +7506,9 @@ static void iter_dfloat_math_s_log2(na_loop_t* const lp) {
|
|
7440
7506
|
@return [Numo::DFloat] result of log2(x).
|
7441
7507
|
*/
|
7442
7508
|
static VALUE dfloat_math_s_log2(VALUE mod, VALUE a1) {
|
7443
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7444
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7445
|
-
ndfunc_t ndf = {iter_dfloat_math_s_log2, FULL_LOOP, 1, 1, ain, aout};
|
7509
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7510
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7511
|
+
ndfunc_t ndf = { iter_dfloat_math_s_log2, FULL_LOOP, 1, 1, ain, aout };
|
7446
7512
|
|
7447
7513
|
return na_ndloop(&ndf, 1, a1);
|
7448
7514
|
}
|
@@ -7518,9 +7584,9 @@ static void iter_dfloat_math_s_log10(na_loop_t* const lp) {
|
|
7518
7584
|
@return [Numo::DFloat] result of log10(x).
|
7519
7585
|
*/
|
7520
7586
|
static VALUE dfloat_math_s_log10(VALUE mod, VALUE a1) {
|
7521
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7522
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7523
|
-
ndfunc_t ndf = {iter_dfloat_math_s_log10, FULL_LOOP, 1, 1, ain, aout};
|
7587
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7588
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7589
|
+
ndfunc_t ndf = { iter_dfloat_math_s_log10, FULL_LOOP, 1, 1, ain, aout };
|
7524
7590
|
|
7525
7591
|
return na_ndloop(&ndf, 1, a1);
|
7526
7592
|
}
|
@@ -7596,9 +7662,9 @@ static void iter_dfloat_math_s_exp(na_loop_t* const lp) {
|
|
7596
7662
|
@return [Numo::DFloat] result of exp(x).
|
7597
7663
|
*/
|
7598
7664
|
static VALUE dfloat_math_s_exp(VALUE mod, VALUE a1) {
|
7599
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7600
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7601
|
-
ndfunc_t ndf = {iter_dfloat_math_s_exp, FULL_LOOP, 1, 1, ain, aout};
|
7665
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7666
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7667
|
+
ndfunc_t ndf = { iter_dfloat_math_s_exp, FULL_LOOP, 1, 1, ain, aout };
|
7602
7668
|
|
7603
7669
|
return na_ndloop(&ndf, 1, a1);
|
7604
7670
|
}
|
@@ -7674,9 +7740,9 @@ static void iter_dfloat_math_s_exp2(na_loop_t* const lp) {
|
|
7674
7740
|
@return [Numo::DFloat] result of exp2(x).
|
7675
7741
|
*/
|
7676
7742
|
static VALUE dfloat_math_s_exp2(VALUE mod, VALUE a1) {
|
7677
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7678
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7679
|
-
ndfunc_t ndf = {iter_dfloat_math_s_exp2, FULL_LOOP, 1, 1, ain, aout};
|
7743
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7744
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7745
|
+
ndfunc_t ndf = { iter_dfloat_math_s_exp2, FULL_LOOP, 1, 1, ain, aout };
|
7680
7746
|
|
7681
7747
|
return na_ndloop(&ndf, 1, a1);
|
7682
7748
|
}
|
@@ -7752,9 +7818,9 @@ static void iter_dfloat_math_s_exp10(na_loop_t* const lp) {
|
|
7752
7818
|
@return [Numo::DFloat] result of exp10(x).
|
7753
7819
|
*/
|
7754
7820
|
static VALUE dfloat_math_s_exp10(VALUE mod, VALUE a1) {
|
7755
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7756
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7757
|
-
ndfunc_t ndf = {iter_dfloat_math_s_exp10, FULL_LOOP, 1, 1, ain, aout};
|
7821
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7822
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7823
|
+
ndfunc_t ndf = { iter_dfloat_math_s_exp10, FULL_LOOP, 1, 1, ain, aout };
|
7758
7824
|
|
7759
7825
|
return na_ndloop(&ndf, 1, a1);
|
7760
7826
|
}
|
@@ -7830,9 +7896,9 @@ static void iter_dfloat_math_s_sin(na_loop_t* const lp) {
|
|
7830
7896
|
@return [Numo::DFloat] result of sin(x).
|
7831
7897
|
*/
|
7832
7898
|
static VALUE dfloat_math_s_sin(VALUE mod, VALUE a1) {
|
7833
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7834
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7835
|
-
ndfunc_t ndf = {iter_dfloat_math_s_sin, FULL_LOOP, 1, 1, ain, aout};
|
7899
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7900
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7901
|
+
ndfunc_t ndf = { iter_dfloat_math_s_sin, FULL_LOOP, 1, 1, ain, aout };
|
7836
7902
|
|
7837
7903
|
return na_ndloop(&ndf, 1, a1);
|
7838
7904
|
}
|
@@ -7908,9 +7974,9 @@ static void iter_dfloat_math_s_cos(na_loop_t* const lp) {
|
|
7908
7974
|
@return [Numo::DFloat] result of cos(x).
|
7909
7975
|
*/
|
7910
7976
|
static VALUE dfloat_math_s_cos(VALUE mod, VALUE a1) {
|
7911
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7912
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7913
|
-
ndfunc_t ndf = {iter_dfloat_math_s_cos, FULL_LOOP, 1, 1, ain, aout};
|
7977
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
7978
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
7979
|
+
ndfunc_t ndf = { iter_dfloat_math_s_cos, FULL_LOOP, 1, 1, ain, aout };
|
7914
7980
|
|
7915
7981
|
return na_ndloop(&ndf, 1, a1);
|
7916
7982
|
}
|
@@ -7986,9 +8052,9 @@ static void iter_dfloat_math_s_tan(na_loop_t* const lp) {
|
|
7986
8052
|
@return [Numo::DFloat] result of tan(x).
|
7987
8053
|
*/
|
7988
8054
|
static VALUE dfloat_math_s_tan(VALUE mod, VALUE a1) {
|
7989
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
7990
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
7991
|
-
ndfunc_t ndf = {iter_dfloat_math_s_tan, FULL_LOOP, 1, 1, ain, aout};
|
8055
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8056
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8057
|
+
ndfunc_t ndf = { iter_dfloat_math_s_tan, FULL_LOOP, 1, 1, ain, aout };
|
7992
8058
|
|
7993
8059
|
return na_ndloop(&ndf, 1, a1);
|
7994
8060
|
}
|
@@ -8064,9 +8130,9 @@ static void iter_dfloat_math_s_asin(na_loop_t* const lp) {
|
|
8064
8130
|
@return [Numo::DFloat] result of asin(x).
|
8065
8131
|
*/
|
8066
8132
|
static VALUE dfloat_math_s_asin(VALUE mod, VALUE a1) {
|
8067
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8068
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8069
|
-
ndfunc_t ndf = {iter_dfloat_math_s_asin, FULL_LOOP, 1, 1, ain, aout};
|
8133
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8134
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8135
|
+
ndfunc_t ndf = { iter_dfloat_math_s_asin, FULL_LOOP, 1, 1, ain, aout };
|
8070
8136
|
|
8071
8137
|
return na_ndloop(&ndf, 1, a1);
|
8072
8138
|
}
|
@@ -8142,9 +8208,9 @@ static void iter_dfloat_math_s_acos(na_loop_t* const lp) {
|
|
8142
8208
|
@return [Numo::DFloat] result of acos(x).
|
8143
8209
|
*/
|
8144
8210
|
static VALUE dfloat_math_s_acos(VALUE mod, VALUE a1) {
|
8145
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8146
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8147
|
-
ndfunc_t ndf = {iter_dfloat_math_s_acos, FULL_LOOP, 1, 1, ain, aout};
|
8211
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8212
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8213
|
+
ndfunc_t ndf = { iter_dfloat_math_s_acos, FULL_LOOP, 1, 1, ain, aout };
|
8148
8214
|
|
8149
8215
|
return na_ndloop(&ndf, 1, a1);
|
8150
8216
|
}
|
@@ -8220,9 +8286,9 @@ static void iter_dfloat_math_s_atan(na_loop_t* const lp) {
|
|
8220
8286
|
@return [Numo::DFloat] result of atan(x).
|
8221
8287
|
*/
|
8222
8288
|
static VALUE dfloat_math_s_atan(VALUE mod, VALUE a1) {
|
8223
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8224
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8225
|
-
ndfunc_t ndf = {iter_dfloat_math_s_atan, FULL_LOOP, 1, 1, ain, aout};
|
8289
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8290
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8291
|
+
ndfunc_t ndf = { iter_dfloat_math_s_atan, FULL_LOOP, 1, 1, ain, aout };
|
8226
8292
|
|
8227
8293
|
return na_ndloop(&ndf, 1, a1);
|
8228
8294
|
}
|
@@ -8298,9 +8364,9 @@ static void iter_dfloat_math_s_sinh(na_loop_t* const lp) {
|
|
8298
8364
|
@return [Numo::DFloat] result of sinh(x).
|
8299
8365
|
*/
|
8300
8366
|
static VALUE dfloat_math_s_sinh(VALUE mod, VALUE a1) {
|
8301
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8302
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8303
|
-
ndfunc_t ndf = {iter_dfloat_math_s_sinh, FULL_LOOP, 1, 1, ain, aout};
|
8367
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8368
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8369
|
+
ndfunc_t ndf = { iter_dfloat_math_s_sinh, FULL_LOOP, 1, 1, ain, aout };
|
8304
8370
|
|
8305
8371
|
return na_ndloop(&ndf, 1, a1);
|
8306
8372
|
}
|
@@ -8376,9 +8442,9 @@ static void iter_dfloat_math_s_cosh(na_loop_t* const lp) {
|
|
8376
8442
|
@return [Numo::DFloat] result of cosh(x).
|
8377
8443
|
*/
|
8378
8444
|
static VALUE dfloat_math_s_cosh(VALUE mod, VALUE a1) {
|
8379
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8380
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8381
|
-
ndfunc_t ndf = {iter_dfloat_math_s_cosh, FULL_LOOP, 1, 1, ain, aout};
|
8445
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8446
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8447
|
+
ndfunc_t ndf = { iter_dfloat_math_s_cosh, FULL_LOOP, 1, 1, ain, aout };
|
8382
8448
|
|
8383
8449
|
return na_ndloop(&ndf, 1, a1);
|
8384
8450
|
}
|
@@ -8454,9 +8520,9 @@ static void iter_dfloat_math_s_tanh(na_loop_t* const lp) {
|
|
8454
8520
|
@return [Numo::DFloat] result of tanh(x).
|
8455
8521
|
*/
|
8456
8522
|
static VALUE dfloat_math_s_tanh(VALUE mod, VALUE a1) {
|
8457
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8458
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8459
|
-
ndfunc_t ndf = {iter_dfloat_math_s_tanh, FULL_LOOP, 1, 1, ain, aout};
|
8523
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8524
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8525
|
+
ndfunc_t ndf = { iter_dfloat_math_s_tanh, FULL_LOOP, 1, 1, ain, aout };
|
8460
8526
|
|
8461
8527
|
return na_ndloop(&ndf, 1, a1);
|
8462
8528
|
}
|
@@ -8532,9 +8598,9 @@ static void iter_dfloat_math_s_asinh(na_loop_t* const lp) {
|
|
8532
8598
|
@return [Numo::DFloat] result of asinh(x).
|
8533
8599
|
*/
|
8534
8600
|
static VALUE dfloat_math_s_asinh(VALUE mod, VALUE a1) {
|
8535
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8536
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8537
|
-
ndfunc_t ndf = {iter_dfloat_math_s_asinh, FULL_LOOP, 1, 1, ain, aout};
|
8601
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8602
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8603
|
+
ndfunc_t ndf = { iter_dfloat_math_s_asinh, FULL_LOOP, 1, 1, ain, aout };
|
8538
8604
|
|
8539
8605
|
return na_ndloop(&ndf, 1, a1);
|
8540
8606
|
}
|
@@ -8610,9 +8676,9 @@ static void iter_dfloat_math_s_acosh(na_loop_t* const lp) {
|
|
8610
8676
|
@return [Numo::DFloat] result of acosh(x).
|
8611
8677
|
*/
|
8612
8678
|
static VALUE dfloat_math_s_acosh(VALUE mod, VALUE a1) {
|
8613
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8614
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8615
|
-
ndfunc_t ndf = {iter_dfloat_math_s_acosh, FULL_LOOP, 1, 1, ain, aout};
|
8679
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8680
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8681
|
+
ndfunc_t ndf = { iter_dfloat_math_s_acosh, FULL_LOOP, 1, 1, ain, aout };
|
8616
8682
|
|
8617
8683
|
return na_ndloop(&ndf, 1, a1);
|
8618
8684
|
}
|
@@ -8688,9 +8754,9 @@ static void iter_dfloat_math_s_atanh(na_loop_t* const lp) {
|
|
8688
8754
|
@return [Numo::DFloat] result of atanh(x).
|
8689
8755
|
*/
|
8690
8756
|
static VALUE dfloat_math_s_atanh(VALUE mod, VALUE a1) {
|
8691
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8692
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8693
|
-
ndfunc_t ndf = {iter_dfloat_math_s_atanh, FULL_LOOP, 1, 1, ain, aout};
|
8757
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8758
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8759
|
+
ndfunc_t ndf = { iter_dfloat_math_s_atanh, FULL_LOOP, 1, 1, ain, aout };
|
8694
8760
|
|
8695
8761
|
return na_ndloop(&ndf, 1, a1);
|
8696
8762
|
}
|
@@ -8766,9 +8832,9 @@ static void iter_dfloat_math_s_sinc(na_loop_t* const lp) {
|
|
8766
8832
|
@return [Numo::DFloat] result of sinc(x).
|
8767
8833
|
*/
|
8768
8834
|
static VALUE dfloat_math_s_sinc(VALUE mod, VALUE a1) {
|
8769
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8770
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8771
|
-
ndfunc_t ndf = {iter_dfloat_math_s_sinc, FULL_LOOP, 1, 1, ain, aout};
|
8835
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8836
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8837
|
+
ndfunc_t ndf = { iter_dfloat_math_s_sinc, FULL_LOOP, 1, 1, ain, aout };
|
8772
8838
|
|
8773
8839
|
return na_ndloop(&ndf, 1, a1);
|
8774
8840
|
}
|
@@ -8798,9 +8864,9 @@ static void iter_dfloat_math_s_atan2(na_loop_t* const lp) {
|
|
8798
8864
|
@return [Numo::DFloat] atan2(a1,a2).
|
8799
8865
|
*/
|
8800
8866
|
static VALUE dfloat_math_s_atan2(VALUE mod, VALUE a1, VALUE a2) {
|
8801
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
8802
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8803
|
-
ndfunc_t ndf = {iter_dfloat_math_s_atan2, STRIDE_LOOP, 2, 1, ain, aout};
|
8867
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
8868
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8869
|
+
ndfunc_t ndf = { iter_dfloat_math_s_atan2, STRIDE_LOOP, 2, 1, ain, aout };
|
8804
8870
|
return na_ndloop(&ndf, 2, a1, a2);
|
8805
8871
|
}
|
8806
8872
|
|
@@ -8829,9 +8895,9 @@ static void iter_dfloat_math_s_hypot(na_loop_t* const lp) {
|
|
8829
8895
|
@return [Numo::DFloat] hypot(a1,a2).
|
8830
8896
|
*/
|
8831
8897
|
static VALUE dfloat_math_s_hypot(VALUE mod, VALUE a1, VALUE a2) {
|
8832
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
8833
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8834
|
-
ndfunc_t ndf = {iter_dfloat_math_s_hypot, STRIDE_LOOP, 2, 1, ain, aout};
|
8898
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
8899
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8900
|
+
ndfunc_t ndf = { iter_dfloat_math_s_hypot, STRIDE_LOOP, 2, 1, ain, aout };
|
8835
8901
|
return na_ndloop(&ndf, 2, a1, a2);
|
8836
8902
|
}
|
8837
8903
|
|
@@ -8906,9 +8972,9 @@ static void iter_dfloat_math_s_erf(na_loop_t* const lp) {
|
|
8906
8972
|
@return [Numo::DFloat] result of erf(x).
|
8907
8973
|
*/
|
8908
8974
|
static VALUE dfloat_math_s_erf(VALUE mod, VALUE a1) {
|
8909
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8910
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8911
|
-
ndfunc_t ndf = {iter_dfloat_math_s_erf, FULL_LOOP, 1, 1, ain, aout};
|
8975
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
8976
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
8977
|
+
ndfunc_t ndf = { iter_dfloat_math_s_erf, FULL_LOOP, 1, 1, ain, aout };
|
8912
8978
|
|
8913
8979
|
return na_ndloop(&ndf, 1, a1);
|
8914
8980
|
}
|
@@ -8984,9 +9050,9 @@ static void iter_dfloat_math_s_erfc(na_loop_t* const lp) {
|
|
8984
9050
|
@return [Numo::DFloat] result of erfc(x).
|
8985
9051
|
*/
|
8986
9052
|
static VALUE dfloat_math_s_erfc(VALUE mod, VALUE a1) {
|
8987
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
8988
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
8989
|
-
ndfunc_t ndf = {iter_dfloat_math_s_erfc, FULL_LOOP, 1, 1, ain, aout};
|
9053
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
9054
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
9055
|
+
ndfunc_t ndf = { iter_dfloat_math_s_erfc, FULL_LOOP, 1, 1, ain, aout };
|
8990
9056
|
|
8991
9057
|
return na_ndloop(&ndf, 1, a1);
|
8992
9058
|
}
|
@@ -9062,9 +9128,9 @@ static void iter_dfloat_math_s_log1p(na_loop_t* const lp) {
|
|
9062
9128
|
@return [Numo::DFloat] result of log1p(x).
|
9063
9129
|
*/
|
9064
9130
|
static VALUE dfloat_math_s_log1p(VALUE mod, VALUE a1) {
|
9065
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
9066
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
9067
|
-
ndfunc_t ndf = {iter_dfloat_math_s_log1p, FULL_LOOP, 1, 1, ain, aout};
|
9131
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
9132
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
9133
|
+
ndfunc_t ndf = { iter_dfloat_math_s_log1p, FULL_LOOP, 1, 1, ain, aout };
|
9068
9134
|
|
9069
9135
|
return na_ndloop(&ndf, 1, a1);
|
9070
9136
|
}
|
@@ -9140,9 +9206,9 @@ static void iter_dfloat_math_s_expm1(na_loop_t* const lp) {
|
|
9140
9206
|
@return [Numo::DFloat] result of expm1(x).
|
9141
9207
|
*/
|
9142
9208
|
static VALUE dfloat_math_s_expm1(VALUE mod, VALUE a1) {
|
9143
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
9144
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
9145
|
-
ndfunc_t ndf = {iter_dfloat_math_s_expm1, FULL_LOOP, 1, 1, ain, aout};
|
9209
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
9210
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
9211
|
+
ndfunc_t ndf = { iter_dfloat_math_s_expm1, FULL_LOOP, 1, 1, ain, aout };
|
9146
9212
|
|
9147
9213
|
return na_ndloop(&ndf, 1, a1);
|
9148
9214
|
}
|
@@ -9172,9 +9238,9 @@ static void iter_dfloat_math_s_ldexp(na_loop_t* const lp) {
|
|
9172
9238
|
@return [Numo::DFloat] ldexp(a1,a2).
|
9173
9239
|
*/
|
9174
9240
|
static VALUE dfloat_math_s_ldexp(VALUE mod, VALUE a1, VALUE a2) {
|
9175
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
9176
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
9177
|
-
ndfunc_t ndf = {iter_dfloat_math_s_ldexp, STRIDE_LOOP, 2, 1, ain, aout};
|
9241
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
9242
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
9243
|
+
ndfunc_t ndf = { iter_dfloat_math_s_ldexp, STRIDE_LOOP, 2, 1, ain, aout };
|
9178
9244
|
return na_ndloop(&ndf, 2, a1, a2);
|
9179
9245
|
}
|
9180
9246
|
|
@@ -9206,9 +9272,9 @@ static void iter_dfloat_math_s_frexp(na_loop_t* const lp) {
|
|
9206
9272
|
|
9207
9273
|
*/
|
9208
9274
|
static VALUE dfloat_math_s_frexp(VALUE mod, VALUE a1) {
|
9209
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
9210
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {numo_cInt32, 0}};
|
9211
|
-
ndfunc_t ndf = {iter_dfloat_math_s_frexp, STRIDE_LOOP, 1, 2, ain, aout};
|
9275
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
9276
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { numo_cInt32, 0 } };
|
9277
|
+
ndfunc_t ndf = { iter_dfloat_math_s_frexp, STRIDE_LOOP, 1, 2, ain, aout };
|
9212
9278
|
return na_ndloop(&ndf, 1, a1);
|
9213
9279
|
}
|
9214
9280
|
|