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
@@ -277,8 +277,8 @@ static void iter_robject_store_bit(na_loop_t* const lp) {
|
|
277
277
|
}
|
278
278
|
|
279
279
|
static VALUE robject_store_bit(VALUE self, VALUE obj) {
|
280
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
281
|
-
ndfunc_t ndf = {iter_robject_store_bit, FULL_LOOP, 2, 0, ain, 0};
|
280
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
281
|
+
ndfunc_t ndf = { iter_robject_store_bit, FULL_LOOP, 2, 0, ain, 0 };
|
282
282
|
|
283
283
|
na_ndloop(&ndf, 2, self, obj);
|
284
284
|
return self;
|
@@ -326,8 +326,8 @@ static void iter_robject_store_dfloat(na_loop_t* const lp) {
|
|
326
326
|
}
|
327
327
|
|
328
328
|
static VALUE robject_store_dfloat(VALUE self, VALUE obj) {
|
329
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
330
|
-
ndfunc_t ndf = {iter_robject_store_dfloat, FULL_LOOP, 2, 0, ain, 0};
|
329
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
330
|
+
ndfunc_t ndf = { iter_robject_store_dfloat, FULL_LOOP, 2, 0, ain, 0 };
|
331
331
|
|
332
332
|
na_ndloop(&ndf, 2, self, obj);
|
333
333
|
return self;
|
@@ -375,8 +375,8 @@ static void iter_robject_store_sfloat(na_loop_t* const lp) {
|
|
375
375
|
}
|
376
376
|
|
377
377
|
static VALUE robject_store_sfloat(VALUE self, VALUE obj) {
|
378
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
379
|
-
ndfunc_t ndf = {iter_robject_store_sfloat, FULL_LOOP, 2, 0, ain, 0};
|
378
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
379
|
+
ndfunc_t ndf = { iter_robject_store_sfloat, FULL_LOOP, 2, 0, ain, 0 };
|
380
380
|
|
381
381
|
na_ndloop(&ndf, 2, self, obj);
|
382
382
|
return self;
|
@@ -424,8 +424,8 @@ static void iter_robject_store_int64(na_loop_t* const lp) {
|
|
424
424
|
}
|
425
425
|
|
426
426
|
static VALUE robject_store_int64(VALUE self, VALUE obj) {
|
427
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
428
|
-
ndfunc_t ndf = {iter_robject_store_int64, FULL_LOOP, 2, 0, ain, 0};
|
427
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
428
|
+
ndfunc_t ndf = { iter_robject_store_int64, FULL_LOOP, 2, 0, ain, 0 };
|
429
429
|
|
430
430
|
na_ndloop(&ndf, 2, self, obj);
|
431
431
|
return self;
|
@@ -473,8 +473,8 @@ static void iter_robject_store_int32(na_loop_t* const lp) {
|
|
473
473
|
}
|
474
474
|
|
475
475
|
static VALUE robject_store_int32(VALUE self, VALUE obj) {
|
476
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
477
|
-
ndfunc_t ndf = {iter_robject_store_int32, FULL_LOOP, 2, 0, ain, 0};
|
476
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
477
|
+
ndfunc_t ndf = { iter_robject_store_int32, FULL_LOOP, 2, 0, ain, 0 };
|
478
478
|
|
479
479
|
na_ndloop(&ndf, 2, self, obj);
|
480
480
|
return self;
|
@@ -522,8 +522,8 @@ static void iter_robject_store_int16(na_loop_t* const lp) {
|
|
522
522
|
}
|
523
523
|
|
524
524
|
static VALUE robject_store_int16(VALUE self, VALUE obj) {
|
525
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
526
|
-
ndfunc_t ndf = {iter_robject_store_int16, FULL_LOOP, 2, 0, ain, 0};
|
525
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
526
|
+
ndfunc_t ndf = { iter_robject_store_int16, FULL_LOOP, 2, 0, ain, 0 };
|
527
527
|
|
528
528
|
na_ndloop(&ndf, 2, self, obj);
|
529
529
|
return self;
|
@@ -571,8 +571,8 @@ static void iter_robject_store_int8(na_loop_t* const lp) {
|
|
571
571
|
}
|
572
572
|
|
573
573
|
static VALUE robject_store_int8(VALUE self, VALUE obj) {
|
574
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
575
|
-
ndfunc_t ndf = {iter_robject_store_int8, FULL_LOOP, 2, 0, ain, 0};
|
574
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
575
|
+
ndfunc_t ndf = { iter_robject_store_int8, FULL_LOOP, 2, 0, ain, 0 };
|
576
576
|
|
577
577
|
na_ndloop(&ndf, 2, self, obj);
|
578
578
|
return self;
|
@@ -620,8 +620,8 @@ static void iter_robject_store_uint64(na_loop_t* const lp) {
|
|
620
620
|
}
|
621
621
|
|
622
622
|
static VALUE robject_store_uint64(VALUE self, VALUE obj) {
|
623
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
624
|
-
ndfunc_t ndf = {iter_robject_store_uint64, FULL_LOOP, 2, 0, ain, 0};
|
623
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
624
|
+
ndfunc_t ndf = { iter_robject_store_uint64, FULL_LOOP, 2, 0, ain, 0 };
|
625
625
|
|
626
626
|
na_ndloop(&ndf, 2, self, obj);
|
627
627
|
return self;
|
@@ -669,8 +669,8 @@ static void iter_robject_store_uint32(na_loop_t* const lp) {
|
|
669
669
|
}
|
670
670
|
|
671
671
|
static VALUE robject_store_uint32(VALUE self, VALUE obj) {
|
672
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
673
|
-
ndfunc_t ndf = {iter_robject_store_uint32, FULL_LOOP, 2, 0, ain, 0};
|
672
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
673
|
+
ndfunc_t ndf = { iter_robject_store_uint32, FULL_LOOP, 2, 0, ain, 0 };
|
674
674
|
|
675
675
|
na_ndloop(&ndf, 2, self, obj);
|
676
676
|
return self;
|
@@ -718,8 +718,8 @@ static void iter_robject_store_uint16(na_loop_t* const lp) {
|
|
718
718
|
}
|
719
719
|
|
720
720
|
static VALUE robject_store_uint16(VALUE self, VALUE obj) {
|
721
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
722
|
-
ndfunc_t ndf = {iter_robject_store_uint16, FULL_LOOP, 2, 0, ain, 0};
|
721
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
722
|
+
ndfunc_t ndf = { iter_robject_store_uint16, FULL_LOOP, 2, 0, ain, 0 };
|
723
723
|
|
724
724
|
na_ndloop(&ndf, 2, self, obj);
|
725
725
|
return self;
|
@@ -767,8 +767,8 @@ static void iter_robject_store_uint8(na_loop_t* const lp) {
|
|
767
767
|
}
|
768
768
|
|
769
769
|
static VALUE robject_store_uint8(VALUE self, VALUE obj) {
|
770
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
771
|
-
ndfunc_t ndf = {iter_robject_store_uint8, FULL_LOOP, 2, 0, ain, 0};
|
770
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
771
|
+
ndfunc_t ndf = { iter_robject_store_uint8, FULL_LOOP, 2, 0, ain, 0 };
|
772
772
|
|
773
773
|
na_ndloop(&ndf, 2, self, obj);
|
774
774
|
return self;
|
@@ -816,8 +816,8 @@ static void iter_robject_store_robject(na_loop_t* const lp) {
|
|
816
816
|
}
|
817
817
|
|
818
818
|
static VALUE robject_store_robject(VALUE self, VALUE obj) {
|
819
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
|
820
|
-
ndfunc_t ndf = {iter_robject_store_robject, FULL_LOOP, 2, 0, ain, 0};
|
819
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
|
820
|
+
ndfunc_t ndf = { iter_robject_store_robject, FULL_LOOP, 2, 0, ain, 0 };
|
821
821
|
|
822
822
|
na_ndloop(&ndf, 2, self, obj);
|
823
823
|
return self;
|
@@ -925,8 +925,8 @@ loop_end:
|
|
925
925
|
}
|
926
926
|
|
927
927
|
static VALUE robject_store_array(VALUE self, VALUE rary) {
|
928
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {rb_cArray, 0}};
|
929
|
-
ndfunc_t ndf = {iter_robject_store_array, FULL_LOOP, 2, 0, ain, 0};
|
928
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { rb_cArray, 0 } };
|
929
|
+
ndfunc_t ndf = { iter_robject_store_array, FULL_LOOP, 2, 0, ain, 0 };
|
930
930
|
|
931
931
|
na_ndloop_store_rarray(&ndf, self, rary);
|
932
932
|
return self;
|
@@ -1183,8 +1183,8 @@ static VALUE robject_s_cast(VALUE type, VALUE obj) {
|
|
1183
1183
|
/*
|
1184
1184
|
Multi-dimensional element reference.
|
1185
1185
|
@overload [](dim0,...,dimL)
|
1186
|
-
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1187
|
-
indices.
|
1186
|
+
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1187
|
+
dim0,...,dimL multi-dimensional indices.
|
1188
1188
|
@return [Numeric,Numo::RObject] an element or NArray view.
|
1189
1189
|
@see Numo::NArray#[]
|
1190
1190
|
@see #[]=
|
@@ -1206,8 +1206,8 @@ static VALUE robject_aref(int argc, VALUE* argv, VALUE self) {
|
|
1206
1206
|
/*
|
1207
1207
|
Multi-dimensional element assignment.
|
1208
1208
|
@overload []=(dim0,...,dimL,val)
|
1209
|
-
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1210
|
-
indices.
|
1209
|
+
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1210
|
+
dim0,...,dimL multi-dimensional indices.
|
1211
1211
|
@param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
|
1212
1212
|
@return [Numeric,Numo::NArray,Array] returns `val` (last argument).
|
1213
1213
|
@see Numo::NArray#[]=
|
@@ -1278,9 +1278,9 @@ static void iter_robject_to_a(na_loop_t* const lp) {
|
|
1278
1278
|
@return [Array]
|
1279
1279
|
*/
|
1280
1280
|
static VALUE robject_to_a(VALUE self) {
|
1281
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
|
1282
|
-
ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
|
1283
|
-
ndfunc_t ndf = {iter_robject_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
|
1281
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
|
1282
|
+
ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
|
1283
|
+
ndfunc_t ndf = { iter_robject_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
|
1284
1284
|
return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
|
1285
1285
|
}
|
1286
1286
|
|
@@ -1312,8 +1312,8 @@ static void iter_robject_fill(na_loop_t* const lp) {
|
|
1312
1312
|
@return [Numo::RObject] self.
|
1313
1313
|
*/
|
1314
1314
|
static VALUE robject_fill(VALUE self, VALUE val) {
|
1315
|
-
ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_option}};
|
1316
|
-
ndfunc_t ndf = {iter_robject_fill, FULL_LOOP, 2, 0, ain, 0};
|
1315
|
+
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
|
1316
|
+
ndfunc_t ndf = { iter_robject_fill, FULL_LOOP, 2, 0, ain, 0 };
|
1317
1317
|
|
1318
1318
|
na_ndloop(&ndf, 2, self, val);
|
1319
1319
|
return self;
|
@@ -1368,9 +1368,9 @@ static void iter_robject_format(na_loop_t* const lp) {
|
|
1368
1368
|
static VALUE robject_format(int argc, VALUE* argv, VALUE self) {
|
1369
1369
|
VALUE fmt = Qnil;
|
1370
1370
|
|
1371
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_option}};
|
1372
|
-
ndfunc_arg_out_t aout[1] = {{numo_cRObject, 0}};
|
1373
|
-
ndfunc_t ndf = {iter_robject_format, FULL_LOOP_NIP, 2, 1, ain, aout};
|
1371
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_option } };
|
1372
|
+
ndfunc_arg_out_t aout[1] = { { numo_cRObject, 0 } };
|
1373
|
+
ndfunc_t ndf = { iter_robject_format, FULL_LOOP_NIP, 2, 1, ain, aout };
|
1374
1374
|
|
1375
1375
|
rb_scan_args(argc, argv, "01", &fmt);
|
1376
1376
|
return na_ndloop(&ndf, 2, self, fmt);
|
@@ -1414,9 +1414,9 @@ static void iter_robject_format_to_a(na_loop_t* const lp) {
|
|
1414
1414
|
*/
|
1415
1415
|
static VALUE robject_format_to_a(int argc, VALUE* argv, VALUE self) {
|
1416
1416
|
VALUE fmt = Qnil;
|
1417
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
|
1418
|
-
ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
|
1419
|
-
ndfunc_t ndf = {iter_robject_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
|
1417
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
|
1418
|
+
ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
|
1419
|
+
ndfunc_t ndf = { iter_robject_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
|
1420
1420
|
|
1421
1421
|
rb_scan_args(argc, argv, "01", &fmt);
|
1422
1422
|
return na_ndloop_cast_narray_to_rarray(&ndf, self, fmt);
|
@@ -1470,8 +1470,8 @@ static void iter_robject_each(na_loop_t* const lp) {
|
|
1470
1470
|
@see #map
|
1471
1471
|
*/
|
1472
1472
|
static VALUE robject_each(VALUE self) {
|
1473
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1474
|
-
ndfunc_t ndf = {iter_robject_each, FULL_LOOP_NIP, 1, 0, ain, 0};
|
1473
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1474
|
+
ndfunc_t ndf = { iter_robject_each, FULL_LOOP_NIP, 1, 0, ain, 0 };
|
1475
1475
|
|
1476
1476
|
na_ndloop(&ndf, 1, self);
|
1477
1477
|
return self;
|
@@ -1528,9 +1528,9 @@ static void iter_robject_map(na_loop_t* const lp) {
|
|
1528
1528
|
@return [Numo::RObject] map of self.
|
1529
1529
|
*/
|
1530
1530
|
static VALUE robject_map(VALUE self) {
|
1531
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
1532
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1533
|
-
ndfunc_t ndf = {iter_robject_map, FULL_LOOP, 1, 1, ain, aout};
|
1531
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
1532
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1533
|
+
ndfunc_t ndf = { iter_robject_map, FULL_LOOP, 1, 1, ain, aout };
|
1534
1534
|
|
1535
1535
|
return na_ndloop(&ndf, 1, self);
|
1536
1536
|
}
|
@@ -1592,8 +1592,8 @@ static void iter_robject_each_with_index(na_loop_t* const lp) {
|
|
1592
1592
|
@see #map_with_index
|
1593
1593
|
*/
|
1594
1594
|
static VALUE robject_each_with_index(VALUE self) {
|
1595
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1596
|
-
ndfunc_t ndf = {iter_robject_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0};
|
1595
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1596
|
+
ndfunc_t ndf = { iter_robject_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0 };
|
1597
1597
|
|
1598
1598
|
na_ndloop_with_index(&ndf, 1, self);
|
1599
1599
|
return self;
|
@@ -1683,9 +1683,9 @@ static void iter_robject_map_with_index(na_loop_t* const lp) {
|
|
1683
1683
|
@see #each_with_index
|
1684
1684
|
*/
|
1685
1685
|
static VALUE robject_map_with_index(VALUE self) {
|
1686
|
-
ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
|
1687
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1688
|
-
ndfunc_t ndf = {iter_robject_map_with_index, FULL_LOOP, 1, 1, ain, aout};
|
1686
|
+
ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
|
1687
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1688
|
+
ndfunc_t ndf = { iter_robject_map_with_index, FULL_LOOP, 1, 1, ain, aout };
|
1689
1689
|
|
1690
1690
|
return na_ndloop_with_index(&ndf, 1, self);
|
1691
1691
|
}
|
@@ -1737,14 +1737,14 @@ static void iter_robject_abs(na_loop_t* const lp) {
|
|
1737
1737
|
@return [Numo::RObject] abs of self.
|
1738
1738
|
*/
|
1739
1739
|
static VALUE robject_abs(VALUE self) {
|
1740
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
1741
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
1742
|
-
ndfunc_t ndf = {iter_robject_abs, FULL_LOOP, 1, 1, ain, aout};
|
1740
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
1741
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
1742
|
+
ndfunc_t ndf = { iter_robject_abs, FULL_LOOP, 1, 1, ain, aout };
|
1743
1743
|
|
1744
1744
|
return na_ndloop(&ndf, 1, self);
|
1745
1745
|
}
|
1746
1746
|
|
1747
|
-
#define check_intdivzero(y)
|
1747
|
+
#define check_intdivzero(y) \
|
1748
1748
|
{}
|
1749
1749
|
|
1750
1750
|
static void iter_robject_add(na_loop_t* const lp) {
|
@@ -1804,9 +1804,9 @@ static void iter_robject_add(na_loop_t* const lp) {
|
|
1804
1804
|
#undef check_intdivzero
|
1805
1805
|
|
1806
1806
|
static VALUE robject_add_self(VALUE self, VALUE other) {
|
1807
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
1808
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1809
|
-
ndfunc_t ndf = {iter_robject_add, STRIDE_LOOP, 2, 1, ain, aout};
|
1807
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
1808
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1809
|
+
ndfunc_t ndf = { iter_robject_add, STRIDE_LOOP, 2, 1, ain, aout };
|
1810
1810
|
|
1811
1811
|
return na_ndloop(&ndf, 2, self, other);
|
1812
1812
|
}
|
@@ -1821,7 +1821,7 @@ static VALUE robject_add(VALUE self, VALUE other) {
|
|
1821
1821
|
return robject_add_self(self, other);
|
1822
1822
|
}
|
1823
1823
|
|
1824
|
-
#define check_intdivzero(y)
|
1824
|
+
#define check_intdivzero(y) \
|
1825
1825
|
{}
|
1826
1826
|
|
1827
1827
|
static void iter_robject_sub(na_loop_t* const lp) {
|
@@ -1881,9 +1881,9 @@ static void iter_robject_sub(na_loop_t* const lp) {
|
|
1881
1881
|
#undef check_intdivzero
|
1882
1882
|
|
1883
1883
|
static VALUE robject_sub_self(VALUE self, VALUE other) {
|
1884
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
1885
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1886
|
-
ndfunc_t ndf = {iter_robject_sub, STRIDE_LOOP, 2, 1, ain, aout};
|
1884
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
1885
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1886
|
+
ndfunc_t ndf = { iter_robject_sub, STRIDE_LOOP, 2, 1, ain, aout };
|
1887
1887
|
|
1888
1888
|
return na_ndloop(&ndf, 2, self, other);
|
1889
1889
|
}
|
@@ -1898,7 +1898,7 @@ static VALUE robject_sub(VALUE self, VALUE other) {
|
|
1898
1898
|
return robject_sub_self(self, other);
|
1899
1899
|
}
|
1900
1900
|
|
1901
|
-
#define check_intdivzero(y)
|
1901
|
+
#define check_intdivzero(y) \
|
1902
1902
|
{}
|
1903
1903
|
|
1904
1904
|
static void iter_robject_mul(na_loop_t* const lp) {
|
@@ -1958,9 +1958,9 @@ static void iter_robject_mul(na_loop_t* const lp) {
|
|
1958
1958
|
#undef check_intdivzero
|
1959
1959
|
|
1960
1960
|
static VALUE robject_mul_self(VALUE self, VALUE other) {
|
1961
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
1962
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
1963
|
-
ndfunc_t ndf = {iter_robject_mul, STRIDE_LOOP, 2, 1, ain, aout};
|
1961
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
1962
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
1963
|
+
ndfunc_t ndf = { iter_robject_mul, STRIDE_LOOP, 2, 1, ain, aout };
|
1964
1964
|
|
1965
1965
|
return na_ndloop(&ndf, 2, self, other);
|
1966
1966
|
}
|
@@ -1975,10 +1975,10 @@ static VALUE robject_mul(VALUE self, VALUE other) {
|
|
1975
1975
|
return robject_mul_self(self, other);
|
1976
1976
|
}
|
1977
1977
|
|
1978
|
-
#define check_intdivzero(y)
|
1979
|
-
if ((y) == 0) {
|
1980
|
-
lp->err_type = rb_eZeroDivError;
|
1981
|
-
return;
|
1978
|
+
#define check_intdivzero(y) \
|
1979
|
+
if ((y) == 0) { \
|
1980
|
+
lp->err_type = rb_eZeroDivError; \
|
1981
|
+
return; \
|
1982
1982
|
}
|
1983
1983
|
|
1984
1984
|
static void iter_robject_div(na_loop_t* const lp) {
|
@@ -2038,9 +2038,9 @@ static void iter_robject_div(na_loop_t* const lp) {
|
|
2038
2038
|
#undef check_intdivzero
|
2039
2039
|
|
2040
2040
|
static VALUE robject_div_self(VALUE self, VALUE other) {
|
2041
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2042
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2043
|
-
ndfunc_t ndf = {iter_robject_div, STRIDE_LOOP, 2, 1, ain, aout};
|
2041
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2042
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2043
|
+
ndfunc_t ndf = { iter_robject_div, STRIDE_LOOP, 2, 1, ain, aout };
|
2044
2044
|
|
2045
2045
|
return na_ndloop(&ndf, 2, self, other);
|
2046
2046
|
}
|
@@ -2055,10 +2055,10 @@ static VALUE robject_div(VALUE self, VALUE other) {
|
|
2055
2055
|
return robject_div_self(self, other);
|
2056
2056
|
}
|
2057
2057
|
|
2058
|
-
#define check_intdivzero(y)
|
2059
|
-
if ((y) == 0) {
|
2060
|
-
lp->err_type = rb_eZeroDivError;
|
2061
|
-
return;
|
2058
|
+
#define check_intdivzero(y) \
|
2059
|
+
if ((y) == 0) { \
|
2060
|
+
lp->err_type = rb_eZeroDivError; \
|
2061
|
+
return; \
|
2062
2062
|
}
|
2063
2063
|
|
2064
2064
|
static void iter_robject_mod(na_loop_t* const lp) {
|
@@ -2118,9 +2118,9 @@ static void iter_robject_mod(na_loop_t* const lp) {
|
|
2118
2118
|
#undef check_intdivzero
|
2119
2119
|
|
2120
2120
|
static VALUE robject_mod_self(VALUE self, VALUE other) {
|
2121
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2122
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2123
|
-
ndfunc_t ndf = {iter_robject_mod, STRIDE_LOOP, 2, 1, ain, aout};
|
2121
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2122
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2123
|
+
ndfunc_t ndf = { iter_robject_mod, STRIDE_LOOP, 2, 1, ain, aout };
|
2124
2124
|
|
2125
2125
|
return na_ndloop(&ndf, 2, self, other);
|
2126
2126
|
}
|
@@ -2159,9 +2159,9 @@ static void iter_robject_divmod(na_loop_t* const lp) {
|
|
2159
2159
|
}
|
2160
2160
|
|
2161
2161
|
static VALUE robject_divmod_self(VALUE self, VALUE other) {
|
2162
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2163
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
2164
|
-
ndfunc_t ndf = {iter_robject_divmod, STRIDE_LOOP, 2, 2, ain, aout};
|
2162
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2163
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
2164
|
+
ndfunc_t ndf = { iter_robject_divmod, STRIDE_LOOP, 2, 2, ain, aout };
|
2165
2165
|
|
2166
2166
|
return na_ndloop(&ndf, 2, self, other);
|
2167
2167
|
}
|
@@ -2212,11 +2212,11 @@ static void iter_robject_pow_int32(na_loop_t* const lp) {
|
|
2212
2212
|
}
|
2213
2213
|
|
2214
2214
|
static VALUE robject_pow_self(VALUE self, VALUE other) {
|
2215
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2216
|
-
ndfunc_arg_in_t ain_i[2] = {{cT, 0}, {numo_cInt32, 0}};
|
2217
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2218
|
-
ndfunc_t ndf = {iter_robject_pow, STRIDE_LOOP, 2, 1, ain, aout};
|
2219
|
-
ndfunc_t ndf_i = {iter_robject_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout};
|
2215
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2216
|
+
ndfunc_arg_in_t ain_i[2] = { { cT, 0 }, { numo_cInt32, 0 } };
|
2217
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2218
|
+
ndfunc_t ndf = { iter_robject_pow, STRIDE_LOOP, 2, 1, ain, aout };
|
2219
|
+
ndfunc_t ndf_i = { iter_robject_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout };
|
2220
2220
|
|
2221
2221
|
// fixme : use na.integer?
|
2222
2222
|
if (FIXNUM_P(other) || rb_obj_is_kind_of(other, numo_cInt32)) {
|
@@ -2287,9 +2287,9 @@ static void iter_robject_minus(na_loop_t* const lp) {
|
|
2287
2287
|
@return [Numo::RObject] minus of self.
|
2288
2288
|
*/
|
2289
2289
|
static VALUE robject_minus(VALUE self) {
|
2290
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2291
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2292
|
-
ndfunc_t ndf = {iter_robject_minus, FULL_LOOP, 1, 1, ain, aout};
|
2290
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2291
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2292
|
+
ndfunc_t ndf = { iter_robject_minus, FULL_LOOP, 1, 1, ain, aout };
|
2293
2293
|
|
2294
2294
|
return na_ndloop(&ndf, 1, self);
|
2295
2295
|
}
|
@@ -2345,9 +2345,9 @@ static void iter_robject_reciprocal(na_loop_t* const lp) {
|
|
2345
2345
|
@return [Numo::RObject] reciprocal of self.
|
2346
2346
|
*/
|
2347
2347
|
static VALUE robject_reciprocal(VALUE self) {
|
2348
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2349
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2350
|
-
ndfunc_t ndf = {iter_robject_reciprocal, FULL_LOOP, 1, 1, ain, aout};
|
2348
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2349
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2350
|
+
ndfunc_t ndf = { iter_robject_reciprocal, FULL_LOOP, 1, 1, ain, aout };
|
2351
2351
|
|
2352
2352
|
return na_ndloop(&ndf, 1, self);
|
2353
2353
|
}
|
@@ -2403,9 +2403,9 @@ static void iter_robject_sign(na_loop_t* const lp) {
|
|
2403
2403
|
@return [Numo::RObject] sign of self.
|
2404
2404
|
*/
|
2405
2405
|
static VALUE robject_sign(VALUE self) {
|
2406
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2407
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2408
|
-
ndfunc_t ndf = {iter_robject_sign, FULL_LOOP, 1, 1, ain, aout};
|
2406
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2407
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2408
|
+
ndfunc_t ndf = { iter_robject_sign, FULL_LOOP, 1, 1, ain, aout };
|
2409
2409
|
|
2410
2410
|
return na_ndloop(&ndf, 1, self);
|
2411
2411
|
}
|
@@ -2461,9 +2461,9 @@ static void iter_robject_square(na_loop_t* const lp) {
|
|
2461
2461
|
@return [Numo::RObject] square of self.
|
2462
2462
|
*/
|
2463
2463
|
static VALUE robject_square(VALUE self) {
|
2464
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2465
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2466
|
-
ndfunc_t ndf = {iter_robject_square, FULL_LOOP, 1, 1, ain, aout};
|
2464
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2465
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2466
|
+
ndfunc_t ndf = { iter_robject_square, FULL_LOOP, 1, 1, ain, aout };
|
2467
2467
|
|
2468
2468
|
return na_ndloop(&ndf, 1, self);
|
2469
2469
|
}
|
@@ -2490,9 +2490,9 @@ static void iter_robject_eq(na_loop_t* const lp) {
|
|
2490
2490
|
}
|
2491
2491
|
|
2492
2492
|
static VALUE robject_eq_self(VALUE self, VALUE other) {
|
2493
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2494
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
2495
|
-
ndfunc_t ndf = {iter_robject_eq, STRIDE_LOOP, 2, 1, ain, aout};
|
2493
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2494
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
2495
|
+
ndfunc_t ndf = { iter_robject_eq, STRIDE_LOOP, 2, 1, ain, aout };
|
2496
2496
|
|
2497
2497
|
return na_ndloop(&ndf, 2, self, other);
|
2498
2498
|
}
|
@@ -2529,9 +2529,9 @@ static void iter_robject_ne(na_loop_t* const lp) {
|
|
2529
2529
|
}
|
2530
2530
|
|
2531
2531
|
static VALUE robject_ne_self(VALUE self, VALUE other) {
|
2532
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2533
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
2534
|
-
ndfunc_t ndf = {iter_robject_ne, STRIDE_LOOP, 2, 1, ain, aout};
|
2532
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2533
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
2534
|
+
ndfunc_t ndf = { iter_robject_ne, STRIDE_LOOP, 2, 1, ain, aout };
|
2535
2535
|
|
2536
2536
|
return na_ndloop(&ndf, 2, self, other);
|
2537
2537
|
}
|
@@ -2568,9 +2568,9 @@ static void iter_robject_nearly_eq(na_loop_t* const lp) {
|
|
2568
2568
|
}
|
2569
2569
|
|
2570
2570
|
static VALUE robject_nearly_eq_self(VALUE self, VALUE other) {
|
2571
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2572
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
2573
|
-
ndfunc_t ndf = {iter_robject_nearly_eq, STRIDE_LOOP, 2, 1, ain, aout};
|
2571
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2572
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
2573
|
+
ndfunc_t ndf = { iter_robject_nearly_eq, STRIDE_LOOP, 2, 1, ain, aout };
|
2574
2574
|
|
2575
2575
|
return na_ndloop(&ndf, 2, self, other);
|
2576
2576
|
}
|
@@ -2585,7 +2585,7 @@ static VALUE robject_nearly_eq(VALUE self, VALUE other) {
|
|
2585
2585
|
return robject_nearly_eq_self(self, other);
|
2586
2586
|
}
|
2587
2587
|
|
2588
|
-
#define check_intdivzero(y)
|
2588
|
+
#define check_intdivzero(y) \
|
2589
2589
|
{}
|
2590
2590
|
|
2591
2591
|
static void iter_robject_bit_and(na_loop_t* const lp) {
|
@@ -2645,9 +2645,9 @@ static void iter_robject_bit_and(na_loop_t* const lp) {
|
|
2645
2645
|
#undef check_intdivzero
|
2646
2646
|
|
2647
2647
|
static VALUE robject_bit_and_self(VALUE self, VALUE other) {
|
2648
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2649
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2650
|
-
ndfunc_t ndf = {iter_robject_bit_and, STRIDE_LOOP, 2, 1, ain, aout};
|
2648
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2649
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2650
|
+
ndfunc_t ndf = { iter_robject_bit_and, STRIDE_LOOP, 2, 1, ain, aout };
|
2651
2651
|
|
2652
2652
|
return na_ndloop(&ndf, 2, self, other);
|
2653
2653
|
}
|
@@ -2662,7 +2662,7 @@ static VALUE robject_bit_and(VALUE self, VALUE other) {
|
|
2662
2662
|
return robject_bit_and_self(self, other);
|
2663
2663
|
}
|
2664
2664
|
|
2665
|
-
#define check_intdivzero(y)
|
2665
|
+
#define check_intdivzero(y) \
|
2666
2666
|
{}
|
2667
2667
|
|
2668
2668
|
static void iter_robject_bit_or(na_loop_t* const lp) {
|
@@ -2722,9 +2722,9 @@ static void iter_robject_bit_or(na_loop_t* const lp) {
|
|
2722
2722
|
#undef check_intdivzero
|
2723
2723
|
|
2724
2724
|
static VALUE robject_bit_or_self(VALUE self, VALUE other) {
|
2725
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2726
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2727
|
-
ndfunc_t ndf = {iter_robject_bit_or, STRIDE_LOOP, 2, 1, ain, aout};
|
2725
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2726
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2727
|
+
ndfunc_t ndf = { iter_robject_bit_or, STRIDE_LOOP, 2, 1, ain, aout };
|
2728
2728
|
|
2729
2729
|
return na_ndloop(&ndf, 2, self, other);
|
2730
2730
|
}
|
@@ -2739,7 +2739,7 @@ static VALUE robject_bit_or(VALUE self, VALUE other) {
|
|
2739
2739
|
return robject_bit_or_self(self, other);
|
2740
2740
|
}
|
2741
2741
|
|
2742
|
-
#define check_intdivzero(y)
|
2742
|
+
#define check_intdivzero(y) \
|
2743
2743
|
{}
|
2744
2744
|
|
2745
2745
|
static void iter_robject_bit_xor(na_loop_t* const lp) {
|
@@ -2799,9 +2799,9 @@ static void iter_robject_bit_xor(na_loop_t* const lp) {
|
|
2799
2799
|
#undef check_intdivzero
|
2800
2800
|
|
2801
2801
|
static VALUE robject_bit_xor_self(VALUE self, VALUE other) {
|
2802
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2803
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2804
|
-
ndfunc_t ndf = {iter_robject_bit_xor, STRIDE_LOOP, 2, 1, ain, aout};
|
2802
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2803
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2804
|
+
ndfunc_t ndf = { iter_robject_bit_xor, STRIDE_LOOP, 2, 1, ain, aout };
|
2805
2805
|
|
2806
2806
|
return na_ndloop(&ndf, 2, self, other);
|
2807
2807
|
}
|
@@ -2867,14 +2867,14 @@ static void iter_robject_bit_not(na_loop_t* const lp) {
|
|
2867
2867
|
@return [Numo::RObject] bit_not of self.
|
2868
2868
|
*/
|
2869
2869
|
static VALUE robject_bit_not(VALUE self) {
|
2870
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
2871
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2872
|
-
ndfunc_t ndf = {iter_robject_bit_not, FULL_LOOP, 1, 1, ain, aout};
|
2870
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
2871
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2872
|
+
ndfunc_t ndf = { iter_robject_bit_not, FULL_LOOP, 1, 1, ain, aout };
|
2873
2873
|
|
2874
2874
|
return na_ndloop(&ndf, 1, self);
|
2875
2875
|
}
|
2876
2876
|
|
2877
|
-
#define check_intdivzero(y)
|
2877
|
+
#define check_intdivzero(y) \
|
2878
2878
|
{}
|
2879
2879
|
|
2880
2880
|
static void iter_robject_left_shift(na_loop_t* const lp) {
|
@@ -2934,9 +2934,9 @@ static void iter_robject_left_shift(na_loop_t* const lp) {
|
|
2934
2934
|
#undef check_intdivzero
|
2935
2935
|
|
2936
2936
|
static VALUE robject_left_shift_self(VALUE self, VALUE other) {
|
2937
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
2938
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
2939
|
-
ndfunc_t ndf = {iter_robject_left_shift, STRIDE_LOOP, 2, 1, ain, aout};
|
2937
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
2938
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
2939
|
+
ndfunc_t ndf = { iter_robject_left_shift, STRIDE_LOOP, 2, 1, ain, aout };
|
2940
2940
|
|
2941
2941
|
return na_ndloop(&ndf, 2, self, other);
|
2942
2942
|
}
|
@@ -2951,7 +2951,7 @@ static VALUE robject_left_shift(VALUE self, VALUE other) {
|
|
2951
2951
|
return robject_left_shift_self(self, other);
|
2952
2952
|
}
|
2953
2953
|
|
2954
|
-
#define check_intdivzero(y)
|
2954
|
+
#define check_intdivzero(y) \
|
2955
2955
|
{}
|
2956
2956
|
|
2957
2957
|
static void iter_robject_right_shift(na_loop_t* const lp) {
|
@@ -3011,9 +3011,9 @@ static void iter_robject_right_shift(na_loop_t* const lp) {
|
|
3011
3011
|
#undef check_intdivzero
|
3012
3012
|
|
3013
3013
|
static VALUE robject_right_shift_self(VALUE self, VALUE other) {
|
3014
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3015
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3016
|
-
ndfunc_t ndf = {iter_robject_right_shift, STRIDE_LOOP, 2, 1, ain, aout};
|
3014
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3015
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3016
|
+
ndfunc_t ndf = { iter_robject_right_shift, STRIDE_LOOP, 2, 1, ain, aout };
|
3017
3017
|
|
3018
3018
|
return na_ndloop(&ndf, 2, self, other);
|
3019
3019
|
}
|
@@ -3079,9 +3079,9 @@ static void iter_robject_floor(na_loop_t* const lp) {
|
|
3079
3079
|
@return [Numo::RObject] floor of self.
|
3080
3080
|
*/
|
3081
3081
|
static VALUE robject_floor(VALUE self) {
|
3082
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3083
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3084
|
-
ndfunc_t ndf = {iter_robject_floor, FULL_LOOP, 1, 1, ain, aout};
|
3082
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3083
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3084
|
+
ndfunc_t ndf = { iter_robject_floor, FULL_LOOP, 1, 1, ain, aout };
|
3085
3085
|
|
3086
3086
|
return na_ndloop(&ndf, 1, self);
|
3087
3087
|
}
|
@@ -3137,9 +3137,9 @@ static void iter_robject_round(na_loop_t* const lp) {
|
|
3137
3137
|
@return [Numo::RObject] round of self.
|
3138
3138
|
*/
|
3139
3139
|
static VALUE robject_round(VALUE self) {
|
3140
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3141
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3142
|
-
ndfunc_t ndf = {iter_robject_round, FULL_LOOP, 1, 1, ain, aout};
|
3140
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3141
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3142
|
+
ndfunc_t ndf = { iter_robject_round, FULL_LOOP, 1, 1, ain, aout };
|
3143
3143
|
|
3144
3144
|
return na_ndloop(&ndf, 1, self);
|
3145
3145
|
}
|
@@ -3195,9 +3195,9 @@ static void iter_robject_ceil(na_loop_t* const lp) {
|
|
3195
3195
|
@return [Numo::RObject] ceil of self.
|
3196
3196
|
*/
|
3197
3197
|
static VALUE robject_ceil(VALUE self) {
|
3198
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3199
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3200
|
-
ndfunc_t ndf = {iter_robject_ceil, FULL_LOOP, 1, 1, ain, aout};
|
3198
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3199
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3200
|
+
ndfunc_t ndf = { iter_robject_ceil, FULL_LOOP, 1, 1, ain, aout };
|
3201
3201
|
|
3202
3202
|
return na_ndloop(&ndf, 1, self);
|
3203
3203
|
}
|
@@ -3253,9 +3253,9 @@ static void iter_robject_trunc(na_loop_t* const lp) {
|
|
3253
3253
|
@return [Numo::RObject] trunc of self.
|
3254
3254
|
*/
|
3255
3255
|
static VALUE robject_trunc(VALUE self) {
|
3256
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3257
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3258
|
-
ndfunc_t ndf = {iter_robject_trunc, FULL_LOOP, 1, 1, ain, aout};
|
3256
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3257
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3258
|
+
ndfunc_t ndf = { iter_robject_trunc, FULL_LOOP, 1, 1, ain, aout };
|
3259
3259
|
|
3260
3260
|
return na_ndloop(&ndf, 1, self);
|
3261
3261
|
}
|
@@ -3282,9 +3282,9 @@ static void iter_robject_gt(na_loop_t* const lp) {
|
|
3282
3282
|
}
|
3283
3283
|
|
3284
3284
|
static VALUE robject_gt_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_robject_gt, 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_robject_gt, STRIDE_LOOP, 2, 1, ain, aout };
|
3288
3288
|
|
3289
3289
|
return na_ndloop(&ndf, 2, self, other);
|
3290
3290
|
}
|
@@ -3321,9 +3321,9 @@ static void iter_robject_ge(na_loop_t* const lp) {
|
|
3321
3321
|
}
|
3322
3322
|
|
3323
3323
|
static VALUE robject_ge_self(VALUE self, VALUE other) {
|
3324
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3325
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3326
|
-
ndfunc_t ndf = {iter_robject_ge, STRIDE_LOOP, 2, 1, ain, aout};
|
3324
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3325
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3326
|
+
ndfunc_t ndf = { iter_robject_ge, STRIDE_LOOP, 2, 1, ain, aout };
|
3327
3327
|
|
3328
3328
|
return na_ndloop(&ndf, 2, self, other);
|
3329
3329
|
}
|
@@ -3360,9 +3360,9 @@ static void iter_robject_lt(na_loop_t* const lp) {
|
|
3360
3360
|
}
|
3361
3361
|
|
3362
3362
|
static VALUE robject_lt_self(VALUE self, VALUE other) {
|
3363
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3364
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3365
|
-
ndfunc_t ndf = {iter_robject_lt, STRIDE_LOOP, 2, 1, ain, aout};
|
3363
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3364
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3365
|
+
ndfunc_t ndf = { iter_robject_lt, STRIDE_LOOP, 2, 1, ain, aout };
|
3366
3366
|
|
3367
3367
|
return na_ndloop(&ndf, 2, self, other);
|
3368
3368
|
}
|
@@ -3399,9 +3399,9 @@ static void iter_robject_le(na_loop_t* const lp) {
|
|
3399
3399
|
}
|
3400
3400
|
|
3401
3401
|
static VALUE robject_le_self(VALUE self, VALUE other) {
|
3402
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
3403
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3404
|
-
ndfunc_t ndf = {iter_robject_le, STRIDE_LOOP, 2, 1, ain, aout};
|
3402
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
3403
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3404
|
+
ndfunc_t ndf = { iter_robject_le, STRIDE_LOOP, 2, 1, ain, aout };
|
3405
3405
|
|
3406
3406
|
return na_ndloop(&ndf, 2, self, other);
|
3407
3407
|
}
|
@@ -3512,11 +3512,11 @@ static void iter_robject_clip_max(na_loop_t* const lp) {
|
|
3512
3512
|
# [3, 4, 2, 3, 4, 5, 6, 7, 8, 8]
|
3513
3513
|
*/
|
3514
3514
|
static VALUE robject_clip(VALUE self, VALUE min, VALUE max) {
|
3515
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {cT, 0}, {cT, 0}};
|
3516
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3517
|
-
ndfunc_t ndf_min = {iter_robject_clip_min, STRIDE_LOOP, 2, 1, ain, aout};
|
3518
|
-
ndfunc_t ndf_max = {iter_robject_clip_max, STRIDE_LOOP, 2, 1, ain, aout};
|
3519
|
-
ndfunc_t ndf_both = {iter_robject_clip, STRIDE_LOOP, 3, 1, ain, aout};
|
3515
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { cT, 0 }, { cT, 0 } };
|
3516
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3517
|
+
ndfunc_t ndf_min = { iter_robject_clip_min, STRIDE_LOOP, 2, 1, ain, aout };
|
3518
|
+
ndfunc_t ndf_max = { iter_robject_clip_max, STRIDE_LOOP, 2, 1, ain, aout };
|
3519
|
+
ndfunc_t ndf_both = { iter_robject_clip, STRIDE_LOOP, 3, 1, ain, aout };
|
3520
3520
|
|
3521
3521
|
if (RTEST(min)) {
|
3522
3522
|
if (RTEST(max)) {
|
@@ -3568,9 +3568,9 @@ static void iter_robject_isnan(na_loop_t* const lp) {
|
|
3568
3568
|
@return [Numo::Bit] Condition of isnan.
|
3569
3569
|
*/
|
3570
3570
|
static VALUE robject_isnan(VALUE self) {
|
3571
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3572
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3573
|
-
ndfunc_t ndf = {iter_robject_isnan, FULL_LOOP, 1, 1, ain, aout};
|
3571
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3572
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3573
|
+
ndfunc_t ndf = { iter_robject_isnan, FULL_LOOP, 1, 1, ain, aout };
|
3574
3574
|
|
3575
3575
|
return na_ndloop(&ndf, 1, self);
|
3576
3576
|
}
|
@@ -3610,9 +3610,9 @@ static void iter_robject_isinf(na_loop_t* const lp) {
|
|
3610
3610
|
@return [Numo::Bit] Condition of isinf.
|
3611
3611
|
*/
|
3612
3612
|
static VALUE robject_isinf(VALUE self) {
|
3613
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3614
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3615
|
-
ndfunc_t ndf = {iter_robject_isinf, FULL_LOOP, 1, 1, ain, aout};
|
3613
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3614
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3615
|
+
ndfunc_t ndf = { iter_robject_isinf, FULL_LOOP, 1, 1, ain, aout };
|
3616
3616
|
|
3617
3617
|
return na_ndloop(&ndf, 1, self);
|
3618
3618
|
}
|
@@ -3652,9 +3652,9 @@ static void iter_robject_isposinf(na_loop_t* const lp) {
|
|
3652
3652
|
@return [Numo::Bit] Condition of isposinf.
|
3653
3653
|
*/
|
3654
3654
|
static VALUE robject_isposinf(VALUE self) {
|
3655
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3656
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3657
|
-
ndfunc_t ndf = {iter_robject_isposinf, FULL_LOOP, 1, 1, ain, aout};
|
3655
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3656
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3657
|
+
ndfunc_t ndf = { iter_robject_isposinf, FULL_LOOP, 1, 1, ain, aout };
|
3658
3658
|
|
3659
3659
|
return na_ndloop(&ndf, 1, self);
|
3660
3660
|
}
|
@@ -3694,9 +3694,9 @@ static void iter_robject_isneginf(na_loop_t* const lp) {
|
|
3694
3694
|
@return [Numo::Bit] Condition of isneginf.
|
3695
3695
|
*/
|
3696
3696
|
static VALUE robject_isneginf(VALUE self) {
|
3697
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3698
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3699
|
-
ndfunc_t ndf = {iter_robject_isneginf, FULL_LOOP, 1, 1, ain, aout};
|
3697
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3698
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3699
|
+
ndfunc_t ndf = { iter_robject_isneginf, FULL_LOOP, 1, 1, ain, aout };
|
3700
3700
|
|
3701
3701
|
return na_ndloop(&ndf, 1, self);
|
3702
3702
|
}
|
@@ -3736,9 +3736,9 @@ static void iter_robject_isfinite(na_loop_t* const lp) {
|
|
3736
3736
|
@return [Numo::Bit] Condition of isfinite.
|
3737
3737
|
*/
|
3738
3738
|
static VALUE robject_isfinite(VALUE self) {
|
3739
|
-
ndfunc_arg_in_t ain[1] = {{cT, 0}};
|
3740
|
-
ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
|
3741
|
-
ndfunc_t ndf = {iter_robject_isfinite, FULL_LOOP, 1, 1, ain, aout};
|
3739
|
+
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
3740
|
+
ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
|
3741
|
+
ndfunc_t ndf = { iter_robject_isfinite, FULL_LOOP, 1, 1, ain, aout };
|
3742
3742
|
|
3743
3743
|
return na_ndloop(&ndf, 1, self);
|
3744
3744
|
}
|
@@ -3769,16 +3769,18 @@ static void iter_robject_sum_nan(na_loop_t* const lp) {
|
|
3769
3769
|
/*
|
3770
3770
|
sum of self.
|
3771
3771
|
@overload sum(axis:nil, keepdims:false, nan:false)
|
3772
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3772
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3773
|
+
return NaN for min/max etc).
|
3773
3774
|
@param [Numeric,Array,Range] axis Performs sum along the axis.
|
3774
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3775
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3776
|
+
dimensions with size one.
|
3775
3777
|
@return [Numo::RObject] returns result of sum.
|
3776
3778
|
*/
|
3777
3779
|
static VALUE robject_sum(int argc, VALUE* argv, VALUE self) {
|
3778
3780
|
VALUE v, reduce;
|
3779
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3780
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3781
|
-
ndfunc_t ndf = {iter_robject_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3781
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3782
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3783
|
+
ndfunc_t ndf = { iter_robject_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3782
3784
|
|
3783
3785
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_sum_nan);
|
3784
3786
|
|
@@ -3813,16 +3815,18 @@ static void iter_robject_prod_nan(na_loop_t* const lp) {
|
|
3813
3815
|
/*
|
3814
3816
|
prod of self.
|
3815
3817
|
@overload prod(axis:nil, keepdims:false, nan:false)
|
3816
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3818
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3819
|
+
return NaN for min/max etc).
|
3817
3820
|
@param [Numeric,Array,Range] axis Performs prod along the axis.
|
3818
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3821
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3822
|
+
dimensions with size one.
|
3819
3823
|
@return [Numo::RObject] returns result of prod.
|
3820
3824
|
*/
|
3821
3825
|
static VALUE robject_prod(int argc, VALUE* argv, VALUE self) {
|
3822
3826
|
VALUE v, reduce;
|
3823
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3824
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3825
|
-
ndfunc_t ndf = {iter_robject_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3827
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3828
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3829
|
+
ndfunc_t ndf = { iter_robject_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3826
3830
|
|
3827
3831
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_prod_nan);
|
3828
3832
|
|
@@ -3857,16 +3861,18 @@ static void iter_robject_mean_nan(na_loop_t* const lp) {
|
|
3857
3861
|
/*
|
3858
3862
|
mean of self.
|
3859
3863
|
@overload mean(axis:nil, keepdims:false, nan:false)
|
3860
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3864
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3865
|
+
return NaN for min/max etc).
|
3861
3866
|
@param [Numeric,Array,Range] axis Performs mean along the axis.
|
3862
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3867
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3868
|
+
dimensions with size one.
|
3863
3869
|
@return [Numo::RObject] returns result of mean.
|
3864
3870
|
*/
|
3865
3871
|
static VALUE robject_mean(int argc, VALUE* argv, VALUE self) {
|
3866
3872
|
VALUE v, reduce;
|
3867
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3868
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
3869
|
-
ndfunc_t ndf = {iter_robject_mean, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3873
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3874
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
3875
|
+
ndfunc_t ndf = { iter_robject_mean, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3870
3876
|
|
3871
3877
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_mean_nan);
|
3872
3878
|
|
@@ -3901,16 +3907,18 @@ static void iter_robject_stddev_nan(na_loop_t* const lp) {
|
|
3901
3907
|
/*
|
3902
3908
|
stddev of self.
|
3903
3909
|
@overload stddev(axis:nil, keepdims:false, nan:false)
|
3904
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3910
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3911
|
+
return NaN for min/max etc).
|
3905
3912
|
@param [Numeric,Array,Range] axis Performs stddev along the axis.
|
3906
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3913
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3914
|
+
dimensions with size one.
|
3907
3915
|
@return [Numo::RObject] returns result of stddev.
|
3908
3916
|
*/
|
3909
3917
|
static VALUE robject_stddev(int argc, VALUE* argv, VALUE self) {
|
3910
3918
|
VALUE v, reduce;
|
3911
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3912
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
3913
|
-
ndfunc_t ndf = {iter_robject_stddev, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3919
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3920
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
3921
|
+
ndfunc_t ndf = { iter_robject_stddev, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3914
3922
|
|
3915
3923
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_stddev_nan);
|
3916
3924
|
|
@@ -3945,16 +3953,18 @@ static void iter_robject_var_nan(na_loop_t* const lp) {
|
|
3945
3953
|
/*
|
3946
3954
|
var of self.
|
3947
3955
|
@overload var(axis:nil, keepdims:false, nan:false)
|
3948
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3956
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3957
|
+
return NaN for min/max etc).
|
3949
3958
|
@param [Numeric,Array,Range] axis Performs var along the axis.
|
3950
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3959
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3960
|
+
dimensions with size one.
|
3951
3961
|
@return [Numo::RObject] returns result of var.
|
3952
3962
|
*/
|
3953
3963
|
static VALUE robject_var(int argc, VALUE* argv, VALUE self) {
|
3954
3964
|
VALUE v, reduce;
|
3955
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
3956
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
3957
|
-
ndfunc_t ndf = {iter_robject_var, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
3965
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
3966
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
3967
|
+
ndfunc_t ndf = { iter_robject_var, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
3958
3968
|
|
3959
3969
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_var_nan);
|
3960
3970
|
|
@@ -3989,16 +3999,18 @@ static void iter_robject_rms_nan(na_loop_t* const lp) {
|
|
3989
3999
|
/*
|
3990
4000
|
rms of self.
|
3991
4001
|
@overload rms(axis:nil, keepdims:false, nan:false)
|
3992
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4002
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4003
|
+
return NaN for min/max etc).
|
3993
4004
|
@param [Numeric,Array,Range] axis Performs rms along the axis.
|
3994
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4005
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4006
|
+
dimensions with size one.
|
3995
4007
|
@return [Numo::RObject] returns result of rms.
|
3996
4008
|
*/
|
3997
4009
|
static VALUE robject_rms(int argc, VALUE* argv, VALUE self) {
|
3998
4010
|
VALUE v, reduce;
|
3999
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4000
|
-
ndfunc_arg_out_t aout[1] = {{cRT, 0}};
|
4001
|
-
ndfunc_t ndf = {iter_robject_rms, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4011
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4012
|
+
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4013
|
+
ndfunc_t ndf = { iter_robject_rms, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4002
4014
|
|
4003
4015
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_rms_nan);
|
4004
4016
|
|
@@ -4033,16 +4045,18 @@ static void iter_robject_min_nan(na_loop_t* const lp) {
|
|
4033
4045
|
/*
|
4034
4046
|
min of self.
|
4035
4047
|
@overload min(axis:nil, keepdims:false, nan:false)
|
4036
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4048
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4049
|
+
return NaN for min/max etc).
|
4037
4050
|
@param [Numeric,Array,Range] axis Performs min along the axis.
|
4038
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4051
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4052
|
+
dimensions with size one.
|
4039
4053
|
@return [Numo::RObject] returns result of min.
|
4040
4054
|
*/
|
4041
4055
|
static VALUE robject_min(int argc, VALUE* argv, VALUE self) {
|
4042
4056
|
VALUE v, reduce;
|
4043
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4044
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4045
|
-
ndfunc_t ndf = {iter_robject_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4057
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4058
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4059
|
+
ndfunc_t ndf = { iter_robject_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4046
4060
|
|
4047
4061
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_min_nan);
|
4048
4062
|
|
@@ -4077,16 +4091,18 @@ static void iter_robject_max_nan(na_loop_t* const lp) {
|
|
4077
4091
|
/*
|
4078
4092
|
max of self.
|
4079
4093
|
@overload max(axis:nil, keepdims:false, nan:false)
|
4080
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4094
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4095
|
+
return NaN for min/max etc).
|
4081
4096
|
@param [Numeric,Array,Range] axis Performs max along the axis.
|
4082
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4097
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4098
|
+
dimensions with size one.
|
4083
4099
|
@return [Numo::RObject] returns result of max.
|
4084
4100
|
*/
|
4085
4101
|
static VALUE robject_max(int argc, VALUE* argv, VALUE self) {
|
4086
4102
|
VALUE v, reduce;
|
4087
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4088
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4089
|
-
ndfunc_t ndf = {iter_robject_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4103
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4104
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4105
|
+
ndfunc_t ndf = { iter_robject_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4090
4106
|
|
4091
4107
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_max_nan);
|
4092
4108
|
|
@@ -4121,16 +4137,18 @@ static void iter_robject_ptp_nan(na_loop_t* const lp) {
|
|
4121
4137
|
/*
|
4122
4138
|
ptp of self.
|
4123
4139
|
@overload ptp(axis:nil, keepdims:false, nan:false)
|
4124
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4140
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4141
|
+
return NaN for min/max etc).
|
4125
4142
|
@param [Numeric,Array,Range] axis Performs ptp along the axis.
|
4126
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4143
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4144
|
+
dimensions with size one.
|
4127
4145
|
@return [Numo::RObject] returns result of ptp.
|
4128
4146
|
*/
|
4129
4147
|
static VALUE robject_ptp(int argc, VALUE* argv, VALUE self) {
|
4130
4148
|
VALUE v, reduce;
|
4131
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4132
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4133
|
-
ndfunc_t ndf = {iter_robject_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
|
4149
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4150
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4151
|
+
ndfunc_t ndf = { iter_robject_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4134
4152
|
|
4135
4153
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_ptp_nan);
|
4136
4154
|
|
@@ -4211,7 +4229,8 @@ static void iter_robject_max_index_index32_nan(na_loop_t* const lp) {
|
|
4211
4229
|
Index of the maximum value.
|
4212
4230
|
@overload max_index(axis:nil, nan:false)
|
4213
4231
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
4214
|
-
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d
|
4232
|
+
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d
|
4233
|
+
indices**.
|
4215
4234
|
@return [Integer,Numo::Int] returns result indices.
|
4216
4235
|
@see #argmax
|
4217
4236
|
@see #max
|
@@ -4229,9 +4248,9 @@ static void iter_robject_max_index_index32_nan(na_loop_t* const lp) {
|
|
4229
4248
|
static VALUE robject_max_index(int argc, VALUE* argv, VALUE self) {
|
4230
4249
|
narray_t* na;
|
4231
4250
|
VALUE idx, reduce;
|
4232
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
|
4233
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4234
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
|
4251
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
|
4252
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4253
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
|
4235
4254
|
|
4236
4255
|
GetNArray(self, na);
|
4237
4256
|
if (na->ndim == 0) {
|
@@ -4242,14 +4261,16 @@ static VALUE robject_max_index(int argc, VALUE* argv, VALUE self) {
|
|
4242
4261
|
idx = nary_new(numo_cInt64, na->ndim, na->shape);
|
4243
4262
|
ndf.func = iter_robject_max_index_index64;
|
4244
4263
|
|
4245
|
-
reduce =
|
4264
|
+
reduce =
|
4265
|
+
na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_max_index_index64_nan);
|
4246
4266
|
|
4247
4267
|
} else {
|
4248
4268
|
aout[0].type = numo_cInt32;
|
4249
4269
|
idx = nary_new(numo_cInt32, na->ndim, na->shape);
|
4250
4270
|
ndf.func = iter_robject_max_index_index32;
|
4251
4271
|
|
4252
|
-
reduce =
|
4272
|
+
reduce =
|
4273
|
+
na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_max_index_index32_nan);
|
4253
4274
|
}
|
4254
4275
|
rb_funcall(idx, rb_intern("seq"), 0);
|
4255
4276
|
|
@@ -4328,7 +4349,8 @@ static void iter_robject_min_index_index32_nan(na_loop_t* const lp) {
|
|
4328
4349
|
Index of the minimum value.
|
4329
4350
|
@overload min_index(axis:nil, nan:false)
|
4330
4351
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
4331
|
-
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d
|
4352
|
+
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d
|
4353
|
+
indices**.
|
4332
4354
|
@return [Integer,Numo::Int] returns result indices.
|
4333
4355
|
@see #argmin
|
4334
4356
|
@see #min
|
@@ -4346,9 +4368,9 @@ static void iter_robject_min_index_index32_nan(na_loop_t* const lp) {
|
|
4346
4368
|
static VALUE robject_min_index(int argc, VALUE* argv, VALUE self) {
|
4347
4369
|
narray_t* na;
|
4348
4370
|
VALUE idx, reduce;
|
4349
|
-
ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
|
4350
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4351
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
|
4371
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
|
4372
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4373
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
|
4352
4374
|
|
4353
4375
|
GetNArray(self, na);
|
4354
4376
|
if (na->ndim == 0) {
|
@@ -4359,14 +4381,16 @@ static VALUE robject_min_index(int argc, VALUE* argv, VALUE self) {
|
|
4359
4381
|
idx = nary_new(numo_cInt64, na->ndim, na->shape);
|
4360
4382
|
ndf.func = iter_robject_min_index_index64;
|
4361
4383
|
|
4362
|
-
reduce =
|
4384
|
+
reduce =
|
4385
|
+
na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_min_index_index64_nan);
|
4363
4386
|
|
4364
4387
|
} else {
|
4365
4388
|
aout[0].type = numo_cInt32;
|
4366
4389
|
idx = nary_new(numo_cInt32, na->ndim, na->shape);
|
4367
4390
|
ndf.func = iter_robject_min_index_index32;
|
4368
4391
|
|
4369
|
-
reduce =
|
4392
|
+
reduce =
|
4393
|
+
na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_min_index_index32_nan);
|
4370
4394
|
}
|
4371
4395
|
rb_funcall(idx, rb_intern("seq"), 0);
|
4372
4396
|
|
@@ -4441,7 +4465,8 @@ static void iter_robject_argmax_arg32_nan(na_loop_t* const lp) {
|
|
4441
4465
|
Index of the maximum value.
|
4442
4466
|
@overload argmax(axis:nil, nan:false)
|
4443
4467
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
4444
|
-
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
|
4468
|
+
@param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
|
4469
|
+
along the axis**.
|
4445
4470
|
@return [Integer,Numo::Int] returns the result indices.
|
4446
4471
|
@see #max_index
|
4447
4472
|
@see #max
|
@@ -4459,9 +4484,9 @@ static void iter_robject_argmax_arg32_nan(na_loop_t* const lp) {
|
|
4459
4484
|
static VALUE robject_argmax(int argc, VALUE* argv, VALUE self) {
|
4460
4485
|
narray_t* na;
|
4461
4486
|
VALUE reduce;
|
4462
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
|
4463
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4464
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
|
4487
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
|
4488
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4489
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
|
4465
4490
|
|
4466
4491
|
GetNArray(self, na);
|
4467
4492
|
if (na->ndim == 0) {
|
@@ -4551,7 +4576,8 @@ static void iter_robject_argmin_arg32_nan(na_loop_t* const lp) {
|
|
4551
4576
|
Index of the minimum value.
|
4552
4577
|
@overload argmin(axis:nil, nan:false)
|
4553
4578
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN posision if exist).
|
4554
|
-
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
|
4579
|
+
@param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
|
4580
|
+
along the axis**.
|
4555
4581
|
@return [Integer,Numo::Int] returns the result indices.
|
4556
4582
|
@see #min_index
|
4557
4583
|
@see #min
|
@@ -4569,9 +4595,9 @@ static void iter_robject_argmin_arg32_nan(na_loop_t* const lp) {
|
|
4569
4595
|
static VALUE robject_argmin(int argc, VALUE* argv, VALUE self) {
|
4570
4596
|
narray_t* na;
|
4571
4597
|
VALUE reduce;
|
4572
|
-
ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
|
4573
|
-
ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
|
4574
|
-
ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
|
4598
|
+
ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
|
4599
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
|
4600
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
|
4575
4601
|
|
4576
4602
|
GetNArray(self, na);
|
4577
4603
|
if (na->ndim == 0) {
|
@@ -4627,14 +4653,17 @@ static void iter_robject_minmax_nan(na_loop_t* const lp) {
|
|
4627
4653
|
@overload minmax(axis:nil, keepdims:false, nan:false)
|
4628
4654
|
@param [TrueClass] nan If true, apply NaN-aware algorithm (return NaN if exist).
|
4629
4655
|
@param [Numeric,Array,Range] axis Finds min-max along the axis.
|
4630
|
-
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
4656
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
4657
|
+
as dimensions with size one.
|
4631
4658
|
@return [Numo::RObject,Numo::RObject] min and max of self.
|
4632
4659
|
*/
|
4633
4660
|
static VALUE robject_minmax(int argc, VALUE* argv, VALUE self) {
|
4634
4661
|
VALUE reduce;
|
4635
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4636
|
-
ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
|
4637
|
-
ndfunc_t ndf = {
|
4662
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4663
|
+
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
|
4664
|
+
ndfunc_t ndf = {
|
4665
|
+
iter_robject_minmax, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 2, ain, aout
|
4666
|
+
};
|
4638
4667
|
|
4639
4668
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_minmax_nan);
|
4640
4669
|
|
@@ -4693,13 +4722,13 @@ static void iter_robject_s_maximum_nan(na_loop_t* const lp) {
|
|
4693
4722
|
static VALUE robject_s_maximum(int argc, VALUE* argv, VALUE mod) {
|
4694
4723
|
VALUE a1 = Qnil;
|
4695
4724
|
VALUE a2 = Qnil;
|
4696
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
4697
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4698
|
-
ndfunc_t ndf = {iter_robject_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
|
4725
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
4726
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4727
|
+
ndfunc_t ndf = { iter_robject_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
|
4699
4728
|
|
4700
4729
|
VALUE kw_hash = Qnil;
|
4701
|
-
ID kw_table[1] = {id_nan};
|
4702
|
-
VALUE opts[1] = {Qundef};
|
4730
|
+
ID kw_table[1] = { id_nan };
|
4731
|
+
VALUE opts[1] = { Qundef };
|
4703
4732
|
|
4704
4733
|
rb_scan_args(argc, argv, "20:", &a1, &a2, &kw_hash);
|
4705
4734
|
rb_get_kwargs(kw_hash, kw_table, 0, 1, opts);
|
@@ -4762,13 +4791,13 @@ static void iter_robject_s_minimum_nan(na_loop_t* const lp) {
|
|
4762
4791
|
static VALUE robject_s_minimum(int argc, VALUE* argv, VALUE mod) {
|
4763
4792
|
VALUE a1 = Qnil;
|
4764
4793
|
VALUE a2 = Qnil;
|
4765
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
|
4766
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4767
|
-
ndfunc_t ndf = {iter_robject_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
|
4794
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
4795
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4796
|
+
ndfunc_t ndf = { iter_robject_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
|
4768
4797
|
|
4769
4798
|
VALUE kw_hash = Qnil;
|
4770
|
-
ID kw_table[1] = {id_nan};
|
4771
|
-
VALUE opts[1] = {Qundef};
|
4799
|
+
ID kw_table[1] = { id_nan };
|
4800
|
+
VALUE opts[1] = { Qundef };
|
4772
4801
|
|
4773
4802
|
rb_scan_args(argc, argv, "20:", &a1, &a2, &kw_hash);
|
4774
4803
|
rb_get_kwargs(kw_hash, kw_table, 0, 1, opts);
|
@@ -4788,16 +4817,13 @@ static void iter_robject_cumsum(na_loop_t* const lp) {
|
|
4788
4817
|
INIT_COUNTER(lp, i);
|
4789
4818
|
INIT_PTR(lp, 0, p1, s1);
|
4790
4819
|
INIT_PTR(lp, 1, p2, s2);
|
4791
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
4792
4820
|
|
4793
4821
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
4794
4822
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4795
|
-
// printf("i=%lu x=%f\n",i,x);
|
4796
4823
|
for (i--; i--;) {
|
4797
4824
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
4798
4825
|
m_cumsum(x, y);
|
4799
4826
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4800
|
-
// printf("i=%lu x=%f\n",i,x);
|
4801
4827
|
}
|
4802
4828
|
}
|
4803
4829
|
static void iter_robject_cumsum_nan(na_loop_t* const lp) {
|
@@ -4809,16 +4835,13 @@ static void iter_robject_cumsum_nan(na_loop_t* const lp) {
|
|
4809
4835
|
INIT_COUNTER(lp, i);
|
4810
4836
|
INIT_PTR(lp, 0, p1, s1);
|
4811
4837
|
INIT_PTR(lp, 1, p2, s2);
|
4812
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
4813
4838
|
|
4814
4839
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
4815
4840
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4816
|
-
// printf("i=%lu x=%f\n",i,x);
|
4817
4841
|
for (i--; i--;) {
|
4818
4842
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
4819
4843
|
m_cumsum_nan(x, y);
|
4820
4844
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4821
|
-
// printf("i=%lu x=%f\n",i,x);
|
4822
4845
|
}
|
4823
4846
|
}
|
4824
4847
|
|
@@ -4831,9 +4854,11 @@ static void iter_robject_cumsum_nan(na_loop_t* const lp) {
|
|
4831
4854
|
*/
|
4832
4855
|
static VALUE robject_cumsum(int argc, VALUE* argv, VALUE self) {
|
4833
4856
|
VALUE reduce;
|
4834
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4835
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4836
|
-
ndfunc_t ndf = {
|
4857
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4858
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4859
|
+
ndfunc_t ndf = {
|
4860
|
+
iter_robject_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
|
4861
|
+
};
|
4837
4862
|
|
4838
4863
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_cumsum_nan);
|
4839
4864
|
|
@@ -4849,16 +4874,13 @@ static void iter_robject_cumprod(na_loop_t* const lp) {
|
|
4849
4874
|
INIT_COUNTER(lp, i);
|
4850
4875
|
INIT_PTR(lp, 0, p1, s1);
|
4851
4876
|
INIT_PTR(lp, 1, p2, s2);
|
4852
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
4853
4877
|
|
4854
4878
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
4855
4879
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4856
|
-
// printf("i=%lu x=%f\n",i,x);
|
4857
4880
|
for (i--; i--;) {
|
4858
4881
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
4859
4882
|
m_cumprod(x, y);
|
4860
4883
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4861
|
-
// printf("i=%lu x=%f\n",i,x);
|
4862
4884
|
}
|
4863
4885
|
}
|
4864
4886
|
static void iter_robject_cumprod_nan(na_loop_t* const lp) {
|
@@ -4870,16 +4892,13 @@ static void iter_robject_cumprod_nan(na_loop_t* const lp) {
|
|
4870
4892
|
INIT_COUNTER(lp, i);
|
4871
4893
|
INIT_PTR(lp, 0, p1, s1);
|
4872
4894
|
INIT_PTR(lp, 1, p2, s2);
|
4873
|
-
// printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
|
4874
4895
|
|
4875
4896
|
GET_DATA_STRIDE(p1, s1, dtype, x);
|
4876
4897
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4877
|
-
// printf("i=%lu x=%f\n",i,x);
|
4878
4898
|
for (i--; i--;) {
|
4879
4899
|
GET_DATA_STRIDE(p1, s1, dtype, y);
|
4880
4900
|
m_cumprod_nan(x, y);
|
4881
4901
|
SET_DATA_STRIDE(p2, s2, dtype, x);
|
4882
|
-
// printf("i=%lu x=%f\n",i,x);
|
4883
4902
|
}
|
4884
4903
|
}
|
4885
4904
|
|
@@ -4892,9 +4911,11 @@ static void iter_robject_cumprod_nan(na_loop_t* const lp) {
|
|
4892
4911
|
*/
|
4893
4912
|
static VALUE robject_cumprod(int argc, VALUE* argv, VALUE self) {
|
4894
4913
|
VALUE reduce;
|
4895
|
-
ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
|
4896
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4897
|
-
ndfunc_t ndf = {
|
4914
|
+
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4915
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4916
|
+
ndfunc_t ndf = {
|
4917
|
+
iter_robject_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
|
4918
|
+
};
|
4898
4919
|
|
4899
4920
|
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_robject_cumprod_nan);
|
4900
4921
|
|
@@ -4974,9 +4995,9 @@ static void iter_robject_mulsum_nan(na_loop_t* const lp) {
|
|
4974
4995
|
static VALUE robject_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
4975
4996
|
VALUE v, reduce;
|
4976
4997
|
VALUE naryv[2];
|
4977
|
-
ndfunc_arg_in_t ain[4] = {{cT, 0}, {cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
|
4978
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
4979
|
-
ndfunc_t ndf = {iter_robject_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout};
|
4998
|
+
ndfunc_arg_in_t ain[4] = { { cT, 0 }, { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
|
4999
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5000
|
+
ndfunc_t ndf = { iter_robject_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout };
|
4980
5001
|
|
4981
5002
|
if (argc < 1) {
|
4982
5003
|
rb_raise(rb_eArgError, "wrong number of arguments (%d for >=1)", argc);
|
@@ -4998,7 +5019,8 @@ static VALUE robject_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
|
4998
5019
|
@overload mulsum(other, axis:nil, keepdims:false, nan:false)
|
4999
5020
|
@param [Numo::NArray,Numeric] other
|
5000
5021
|
@param [Numeric,Array,Range] axis Performs mulsum along the axis.
|
5001
|
-
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5022
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
5023
|
+
as dimensions with size one.
|
5002
5024
|
@param [TrueClass] nan (keyword) If true, apply NaN-aware algorithm (avoid NaN if exists).
|
5003
5025
|
@return [Numo::NArray] mulsum of self and other.
|
5004
5026
|
*/
|
@@ -5074,8 +5096,8 @@ static void iter_robject_seq(na_loop_t* const lp) {
|
|
5074
5096
|
static VALUE robject_seq(int argc, VALUE* args, VALUE self) {
|
5075
5097
|
seq_opt_t* g;
|
5076
5098
|
VALUE vbeg = Qnil, vstep = Qnil;
|
5077
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
5078
|
-
ndfunc_t ndf = {iter_robject_seq, FULL_LOOP, 1, 0, ain, 0};
|
5099
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
5100
|
+
ndfunc_t ndf = { iter_robject_seq, FULL_LOOP, 1, 0, ain, 0 };
|
5079
5101
|
|
5080
5102
|
g = ALLOCA_N(seq_opt_t, 1);
|
5081
5103
|
g->beg = m_zero;
|
@@ -5157,8 +5179,8 @@ static void iter_robject_logseq(na_loop_t* const lp) {
|
|
5157
5179
|
static VALUE robject_logseq(int argc, VALUE* args, VALUE self) {
|
5158
5180
|
logseq_opt_t* g;
|
5159
5181
|
VALUE vbeg, vstep, vbase;
|
5160
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
5161
|
-
ndfunc_t ndf = {iter_robject_logseq, FULL_LOOP, 1, 0, ain, 0};
|
5182
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
5183
|
+
ndfunc_t ndf = { iter_robject_logseq, FULL_LOOP, 1, 0, ain, 0 };
|
5162
5184
|
|
5163
5185
|
g = ALLOCA_N(logseq_opt_t, 1);
|
5164
5186
|
rb_scan_args(argc, args, "21", &vbeg, &vstep, &vbase);
|
@@ -5212,8 +5234,8 @@ static void iter_robject_eye(na_loop_t* const lp) {
|
|
5212
5234
|
@return [Numo::RObject] eye of self.
|
5213
5235
|
*/
|
5214
5236
|
static VALUE robject_eye(int argc, VALUE* argv, VALUE self) {
|
5215
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 2}};
|
5216
|
-
ndfunc_t ndf = {iter_robject_eye, NO_LOOP, 1, 0, ain, 0};
|
5237
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 2 } };
|
5238
|
+
ndfunc_t ndf = { iter_robject_eye, NO_LOOP, 1, 0, ain, 0 };
|
5217
5239
|
ssize_t kofs;
|
5218
5240
|
dtype data;
|
5219
5241
|
char* g;
|
@@ -5243,17 +5265,21 @@ static VALUE robject_eye(int argc, VALUE* argv, VALUE self) {
|
|
5243
5265
|
// Diagonal offset from the main diagonal.
|
5244
5266
|
if (kofs >= 0) {
|
5245
5267
|
if ((size_t)(kofs) >= na->shape[nd - 1]) {
|
5246
|
-
rb_raise(
|
5247
|
-
|
5248
|
-
|
5249
|
-
|
5268
|
+
rb_raise(
|
5269
|
+
rb_eArgError,
|
5270
|
+
"invalid diagonal offset(%" SZF "d) for "
|
5271
|
+
"last dimension size(%" SZF "d)",
|
5272
|
+
kofs, na->shape[nd - 1]
|
5273
|
+
);
|
5250
5274
|
}
|
5251
5275
|
} else {
|
5252
5276
|
if ((size_t)(-kofs) >= na->shape[nd - 2]) {
|
5253
|
-
rb_raise(
|
5254
|
-
|
5255
|
-
|
5256
|
-
|
5277
|
+
rb_raise(
|
5278
|
+
rb_eArgError,
|
5279
|
+
"invalid diagonal offset(%" SZF "d) for "
|
5280
|
+
"last-1 dimension size(%" SZF "d)",
|
5281
|
+
kofs, na->shape[nd - 2]
|
5282
|
+
);
|
5257
5283
|
}
|
5258
5284
|
}
|
5259
5285
|
|
@@ -5303,7 +5329,8 @@ static void iter_robject_rand(na_loop_t* const lp) {
|
|
5303
5329
|
Generate uniformly distributed random numbers on self narray.
|
5304
5330
|
@overload rand([[low],high])
|
5305
5331
|
@param [Numeric] low lower inclusive boundary of random numbers. (default=0)
|
5306
|
-
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
5332
|
+
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
5333
|
+
complex types)
|
5307
5334
|
@return [Numo::RObject] self.
|
5308
5335
|
@example
|
5309
5336
|
Numo::DFloat.new(6).rand
|
@@ -5322,8 +5349,8 @@ static VALUE robject_rand(int argc, VALUE* args, VALUE self) {
|
|
5322
5349
|
rand_opt_t g;
|
5323
5350
|
VALUE v1 = Qnil, v2 = Qnil;
|
5324
5351
|
dtype high;
|
5325
|
-
ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
|
5326
|
-
ndfunc_t ndf = {iter_robject_rand, FULL_LOOP, 1, 0, ain, 0};
|
5352
|
+
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
5353
|
+
ndfunc_t ndf = { iter_robject_rand, FULL_LOOP, 1, 0, ain, 0 };
|
5327
5354
|
|
5328
5355
|
rb_scan_args(argc, args, "02", &v1, &v2);
|
5329
5356
|
if (v2 == Qnil) {
|
@@ -5373,8 +5400,8 @@ static VALUE robject_poly(VALUE self, VALUE args) {
|
|
5373
5400
|
int argc, i;
|
5374
5401
|
VALUE* argv;
|
5375
5402
|
volatile VALUE v, a;
|
5376
|
-
ndfunc_arg_out_t aout[1] = {{cT, 0}};
|
5377
|
-
ndfunc_t ndf = {iter_robject_poly, NO_LOOP, 0, 1, 0, aout};
|
5403
|
+
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
5404
|
+
ndfunc_t ndf = { iter_robject_poly, NO_LOOP, 0, 1, 0, aout };
|
5378
5405
|
|
5379
5406
|
argc = (int)RARRAY_LEN(args);
|
5380
5407
|
ndf.nin = argc + 1;
|