numo-narray-alt 0.9.4 → 0.9.6

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/README.md +22 -3
  4. data/Rakefile +8 -0
  5. data/ext/numo/narray/SFMT-params19937.h +16 -12
  6. data/ext/numo/narray/SFMT.c +12 -5
  7. data/ext/numo/narray/array.c +51 -21
  8. data/ext/numo/narray/data.c +88 -86
  9. data/ext/numo/narray/index.c +51 -28
  10. data/ext/numo/narray/kwargs.c +11 -9
  11. data/ext/numo/narray/math.c +14 -6
  12. data/ext/numo/narray/narray.c +93 -58
  13. data/ext/numo/narray/ndloop.c +52 -63
  14. data/ext/numo/narray/numo/intern.h +9 -3
  15. data/ext/numo/narray/numo/narray.h +20 -20
  16. data/ext/numo/narray/numo/ndloop.h +1 -1
  17. data/ext/numo/narray/numo/template.h +85 -81
  18. data/ext/numo/narray/numo/types/bit.h +76 -0
  19. data/ext/numo/narray/numo/types/complex.h +7 -3
  20. data/ext/numo/narray/numo/types/complex_macro.h +28 -25
  21. data/ext/numo/narray/numo/types/float_macro.h +21 -17
  22. data/ext/numo/narray/numo/types/real_accum.h +22 -22
  23. data/ext/numo/narray/numo/types/robj_macro.h +20 -12
  24. data/ext/numo/narray/numo/types/xint_macro.h +51 -8
  25. data/ext/numo/narray/rand.c +7 -0
  26. data/ext/numo/narray/src/mh/mean.h +102 -0
  27. data/ext/numo/narray/src/mh/rms.h +102 -0
  28. data/ext/numo/narray/src/mh/stddev.h +103 -0
  29. data/ext/numo/narray/src/mh/var.h +102 -0
  30. data/ext/numo/narray/src/t_bit.c +206 -147
  31. data/ext/numo/narray/src/t_dcomplex.c +531 -641
  32. data/ext/numo/narray/src/t_dfloat.c +1341 -1421
  33. data/ext/numo/narray/src/t_int16.c +562 -468
  34. data/ext/numo/narray/src/t_int32.c +562 -468
  35. data/ext/numo/narray/src/t_int64.c +561 -467
  36. data/ext/numo/narray/src/t_int8.c +520 -448
  37. data/ext/numo/narray/src/t_robject.c +519 -619
  38. data/ext/numo/narray/src/t_scomplex.c +524 -659
  39. data/ext/numo/narray/src/t_sfloat.c +1332 -1410
  40. data/ext/numo/narray/src/t_uint16.c +562 -468
  41. data/ext/numo/narray/src/t_uint32.c +562 -468
  42. data/ext/numo/narray/src/t_uint64.c +562 -468
  43. data/ext/numo/narray/src/t_uint8.c +522 -448
  44. data/ext/numo/narray/step.c +7 -2
  45. data/ext/numo/narray/struct.c +31 -24
  46. data/lib/numo/narray/extra.rb +74 -30
  47. data/numo-narray-alt.gemspec +38 -0
  48. metadata +10 -1
@@ -37,14 +37,23 @@ static ID id_to_a;
37
37
 
38
38
  #include <numo/types/int32.h>
39
39
 
40
- VALUE cT;
41
- extern VALUE cRT;
42
-
43
40
  /*
44
41
  class definition: Numo::Int32
45
42
  */
46
-
47
43
  VALUE cT;
44
+ extern VALUE cRT;
45
+
46
+ #include "mh/mean.h"
47
+ #include "mh/var.h"
48
+ #include "mh/stddev.h"
49
+ #include "mh/rms.h"
50
+
51
+ typedef int32_t int32; // Type aliases for shorter notation
52
+ // following the codebase naming convention.
53
+ DEF_NARRAY_INT_MEAN_METHOD_FUNC(int32, numo_cInt32)
54
+ DEF_NARRAY_INT_VAR_METHOD_FUNC(int32, numo_cInt32)
55
+ DEF_NARRAY_INT_STDDEV_METHOD_FUNC(int32, numo_cInt32)
56
+ DEF_NARRAY_INT_RMS_METHOD_FUNC(int32, numo_cInt32)
48
57
 
49
58
  static VALUE int32_store(VALUE, VALUE);
50
59
 
@@ -152,9 +161,9 @@ static VALUE int32_allocate(VALUE self) {
152
161
  /*
153
162
  Extract an element only if self is a dimensionless NArray.
154
163
  @overload extract
155
- @return [Numeric,Numo::NArray]
156
- --- Extract element value as Ruby Object if self is a dimensionless NArray,
157
- otherwise returns self.
164
+ @return [Numeric,Numo::NArray]
165
+ --- Extract element value as Ruby Object if self is a dimensionless NArray,
166
+ otherwise returns self.
158
167
  */
159
168
  static VALUE int32_extract(VALUE self) {
160
169
  volatile VALUE v;
@@ -238,8 +247,8 @@ static void iter_int32_store_bit(na_loop_t* const lp) {
238
247
  }
239
248
 
240
249
  static VALUE int32_store_bit(VALUE self, VALUE obj) {
241
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
242
- ndfunc_t ndf = {iter_int32_store_bit, FULL_LOOP, 2, 0, ain, 0};
250
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
251
+ ndfunc_t ndf = { iter_int32_store_bit, FULL_LOOP, 2, 0, ain, 0 };
243
252
 
244
253
  na_ndloop(&ndf, 2, self, obj);
245
254
  return self;
@@ -287,8 +296,8 @@ static void iter_int32_store_dfloat(na_loop_t* const lp) {
287
296
  }
288
297
 
289
298
  static VALUE int32_store_dfloat(VALUE self, VALUE obj) {
290
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
291
- ndfunc_t ndf = {iter_int32_store_dfloat, FULL_LOOP, 2, 0, ain, 0};
299
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
300
+ ndfunc_t ndf = { iter_int32_store_dfloat, FULL_LOOP, 2, 0, ain, 0 };
292
301
 
293
302
  na_ndloop(&ndf, 2, self, obj);
294
303
  return self;
@@ -336,8 +345,8 @@ static void iter_int32_store_sfloat(na_loop_t* const lp) {
336
345
  }
337
346
 
338
347
  static VALUE int32_store_sfloat(VALUE self, VALUE obj) {
339
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
340
- ndfunc_t ndf = {iter_int32_store_sfloat, FULL_LOOP, 2, 0, ain, 0};
348
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
349
+ ndfunc_t ndf = { iter_int32_store_sfloat, FULL_LOOP, 2, 0, ain, 0 };
341
350
 
342
351
  na_ndloop(&ndf, 2, self, obj);
343
352
  return self;
@@ -385,8 +394,8 @@ static void iter_int32_store_int64(na_loop_t* const lp) {
385
394
  }
386
395
 
387
396
  static VALUE int32_store_int64(VALUE self, VALUE obj) {
388
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
389
- ndfunc_t ndf = {iter_int32_store_int64, FULL_LOOP, 2, 0, ain, 0};
397
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
398
+ ndfunc_t ndf = { iter_int32_store_int64, FULL_LOOP, 2, 0, ain, 0 };
390
399
 
391
400
  na_ndloop(&ndf, 2, self, obj);
392
401
  return self;
@@ -434,8 +443,8 @@ static void iter_int32_store_int32(na_loop_t* const lp) {
434
443
  }
435
444
 
436
445
  static VALUE int32_store_int32(VALUE self, VALUE obj) {
437
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
438
- ndfunc_t ndf = {iter_int32_store_int32, FULL_LOOP, 2, 0, ain, 0};
446
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
447
+ ndfunc_t ndf = { iter_int32_store_int32, FULL_LOOP, 2, 0, ain, 0 };
439
448
 
440
449
  na_ndloop(&ndf, 2, self, obj);
441
450
  return self;
@@ -483,8 +492,8 @@ static void iter_int32_store_int16(na_loop_t* const lp) {
483
492
  }
484
493
 
485
494
  static VALUE int32_store_int16(VALUE self, VALUE obj) {
486
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
487
- ndfunc_t ndf = {iter_int32_store_int16, FULL_LOOP, 2, 0, ain, 0};
495
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
496
+ ndfunc_t ndf = { iter_int32_store_int16, FULL_LOOP, 2, 0, ain, 0 };
488
497
 
489
498
  na_ndloop(&ndf, 2, self, obj);
490
499
  return self;
@@ -532,8 +541,8 @@ static void iter_int32_store_int8(na_loop_t* const lp) {
532
541
  }
533
542
 
534
543
  static VALUE int32_store_int8(VALUE self, VALUE obj) {
535
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
536
- ndfunc_t ndf = {iter_int32_store_int8, FULL_LOOP, 2, 0, ain, 0};
544
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
545
+ ndfunc_t ndf = { iter_int32_store_int8, FULL_LOOP, 2, 0, ain, 0 };
537
546
 
538
547
  na_ndloop(&ndf, 2, self, obj);
539
548
  return self;
@@ -581,8 +590,8 @@ static void iter_int32_store_uint64(na_loop_t* const lp) {
581
590
  }
582
591
 
583
592
  static VALUE int32_store_uint64(VALUE self, VALUE obj) {
584
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
585
- ndfunc_t ndf = {iter_int32_store_uint64, FULL_LOOP, 2, 0, ain, 0};
593
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
594
+ ndfunc_t ndf = { iter_int32_store_uint64, FULL_LOOP, 2, 0, ain, 0 };
586
595
 
587
596
  na_ndloop(&ndf, 2, self, obj);
588
597
  return self;
@@ -630,8 +639,8 @@ static void iter_int32_store_uint32(na_loop_t* const lp) {
630
639
  }
631
640
 
632
641
  static VALUE int32_store_uint32(VALUE self, VALUE obj) {
633
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
634
- ndfunc_t ndf = {iter_int32_store_uint32, FULL_LOOP, 2, 0, ain, 0};
642
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
643
+ ndfunc_t ndf = { iter_int32_store_uint32, FULL_LOOP, 2, 0, ain, 0 };
635
644
 
636
645
  na_ndloop(&ndf, 2, self, obj);
637
646
  return self;
@@ -679,8 +688,8 @@ static void iter_int32_store_uint16(na_loop_t* const lp) {
679
688
  }
680
689
 
681
690
  static VALUE int32_store_uint16(VALUE self, VALUE obj) {
682
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
683
- ndfunc_t ndf = {iter_int32_store_uint16, FULL_LOOP, 2, 0, ain, 0};
691
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
692
+ ndfunc_t ndf = { iter_int32_store_uint16, FULL_LOOP, 2, 0, ain, 0 };
684
693
 
685
694
  na_ndloop(&ndf, 2, self, obj);
686
695
  return self;
@@ -728,8 +737,8 @@ static void iter_int32_store_uint8(na_loop_t* const lp) {
728
737
  }
729
738
 
730
739
  static VALUE int32_store_uint8(VALUE self, VALUE obj) {
731
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
732
- ndfunc_t ndf = {iter_int32_store_uint8, FULL_LOOP, 2, 0, ain, 0};
740
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
741
+ ndfunc_t ndf = { iter_int32_store_uint8, FULL_LOOP, 2, 0, ain, 0 };
733
742
 
734
743
  na_ndloop(&ndf, 2, self, obj);
735
744
  return self;
@@ -777,8 +786,8 @@ static void iter_int32_store_robject(na_loop_t* const lp) {
777
786
  }
778
787
 
779
788
  static VALUE int32_store_robject(VALUE self, VALUE obj) {
780
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
781
- ndfunc_t ndf = {iter_int32_store_robject, FULL_LOOP, 2, 0, ain, 0};
789
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
790
+ ndfunc_t ndf = { iter_int32_store_robject, FULL_LOOP, 2, 0, ain, 0 };
782
791
 
783
792
  na_ndloop(&ndf, 2, self, obj);
784
793
  return self;
@@ -886,8 +895,8 @@ loop_end:
886
895
  }
887
896
 
888
897
  static VALUE int32_store_array(VALUE self, VALUE rary) {
889
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {rb_cArray, 0}};
890
- ndfunc_t ndf = {iter_int32_store_array, FULL_LOOP, 2, 0, ain, 0};
898
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { rb_cArray, 0 } };
899
+ ndfunc_t ndf = { iter_int32_store_array, FULL_LOOP, 2, 0, ain, 0 };
891
900
 
892
901
  na_ndloop_store_rarray(&ndf, self, rary);
893
902
  return self;
@@ -896,8 +905,8 @@ static VALUE int32_store_array(VALUE self, VALUE rary) {
896
905
  /*
897
906
  Store elements to Numo::Int32 from other.
898
907
  @overload store(other)
899
- @param [Object] other
900
- @return [Numo::Int32] self
908
+ @param [Object] other
909
+ @return [Numo::Int32] self
901
910
  */
902
911
  static VALUE int32_store(VALUE self, VALUE obj) {
903
912
  VALUE r, klass;
@@ -982,8 +991,10 @@ static VALUE int32_store(VALUE self, VALUE obj) {
982
991
  }
983
992
  }
984
993
 
985
- rb_raise(nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
986
- rb_class2name(rb_obj_class(self)));
994
+ rb_raise(
995
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
996
+ rb_class2name(rb_obj_class(self))
997
+ );
987
998
 
988
999
  return self;
989
1000
  }
@@ -1077,7 +1088,10 @@ static dtype int32_extract_data(VALUE obj) {
1077
1088
  return int32_extract_data(r);
1078
1089
  }
1079
1090
 
1080
- rb_raise(nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)), rb_class2name(cT));
1091
+ rb_raise(
1092
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
1093
+ rb_class2name(cT)
1094
+ );
1081
1095
  }
1082
1096
  if (TYPE(obj) == T_ARRAY) {
1083
1097
  if (RARRAY_LEN(obj) != 1) {
@@ -1104,9 +1118,9 @@ static VALUE int32_cast_array(VALUE rary) {
1104
1118
  Cast object to Numo::Int32.
1105
1119
  @overload [](elements)
1106
1120
  @overload cast(array)
1107
- @param [Numeric,Array] elements
1108
- @param [Array] array
1109
- @return [Numo::Int32]
1121
+ @param [Numeric,Array] elements
1122
+ @param [Array] array
1123
+ @return [Numo::Int32]
1110
1124
  */
1111
1125
  static VALUE int32_s_cast(VALUE type, VALUE obj) {
1112
1126
  VALUE v;
@@ -1146,9 +1160,9 @@ static VALUE int32_s_cast(VALUE type, VALUE obj) {
1146
1160
  /*
1147
1161
  Multi-dimensional element reference.
1148
1162
  @overload [](dim0,...,dimL)
1149
- @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol] dim0,...,dimL multi-dimensional
1150
- indices.
1151
- @return [Numeric,Numo::Int32] an element or NArray view.
1163
+ @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
1164
+ dim0,...,dimL multi-dimensional indices.
1165
+ @return [Numeric,Numo::Int32] an element or NArray view.
1152
1166
  @see Numo::NArray#[]
1153
1167
  @see #[]=
1154
1168
  */
@@ -1169,10 +1183,10 @@ static VALUE int32_aref(int argc, VALUE* argv, VALUE self) {
1169
1183
  /*
1170
1184
  Multi-dimensional element assignment.
1171
1185
  @overload []=(dim0,...,dimL,val)
1172
- @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol] dim0,...,dimL multi-dimensional
1173
- indices.
1174
- @param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
1175
- @return [Numeric,Numo::NArray,Array] returns `val` (last argument).
1186
+ @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
1187
+ dim0,...,dimL multi-dimensional indices.
1188
+ @param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
1189
+ @return [Numeric,Numo::NArray,Array] returns `val` (last argument).
1176
1190
  @see Numo::NArray#[]=
1177
1191
  @see #[]
1178
1192
  */
@@ -1203,7 +1217,7 @@ static VALUE int32_aset(int argc, VALUE* argv, VALUE self) {
1203
1217
  /*
1204
1218
  return NArray with cast to the type of self.
1205
1219
  @overload coerce_cast(type)
1206
- @return [nil]
1220
+ @return [nil]
1207
1221
  */
1208
1222
  static VALUE int32_coerce_cast(VALUE self, VALUE type) {
1209
1223
  return Qnil;
@@ -1238,12 +1252,12 @@ static void iter_int32_to_a(na_loop_t* const lp) {
1238
1252
  /*
1239
1253
  Convert self to Array.
1240
1254
  @overload to_a
1241
- @return [Array]
1255
+ @return [Array]
1242
1256
  */
1243
1257
  static VALUE int32_to_a(VALUE self) {
1244
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
1245
- ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
1246
- ndfunc_t ndf = {iter_int32_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
1258
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
1259
+ ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
1260
+ ndfunc_t ndf = { iter_int32_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
1247
1261
  return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
1248
1262
  }
1249
1263
 
@@ -1271,12 +1285,12 @@ static void iter_int32_fill(na_loop_t* const lp) {
1271
1285
  /*
1272
1286
  Fill elements with other.
1273
1287
  @overload fill other
1274
- @param [Numeric] other
1275
- @return [Numo::Int32] self.
1288
+ @param [Numeric] other
1289
+ @return [Numo::Int32] self.
1276
1290
  */
1277
1291
  static VALUE int32_fill(VALUE self, VALUE val) {
1278
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_option}};
1279
- ndfunc_t ndf = {iter_int32_fill, FULL_LOOP, 2, 0, ain, 0};
1292
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
1293
+ ndfunc_t ndf = { iter_int32_fill, FULL_LOOP, 2, 0, ain, 0 };
1280
1294
 
1281
1295
  na_ndloop(&ndf, 2, self, val);
1282
1296
  return self;
@@ -1325,15 +1339,15 @@ static void iter_int32_format(na_loop_t* const lp) {
1325
1339
  /*
1326
1340
  Format elements into strings.
1327
1341
  @overload format format
1328
- @param [String] format
1329
- @return [Numo::RObject] array of formatted strings.
1342
+ @param [String] format
1343
+ @return [Numo::RObject] array of formatted strings.
1330
1344
  */
1331
1345
  static VALUE int32_format(int argc, VALUE* argv, VALUE self) {
1332
1346
  VALUE fmt = Qnil;
1333
1347
 
1334
- ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_option}};
1335
- ndfunc_arg_out_t aout[1] = {{numo_cRObject, 0}};
1336
- ndfunc_t ndf = {iter_int32_format, FULL_LOOP_NIP, 2, 1, ain, aout};
1348
+ ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_option } };
1349
+ ndfunc_arg_out_t aout[1] = { { numo_cRObject, 0 } };
1350
+ ndfunc_t ndf = { iter_int32_format, FULL_LOOP_NIP, 2, 1, ain, aout };
1337
1351
 
1338
1352
  rb_scan_args(argc, argv, "01", &fmt);
1339
1353
  return na_ndloop(&ndf, 2, self, fmt);
@@ -1372,14 +1386,14 @@ static void iter_int32_format_to_a(na_loop_t* const lp) {
1372
1386
  /*
1373
1387
  Format elements into strings.
1374
1388
  @overload format_to_a format
1375
- @param [String] format
1376
- @return [Array] array of formatted strings.
1389
+ @param [String] format
1390
+ @return [Array] array of formatted strings.
1377
1391
  */
1378
1392
  static VALUE int32_format_to_a(int argc, VALUE* argv, VALUE self) {
1379
1393
  VALUE fmt = Qnil;
1380
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
1381
- ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
1382
- ndfunc_t ndf = {iter_int32_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
1394
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
1395
+ ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
1396
+ ndfunc_t ndf = { iter_int32_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
1383
1397
 
1384
1398
  rb_scan_args(argc, argv, "01", &fmt);
1385
1399
  return na_ndloop_cast_narray_to_rarray(&ndf, self, fmt);
@@ -1392,7 +1406,7 @@ static VALUE iter_int32_inspect(char* ptr, size_t pos, VALUE fmt) {
1392
1406
  /*
1393
1407
  Returns a string containing a human-readable representation of NArray.
1394
1408
  @overload inspect
1395
- @return [String]
1409
+ @return [String]
1396
1410
  */
1397
1411
  static VALUE int32_inspect(VALUE ary) {
1398
1412
  return na_ndloop_inspect(ary, iter_int32_inspect, Qnil);
@@ -1426,15 +1440,15 @@ static void iter_int32_each(na_loop_t* const lp) {
1426
1440
  Calls the given block once for each element in self,
1427
1441
  passing that element as a parameter.
1428
1442
  @overload each
1429
- @return [Numo::NArray] self
1430
- For a block `{|x| ... }`,
1431
- @yieldparam [Numeric] x an element of NArray.
1443
+ @return [Numo::NArray] self
1444
+ For a block `{|x| ... }`,
1445
+ @yieldparam [Numeric] x an element of NArray.
1432
1446
  @see #each_with_index
1433
1447
  @see #map
1434
1448
  */
1435
1449
  static VALUE int32_each(VALUE self) {
1436
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1437
- ndfunc_t ndf = {iter_int32_each, FULL_LOOP_NIP, 1, 0, ain, 0};
1450
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1451
+ ndfunc_t ndf = { iter_int32_each, FULL_LOOP_NIP, 1, 0, ain, 0 };
1438
1452
 
1439
1453
  na_ndloop(&ndf, 1, self);
1440
1454
  return self;
@@ -1505,12 +1519,12 @@ static void iter_int32_map(na_loop_t* const lp) {
1505
1519
  /*
1506
1520
  Unary map.
1507
1521
  @overload map
1508
- @return [Numo::Int32] map of self.
1522
+ @return [Numo::Int32] map of self.
1509
1523
  */
1510
1524
  static VALUE int32_map(VALUE self) {
1511
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
1512
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1513
- ndfunc_t ndf = {iter_int32_map, FULL_LOOP, 1, 1, ain, aout};
1525
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
1526
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1527
+ ndfunc_t ndf = { iter_int32_map, FULL_LOOP, 1, 1, ain, aout };
1514
1528
 
1515
1529
  return na_ndloop(&ndf, 1, self);
1516
1530
  }
@@ -1564,16 +1578,16 @@ static void iter_int32_each_with_index(na_loop_t* const lp) {
1564
1578
  Invokes the given block once for each element of self,
1565
1579
  passing that element and indices along each axis as parameters.
1566
1580
  @overload each_with_index
1567
- For a block `{|x,i,j,...| ... }`,
1568
- @yieldparam [Numeric] x an element
1569
- @yieldparam [Integer] i,j,... multitimensional indices
1570
- @return [Numo::NArray] self
1581
+ For a block `{|x,i,j,...| ... }`,
1582
+ @yieldparam [Numeric] x an element
1583
+ @yieldparam [Integer] i,j,... multitimensional indices
1584
+ @return [Numo::NArray] self
1571
1585
  @see #each
1572
1586
  @see #map_with_index
1573
1587
  */
1574
1588
  static VALUE int32_each_with_index(VALUE self) {
1575
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1576
- ndfunc_t ndf = {iter_int32_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0};
1589
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1590
+ ndfunc_t ndf = { iter_int32_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0 };
1577
1591
 
1578
1592
  na_ndloop_with_index(&ndf, 1, self);
1579
1593
  return self;
@@ -1655,17 +1669,17 @@ static void iter_int32_map_with_index(na_loop_t* const lp) {
1655
1669
  Creates a new NArray containing the values returned by the block.
1656
1670
  Inplace option is allowed, i.e., `nary.inplace.map` overwrites `nary`.
1657
1671
  @overload map_with_index
1658
- For a block `{|x,i,j,...| ... }`,
1659
- @yieldparam [Numeric] x an element
1660
- @yieldparam [Integer] i,j,... multitimensional indices
1661
- @return [Numo::NArray] mapped array
1672
+ For a block `{|x,i,j,...| ... }`,
1673
+ @yieldparam [Numeric] x an element
1674
+ @yieldparam [Integer] i,j,... multitimensional indices
1675
+ @return [Numo::NArray] mapped array
1662
1676
  @see #map
1663
1677
  @see #each_with_index
1664
1678
  */
1665
1679
  static VALUE int32_map_with_index(VALUE self) {
1666
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1667
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1668
- ndfunc_t ndf = {iter_int32_map_with_index, FULL_LOOP, 1, 1, ain, aout};
1680
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1681
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1682
+ ndfunc_t ndf = { iter_int32_map_with_index, FULL_LOOP, 1, 1, ain, aout };
1669
1683
 
1670
1684
  return na_ndloop_with_index(&ndf, 1, self);
1671
1685
  }
@@ -1714,17 +1728,17 @@ static void iter_int32_abs(na_loop_t* const lp) {
1714
1728
  /*
1715
1729
  abs of self.
1716
1730
  @overload abs
1717
- @return [Numo::Int32] abs of self.
1731
+ @return [Numo::Int32] abs of self.
1718
1732
  */
1719
1733
  static VALUE int32_abs(VALUE self) {
1720
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
1721
- ndfunc_arg_out_t aout[1] = {{cRT, 0}};
1722
- ndfunc_t ndf = {iter_int32_abs, FULL_LOOP, 1, 1, ain, aout};
1734
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
1735
+ ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
1736
+ ndfunc_t ndf = { iter_int32_abs, FULL_LOOP, 1, 1, ain, aout };
1723
1737
 
1724
1738
  return na_ndloop(&ndf, 1, self);
1725
1739
  }
1726
1740
 
1727
- #define check_intdivzero(y) \
1741
+ #define check_intdivzero(y) \
1728
1742
  {}
1729
1743
 
1730
1744
  static void iter_int32_add(na_loop_t* const lp) {
@@ -1739,7 +1753,8 @@ static void iter_int32_add(na_loop_t* const lp) {
1739
1753
  INIT_PTR(lp, 2, p3, s3);
1740
1754
 
1741
1755
  //
1742
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
1756
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
1757
+ is_aligned(p3, sizeof(dtype))) {
1743
1758
 
1744
1759
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
1745
1760
  if (p1 == p3) { // inplace case
@@ -1756,7 +1771,8 @@ static void iter_int32_add(na_loop_t* const lp) {
1756
1771
  return;
1757
1772
  }
1758
1773
 
1759
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
1774
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
1775
+ is_aligned_step(s3, sizeof(dtype))) {
1760
1776
  //
1761
1777
 
1762
1778
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -1814,9 +1830,9 @@ static void iter_int32_add(na_loop_t* const lp) {
1814
1830
  #undef check_intdivzero
1815
1831
 
1816
1832
  static VALUE int32_add_self(VALUE self, VALUE other) {
1817
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
1818
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1819
- ndfunc_t ndf = {iter_int32_add, STRIDE_LOOP, 2, 1, ain, aout};
1833
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
1834
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1835
+ ndfunc_t ndf = { iter_int32_add, STRIDE_LOOP, 2, 1, ain, aout };
1820
1836
 
1821
1837
  return na_ndloop(&ndf, 2, self, other);
1822
1838
  }
@@ -1824,8 +1840,8 @@ static VALUE int32_add_self(VALUE self, VALUE other) {
1824
1840
  /*
1825
1841
  Binary add.
1826
1842
  @overload + other
1827
- @param [Numo::NArray,Numeric] other
1828
- @return [Numo::NArray] self + other
1843
+ @param [Numo::NArray,Numeric] other
1844
+ @return [Numo::NArray] self + other
1829
1845
  */
1830
1846
  static VALUE int32_add(VALUE self, VALUE other) {
1831
1847
 
@@ -1840,7 +1856,7 @@ static VALUE int32_add(VALUE self, VALUE other) {
1840
1856
  }
1841
1857
  }
1842
1858
 
1843
- #define check_intdivzero(y) \
1859
+ #define check_intdivzero(y) \
1844
1860
  {}
1845
1861
 
1846
1862
  static void iter_int32_sub(na_loop_t* const lp) {
@@ -1855,7 +1871,8 @@ static void iter_int32_sub(na_loop_t* const lp) {
1855
1871
  INIT_PTR(lp, 2, p3, s3);
1856
1872
 
1857
1873
  //
1858
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
1874
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
1875
+ is_aligned(p3, sizeof(dtype))) {
1859
1876
 
1860
1877
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
1861
1878
  if (p1 == p3) { // inplace case
@@ -1872,7 +1889,8 @@ static void iter_int32_sub(na_loop_t* const lp) {
1872
1889
  return;
1873
1890
  }
1874
1891
 
1875
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
1892
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
1893
+ is_aligned_step(s3, sizeof(dtype))) {
1876
1894
  //
1877
1895
 
1878
1896
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -1930,9 +1948,9 @@ static void iter_int32_sub(na_loop_t* const lp) {
1930
1948
  #undef check_intdivzero
1931
1949
 
1932
1950
  static VALUE int32_sub_self(VALUE self, VALUE other) {
1933
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
1934
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1935
- ndfunc_t ndf = {iter_int32_sub, STRIDE_LOOP, 2, 1, ain, aout};
1951
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
1952
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1953
+ ndfunc_t ndf = { iter_int32_sub, STRIDE_LOOP, 2, 1, ain, aout };
1936
1954
 
1937
1955
  return na_ndloop(&ndf, 2, self, other);
1938
1956
  }
@@ -1940,8 +1958,8 @@ static VALUE int32_sub_self(VALUE self, VALUE other) {
1940
1958
  /*
1941
1959
  Binary sub.
1942
1960
  @overload - other
1943
- @param [Numo::NArray,Numeric] other
1944
- @return [Numo::NArray] self - other
1961
+ @param [Numo::NArray,Numeric] other
1962
+ @return [Numo::NArray] self - other
1945
1963
  */
1946
1964
  static VALUE int32_sub(VALUE self, VALUE other) {
1947
1965
 
@@ -1956,7 +1974,7 @@ static VALUE int32_sub(VALUE self, VALUE other) {
1956
1974
  }
1957
1975
  }
1958
1976
 
1959
- #define check_intdivzero(y) \
1977
+ #define check_intdivzero(y) \
1960
1978
  {}
1961
1979
 
1962
1980
  static void iter_int32_mul(na_loop_t* const lp) {
@@ -1971,7 +1989,8 @@ static void iter_int32_mul(na_loop_t* const lp) {
1971
1989
  INIT_PTR(lp, 2, p3, s3);
1972
1990
 
1973
1991
  //
1974
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
1992
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
1993
+ is_aligned(p3, sizeof(dtype))) {
1975
1994
 
1976
1995
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
1977
1996
  if (p1 == p3) { // inplace case
@@ -1988,7 +2007,8 @@ static void iter_int32_mul(na_loop_t* const lp) {
1988
2007
  return;
1989
2008
  }
1990
2009
 
1991
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2010
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2011
+ is_aligned_step(s3, sizeof(dtype))) {
1992
2012
  //
1993
2013
 
1994
2014
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2046,9 +2066,9 @@ static void iter_int32_mul(na_loop_t* const lp) {
2046
2066
  #undef check_intdivzero
2047
2067
 
2048
2068
  static VALUE int32_mul_self(VALUE self, VALUE other) {
2049
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2050
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2051
- ndfunc_t ndf = {iter_int32_mul, STRIDE_LOOP, 2, 1, ain, aout};
2069
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2070
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2071
+ ndfunc_t ndf = { iter_int32_mul, STRIDE_LOOP, 2, 1, ain, aout };
2052
2072
 
2053
2073
  return na_ndloop(&ndf, 2, self, other);
2054
2074
  }
@@ -2056,8 +2076,8 @@ static VALUE int32_mul_self(VALUE self, VALUE other) {
2056
2076
  /*
2057
2077
  Binary mul.
2058
2078
  @overload * other
2059
- @param [Numo::NArray,Numeric] other
2060
- @return [Numo::NArray] self * other
2079
+ @param [Numo::NArray,Numeric] other
2080
+ @return [Numo::NArray] self * other
2061
2081
  */
2062
2082
  static VALUE int32_mul(VALUE self, VALUE other) {
2063
2083
 
@@ -2072,10 +2092,10 @@ static VALUE int32_mul(VALUE self, VALUE other) {
2072
2092
  }
2073
2093
  }
2074
2094
 
2075
- #define check_intdivzero(y) \
2076
- if ((y) == 0) { \
2077
- lp->err_type = rb_eZeroDivError; \
2078
- return; \
2095
+ #define check_intdivzero(y) \
2096
+ if ((y) == 0) { \
2097
+ lp->err_type = rb_eZeroDivError; \
2098
+ return; \
2079
2099
  }
2080
2100
 
2081
2101
  static void iter_int32_div(na_loop_t* const lp) {
@@ -2090,7 +2110,8 @@ static void iter_int32_div(na_loop_t* const lp) {
2090
2110
  INIT_PTR(lp, 2, p3, s3);
2091
2111
 
2092
2112
  //
2093
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2113
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2114
+ is_aligned(p3, sizeof(dtype))) {
2094
2115
 
2095
2116
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2096
2117
  if (p1 == p3) { // inplace case
@@ -2107,7 +2128,8 @@ static void iter_int32_div(na_loop_t* const lp) {
2107
2128
  return;
2108
2129
  }
2109
2130
 
2110
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2131
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2132
+ is_aligned_step(s3, sizeof(dtype))) {
2111
2133
  //
2112
2134
 
2113
2135
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2165,9 +2187,9 @@ static void iter_int32_div(na_loop_t* const lp) {
2165
2187
  #undef check_intdivzero
2166
2188
 
2167
2189
  static VALUE int32_div_self(VALUE self, VALUE other) {
2168
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2169
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2170
- ndfunc_t ndf = {iter_int32_div, STRIDE_LOOP, 2, 1, ain, aout};
2190
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2191
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2192
+ ndfunc_t ndf = { iter_int32_div, STRIDE_LOOP, 2, 1, ain, aout };
2171
2193
 
2172
2194
  return na_ndloop(&ndf, 2, self, other);
2173
2195
  }
@@ -2175,8 +2197,8 @@ static VALUE int32_div_self(VALUE self, VALUE other) {
2175
2197
  /*
2176
2198
  Binary div.
2177
2199
  @overload / other
2178
- @param [Numo::NArray,Numeric] other
2179
- @return [Numo::NArray] self / other
2200
+ @param [Numo::NArray,Numeric] other
2201
+ @return [Numo::NArray] self / other
2180
2202
  */
2181
2203
  static VALUE int32_div(VALUE self, VALUE other) {
2182
2204
 
@@ -2191,10 +2213,10 @@ static VALUE int32_div(VALUE self, VALUE other) {
2191
2213
  }
2192
2214
  }
2193
2215
 
2194
- #define check_intdivzero(y) \
2195
- if ((y) == 0) { \
2196
- lp->err_type = rb_eZeroDivError; \
2197
- return; \
2216
+ #define check_intdivzero(y) \
2217
+ if ((y) == 0) { \
2218
+ lp->err_type = rb_eZeroDivError; \
2219
+ return; \
2198
2220
  }
2199
2221
 
2200
2222
  static void iter_int32_mod(na_loop_t* const lp) {
@@ -2209,7 +2231,8 @@ static void iter_int32_mod(na_loop_t* const lp) {
2209
2231
  INIT_PTR(lp, 2, p3, s3);
2210
2232
 
2211
2233
  //
2212
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2234
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2235
+ is_aligned(p3, sizeof(dtype))) {
2213
2236
 
2214
2237
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2215
2238
  if (p1 == p3) { // inplace case
@@ -2226,7 +2249,8 @@ static void iter_int32_mod(na_loop_t* const lp) {
2226
2249
  return;
2227
2250
  }
2228
2251
 
2229
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2252
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2253
+ is_aligned_step(s3, sizeof(dtype))) {
2230
2254
  //
2231
2255
 
2232
2256
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2284,9 +2308,9 @@ static void iter_int32_mod(na_loop_t* const lp) {
2284
2308
  #undef check_intdivzero
2285
2309
 
2286
2310
  static VALUE int32_mod_self(VALUE self, VALUE other) {
2287
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2288
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2289
- ndfunc_t ndf = {iter_int32_mod, STRIDE_LOOP, 2, 1, ain, aout};
2311
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2312
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2313
+ ndfunc_t ndf = { iter_int32_mod, STRIDE_LOOP, 2, 1, ain, aout };
2290
2314
 
2291
2315
  return na_ndloop(&ndf, 2, self, other);
2292
2316
  }
@@ -2294,8 +2318,8 @@ static VALUE int32_mod_self(VALUE self, VALUE other) {
2294
2318
  /*
2295
2319
  Binary mod.
2296
2320
  @overload % other
2297
- @param [Numo::NArray,Numeric] other
2298
- @return [Numo::NArray] self % other
2321
+ @param [Numo::NArray,Numeric] other
2322
+ @return [Numo::NArray] self % other
2299
2323
  */
2300
2324
  static VALUE int32_mod(VALUE self, VALUE other) {
2301
2325
 
@@ -2334,9 +2358,9 @@ static void iter_int32_divmod(na_loop_t* const lp) {
2334
2358
  }
2335
2359
 
2336
2360
  static VALUE int32_divmod_self(VALUE self, VALUE other) {
2337
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2338
- ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
2339
- ndfunc_t ndf = {iter_int32_divmod, STRIDE_LOOP, 2, 2, ain, aout};
2361
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2362
+ ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
2363
+ ndfunc_t ndf = { iter_int32_divmod, STRIDE_LOOP, 2, 2, ain, aout };
2340
2364
 
2341
2365
  return na_ndloop(&ndf, 2, self, other);
2342
2366
  }
@@ -2344,8 +2368,8 @@ static VALUE int32_divmod_self(VALUE self, VALUE other) {
2344
2368
  /*
2345
2369
  Binary divmod.
2346
2370
  @overload divmod other
2347
- @param [Numo::NArray,Numeric] other
2348
- @return [Numo::NArray] divmod of self and other.
2371
+ @param [Numo::NArray,Numeric] other
2372
+ @return [Numo::NArray] divmod of self and other.
2349
2373
  */
2350
2374
  static VALUE int32_divmod(VALUE self, VALUE other) {
2351
2375
 
@@ -2395,11 +2419,11 @@ static void iter_int32_pow_int32(na_loop_t* const lp) {
2395
2419
  }
2396
2420
 
2397
2421
  static VALUE int32_pow_self(VALUE self, VALUE other) {
2398
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2399
- ndfunc_arg_in_t ain_i[2] = {{cT, 0}, {numo_cInt32, 0}};
2400
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2401
- ndfunc_t ndf = {iter_int32_pow, STRIDE_LOOP, 2, 1, ain, aout};
2402
- ndfunc_t ndf_i = {iter_int32_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout};
2422
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2423
+ ndfunc_arg_in_t ain_i[2] = { { cT, 0 }, { numo_cInt32, 0 } };
2424
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2425
+ ndfunc_t ndf = { iter_int32_pow, STRIDE_LOOP, 2, 1, ain, aout };
2426
+ ndfunc_t ndf_i = { iter_int32_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout };
2403
2427
 
2404
2428
  // fixme : use na.integer?
2405
2429
  if (FIXNUM_P(other) || rb_obj_is_kind_of(other, numo_cInt32)) {
@@ -2412,8 +2436,8 @@ static VALUE int32_pow_self(VALUE self, VALUE other) {
2412
2436
  /*
2413
2437
  Binary power.
2414
2438
  @overload ** other
2415
- @param [Numo::NArray,Numeric] other
2416
- @return [Numo::NArray] self to the other-th power.
2439
+ @param [Numo::NArray,Numeric] other
2440
+ @return [Numo::NArray] self to the other-th power.
2417
2441
  */
2418
2442
  static VALUE int32_pow(VALUE self, VALUE other) {
2419
2443
 
@@ -2492,12 +2516,12 @@ static void iter_int32_minus(na_loop_t* const lp) {
2492
2516
  /*
2493
2517
  Unary minus.
2494
2518
  @overload -@
2495
- @return [Numo::Int32] minus of self.
2519
+ @return [Numo::Int32] minus of self.
2496
2520
  */
2497
2521
  static VALUE int32_minus(VALUE self) {
2498
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2499
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2500
- ndfunc_t ndf = {iter_int32_minus, FULL_LOOP, 1, 1, ain, aout};
2522
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2523
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2524
+ ndfunc_t ndf = { iter_int32_minus, FULL_LOOP, 1, 1, ain, aout };
2501
2525
 
2502
2526
  return na_ndloop(&ndf, 1, self);
2503
2527
  }
@@ -2567,12 +2591,12 @@ static void iter_int32_reciprocal(na_loop_t* const lp) {
2567
2591
  /*
2568
2592
  Unary reciprocal.
2569
2593
  @overload reciprocal
2570
- @return [Numo::Int32] reciprocal of self.
2594
+ @return [Numo::Int32] reciprocal of self.
2571
2595
  */
2572
2596
  static VALUE int32_reciprocal(VALUE self) {
2573
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2574
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2575
- ndfunc_t ndf = {iter_int32_reciprocal, FULL_LOOP, 1, 1, ain, aout};
2597
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2598
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2599
+ ndfunc_t ndf = { iter_int32_reciprocal, FULL_LOOP, 1, 1, ain, aout };
2576
2600
 
2577
2601
  return na_ndloop(&ndf, 1, self);
2578
2602
  }
@@ -2642,12 +2666,12 @@ static void iter_int32_sign(na_loop_t* const lp) {
2642
2666
  /*
2643
2667
  Unary sign.
2644
2668
  @overload sign
2645
- @return [Numo::Int32] sign of self.
2669
+ @return [Numo::Int32] sign of self.
2646
2670
  */
2647
2671
  static VALUE int32_sign(VALUE self) {
2648
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2649
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2650
- ndfunc_t ndf = {iter_int32_sign, FULL_LOOP, 1, 1, ain, aout};
2672
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2673
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2674
+ ndfunc_t ndf = { iter_int32_sign, FULL_LOOP, 1, 1, ain, aout };
2651
2675
 
2652
2676
  return na_ndloop(&ndf, 1, self);
2653
2677
  }
@@ -2717,12 +2741,12 @@ static void iter_int32_square(na_loop_t* const lp) {
2717
2741
  /*
2718
2742
  Unary square.
2719
2743
  @overload square
2720
- @return [Numo::Int32] square of self.
2744
+ @return [Numo::Int32] square of self.
2721
2745
  */
2722
2746
  static VALUE int32_square(VALUE self) {
2723
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2724
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2725
- ndfunc_t ndf = {iter_int32_square, FULL_LOOP, 1, 1, ain, aout};
2747
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2748
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2749
+ ndfunc_t ndf = { iter_int32_square, FULL_LOOP, 1, 1, ain, aout };
2726
2750
 
2727
2751
  return na_ndloop(&ndf, 1, self);
2728
2752
  }
@@ -2749,9 +2773,9 @@ static void iter_int32_eq(na_loop_t* const lp) {
2749
2773
  }
2750
2774
 
2751
2775
  static VALUE int32_eq_self(VALUE self, VALUE other) {
2752
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2753
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
2754
- ndfunc_t ndf = {iter_int32_eq, STRIDE_LOOP, 2, 1, ain, aout};
2776
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2777
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
2778
+ ndfunc_t ndf = { iter_int32_eq, STRIDE_LOOP, 2, 1, ain, aout };
2755
2779
 
2756
2780
  return na_ndloop(&ndf, 2, self, other);
2757
2781
  }
@@ -2759,8 +2783,8 @@ static VALUE int32_eq_self(VALUE self, VALUE other) {
2759
2783
  /*
2760
2784
  Comparison eq other.
2761
2785
  @overload eq other
2762
- @param [Numo::NArray,Numeric] other
2763
- @return [Numo::Bit] result of self eq other.
2786
+ @param [Numo::NArray,Numeric] other
2787
+ @return [Numo::Bit] result of self eq other.
2764
2788
  */
2765
2789
  static VALUE int32_eq(VALUE self, VALUE other) {
2766
2790
 
@@ -2796,9 +2820,9 @@ static void iter_int32_ne(na_loop_t* const lp) {
2796
2820
  }
2797
2821
 
2798
2822
  static VALUE int32_ne_self(VALUE self, VALUE other) {
2799
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2800
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
2801
- ndfunc_t ndf = {iter_int32_ne, STRIDE_LOOP, 2, 1, ain, aout};
2823
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2824
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
2825
+ ndfunc_t ndf = { iter_int32_ne, STRIDE_LOOP, 2, 1, ain, aout };
2802
2826
 
2803
2827
  return na_ndloop(&ndf, 2, self, other);
2804
2828
  }
@@ -2806,8 +2830,8 @@ static VALUE int32_ne_self(VALUE self, VALUE other) {
2806
2830
  /*
2807
2831
  Comparison ne other.
2808
2832
  @overload ne other
2809
- @param [Numo::NArray,Numeric] other
2810
- @return [Numo::Bit] result of self ne other.
2833
+ @param [Numo::NArray,Numeric] other
2834
+ @return [Numo::Bit] result of self ne other.
2811
2835
  */
2812
2836
  static VALUE int32_ne(VALUE self, VALUE other) {
2813
2837
 
@@ -2821,7 +2845,7 @@ static VALUE int32_ne(VALUE self, VALUE other) {
2821
2845
  }
2822
2846
  }
2823
2847
 
2824
- #define check_intdivzero(y) \
2848
+ #define check_intdivzero(y) \
2825
2849
  {}
2826
2850
 
2827
2851
  static void iter_int32_bit_and(na_loop_t* const lp) {
@@ -2836,7 +2860,8 @@ static void iter_int32_bit_and(na_loop_t* const lp) {
2836
2860
  INIT_PTR(lp, 2, p3, s3);
2837
2861
 
2838
2862
  //
2839
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2863
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2864
+ is_aligned(p3, sizeof(dtype))) {
2840
2865
 
2841
2866
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2842
2867
  if (p1 == p3) { // inplace case
@@ -2853,7 +2878,8 @@ static void iter_int32_bit_and(na_loop_t* const lp) {
2853
2878
  return;
2854
2879
  }
2855
2880
 
2856
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2881
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2882
+ is_aligned_step(s3, sizeof(dtype))) {
2857
2883
  //
2858
2884
 
2859
2885
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2911,9 +2937,9 @@ static void iter_int32_bit_and(na_loop_t* const lp) {
2911
2937
  #undef check_intdivzero
2912
2938
 
2913
2939
  static VALUE int32_bit_and_self(VALUE self, VALUE other) {
2914
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2915
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2916
- ndfunc_t ndf = {iter_int32_bit_and, STRIDE_LOOP, 2, 1, ain, aout};
2940
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2941
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2942
+ ndfunc_t ndf = { iter_int32_bit_and, STRIDE_LOOP, 2, 1, ain, aout };
2917
2943
 
2918
2944
  return na_ndloop(&ndf, 2, self, other);
2919
2945
  }
@@ -2921,8 +2947,8 @@ static VALUE int32_bit_and_self(VALUE self, VALUE other) {
2921
2947
  /*
2922
2948
  Binary bit_and.
2923
2949
  @overload & other
2924
- @param [Numo::NArray,Numeric] other
2925
- @return [Numo::NArray] self & other
2950
+ @param [Numo::NArray,Numeric] other
2951
+ @return [Numo::NArray] self & other
2926
2952
  */
2927
2953
  static VALUE int32_bit_and(VALUE self, VALUE other) {
2928
2954
 
@@ -2937,7 +2963,7 @@ static VALUE int32_bit_and(VALUE self, VALUE other) {
2937
2963
  }
2938
2964
  }
2939
2965
 
2940
- #define check_intdivzero(y) \
2966
+ #define check_intdivzero(y) \
2941
2967
  {}
2942
2968
 
2943
2969
  static void iter_int32_bit_or(na_loop_t* const lp) {
@@ -2952,7 +2978,8 @@ static void iter_int32_bit_or(na_loop_t* const lp) {
2952
2978
  INIT_PTR(lp, 2, p3, s3);
2953
2979
 
2954
2980
  //
2955
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2981
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2982
+ is_aligned(p3, sizeof(dtype))) {
2956
2983
 
2957
2984
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2958
2985
  if (p1 == p3) { // inplace case
@@ -2969,7 +2996,8 @@ static void iter_int32_bit_or(na_loop_t* const lp) {
2969
2996
  return;
2970
2997
  }
2971
2998
 
2972
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2999
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
3000
+ is_aligned_step(s3, sizeof(dtype))) {
2973
3001
  //
2974
3002
 
2975
3003
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -3027,9 +3055,9 @@ static void iter_int32_bit_or(na_loop_t* const lp) {
3027
3055
  #undef check_intdivzero
3028
3056
 
3029
3057
  static VALUE int32_bit_or_self(VALUE self, VALUE other) {
3030
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3031
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3032
- ndfunc_t ndf = {iter_int32_bit_or, STRIDE_LOOP, 2, 1, ain, aout};
3058
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3059
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3060
+ ndfunc_t ndf = { iter_int32_bit_or, STRIDE_LOOP, 2, 1, ain, aout };
3033
3061
 
3034
3062
  return na_ndloop(&ndf, 2, self, other);
3035
3063
  }
@@ -3037,8 +3065,8 @@ static VALUE int32_bit_or_self(VALUE self, VALUE other) {
3037
3065
  /*
3038
3066
  Binary bit_or.
3039
3067
  @overload | other
3040
- @param [Numo::NArray,Numeric] other
3041
- @return [Numo::NArray] self | other
3068
+ @param [Numo::NArray,Numeric] other
3069
+ @return [Numo::NArray] self | other
3042
3070
  */
3043
3071
  static VALUE int32_bit_or(VALUE self, VALUE other) {
3044
3072
 
@@ -3053,7 +3081,7 @@ static VALUE int32_bit_or(VALUE self, VALUE other) {
3053
3081
  }
3054
3082
  }
3055
3083
 
3056
- #define check_intdivzero(y) \
3084
+ #define check_intdivzero(y) \
3057
3085
  {}
3058
3086
 
3059
3087
  static void iter_int32_bit_xor(na_loop_t* const lp) {
@@ -3068,7 +3096,8 @@ static void iter_int32_bit_xor(na_loop_t* const lp) {
3068
3096
  INIT_PTR(lp, 2, p3, s3);
3069
3097
 
3070
3098
  //
3071
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
3099
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
3100
+ is_aligned(p3, sizeof(dtype))) {
3072
3101
 
3073
3102
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
3074
3103
  if (p1 == p3) { // inplace case
@@ -3085,7 +3114,8 @@ static void iter_int32_bit_xor(na_loop_t* const lp) {
3085
3114
  return;
3086
3115
  }
3087
3116
 
3088
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
3117
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
3118
+ is_aligned_step(s3, sizeof(dtype))) {
3089
3119
  //
3090
3120
 
3091
3121
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -3143,9 +3173,9 @@ static void iter_int32_bit_xor(na_loop_t* const lp) {
3143
3173
  #undef check_intdivzero
3144
3174
 
3145
3175
  static VALUE int32_bit_xor_self(VALUE self, VALUE other) {
3146
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3147
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3148
- ndfunc_t ndf = {iter_int32_bit_xor, STRIDE_LOOP, 2, 1, ain, aout};
3176
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3177
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3178
+ ndfunc_t ndf = { iter_int32_bit_xor, STRIDE_LOOP, 2, 1, ain, aout };
3149
3179
 
3150
3180
  return na_ndloop(&ndf, 2, self, other);
3151
3181
  }
@@ -3153,8 +3183,8 @@ static VALUE int32_bit_xor_self(VALUE self, VALUE other) {
3153
3183
  /*
3154
3184
  Binary bit_xor.
3155
3185
  @overload ^ other
3156
- @param [Numo::NArray,Numeric] other
3157
- @return [Numo::NArray] self ^ other
3186
+ @param [Numo::NArray,Numeric] other
3187
+ @return [Numo::NArray] self ^ other
3158
3188
  */
3159
3189
  static VALUE int32_bit_xor(VALUE self, VALUE other) {
3160
3190
 
@@ -3234,17 +3264,17 @@ static void iter_int32_bit_not(na_loop_t* const lp) {
3234
3264
  /*
3235
3265
  Unary bit_not.
3236
3266
  @overload ~
3237
- @return [Numo::Int32] bit_not of self.
3267
+ @return [Numo::Int32] bit_not of self.
3238
3268
  */
3239
3269
  static VALUE int32_bit_not(VALUE self) {
3240
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3241
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3242
- ndfunc_t ndf = {iter_int32_bit_not, FULL_LOOP, 1, 1, ain, aout};
3270
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3271
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3272
+ ndfunc_t ndf = { iter_int32_bit_not, FULL_LOOP, 1, 1, ain, aout };
3243
3273
 
3244
3274
  return na_ndloop(&ndf, 1, self);
3245
3275
  }
3246
3276
 
3247
- #define check_intdivzero(y) \
3277
+ #define check_intdivzero(y) \
3248
3278
  {}
3249
3279
 
3250
3280
  static void iter_int32_left_shift(na_loop_t* const lp) {
@@ -3259,7 +3289,8 @@ static void iter_int32_left_shift(na_loop_t* const lp) {
3259
3289
  INIT_PTR(lp, 2, p3, s3);
3260
3290
 
3261
3291
  //
3262
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
3292
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
3293
+ is_aligned(p3, sizeof(dtype))) {
3263
3294
 
3264
3295
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
3265
3296
  if (p1 == p3) { // inplace case
@@ -3276,7 +3307,8 @@ static void iter_int32_left_shift(na_loop_t* const lp) {
3276
3307
  return;
3277
3308
  }
3278
3309
 
3279
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
3310
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
3311
+ is_aligned_step(s3, sizeof(dtype))) {
3280
3312
  //
3281
3313
 
3282
3314
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -3334,9 +3366,9 @@ static void iter_int32_left_shift(na_loop_t* const lp) {
3334
3366
  #undef check_intdivzero
3335
3367
 
3336
3368
  static VALUE int32_left_shift_self(VALUE self, VALUE other) {
3337
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3338
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3339
- ndfunc_t ndf = {iter_int32_left_shift, STRIDE_LOOP, 2, 1, ain, aout};
3369
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3370
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3371
+ ndfunc_t ndf = { iter_int32_left_shift, STRIDE_LOOP, 2, 1, ain, aout };
3340
3372
 
3341
3373
  return na_ndloop(&ndf, 2, self, other);
3342
3374
  }
@@ -3344,8 +3376,8 @@ static VALUE int32_left_shift_self(VALUE self, VALUE other) {
3344
3376
  /*
3345
3377
  Binary left_shift.
3346
3378
  @overload << other
3347
- @param [Numo::NArray,Numeric] other
3348
- @return [Numo::NArray] self << other
3379
+ @param [Numo::NArray,Numeric] other
3380
+ @return [Numo::NArray] self << other
3349
3381
  */
3350
3382
  static VALUE int32_left_shift(VALUE self, VALUE other) {
3351
3383
 
@@ -3360,7 +3392,7 @@ static VALUE int32_left_shift(VALUE self, VALUE other) {
3360
3392
  }
3361
3393
  }
3362
3394
 
3363
- #define check_intdivzero(y) \
3395
+ #define check_intdivzero(y) \
3364
3396
  {}
3365
3397
 
3366
3398
  static void iter_int32_right_shift(na_loop_t* const lp) {
@@ -3375,7 +3407,8 @@ static void iter_int32_right_shift(na_loop_t* const lp) {
3375
3407
  INIT_PTR(lp, 2, p3, s3);
3376
3408
 
3377
3409
  //
3378
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
3410
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
3411
+ is_aligned(p3, sizeof(dtype))) {
3379
3412
 
3380
3413
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
3381
3414
  if (p1 == p3) { // inplace case
@@ -3392,7 +3425,8 @@ static void iter_int32_right_shift(na_loop_t* const lp) {
3392
3425
  return;
3393
3426
  }
3394
3427
 
3395
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
3428
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
3429
+ is_aligned_step(s3, sizeof(dtype))) {
3396
3430
  //
3397
3431
 
3398
3432
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -3450,9 +3484,9 @@ static void iter_int32_right_shift(na_loop_t* const lp) {
3450
3484
  #undef check_intdivzero
3451
3485
 
3452
3486
  static VALUE int32_right_shift_self(VALUE self, VALUE other) {
3453
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3454
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3455
- ndfunc_t ndf = {iter_int32_right_shift, STRIDE_LOOP, 2, 1, ain, aout};
3487
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3488
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3489
+ ndfunc_t ndf = { iter_int32_right_shift, STRIDE_LOOP, 2, 1, ain, aout };
3456
3490
 
3457
3491
  return na_ndloop(&ndf, 2, self, other);
3458
3492
  }
@@ -3460,8 +3494,8 @@ static VALUE int32_right_shift_self(VALUE self, VALUE other) {
3460
3494
  /*
3461
3495
  Binary right_shift.
3462
3496
  @overload >> other
3463
- @param [Numo::NArray,Numeric] other
3464
- @return [Numo::NArray] self >> other
3497
+ @param [Numo::NArray,Numeric] other
3498
+ @return [Numo::NArray] self >> other
3465
3499
  */
3466
3500
  static VALUE int32_right_shift(VALUE self, VALUE other) {
3467
3501
 
@@ -3498,9 +3532,9 @@ static void iter_int32_gt(na_loop_t* const lp) {
3498
3532
  }
3499
3533
 
3500
3534
  static VALUE int32_gt_self(VALUE self, VALUE other) {
3501
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3502
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3503
- ndfunc_t ndf = {iter_int32_gt, STRIDE_LOOP, 2, 1, ain, aout};
3535
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3536
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3537
+ ndfunc_t ndf = { iter_int32_gt, STRIDE_LOOP, 2, 1, ain, aout };
3504
3538
 
3505
3539
  return na_ndloop(&ndf, 2, self, other);
3506
3540
  }
@@ -3508,8 +3542,8 @@ static VALUE int32_gt_self(VALUE self, VALUE other) {
3508
3542
  /*
3509
3543
  Comparison gt other.
3510
3544
  @overload gt other
3511
- @param [Numo::NArray,Numeric] other
3512
- @return [Numo::Bit] result of self gt other.
3545
+ @param [Numo::NArray,Numeric] other
3546
+ @return [Numo::Bit] result of self gt other.
3513
3547
  */
3514
3548
  static VALUE int32_gt(VALUE self, VALUE other) {
3515
3549
 
@@ -3545,9 +3579,9 @@ static void iter_int32_ge(na_loop_t* const lp) {
3545
3579
  }
3546
3580
 
3547
3581
  static VALUE int32_ge_self(VALUE self, VALUE other) {
3548
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3549
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3550
- ndfunc_t ndf = {iter_int32_ge, STRIDE_LOOP, 2, 1, ain, aout};
3582
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3583
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3584
+ ndfunc_t ndf = { iter_int32_ge, STRIDE_LOOP, 2, 1, ain, aout };
3551
3585
 
3552
3586
  return na_ndloop(&ndf, 2, self, other);
3553
3587
  }
@@ -3555,8 +3589,8 @@ static VALUE int32_ge_self(VALUE self, VALUE other) {
3555
3589
  /*
3556
3590
  Comparison ge other.
3557
3591
  @overload ge other
3558
- @param [Numo::NArray,Numeric] other
3559
- @return [Numo::Bit] result of self ge other.
3592
+ @param [Numo::NArray,Numeric] other
3593
+ @return [Numo::Bit] result of self ge other.
3560
3594
  */
3561
3595
  static VALUE int32_ge(VALUE self, VALUE other) {
3562
3596
 
@@ -3592,9 +3626,9 @@ static void iter_int32_lt(na_loop_t* const lp) {
3592
3626
  }
3593
3627
 
3594
3628
  static VALUE int32_lt_self(VALUE self, VALUE other) {
3595
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3596
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3597
- ndfunc_t ndf = {iter_int32_lt, STRIDE_LOOP, 2, 1, ain, aout};
3629
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3630
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3631
+ ndfunc_t ndf = { iter_int32_lt, STRIDE_LOOP, 2, 1, ain, aout };
3598
3632
 
3599
3633
  return na_ndloop(&ndf, 2, self, other);
3600
3634
  }
@@ -3602,8 +3636,8 @@ static VALUE int32_lt_self(VALUE self, VALUE other) {
3602
3636
  /*
3603
3637
  Comparison lt other.
3604
3638
  @overload lt other
3605
- @param [Numo::NArray,Numeric] other
3606
- @return [Numo::Bit] result of self lt other.
3639
+ @param [Numo::NArray,Numeric] other
3640
+ @return [Numo::Bit] result of self lt other.
3607
3641
  */
3608
3642
  static VALUE int32_lt(VALUE self, VALUE other) {
3609
3643
 
@@ -3639,9 +3673,9 @@ static void iter_int32_le(na_loop_t* const lp) {
3639
3673
  }
3640
3674
 
3641
3675
  static VALUE int32_le_self(VALUE self, VALUE other) {
3642
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3643
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3644
- ndfunc_t ndf = {iter_int32_le, STRIDE_LOOP, 2, 1, ain, aout};
3676
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3677
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3678
+ ndfunc_t ndf = { iter_int32_le, STRIDE_LOOP, 2, 1, ain, aout };
3645
3679
 
3646
3680
  return na_ndloop(&ndf, 2, self, other);
3647
3681
  }
@@ -3649,8 +3683,8 @@ static VALUE int32_le_self(VALUE self, VALUE other) {
3649
3683
  /*
3650
3684
  Comparison le other.
3651
3685
  @overload le other
3652
- @param [Numo::NArray,Numeric] other
3653
- @return [Numo::Bit] result of self le other.
3686
+ @param [Numo::NArray,Numeric] other
3687
+ @return [Numo::Bit] result of self le other.
3654
3688
  */
3655
3689
  static VALUE int32_le(VALUE self, VALUE other) {
3656
3690
 
@@ -3733,9 +3767,9 @@ static void iter_int32_clip_max(na_loop_t* const lp) {
3733
3767
  Clip array elements by [min,max].
3734
3768
  If either of min or max is nil, one side is clipped.
3735
3769
  @overload clip(min,max)
3736
- @param [Numo::NArray,Numeric] min
3737
- @param [Numo::NArray,Numeric] max
3738
- @return [Numo::NArray] result of clip.
3770
+ @param [Numo::NArray,Numeric] min
3771
+ @param [Numo::NArray,Numeric] max
3772
+ @return [Numo::NArray] result of clip.
3739
3773
 
3740
3774
  @example
3741
3775
  a = Numo::Int32.new(10).seq
@@ -3760,11 +3794,11 @@ static void iter_int32_clip_max(na_loop_t* const lp) {
3760
3794
  # [3, 4, 2, 3, 4, 5, 6, 7, 8, 8]
3761
3795
  */
3762
3796
  static VALUE int32_clip(VALUE self, VALUE min, VALUE max) {
3763
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {cT, 0}, {cT, 0}};
3764
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3765
- ndfunc_t ndf_min = {iter_int32_clip_min, STRIDE_LOOP, 2, 1, ain, aout};
3766
- ndfunc_t ndf_max = {iter_int32_clip_max, STRIDE_LOOP, 2, 1, ain, aout};
3767
- ndfunc_t ndf_both = {iter_int32_clip, STRIDE_LOOP, 3, 1, ain, aout};
3797
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { cT, 0 }, { cT, 0 } };
3798
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3799
+ ndfunc_t ndf_min = { iter_int32_clip_min, STRIDE_LOOP, 2, 1, ain, aout };
3800
+ ndfunc_t ndf_max = { iter_int32_clip_max, STRIDE_LOOP, 2, 1, ain, aout };
3801
+ ndfunc_t ndf_both = { iter_int32_clip, STRIDE_LOOP, 3, 1, ain, aout };
3768
3802
 
3769
3803
  if (RTEST(min)) {
3770
3804
  if (RTEST(max)) {
@@ -3796,15 +3830,16 @@ static void iter_int32_sum(na_loop_t* const lp) {
3796
3830
  /*
3797
3831
  sum of self.
3798
3832
  @overload sum(axis:nil, keepdims:false)
3799
- @param [Numeric,Array,Range] axis Performs sum along the axis.
3800
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3801
- @return [Numo::Int32] returns result of sum.
3833
+ @param [Numeric,Array,Range] axis Performs sum along the axis.
3834
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3835
+ dimensions with size one.
3836
+ @return [Numo::Int32] returns result of sum.
3802
3837
  */
3803
3838
  static VALUE int32_sum(int argc, VALUE* argv, VALUE self) {
3804
3839
  VALUE v, reduce;
3805
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3806
- ndfunc_arg_out_t aout[1] = {{numo_cInt64, 0}};
3807
- ndfunc_t ndf = {iter_int32_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3840
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3841
+ ndfunc_arg_out_t aout[1] = { { numo_cInt64, 0 } };
3842
+ ndfunc_t ndf = { iter_int32_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3808
3843
 
3809
3844
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3810
3845
 
@@ -3828,15 +3863,16 @@ static void iter_int32_prod(na_loop_t* const lp) {
3828
3863
  /*
3829
3864
  prod of self.
3830
3865
  @overload prod(axis:nil, keepdims:false)
3831
- @param [Numeric,Array,Range] axis Performs prod along the axis.
3832
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3833
- @return [Numo::Int32] returns result of prod.
3866
+ @param [Numeric,Array,Range] axis Performs prod along the axis.
3867
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3868
+ dimensions with size one.
3869
+ @return [Numo::Int32] returns result of prod.
3834
3870
  */
3835
3871
  static VALUE int32_prod(int argc, VALUE* argv, VALUE self) {
3836
3872
  VALUE v, reduce;
3837
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3838
- ndfunc_arg_out_t aout[1] = {{numo_cInt64, 0}};
3839
- ndfunc_t ndf = {iter_int32_prod, 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] = { { numo_cInt64, 0 } };
3875
+ ndfunc_t ndf = { iter_int32_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3840
3876
 
3841
3877
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3842
3878
 
@@ -3860,15 +3896,16 @@ static void iter_int32_min(na_loop_t* const lp) {
3860
3896
  /*
3861
3897
  min of self.
3862
3898
  @overload min(axis:nil, keepdims:false)
3863
- @param [Numeric,Array,Range] axis Performs min along the axis.
3864
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3865
- @return [Numo::Int32] returns result of min.
3899
+ @param [Numeric,Array,Range] axis Performs min along the axis.
3900
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3901
+ dimensions with size one.
3902
+ @return [Numo::Int32] returns result of min.
3866
3903
  */
3867
3904
  static VALUE int32_min(int argc, VALUE* argv, VALUE self) {
3868
3905
  VALUE v, reduce;
3869
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3870
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3871
- ndfunc_t ndf = {iter_int32_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3906
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3907
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3908
+ ndfunc_t ndf = { iter_int32_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3872
3909
 
3873
3910
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3874
3911
 
@@ -3892,15 +3929,16 @@ static void iter_int32_max(na_loop_t* const lp) {
3892
3929
  /*
3893
3930
  max of self.
3894
3931
  @overload max(axis:nil, keepdims:false)
3895
- @param [Numeric,Array,Range] axis Performs max along the axis.
3896
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3897
- @return [Numo::Int32] returns result of max.
3932
+ @param [Numeric,Array,Range] axis Performs max along the axis.
3933
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3934
+ dimensions with size one.
3935
+ @return [Numo::Int32] returns result of max.
3898
3936
  */
3899
3937
  static VALUE int32_max(int argc, VALUE* argv, VALUE self) {
3900
3938
  VALUE v, reduce;
3901
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3902
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3903
- ndfunc_t ndf = {iter_int32_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3939
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3940
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3941
+ ndfunc_t ndf = { iter_int32_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3904
3942
 
3905
3943
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3906
3944
 
@@ -3924,15 +3962,16 @@ static void iter_int32_ptp(na_loop_t* const lp) {
3924
3962
  /*
3925
3963
  ptp of self.
3926
3964
  @overload ptp(axis:nil, keepdims:false)
3927
- @param [Numeric,Array,Range] axis Performs ptp along the axis.
3928
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3929
- @return [Numo::Int32] returns result of ptp.
3965
+ @param [Numeric,Array,Range] axis Performs ptp along the axis.
3966
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3967
+ dimensions with size one.
3968
+ @return [Numo::Int32] returns result of ptp.
3930
3969
  */
3931
3970
  static VALUE int32_ptp(int argc, VALUE* argv, VALUE self) {
3932
3971
  VALUE v, reduce;
3933
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3934
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3935
- ndfunc_t ndf = {iter_int32_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3972
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3973
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3974
+ ndfunc_t ndf = { iter_int32_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3936
3975
 
3937
3976
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3938
3977
 
@@ -3978,8 +4017,9 @@ static void iter_int32_max_index_index32(na_loop_t* const lp) {
3978
4017
  /*
3979
4018
  Index of the maximum value.
3980
4019
  @overload max_index(axis:nil)
3981
- @param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d indices**.
3982
- @return [Integer,Numo::Int] returns result indices.
4020
+ @param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat
4021
+ 1-d indices**.
4022
+ @return [Integer,Numo::Int] returns result indices.
3983
4023
  @see #argmax
3984
4024
  @see #max
3985
4025
 
@@ -3996,9 +4036,9 @@ static void iter_int32_max_index_index32(na_loop_t* const lp) {
3996
4036
  static VALUE int32_max_index(int argc, VALUE* argv, VALUE self) {
3997
4037
  narray_t* na;
3998
4038
  VALUE idx, reduce;
3999
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
4000
- ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
4001
- ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
4039
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
4040
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
4041
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
4002
4042
 
4003
4043
  GetNArray(self, na);
4004
4044
  if (na->ndim == 0) {
@@ -4060,8 +4100,9 @@ static void iter_int32_min_index_index32(na_loop_t* const lp) {
4060
4100
  /*
4061
4101
  Index of the minimum value.
4062
4102
  @overload min_index(axis:nil)
4063
- @param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d indices**.
4064
- @return [Integer,Numo::Int] returns result indices.
4103
+ @param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat
4104
+ 1-d indices**.
4105
+ @return [Integer,Numo::Int] returns result indices.
4065
4106
  @see #argmin
4066
4107
  @see #min
4067
4108
 
@@ -4078,9 +4119,9 @@ static void iter_int32_min_index_index32(na_loop_t* const lp) {
4078
4119
  static VALUE int32_min_index(int argc, VALUE* argv, VALUE self) {
4079
4120
  narray_t* na;
4080
4121
  VALUE idx, reduce;
4081
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
4082
- ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
4083
- ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
4122
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
4123
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
4124
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
4084
4125
 
4085
4126
  GetNArray(self, na);
4086
4127
  if (na->ndim == 0) {
@@ -4140,8 +4181,9 @@ static void iter_int32_argmax_arg32(na_loop_t* const lp) {
4140
4181
  /*
4141
4182
  Index of the maximum value.
4142
4183
  @overload argmax(axis:nil)
4143
- @param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices along the axis**.
4144
- @return [Integer,Numo::Int] returns the result indices.
4184
+ @param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
4185
+ along the axis**.
4186
+ @return [Integer,Numo::Int] returns the result indices.
4145
4187
  @see #max_index
4146
4188
  @see #max
4147
4189
 
@@ -4158,9 +4200,9 @@ static void iter_int32_argmax_arg32(na_loop_t* const lp) {
4158
4200
  static VALUE int32_argmax(int argc, VALUE* argv, VALUE self) {
4159
4201
  narray_t* na;
4160
4202
  VALUE reduce;
4161
- ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
4162
- ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
4163
- ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
4203
+ ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
4204
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
4205
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
4164
4206
 
4165
4207
  GetNArray(self, na);
4166
4208
  if (na->ndim == 0) {
@@ -4217,8 +4259,9 @@ static void iter_int32_argmin_arg32(na_loop_t* const lp) {
4217
4259
  /*
4218
4260
  Index of the minimum value.
4219
4261
  @overload argmin(axis:nil)
4220
- @param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices along the axis**.
4221
- @return [Integer,Numo::Int] returns the result indices.
4262
+ @param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
4263
+ along the axis**.
4264
+ @return [Integer,Numo::Int] returns the result indices.
4222
4265
  @see #min_index
4223
4266
  @see #min
4224
4267
 
@@ -4235,9 +4278,9 @@ static void iter_int32_argmin_arg32(na_loop_t* const lp) {
4235
4278
  static VALUE int32_argmin(int argc, VALUE* argv, VALUE self) {
4236
4279
  narray_t* na;
4237
4280
  VALUE reduce;
4238
- ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
4239
- ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
4240
- ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
4281
+ ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
4282
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
4283
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
4241
4284
 
4242
4285
  GetNArray(self, na);
4243
4286
  if (na->ndim == 0) {
@@ -4277,29 +4320,24 @@ static void iter_int32_minmax(na_loop_t* const lp) {
4277
4320
  /*
4278
4321
  minmax of self.
4279
4322
  @overload minmax(axis:nil, keepdims:false)
4280
- @param [Numeric,Array,Range] axis Finds min-max along the axis.
4281
- @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array as dimensions with size one.
4282
- @return [Numo::Int32,Numo::Int32] min and max of self.
4323
+ @param [Numeric,Array,Range] axis Finds min-max along the axis.
4324
+ @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
4325
+ as dimensions with size one.
4326
+ @return [Numo::Int32,Numo::Int32] min and max of self.
4283
4327
  */
4284
4328
  static VALUE int32_minmax(int argc, VALUE* argv, VALUE self) {
4285
4329
  VALUE reduce;
4286
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4287
- ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
4288
- ndfunc_t ndf = {iter_int32_minmax, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 2, ain, aout};
4330
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4331
+ ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
4332
+ ndfunc_t ndf = {
4333
+ iter_int32_minmax, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 2, ain, aout
4334
+ };
4289
4335
 
4290
4336
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
4291
4337
 
4292
4338
  return na_ndloop(&ndf, 2, self, reduce);
4293
4339
  }
4294
4340
 
4295
- /*
4296
- Element-wise maximum of two arrays.
4297
-
4298
- @overload maximum(a1, a2)
4299
- @param [Numo::NArray,Numeric] a1,a2 The arrays holding the elements to be compared.
4300
- @return [Numo::Int32]
4301
- */
4302
-
4303
4341
  static void iter_int32_s_maximum(na_loop_t* const lp) {
4304
4342
  size_t i, n;
4305
4343
  char *p1, *p2, *p3;
@@ -4323,23 +4361,15 @@ static void iter_int32_s_maximum(na_loop_t* const lp) {
4323
4361
  static VALUE int32_s_maximum(int argc, VALUE* argv, VALUE mod) {
4324
4362
  VALUE a1 = Qnil;
4325
4363
  VALUE a2 = Qnil;
4326
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
4327
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4328
- ndfunc_t ndf = {iter_int32_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
4364
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
4365
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4366
+ ndfunc_t ndf = { iter_int32_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
4329
4367
 
4330
4368
  rb_scan_args(argc, argv, "20", &a1, &a2);
4331
4369
 
4332
4370
  return na_ndloop(&ndf, 2, a1, a2);
4333
4371
  }
4334
4372
 
4335
- /*
4336
- Element-wise minimum of two arrays.
4337
-
4338
- @overload minimum(a1, a2)
4339
- @param [Numo::NArray,Numeric] a1,a2 The arrays holding the elements to be compared.
4340
- @return [Numo::Int32]
4341
- */
4342
-
4343
4373
  static void iter_int32_s_minimum(na_loop_t* const lp) {
4344
4374
  size_t i, n;
4345
4375
  char *p1, *p2, *p3;
@@ -4363,9 +4393,9 @@ static void iter_int32_s_minimum(na_loop_t* const lp) {
4363
4393
  static VALUE int32_s_minimum(int argc, VALUE* argv, VALUE mod) {
4364
4394
  VALUE a1 = Qnil;
4365
4395
  VALUE a2 = Qnil;
4366
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
4367
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4368
- ndfunc_t ndf = {iter_int32_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
4396
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
4397
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4398
+ ndfunc_t ndf = { iter_int32_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
4369
4399
 
4370
4400
  rb_scan_args(argc, argv, "20", &a1, &a2);
4371
4401
 
@@ -4404,10 +4434,12 @@ static void iter_int32_bincount_32(na_loop_t* const lp) {
4404
4434
  }
4405
4435
 
4406
4436
  static VALUE int32_bincount_32(VALUE self, size_t length) {
4407
- size_t shape_out[1] = {length};
4408
- ndfunc_arg_in_t ain[1] = {{cT, 1}};
4409
- ndfunc_arg_out_t aout[1] = {{numo_cUInt32, 1, shape_out}};
4410
- ndfunc_t ndf = {iter_int32_bincount_32, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout};
4437
+ size_t shape_out[1] = { length };
4438
+ ndfunc_arg_in_t ain[1] = { { cT, 1 } };
4439
+ ndfunc_arg_out_t aout[1] = { { numo_cUInt32, 1, shape_out } };
4440
+ ndfunc_t ndf = {
4441
+ iter_int32_bincount_32, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout
4442
+ };
4411
4443
 
4412
4444
  return na_ndloop(&ndf, 1, self);
4413
4445
  }
@@ -4442,10 +4474,12 @@ static void iter_int32_bincount_64(na_loop_t* const lp) {
4442
4474
  }
4443
4475
 
4444
4476
  static VALUE int32_bincount_64(VALUE self, size_t length) {
4445
- size_t shape_out[1] = {length};
4446
- ndfunc_arg_in_t ain[1] = {{cT, 1}};
4447
- ndfunc_arg_out_t aout[1] = {{numo_cUInt64, 1, shape_out}};
4448
- ndfunc_t ndf = {iter_int32_bincount_64, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout};
4477
+ size_t shape_out[1] = { length };
4478
+ ndfunc_arg_in_t ain[1] = { { cT, 1 } };
4479
+ ndfunc_arg_out_t aout[1] = { { numo_cUInt64, 1, shape_out } };
4480
+ ndfunc_t ndf = {
4481
+ iter_int32_bincount_64, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout
4482
+ };
4449
4483
 
4450
4484
  return na_ndloop(&ndf, 1, self);
4451
4485
  }
@@ -4482,10 +4516,10 @@ static void iter_int32_bincount_sf(na_loop_t* const lp) {
4482
4516
  }
4483
4517
 
4484
4518
  static VALUE int32_bincount_sf(VALUE self, VALUE weight, size_t length) {
4485
- size_t shape_out[1] = {length};
4486
- ndfunc_arg_in_t ain[2] = {{cT, 1}, {numo_cSFloat, 1}};
4487
- ndfunc_arg_out_t aout[1] = {{numo_cSFloat, 1, shape_out}};
4488
- ndfunc_t ndf = {iter_int32_bincount_sf, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout};
4519
+ size_t shape_out[1] = { length };
4520
+ ndfunc_arg_in_t ain[2] = { { cT, 1 }, { numo_cSFloat, 1 } };
4521
+ ndfunc_arg_out_t aout[1] = { { numo_cSFloat, 1, shape_out } };
4522
+ ndfunc_t ndf = { iter_int32_bincount_sf, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout };
4489
4523
 
4490
4524
  return na_ndloop(&ndf, 2, self, weight);
4491
4525
  }
@@ -4519,10 +4553,10 @@ static void iter_int32_bincount_df(na_loop_t* const lp) {
4519
4553
  }
4520
4554
 
4521
4555
  static VALUE int32_bincount_df(VALUE self, VALUE weight, size_t length) {
4522
- size_t shape_out[1] = {length};
4523
- ndfunc_arg_in_t ain[2] = {{cT, 1}, {numo_cDFloat, 1}};
4524
- ndfunc_arg_out_t aout[1] = {{numo_cDFloat, 1, shape_out}};
4525
- ndfunc_t ndf = {iter_int32_bincount_df, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout};
4556
+ size_t shape_out[1] = { length };
4557
+ ndfunc_arg_in_t ain[2] = { { cT, 1 }, { numo_cDFloat, 1 } };
4558
+ ndfunc_arg_out_t aout[1] = { { numo_cDFloat, 1, shape_out } };
4559
+ ndfunc_t ndf = { iter_int32_bincount_df, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout };
4526
4560
 
4527
4561
  return na_ndloop(&ndf, 2, self, weight);
4528
4562
  }
@@ -4533,13 +4567,13 @@ static VALUE int32_bincount_df(VALUE self, VALUE weight, size_t length) {
4533
4567
  Only Integer-types has this method.
4534
4568
 
4535
4569
  @overload bincount([weight], minlength:nil)
4536
- @param [SFloat or DFloat or Array] weight (optional) Array of
4537
- float values. Its size along last axis should be same as that of self.
4538
- @param [Integer] minlength (keyword, optional) Minimum size along
4539
- last axis for the output array.
4540
- @return [UInt32 or UInt64 or SFloat or DFloat]
4541
- Returns Float NArray if weight array is supplied,
4542
- otherwise returns UInt32 or UInt64 depending on the size along last axis.
4570
+ @param [SFloat or DFloat or Array] weight (optional) Array of
4571
+ float values. Its size along last axis should be same as that of self.
4572
+ @param [Integer] minlength (keyword, optional) Minimum size along
4573
+ last axis for the output array.
4574
+ @return [UInt32 or UInt64 or SFloat or DFloat]
4575
+ Returns Float NArray if weight array is supplied,
4576
+ otherwise returns UInt32 or UInt64 depending on the size along last axis.
4543
4577
  @example
4544
4578
  Numo::Int32[0..4].bincount
4545
4579
  # => Numo::UInt32#shape=[5]
@@ -4562,9 +4596,9 @@ static VALUE int32_bincount_df(VALUE self, VALUE weight, size_t length) {
4562
4596
  */
4563
4597
  static VALUE int32_bincount(int argc, VALUE* argv, VALUE self) {
4564
4598
  VALUE weight = Qnil, kw = Qnil;
4565
- VALUE opts[1] = {Qundef};
4599
+ VALUE opts[1] = { Qundef };
4566
4600
  VALUE v, wclass;
4567
- ID table[1] = {id_minlength};
4601
+ ID table[1] = { id_minlength };
4568
4602
  size_t length, minlength;
4569
4603
 
4570
4604
  rb_scan_args(argc, argv, "01:", &weight, &kw);
@@ -4610,31 +4644,30 @@ static void iter_int32_cumsum(na_loop_t* const lp) {
4610
4644
  INIT_COUNTER(lp, i);
4611
4645
  INIT_PTR(lp, 0, p1, s1);
4612
4646
  INIT_PTR(lp, 1, p2, s2);
4613
- // printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
4614
4647
 
4615
4648
  GET_DATA_STRIDE(p1, s1, dtype, x);
4616
4649
  SET_DATA_STRIDE(p2, s2, dtype, x);
4617
- // printf("i=%lu x=%f\n",i,x);
4618
4650
  for (i--; i--;) {
4619
4651
  GET_DATA_STRIDE(p1, s1, dtype, y);
4620
4652
  m_cumsum(x, y);
4621
4653
  SET_DATA_STRIDE(p2, s2, dtype, x);
4622
- // printf("i=%lu x=%f\n",i,x);
4623
4654
  }
4624
4655
  }
4625
4656
 
4626
4657
  /*
4627
4658
  cumsum of self.
4628
4659
  @overload cumsum(axis:nil, nan:false)
4629
- @param [Numeric,Array,Range] axis Performs cumsum along the axis.
4630
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
4631
- @return [Numo::Int32] cumsum of self.
4660
+ @param [Numeric,Array,Range] axis Performs cumsum along the axis.
4661
+ @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
4662
+ @return [Numo::Int32] cumsum of self.
4632
4663
  */
4633
4664
  static VALUE int32_cumsum(int argc, VALUE* argv, VALUE self) {
4634
4665
  VALUE reduce;
4635
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4636
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4637
- ndfunc_t ndf = {iter_int32_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout};
4666
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4667
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4668
+ ndfunc_t ndf = {
4669
+ iter_int32_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
4670
+ };
4638
4671
 
4639
4672
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
4640
4673
 
@@ -4650,31 +4683,30 @@ static void iter_int32_cumprod(na_loop_t* const lp) {
4650
4683
  INIT_COUNTER(lp, i);
4651
4684
  INIT_PTR(lp, 0, p1, s1);
4652
4685
  INIT_PTR(lp, 1, p2, s2);
4653
- // printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
4654
4686
 
4655
4687
  GET_DATA_STRIDE(p1, s1, dtype, x);
4656
4688
  SET_DATA_STRIDE(p2, s2, dtype, x);
4657
- // printf("i=%lu x=%f\n",i,x);
4658
4689
  for (i--; i--;) {
4659
4690
  GET_DATA_STRIDE(p1, s1, dtype, y);
4660
4691
  m_cumprod(x, y);
4661
4692
  SET_DATA_STRIDE(p2, s2, dtype, x);
4662
- // printf("i=%lu x=%f\n",i,x);
4663
4693
  }
4664
4694
  }
4665
4695
 
4666
4696
  /*
4667
4697
  cumprod of self.
4668
4698
  @overload cumprod(axis:nil, nan:false)
4669
- @param [Numeric,Array,Range] axis Performs cumprod along the axis.
4670
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
4671
- @return [Numo::Int32] cumprod of self.
4699
+ @param [Numeric,Array,Range] axis Performs cumprod along the axis.
4700
+ @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
4701
+ @return [Numo::Int32] cumprod of self.
4672
4702
  */
4673
4703
  static VALUE int32_cumprod(int argc, VALUE* argv, VALUE self) {
4674
4704
  VALUE reduce;
4675
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4676
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4677
- ndfunc_t ndf = {iter_int32_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout};
4705
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4706
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4707
+ ndfunc_t ndf = {
4708
+ iter_int32_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
4709
+ };
4678
4710
 
4679
4711
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
4680
4712
 
@@ -4720,9 +4752,9 @@ static void iter_int32_mulsum(na_loop_t* const lp) {
4720
4752
  static VALUE int32_mulsum_self(int argc, VALUE* argv, VALUE self) {
4721
4753
  VALUE v, reduce;
4722
4754
  VALUE naryv[2];
4723
- ndfunc_arg_in_t ain[4] = {{cT, 0}, {cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
4724
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4725
- ndfunc_t ndf = {iter_int32_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout};
4755
+ ndfunc_arg_in_t ain[4] = { { cT, 0 }, { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
4756
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4757
+ ndfunc_t ndf = { iter_int32_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout };
4726
4758
 
4727
4759
  if (argc < 1) {
4728
4760
  rb_raise(rb_eArgError, "wrong number of arguments (%d for >=1)", argc);
@@ -4742,10 +4774,11 @@ static VALUE int32_mulsum_self(int argc, VALUE* argv, VALUE self) {
4742
4774
  Binary mulsum.
4743
4775
 
4744
4776
  @overload mulsum(other, axis:nil, keepdims:false)
4745
- @param [Numo::NArray,Numeric] other
4746
- @param [Numeric,Array,Range] axis Performs mulsum along the axis.
4747
- @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array as dimensions with size one.
4748
- @return [Numo::NArray] mulsum of self and other.
4777
+ @param [Numo::NArray,Numeric] other
4778
+ @param [Numeric,Array,Range] axis Performs mulsum along the axis.
4779
+ @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
4780
+ as dimensions with size one.
4781
+ @return [Numo::NArray] mulsum of self and other.
4749
4782
  */
4750
4783
  static VALUE int32_mulsum(int argc, VALUE* argv, VALUE self) {
4751
4784
  //
@@ -4814,9 +4847,9 @@ static void iter_int32_seq(na_loop_t* const lp) {
4814
4847
  beg+i*step
4815
4848
  where i is 1-dimensional index.
4816
4849
  @overload seq([beg,[step]])
4817
- @param [Numeric] beg beginning of sequence. (default=0)
4818
- @param [Numeric] step step of sequence. (default=1)
4819
- @return [Numo::Int32] self.
4850
+ @param [Numeric] beg beginning of sequence. (default=0)
4851
+ @param [Numeric] step step of sequence. (default=1)
4852
+ @return [Numo::Int32] self.
4820
4853
  @example
4821
4854
  Numo::DFloat.new(6).seq(1,-0.2)
4822
4855
  # => Numo::DFloat#shape=[6]
@@ -4826,17 +4859,17 @@ static void iter_int32_seq(na_loop_t* const lp) {
4826
4859
  # => Numo::DComplex#shape=[6]
4827
4860
  # [1+0i, 0.8+0.2i, 0.6+0.4i, 0.4+0.6i, 0.2+0.8i, 0+1i]
4828
4861
  */
4829
- static VALUE int32_seq(int argc, VALUE* args, VALUE self) {
4862
+ static VALUE int32_seq(int argc, VALUE* argv, VALUE self) {
4830
4863
  seq_opt_t* g;
4831
4864
  VALUE vbeg = Qnil, vstep = Qnil;
4832
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
4833
- ndfunc_t ndf = {iter_int32_seq, FULL_LOOP, 1, 0, ain, 0};
4865
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
4866
+ ndfunc_t ndf = { iter_int32_seq, FULL_LOOP, 1, 0, ain, 0 };
4834
4867
 
4835
4868
  g = ALLOCA_N(seq_opt_t, 1);
4836
4869
  g->beg = m_zero;
4837
4870
  g->step = m_one;
4838
4871
  g->count = 0;
4839
- rb_scan_args(argc, args, "02", &vbeg, &vstep);
4872
+ rb_scan_args(argc, argv, "02", &vbeg, &vstep);
4840
4873
  if (vbeg != Qnil) {
4841
4874
  g->beg = NUM2DBL(vbeg);
4842
4875
  }
@@ -4880,15 +4913,15 @@ static void iter_int32_eye(na_loop_t* const lp) {
4880
4913
  /*
4881
4914
  Eye: Set a value to diagonal components, set 0 to non-diagonal components.
4882
4915
  @overload eye([element,offset])
4883
- @param [Numeric] element Diagonal element to be stored. Default is 1.
4884
- @param [Integer] offset Diagonal offset from the main diagonal. The
4885
- default is 0. k>0 for diagonals above the main diagonal, and k<0
4886
- for diagonals below the main diagonal.
4887
- @return [Numo::Int32] eye of self.
4916
+ @param [Numeric] element Diagonal element to be stored. Default is 1.
4917
+ @param [Integer] offset Diagonal offset from the main diagonal. The
4918
+ default is 0. k>0 for diagonals above the main diagonal, and k<0
4919
+ for diagonals below the main diagonal.
4920
+ @return [Numo::Int32] eye of self.
4888
4921
  */
4889
4922
  static VALUE int32_eye(int argc, VALUE* argv, VALUE self) {
4890
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 2}};
4891
- ndfunc_t ndf = {iter_int32_eye, NO_LOOP, 1, 0, ain, 0};
4923
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 2 } };
4924
+ ndfunc_t ndf = { iter_int32_eye, NO_LOOP, 1, 0, ain, 0 };
4892
4925
  ssize_t kofs;
4893
4926
  dtype data;
4894
4927
  char* g;
@@ -4918,17 +4951,21 @@ static VALUE int32_eye(int argc, VALUE* argv, VALUE self) {
4918
4951
  // Diagonal offset from the main diagonal.
4919
4952
  if (kofs >= 0) {
4920
4953
  if ((size_t)(kofs) >= na->shape[nd - 1]) {
4921
- rb_raise(rb_eArgError,
4922
- "invalid diagonal offset(%" SZF "d) for "
4923
- "last dimension size(%" SZF "d)",
4924
- kofs, na->shape[nd - 1]);
4954
+ rb_raise(
4955
+ rb_eArgError,
4956
+ "invalid diagonal offset(%" SZF "d) for "
4957
+ "last dimension size(%" SZF "d)",
4958
+ kofs, na->shape[nd - 1]
4959
+ );
4925
4960
  }
4926
4961
  } else {
4927
4962
  if ((size_t)(-kofs) >= na->shape[nd - 2]) {
4928
- rb_raise(rb_eArgError,
4929
- "invalid diagonal offset(%" SZF "d) for "
4930
- "last-1 dimension size(%" SZF "d)",
4931
- kofs, na->shape[nd - 2]);
4963
+ rb_raise(
4964
+ rb_eArgError,
4965
+ "invalid diagonal offset(%" SZF "d) for "
4966
+ "last-1 dimension size(%" SZF "d)",
4967
+ kofs, na->shape[nd - 2]
4968
+ );
4932
4969
  }
4933
4970
  }
4934
4971
 
@@ -5012,9 +5049,10 @@ static void iter_int32_rand(na_loop_t* const lp) {
5012
5049
  /*
5013
5050
  Generate uniformly distributed random numbers on self narray.
5014
5051
  @overload rand([[low],high])
5015
- @param [Numeric] low lower inclusive boundary of random numbers. (default=0)
5016
- @param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for complex types)
5017
- @return [Numo::Int32] self.
5052
+ @param [Numeric] low lower inclusive boundary of random numbers. (default=0)
5053
+ @param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
5054
+ complex types)
5055
+ @return [Numo::Int32] self.
5018
5056
  @example
5019
5057
  Numo::DFloat.new(6).rand
5020
5058
  # => Numo::DFloat#shape=[6]
@@ -5028,14 +5066,14 @@ static void iter_int32_rand(na_loop_t* const lp) {
5028
5066
  # => Numo::Int32#shape=[6]
5029
5067
  # [4, 3, 3, 2, 4, 2]
5030
5068
  */
5031
- static VALUE int32_rand(int argc, VALUE* args, VALUE self) {
5069
+ static VALUE int32_rand(int argc, VALUE* argv, VALUE self) {
5032
5070
  rand_opt_t g;
5033
5071
  VALUE v1 = Qnil, v2 = Qnil;
5034
5072
  dtype high;
5035
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
5036
- ndfunc_t ndf = {iter_int32_rand, FULL_LOOP, 1, 0, ain, 0};
5073
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
5074
+ ndfunc_t ndf = { iter_int32_rand, FULL_LOOP, 1, 0, ain, 0 };
5037
5075
 
5038
- rb_scan_args(argc, args, "11", &v1, &v2);
5076
+ rb_scan_args(argc, argv, "11", &v1, &v2);
5039
5077
  if (v2 == Qnil) {
5040
5078
  g.low = m_zero;
5041
5079
  g.max = high = m_num_to_data(v1);
@@ -5074,15 +5112,15 @@ static void iter_int32_poly(na_loop_t* const lp) {
5074
5112
  Calculate polynomial.
5075
5113
  `x.poly(a0,a1,a2,...,an) = a0 + a1*x + a2*x**2 + ... + an*x**n`
5076
5114
  @overload poly a0, a1, ..., an
5077
- @param [Numo::NArray,Numeric] a0,a1,...,an
5078
- @return [Numo::Int32]
5115
+ @param [Numo::NArray,Numeric] a0,a1,...,an
5116
+ @return [Numo::Int32]
5079
5117
  */
5080
5118
  static VALUE int32_poly(VALUE self, VALUE args) {
5081
5119
  int argc, i;
5082
5120
  VALUE* argv;
5083
5121
  volatile VALUE v, a;
5084
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5085
- ndfunc_t ndf = {iter_int32_poly, NO_LOOP, 0, 1, 0, aout};
5122
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5123
+ ndfunc_t ndf = { iter_int32_poly, NO_LOOP, 0, 1, 0, aout };
5086
5124
 
5087
5125
  argc = (int)RARRAY_LEN(args);
5088
5126
  ndf.nin = argc + 1;
@@ -5162,23 +5200,28 @@ static VALUE int32_poly(VALUE self, VALUE args) {
5162
5200
  * We have modified their original by adding a check for already-sorted input,
5163
5201
  * which seems to be a win per discussions on pgsql-hackers around 2006-03-21.
5164
5202
  */
5165
- #define swapcode(TYPE, parmi, parmj, n) \
5166
- do { \
5167
- size_t i = (n) / sizeof(TYPE); \
5168
- TYPE* pi = (TYPE*)(void*)(parmi); \
5169
- TYPE* pj = (TYPE*)(void*)(parmj); \
5170
- do { \
5171
- TYPE t = *pi; \
5172
- *pi++ = *pj; \
5173
- *pj++ = t; \
5174
- } while (--i > 0); \
5203
+ #define swapcode(TYPE, parmi, parmj, n) \
5204
+ do { \
5205
+ size_t i = (n) / sizeof(TYPE); \
5206
+ TYPE* pi = (TYPE*)(void*)(parmi); \
5207
+ TYPE* pj = (TYPE*)(void*)(parmj); \
5208
+ do { \
5209
+ TYPE t = *pi; \
5210
+ *pi++ = *pj; \
5211
+ *pj++ = t; \
5212
+ } while (--i > 0); \
5175
5213
  } while (0)
5176
5214
 
5177
5215
  #ifdef HAVE_STDINT_H
5178
- #define SWAPINIT(a, es) swaptype = (uintptr_t)(a) % sizeof(long) || (es) % sizeof(long) ? 2 : (es) == sizeof(long) ? 0 : 1;
5216
+ #define SWAPINIT(a, es) \
5217
+ swaptype = (uintptr_t)(a) % sizeof(long) || (es) % sizeof(long) ? 2 \
5218
+ : (es) == sizeof(long) ? 0 \
5219
+ : 1;
5179
5220
  #else
5180
- #define SWAPINIT(a, es) \
5181
- swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2 : (es) == sizeof(long) ? 0 : 1;
5221
+ #define SWAPINIT(a, es) \
5222
+ swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2 \
5223
+ : (es) == sizeof(long) ? 0 \
5224
+ : 1;
5182
5225
  #endif
5183
5226
 
5184
5227
  static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
@@ -5188,19 +5231,20 @@ static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
5188
5231
  swapcode(char, a, b, n);
5189
5232
  }
5190
5233
 
5191
- #define swap(a, b) \
5192
- if (swaptype == 0) { \
5193
- long t = *(long*)(void*)(a); \
5194
- *(long*)(void*)(a) = *(long*)(void*)(b); \
5195
- *(long*)(void*)(b) = t; \
5196
- } else \
5234
+ #define swap(a, b) \
5235
+ if (swaptype == 0) { \
5236
+ long t = *(long*)(void*)(a); \
5237
+ *(long*)(void*)(a) = *(long*)(void*)(b); \
5238
+ *(long*)(void*)(b) = t; \
5239
+ } else \
5197
5240
  swapfunc(a, b, es, swaptype)
5198
5241
 
5199
- #define vecswap(a, b, n) \
5242
+ #define vecswap(a, b, n) \
5200
5243
  if ((n) > 0) swapfunc((a), (b), (size_t)(n), swaptype)
5201
5244
 
5202
- #define med3(a, b, c, _cmp) \
5203
- (cmpgt(b, a) ? (cmpgt(c, b) ? b : (cmpgt(c, a) ? c : a)) : (cmpgt(b, c) ? b : (cmpgt(c, a) ? a : c)))
5245
+ #define med3(a, b, c, _cmp) \
5246
+ (cmpgt(b, a) ? (cmpgt(c, b) ? b : (cmpgt(c, a) ? c : a)) \
5247
+ : (cmpgt(b, c) ? b : (cmpgt(c, a) ? a : c)))
5204
5248
  #endif
5205
5249
 
5206
5250
  #undef qsort_dtype
@@ -5290,15 +5334,15 @@ static void iter_int32_sort(na_loop_t* const lp) {
5290
5334
  /*
5291
5335
  sort of self.
5292
5336
  @overload sort(axis:nil)
5293
- @param [Numeric,Array,Range] axis Performs sort along the axis.
5294
- @return [Numo::Int32] returns result of sort.
5337
+ @param [Numeric,Array,Range] axis Performs sort along the axis.
5338
+ @return [Numo::Int32] returns result of sort.
5295
5339
  @example
5296
5340
  Numo::DFloat[3,4,1,2].sort #=> Numo::DFloat[1,2,3,4]
5297
5341
  */
5298
5342
  static VALUE int32_sort(int argc, VALUE* argv, VALUE self) {
5299
5343
  VALUE reduce;
5300
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_reduce, 0}};
5301
- ndfunc_t ndf = {0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 0, ain, 0};
5344
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
5345
+ ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 0, ain, 0 };
5302
5346
 
5303
5347
  if (!TEST_INPLACE(self)) {
5304
5348
  self = na_copy(self);
@@ -5399,7 +5443,8 @@ loop:
5399
5443
  pm = med3(pl, pm, pn, cmp);
5400
5444
  }
5401
5445
  swap(a, pm);
5402
- for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc; pb += es, pc -= es) {
5446
+ for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
5447
+ pb += es, pc -= es) {
5403
5448
  while (pb <= pc && (r = cmp(pb, a)) <= 0) {
5404
5449
  if (r == 0) {
5405
5450
  swap(pa, pb);
@@ -5446,7 +5491,6 @@ static void int32_index64_qsort(na_loop_t* const lp) {
5446
5491
 
5447
5492
  ptr = (char**)(lp->opt_ptr);
5448
5493
 
5449
- // printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
5450
5494
  // 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);
5451
5495
 
5452
5496
  if (n == 1) {
@@ -5456,21 +5500,17 @@ static void int32_index64_qsort(na_loop_t* const lp) {
5456
5500
 
5457
5501
  for (i = 0; i < n; i++) {
5458
5502
  ptr[i] = d_ptr + d_step * i;
5459
- // printf("(%ld,%.3f)",i,*(double*)ptr[i]);
5460
5503
  }
5461
5504
 
5462
5505
  int32_index_qsort(ptr, n, sizeof(dtype*));
5463
5506
 
5464
5507
  // d_ptr = lp->args[0].ptr;
5465
- // printf("(d_ptr=%lx)\n",(size_t)d_ptr);
5466
5508
 
5467
5509
  for (i = 0; i < n; i++) {
5468
5510
  idx = (ptr[i] - d_ptr) / d_step;
5469
5511
  *(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
5470
- // printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
5471
5512
  o_ptr += o_step;
5472
5513
  }
5473
- // printf("\n");
5474
5514
  }
5475
5515
  #undef idx_t
5476
5516
 
@@ -5488,7 +5528,6 @@ static void int32_index32_qsort(na_loop_t* const lp) {
5488
5528
 
5489
5529
  ptr = (char**)(lp->opt_ptr);
5490
5530
 
5491
- // printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
5492
5531
  // 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);
5493
5532
 
5494
5533
  if (n == 1) {
@@ -5498,29 +5537,25 @@ static void int32_index32_qsort(na_loop_t* const lp) {
5498
5537
 
5499
5538
  for (i = 0; i < n; i++) {
5500
5539
  ptr[i] = d_ptr + d_step * i;
5501
- // printf("(%ld,%.3f)",i,*(double*)ptr[i]);
5502
5540
  }
5503
5541
 
5504
5542
  int32_index_qsort(ptr, n, sizeof(dtype*));
5505
5543
 
5506
5544
  // d_ptr = lp->args[0].ptr;
5507
- // printf("(d_ptr=%lx)\n",(size_t)d_ptr);
5508
5545
 
5509
5546
  for (i = 0; i < n; i++) {
5510
5547
  idx = (ptr[i] - d_ptr) / d_step;
5511
5548
  *(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
5512
- // printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
5513
5549
  o_ptr += o_step;
5514
5550
  }
5515
- // printf("\n");
5516
5551
  }
5517
5552
  #undef idx_t
5518
5553
 
5519
5554
  /*
5520
5555
  sort_index. Returns an index array of sort result.
5521
5556
  @overload sort_index(axis:nil)
5522
- @param [Numeric,Array,Range] axis Performs sort_index along the axis.
5523
- @return [Integer,Numo::Int] returns result index of sort_index.
5557
+ @param [Numeric,Array,Range] axis Performs sort_index along the axis.
5558
+ @return [Integer,Numo::Int] returns result index of sort_index.
5524
5559
  @example
5525
5560
  Numo::NArray[3,4,1,2].sort_index #=> Numo::Int32[2,3,0,1]
5526
5561
  */
@@ -5529,9 +5564,9 @@ static VALUE int32_sort_index(int argc, VALUE* argv, VALUE self) {
5529
5564
  narray_t* na;
5530
5565
  VALUE idx, tmp, reduce, res;
5531
5566
  char* buf;
5532
- ndfunc_arg_in_t ain[3] = {{cT, 0}, {0, 0}, {sym_reduce, 0}};
5533
- ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
5534
- ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_CUM, 3, 1, ain, aout};
5567
+ ndfunc_arg_in_t ain[3] = { { cT, 0 }, { 0, 0 }, { sym_reduce, 0 } };
5568
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
5569
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_CUM, 3, 1, ain, aout };
5535
5570
 
5536
5571
  GetNArray(self, na);
5537
5572
  if (na->ndim == 0) {
@@ -5584,16 +5619,17 @@ static void iter_int32_median(na_loop_t* const lp) {
5584
5619
  /*
5585
5620
  median of self.
5586
5621
  @overload median(axis:nil, keepdims:false)
5587
- @param [Numeric,Array,Range] axis Finds median along the axis.
5588
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
5589
- @return [Numo::Int32] returns median of self.
5622
+ @param [Numeric,Array,Range] axis Finds median along the axis.
5623
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
5624
+ dimensions with size one.
5625
+ @return [Numo::Int32] returns median of self.
5590
5626
  */
5591
5627
 
5592
5628
  static VALUE int32_median(int argc, VALUE* argv, VALUE self) {
5593
5629
  VALUE v, reduce;
5594
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_reduce, 0}};
5595
- ndfunc_arg_out_t aout[1] = {{INT2FIX(0), 0}};
5596
- ndfunc_t ndf = {0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
5630
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
5631
+ ndfunc_arg_out_t aout[1] = { { INT2FIX(0), 0 } };
5632
+ ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
5597
5633
 
5598
5634
  self = na_copy(self); // as temporary buffer
5599
5635
 
@@ -5625,13 +5661,15 @@ void Init_numo_int32(void) {
5625
5661
  id_ne = rb_intern("ne");
5626
5662
  id_to_a = rb_intern("to_a");
5627
5663
 
5628
- /*
5629
- Document-class: Numo::Int32
5630
-
5631
- */
5664
+ /**
5665
+ * Document-class: Numo::Int32
5666
+ *
5667
+ * 32-bit signed integer N-dimensional array.
5668
+ */
5632
5669
  cT = rb_define_class_under(mNumo, "Int32", cNArray);
5633
5670
 
5634
5671
  hCast = rb_hash_new();
5672
+ /* Upcasting rules of Int32. */
5635
5673
  rb_define_const(cT, "UPCAST", hCast);
5636
5674
  rb_hash_aset(hCast, rb_cArray, cT);
5637
5675
 
@@ -5658,15 +5696,15 @@ void Init_numo_int32(void) {
5658
5696
  rb_hash_aset(hCast, numo_cUInt8, cT);
5659
5697
  rb_obj_freeze(hCast);
5660
5698
 
5661
- /**/
5699
+ /* Element size of Int32 in bits. */
5662
5700
  rb_define_const(cT, "ELEMENT_BIT_SIZE", INT2FIX(sizeof(dtype) * 8));
5663
- /**/
5701
+ /* Element size of Int32 in bytes. */
5664
5702
  rb_define_const(cT, "ELEMENT_BYTE_SIZE", INT2FIX(sizeof(dtype)));
5665
- /**/
5703
+ /* Stride size of contiguous Int32 array. */
5666
5704
  rb_define_const(cT, "CONTIGUOUS_STRIDE", INT2FIX(sizeof(dtype)));
5667
- /**/
5705
+ /* The largest representable value of Int32. */
5668
5706
  rb_define_const(cT, "MAX", M_MAX);
5669
- /**/
5707
+ /* The smallest representable value of Int32. */
5670
5708
  rb_define_const(cT, "MIN", M_MIN);
5671
5709
  rb_define_alloc_func(cT, int32_s_alloc_func);
5672
5710
  rb_define_method(cT, "allocate", int32_allocate, 0);
@@ -5737,7 +5775,19 @@ void Init_numo_int32(void) {
5737
5775
  rb_define_method(cT, "argmax", int32_argmax, -1);
5738
5776
  rb_define_method(cT, "argmin", int32_argmin, -1);
5739
5777
  rb_define_method(cT, "minmax", int32_minmax, -1);
5778
+ /**
5779
+ * Element-wise maximum of two arrays.
5780
+ * @overload maximum(a1, a2)
5781
+ * @param [Numo::NArray,Numeric] a1,a2 The arrays holding the elements to be compared.
5782
+ * @return [Numo::Int32]
5783
+ */
5740
5784
  rb_define_module_function(cT, "maximum", int32_s_maximum, -1);
5785
+ /**
5786
+ * Element-wise minimum of two arrays.
5787
+ * @overload minimum(a1, a2)
5788
+ * @param [Numo::NArray,Numeric] a1,a2 The arrays holding the elements to be compared.
5789
+ * @return [Numo::Int32]
5790
+ */
5741
5791
  rb_define_module_function(cT, "minimum", int32_s_minimum, -1);
5742
5792
  rb_define_method(cT, "bincount", int32_bincount, -1);
5743
5793
  rb_define_method(cT, "cumsum", int32_cumsum, -1);
@@ -5754,4 +5804,48 @@ void Init_numo_int32(void) {
5754
5804
  rb_define_method(cT, "sort_index", int32_sort_index, -1);
5755
5805
  rb_define_method(cT, "median", int32_median, -1);
5756
5806
  rb_define_singleton_method(cT, "[]", int32_s_cast, -2);
5807
+ /**
5808
+ * mean of self.
5809
+ * @overload mean(axis: nil, keepdims: false, nan: false)
5810
+ * @param axis [Numeric, Array, Range] Performs mean along the axis.
5811
+ * @param keepdims [Boolean] If true, the reduced axes are left in the result array as
5812
+ * dimensions with size one.
5813
+ * @param nan [Boolean] If true, apply NaN-aware algorithm
5814
+ * (avoid NaN for sum/mean etc, or return NaN for min/max etc).
5815
+ * @return [Numo::DFloat] returns result of mean.
5816
+ */
5817
+ rb_define_method(cT, "mean", int32_mean, -1);
5818
+ /**
5819
+ * var of self.
5820
+ * @overload var(axis: nil, keepdims: false, nan: false)
5821
+ * @param axis [Numeric, Array, Range] Performs var along the axis.
5822
+ * @param keepdims [Boolean] If true, the reduced axes are left in the result array as
5823
+ * dimensions with size one.
5824
+ * @param nan [Boolean] If true, apply NaN-aware algorithm
5825
+ * (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
5826
+ * @return [Numo::DFloat] returns result of var.
5827
+ */
5828
+ rb_define_method(cT, "var", int32_var, -1);
5829
+ /**
5830
+ * stddev of self.
5831
+ * @overload stddev(axis: nil, keepdims: false, nan: false)
5832
+ * @param axis [Numeric, Array, Range] Performs stddev along the axis.
5833
+ * @param keepdims [Boolean] If true, the reduced axes are left in the result array as
5834
+ * dimensions with size one.
5835
+ * @param nan [Boolean] If true, apply NaN-aware algorithm
5836
+ * (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
5837
+ * @return [Numo::DFloat] returns result of stddev.
5838
+ */
5839
+ rb_define_method(cT, "stddev", int32_stddev, -1);
5840
+ /**
5841
+ * rms of self.
5842
+ * @overload rms(axis: nil, keepdims: false, nan: false)
5843
+ * @param axis [Numeric, Array, Range] Performs rms along the axis.
5844
+ * @param keepdims [Boolean] If true, the reduced axes are left in the result array as
5845
+ * dimensions with size one.
5846
+ * @param nan [Boolean] If true, apply NaN-aware algorithm
5847
+ * (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
5848
+ * @return [Numo::DFloat] returns result of rms.
5849
+ */
5850
+ rb_define_method(cT, "rms", int32_rms, -1);
5757
5851
  }