numo-narray-alt 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -3
  3. data/Rakefile +8 -0
  4. data/ext/numo/narray/SFMT-params19937.h +16 -12
  5. data/ext/numo/narray/SFMT.c +12 -5
  6. data/ext/numo/narray/array.c +25 -19
  7. data/ext/numo/narray/data.c +74 -70
  8. data/ext/numo/narray/extconf.rb +1 -0
  9. data/ext/numo/narray/index.c +49 -26
  10. data/ext/numo/narray/kwargs.c +11 -9
  11. data/ext/numo/narray/math.c +4 -2
  12. data/ext/numo/narray/narray.c +17 -10
  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/complex.h +7 -3
  19. data/ext/numo/narray/numo/types/complex_macro.h +27 -25
  20. data/ext/numo/narray/numo/types/float_macro.h +20 -17
  21. data/ext/numo/narray/numo/types/real_accum.h +22 -22
  22. data/ext/numo/narray/numo/types/robj_macro.h +19 -12
  23. data/ext/numo/narray/numo/types/xint_macro.h +9 -8
  24. data/ext/numo/narray/src/t_bit.c +97 -88
  25. data/ext/numo/narray/src/t_dcomplex.c +336 -307
  26. data/ext/numo/narray/src/t_dfloat.c +522 -456
  27. data/ext/numo/narray/src/t_int16.c +351 -308
  28. data/ext/numo/narray/src/t_int32.c +351 -308
  29. data/ext/numo/narray/src/t_int64.c +351 -308
  30. data/ext/numo/narray/src/t_int8.c +309 -288
  31. data/ext/numo/narray/src/t_mean.c +105 -0
  32. data/ext/numo/narray/src/t_robject.c +323 -296
  33. data/ext/numo/narray/src/t_scomplex.c +327 -302
  34. data/ext/numo/narray/src/t_sfloat.c +515 -451
  35. data/ext/numo/narray/src/t_uint16.c +351 -308
  36. data/ext/numo/narray/src/t_uint32.c +351 -308
  37. data/ext/numo/narray/src/t_uint64.c +351 -308
  38. data/ext/numo/narray/src/t_uint8.c +311 -288
  39. data/ext/numo/narray/step.c +7 -2
  40. data/ext/numo/narray/struct.c +24 -22
  41. data/lib/numo/narray/extra.rb +66 -25
  42. data/numo-narray-alt.gemspec +38 -0
  43. metadata +7 -1
@@ -238,8 +238,8 @@ static void iter_int16_store_bit(na_loop_t* const lp) {
238
238
  }
239
239
 
240
240
  static VALUE int16_store_bit(VALUE self, VALUE obj) {
241
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
242
- ndfunc_t ndf = {iter_int16_store_bit, FULL_LOOP, 2, 0, ain, 0};
241
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
242
+ ndfunc_t ndf = { iter_int16_store_bit, FULL_LOOP, 2, 0, ain, 0 };
243
243
 
244
244
  na_ndloop(&ndf, 2, self, obj);
245
245
  return self;
@@ -287,8 +287,8 @@ static void iter_int16_store_dfloat(na_loop_t* const lp) {
287
287
  }
288
288
 
289
289
  static VALUE int16_store_dfloat(VALUE self, VALUE obj) {
290
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
291
- ndfunc_t ndf = {iter_int16_store_dfloat, FULL_LOOP, 2, 0, ain, 0};
290
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
291
+ ndfunc_t ndf = { iter_int16_store_dfloat, FULL_LOOP, 2, 0, ain, 0 };
292
292
 
293
293
  na_ndloop(&ndf, 2, self, obj);
294
294
  return self;
@@ -336,8 +336,8 @@ static void iter_int16_store_sfloat(na_loop_t* const lp) {
336
336
  }
337
337
 
338
338
  static VALUE int16_store_sfloat(VALUE self, VALUE obj) {
339
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
340
- ndfunc_t ndf = {iter_int16_store_sfloat, FULL_LOOP, 2, 0, ain, 0};
339
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
340
+ ndfunc_t ndf = { iter_int16_store_sfloat, FULL_LOOP, 2, 0, ain, 0 };
341
341
 
342
342
  na_ndloop(&ndf, 2, self, obj);
343
343
  return self;
@@ -385,8 +385,8 @@ static void iter_int16_store_int64(na_loop_t* const lp) {
385
385
  }
386
386
 
387
387
  static VALUE int16_store_int64(VALUE self, VALUE obj) {
388
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
389
- ndfunc_t ndf = {iter_int16_store_int64, FULL_LOOP, 2, 0, ain, 0};
388
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
389
+ ndfunc_t ndf = { iter_int16_store_int64, FULL_LOOP, 2, 0, ain, 0 };
390
390
 
391
391
  na_ndloop(&ndf, 2, self, obj);
392
392
  return self;
@@ -434,8 +434,8 @@ static void iter_int16_store_int32(na_loop_t* const lp) {
434
434
  }
435
435
 
436
436
  static VALUE int16_store_int32(VALUE self, VALUE obj) {
437
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
438
- ndfunc_t ndf = {iter_int16_store_int32, FULL_LOOP, 2, 0, ain, 0};
437
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
438
+ ndfunc_t ndf = { iter_int16_store_int32, FULL_LOOP, 2, 0, ain, 0 };
439
439
 
440
440
  na_ndloop(&ndf, 2, self, obj);
441
441
  return self;
@@ -483,8 +483,8 @@ static void iter_int16_store_int16(na_loop_t* const lp) {
483
483
  }
484
484
 
485
485
  static VALUE int16_store_int16(VALUE self, VALUE obj) {
486
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
487
- ndfunc_t ndf = {iter_int16_store_int16, FULL_LOOP, 2, 0, ain, 0};
486
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
487
+ ndfunc_t ndf = { iter_int16_store_int16, FULL_LOOP, 2, 0, ain, 0 };
488
488
 
489
489
  na_ndloop(&ndf, 2, self, obj);
490
490
  return self;
@@ -532,8 +532,8 @@ static void iter_int16_store_int8(na_loop_t* const lp) {
532
532
  }
533
533
 
534
534
  static VALUE int16_store_int8(VALUE self, VALUE obj) {
535
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
536
- ndfunc_t ndf = {iter_int16_store_int8, FULL_LOOP, 2, 0, ain, 0};
535
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
536
+ ndfunc_t ndf = { iter_int16_store_int8, FULL_LOOP, 2, 0, ain, 0 };
537
537
 
538
538
  na_ndloop(&ndf, 2, self, obj);
539
539
  return self;
@@ -581,8 +581,8 @@ static void iter_int16_store_uint64(na_loop_t* const lp) {
581
581
  }
582
582
 
583
583
  static VALUE int16_store_uint64(VALUE self, VALUE obj) {
584
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
585
- ndfunc_t ndf = {iter_int16_store_uint64, FULL_LOOP, 2, 0, ain, 0};
584
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
585
+ ndfunc_t ndf = { iter_int16_store_uint64, FULL_LOOP, 2, 0, ain, 0 };
586
586
 
587
587
  na_ndloop(&ndf, 2, self, obj);
588
588
  return self;
@@ -630,8 +630,8 @@ static void iter_int16_store_uint32(na_loop_t* const lp) {
630
630
  }
631
631
 
632
632
  static VALUE int16_store_uint32(VALUE self, VALUE obj) {
633
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
634
- ndfunc_t ndf = {iter_int16_store_uint32, FULL_LOOP, 2, 0, ain, 0};
633
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
634
+ ndfunc_t ndf = { iter_int16_store_uint32, FULL_LOOP, 2, 0, ain, 0 };
635
635
 
636
636
  na_ndloop(&ndf, 2, self, obj);
637
637
  return self;
@@ -679,8 +679,8 @@ static void iter_int16_store_uint16(na_loop_t* const lp) {
679
679
  }
680
680
 
681
681
  static VALUE int16_store_uint16(VALUE self, VALUE obj) {
682
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
683
- ndfunc_t ndf = {iter_int16_store_uint16, FULL_LOOP, 2, 0, ain, 0};
682
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
683
+ ndfunc_t ndf = { iter_int16_store_uint16, FULL_LOOP, 2, 0, ain, 0 };
684
684
 
685
685
  na_ndloop(&ndf, 2, self, obj);
686
686
  return self;
@@ -728,8 +728,8 @@ static void iter_int16_store_uint8(na_loop_t* const lp) {
728
728
  }
729
729
 
730
730
  static VALUE int16_store_uint8(VALUE self, VALUE obj) {
731
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
732
- ndfunc_t ndf = {iter_int16_store_uint8, FULL_LOOP, 2, 0, ain, 0};
731
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
732
+ ndfunc_t ndf = { iter_int16_store_uint8, FULL_LOOP, 2, 0, ain, 0 };
733
733
 
734
734
  na_ndloop(&ndf, 2, self, obj);
735
735
  return self;
@@ -777,8 +777,8 @@ static void iter_int16_store_robject(na_loop_t* const lp) {
777
777
  }
778
778
 
779
779
  static VALUE int16_store_robject(VALUE self, VALUE obj) {
780
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
781
- ndfunc_t ndf = {iter_int16_store_robject, FULL_LOOP, 2, 0, ain, 0};
780
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
781
+ ndfunc_t ndf = { iter_int16_store_robject, FULL_LOOP, 2, 0, ain, 0 };
782
782
 
783
783
  na_ndloop(&ndf, 2, self, obj);
784
784
  return self;
@@ -886,8 +886,8 @@ loop_end:
886
886
  }
887
887
 
888
888
  static VALUE int16_store_array(VALUE self, VALUE rary) {
889
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {rb_cArray, 0}};
890
- ndfunc_t ndf = {iter_int16_store_array, FULL_LOOP, 2, 0, ain, 0};
889
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { rb_cArray, 0 } };
890
+ ndfunc_t ndf = { iter_int16_store_array, FULL_LOOP, 2, 0, ain, 0 };
891
891
 
892
892
  na_ndloop_store_rarray(&ndf, self, rary);
893
893
  return self;
@@ -982,8 +982,10 @@ static VALUE int16_store(VALUE self, VALUE obj) {
982
982
  }
983
983
  }
984
984
 
985
- rb_raise(nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
986
- rb_class2name(rb_obj_class(self)));
985
+ rb_raise(
986
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
987
+ rb_class2name(rb_obj_class(self))
988
+ );
987
989
 
988
990
  return self;
989
991
  }
@@ -1077,7 +1079,10 @@ static dtype int16_extract_data(VALUE obj) {
1077
1079
  return int16_extract_data(r);
1078
1080
  }
1079
1081
 
1080
- rb_raise(nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)), rb_class2name(cT));
1082
+ rb_raise(
1083
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
1084
+ rb_class2name(cT)
1085
+ );
1081
1086
  }
1082
1087
  if (TYPE(obj) == T_ARRAY) {
1083
1088
  if (RARRAY_LEN(obj) != 1) {
@@ -1146,8 +1151,8 @@ static VALUE int16_s_cast(VALUE type, VALUE obj) {
1146
1151
  /*
1147
1152
  Multi-dimensional element reference.
1148
1153
  @overload [](dim0,...,dimL)
1149
- @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol] dim0,...,dimL multi-dimensional
1150
- indices.
1154
+ @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
1155
+ dim0,...,dimL multi-dimensional indices.
1151
1156
  @return [Numeric,Numo::Int16] an element or NArray view.
1152
1157
  @see Numo::NArray#[]
1153
1158
  @see #[]=
@@ -1169,8 +1174,8 @@ static VALUE int16_aref(int argc, VALUE* argv, VALUE self) {
1169
1174
  /*
1170
1175
  Multi-dimensional element assignment.
1171
1176
  @overload []=(dim0,...,dimL,val)
1172
- @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol] dim0,...,dimL multi-dimensional
1173
- indices.
1177
+ @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
1178
+ dim0,...,dimL multi-dimensional indices.
1174
1179
  @param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
1175
1180
  @return [Numeric,Numo::NArray,Array] returns `val` (last argument).
1176
1181
  @see Numo::NArray#[]=
@@ -1241,9 +1246,9 @@ static void iter_int16_to_a(na_loop_t* const lp) {
1241
1246
  @return [Array]
1242
1247
  */
1243
1248
  static VALUE int16_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_int16_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
1249
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
1250
+ ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
1251
+ ndfunc_t ndf = { iter_int16_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
1247
1252
  return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
1248
1253
  }
1249
1254
 
@@ -1275,8 +1280,8 @@ static void iter_int16_fill(na_loop_t* const lp) {
1275
1280
  @return [Numo::Int16] self.
1276
1281
  */
1277
1282
  static VALUE int16_fill(VALUE self, VALUE val) {
1278
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_option}};
1279
- ndfunc_t ndf = {iter_int16_fill, FULL_LOOP, 2, 0, ain, 0};
1283
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
1284
+ ndfunc_t ndf = { iter_int16_fill, FULL_LOOP, 2, 0, ain, 0 };
1280
1285
 
1281
1286
  na_ndloop(&ndf, 2, self, val);
1282
1287
  return self;
@@ -1331,9 +1336,9 @@ static void iter_int16_format(na_loop_t* const lp) {
1331
1336
  static VALUE int16_format(int argc, VALUE* argv, VALUE self) {
1332
1337
  VALUE fmt = Qnil;
1333
1338
 
1334
- ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_option}};
1335
- ndfunc_arg_out_t aout[1] = {{numo_cRObject, 0}};
1336
- ndfunc_t ndf = {iter_int16_format, FULL_LOOP_NIP, 2, 1, ain, aout};
1339
+ ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_option } };
1340
+ ndfunc_arg_out_t aout[1] = { { numo_cRObject, 0 } };
1341
+ ndfunc_t ndf = { iter_int16_format, FULL_LOOP_NIP, 2, 1, ain, aout };
1337
1342
 
1338
1343
  rb_scan_args(argc, argv, "01", &fmt);
1339
1344
  return na_ndloop(&ndf, 2, self, fmt);
@@ -1377,9 +1382,9 @@ static void iter_int16_format_to_a(na_loop_t* const lp) {
1377
1382
  */
1378
1383
  static VALUE int16_format_to_a(int argc, VALUE* argv, VALUE self) {
1379
1384
  VALUE fmt = Qnil;
1380
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
1381
- ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
1382
- ndfunc_t ndf = {iter_int16_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
1385
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
1386
+ ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
1387
+ ndfunc_t ndf = { iter_int16_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
1383
1388
 
1384
1389
  rb_scan_args(argc, argv, "01", &fmt);
1385
1390
  return na_ndloop_cast_narray_to_rarray(&ndf, self, fmt);
@@ -1433,8 +1438,8 @@ static void iter_int16_each(na_loop_t* const lp) {
1433
1438
  @see #map
1434
1439
  */
1435
1440
  static VALUE int16_each(VALUE self) {
1436
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1437
- ndfunc_t ndf = {iter_int16_each, FULL_LOOP_NIP, 1, 0, ain, 0};
1441
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1442
+ ndfunc_t ndf = { iter_int16_each, FULL_LOOP_NIP, 1, 0, ain, 0 };
1438
1443
 
1439
1444
  na_ndloop(&ndf, 1, self);
1440
1445
  return self;
@@ -1508,9 +1513,9 @@ static void iter_int16_map(na_loop_t* const lp) {
1508
1513
  @return [Numo::Int16] map of self.
1509
1514
  */
1510
1515
  static VALUE int16_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_int16_map, FULL_LOOP, 1, 1, ain, aout};
1516
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
1517
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1518
+ ndfunc_t ndf = { iter_int16_map, FULL_LOOP, 1, 1, ain, aout };
1514
1519
 
1515
1520
  return na_ndloop(&ndf, 1, self);
1516
1521
  }
@@ -1572,8 +1577,8 @@ static void iter_int16_each_with_index(na_loop_t* const lp) {
1572
1577
  @see #map_with_index
1573
1578
  */
1574
1579
  static VALUE int16_each_with_index(VALUE self) {
1575
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1576
- ndfunc_t ndf = {iter_int16_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0};
1580
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1581
+ ndfunc_t ndf = { iter_int16_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0 };
1577
1582
 
1578
1583
  na_ndloop_with_index(&ndf, 1, self);
1579
1584
  return self;
@@ -1663,9 +1668,9 @@ static void iter_int16_map_with_index(na_loop_t* const lp) {
1663
1668
  @see #each_with_index
1664
1669
  */
1665
1670
  static VALUE int16_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_int16_map_with_index, FULL_LOOP, 1, 1, ain, aout};
1671
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1672
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1673
+ ndfunc_t ndf = { iter_int16_map_with_index, FULL_LOOP, 1, 1, ain, aout };
1669
1674
 
1670
1675
  return na_ndloop_with_index(&ndf, 1, self);
1671
1676
  }
@@ -1717,14 +1722,14 @@ static void iter_int16_abs(na_loop_t* const lp) {
1717
1722
  @return [Numo::Int16] abs of self.
1718
1723
  */
1719
1724
  static VALUE int16_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_int16_abs, FULL_LOOP, 1, 1, ain, aout};
1725
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
1726
+ ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
1727
+ ndfunc_t ndf = { iter_int16_abs, FULL_LOOP, 1, 1, ain, aout };
1723
1728
 
1724
1729
  return na_ndloop(&ndf, 1, self);
1725
1730
  }
1726
1731
 
1727
- #define check_intdivzero(y) \
1732
+ #define check_intdivzero(y) \
1728
1733
  {}
1729
1734
 
1730
1735
  static void iter_int16_add(na_loop_t* const lp) {
@@ -1739,7 +1744,8 @@ static void iter_int16_add(na_loop_t* const lp) {
1739
1744
  INIT_PTR(lp, 2, p3, s3);
1740
1745
 
1741
1746
  //
1742
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
1747
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
1748
+ is_aligned(p3, sizeof(dtype))) {
1743
1749
 
1744
1750
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
1745
1751
  if (p1 == p3) { // inplace case
@@ -1756,7 +1762,8 @@ static void iter_int16_add(na_loop_t* const lp) {
1756
1762
  return;
1757
1763
  }
1758
1764
 
1759
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
1765
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
1766
+ is_aligned_step(s3, sizeof(dtype))) {
1760
1767
  //
1761
1768
 
1762
1769
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -1814,9 +1821,9 @@ static void iter_int16_add(na_loop_t* const lp) {
1814
1821
  #undef check_intdivzero
1815
1822
 
1816
1823
  static VALUE int16_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_int16_add, STRIDE_LOOP, 2, 1, ain, aout};
1824
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
1825
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1826
+ ndfunc_t ndf = { iter_int16_add, STRIDE_LOOP, 2, 1, ain, aout };
1820
1827
 
1821
1828
  return na_ndloop(&ndf, 2, self, other);
1822
1829
  }
@@ -1840,7 +1847,7 @@ static VALUE int16_add(VALUE self, VALUE other) {
1840
1847
  }
1841
1848
  }
1842
1849
 
1843
- #define check_intdivzero(y) \
1850
+ #define check_intdivzero(y) \
1844
1851
  {}
1845
1852
 
1846
1853
  static void iter_int16_sub(na_loop_t* const lp) {
@@ -1855,7 +1862,8 @@ static void iter_int16_sub(na_loop_t* const lp) {
1855
1862
  INIT_PTR(lp, 2, p3, s3);
1856
1863
 
1857
1864
  //
1858
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
1865
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
1866
+ is_aligned(p3, sizeof(dtype))) {
1859
1867
 
1860
1868
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
1861
1869
  if (p1 == p3) { // inplace case
@@ -1872,7 +1880,8 @@ static void iter_int16_sub(na_loop_t* const lp) {
1872
1880
  return;
1873
1881
  }
1874
1882
 
1875
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
1883
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
1884
+ is_aligned_step(s3, sizeof(dtype))) {
1876
1885
  //
1877
1886
 
1878
1887
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -1930,9 +1939,9 @@ static void iter_int16_sub(na_loop_t* const lp) {
1930
1939
  #undef check_intdivzero
1931
1940
 
1932
1941
  static VALUE int16_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_int16_sub, STRIDE_LOOP, 2, 1, ain, aout};
1942
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
1943
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1944
+ ndfunc_t ndf = { iter_int16_sub, STRIDE_LOOP, 2, 1, ain, aout };
1936
1945
 
1937
1946
  return na_ndloop(&ndf, 2, self, other);
1938
1947
  }
@@ -1956,7 +1965,7 @@ static VALUE int16_sub(VALUE self, VALUE other) {
1956
1965
  }
1957
1966
  }
1958
1967
 
1959
- #define check_intdivzero(y) \
1968
+ #define check_intdivzero(y) \
1960
1969
  {}
1961
1970
 
1962
1971
  static void iter_int16_mul(na_loop_t* const lp) {
@@ -1971,7 +1980,8 @@ static void iter_int16_mul(na_loop_t* const lp) {
1971
1980
  INIT_PTR(lp, 2, p3, s3);
1972
1981
 
1973
1982
  //
1974
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
1983
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
1984
+ is_aligned(p3, sizeof(dtype))) {
1975
1985
 
1976
1986
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
1977
1987
  if (p1 == p3) { // inplace case
@@ -1988,7 +1998,8 @@ static void iter_int16_mul(na_loop_t* const lp) {
1988
1998
  return;
1989
1999
  }
1990
2000
 
1991
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2001
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2002
+ is_aligned_step(s3, sizeof(dtype))) {
1992
2003
  //
1993
2004
 
1994
2005
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2046,9 +2057,9 @@ static void iter_int16_mul(na_loop_t* const lp) {
2046
2057
  #undef check_intdivzero
2047
2058
 
2048
2059
  static VALUE int16_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_int16_mul, STRIDE_LOOP, 2, 1, ain, aout};
2060
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2061
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2062
+ ndfunc_t ndf = { iter_int16_mul, STRIDE_LOOP, 2, 1, ain, aout };
2052
2063
 
2053
2064
  return na_ndloop(&ndf, 2, self, other);
2054
2065
  }
@@ -2072,10 +2083,10 @@ static VALUE int16_mul(VALUE self, VALUE other) {
2072
2083
  }
2073
2084
  }
2074
2085
 
2075
- #define check_intdivzero(y) \
2076
- if ((y) == 0) { \
2077
- lp->err_type = rb_eZeroDivError; \
2078
- return; \
2086
+ #define check_intdivzero(y) \
2087
+ if ((y) == 0) { \
2088
+ lp->err_type = rb_eZeroDivError; \
2089
+ return; \
2079
2090
  }
2080
2091
 
2081
2092
  static void iter_int16_div(na_loop_t* const lp) {
@@ -2090,7 +2101,8 @@ static void iter_int16_div(na_loop_t* const lp) {
2090
2101
  INIT_PTR(lp, 2, p3, s3);
2091
2102
 
2092
2103
  //
2093
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2104
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2105
+ is_aligned(p3, sizeof(dtype))) {
2094
2106
 
2095
2107
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2096
2108
  if (p1 == p3) { // inplace case
@@ -2107,7 +2119,8 @@ static void iter_int16_div(na_loop_t* const lp) {
2107
2119
  return;
2108
2120
  }
2109
2121
 
2110
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2122
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2123
+ is_aligned_step(s3, sizeof(dtype))) {
2111
2124
  //
2112
2125
 
2113
2126
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2165,9 +2178,9 @@ static void iter_int16_div(na_loop_t* const lp) {
2165
2178
  #undef check_intdivzero
2166
2179
 
2167
2180
  static VALUE int16_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_int16_div, STRIDE_LOOP, 2, 1, ain, aout};
2181
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2182
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2183
+ ndfunc_t ndf = { iter_int16_div, STRIDE_LOOP, 2, 1, ain, aout };
2171
2184
 
2172
2185
  return na_ndloop(&ndf, 2, self, other);
2173
2186
  }
@@ -2191,10 +2204,10 @@ static VALUE int16_div(VALUE self, VALUE other) {
2191
2204
  }
2192
2205
  }
2193
2206
 
2194
- #define check_intdivzero(y) \
2195
- if ((y) == 0) { \
2196
- lp->err_type = rb_eZeroDivError; \
2197
- return; \
2207
+ #define check_intdivzero(y) \
2208
+ if ((y) == 0) { \
2209
+ lp->err_type = rb_eZeroDivError; \
2210
+ return; \
2198
2211
  }
2199
2212
 
2200
2213
  static void iter_int16_mod(na_loop_t* const lp) {
@@ -2209,7 +2222,8 @@ static void iter_int16_mod(na_loop_t* const lp) {
2209
2222
  INIT_PTR(lp, 2, p3, s3);
2210
2223
 
2211
2224
  //
2212
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2225
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2226
+ is_aligned(p3, sizeof(dtype))) {
2213
2227
 
2214
2228
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2215
2229
  if (p1 == p3) { // inplace case
@@ -2226,7 +2240,8 @@ static void iter_int16_mod(na_loop_t* const lp) {
2226
2240
  return;
2227
2241
  }
2228
2242
 
2229
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2243
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2244
+ is_aligned_step(s3, sizeof(dtype))) {
2230
2245
  //
2231
2246
 
2232
2247
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2284,9 +2299,9 @@ static void iter_int16_mod(na_loop_t* const lp) {
2284
2299
  #undef check_intdivzero
2285
2300
 
2286
2301
  static VALUE int16_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_int16_mod, STRIDE_LOOP, 2, 1, ain, aout};
2302
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2303
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2304
+ ndfunc_t ndf = { iter_int16_mod, STRIDE_LOOP, 2, 1, ain, aout };
2290
2305
 
2291
2306
  return na_ndloop(&ndf, 2, self, other);
2292
2307
  }
@@ -2334,9 +2349,9 @@ static void iter_int16_divmod(na_loop_t* const lp) {
2334
2349
  }
2335
2350
 
2336
2351
  static VALUE int16_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_int16_divmod, STRIDE_LOOP, 2, 2, ain, aout};
2352
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2353
+ ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
2354
+ ndfunc_t ndf = { iter_int16_divmod, STRIDE_LOOP, 2, 2, ain, aout };
2340
2355
 
2341
2356
  return na_ndloop(&ndf, 2, self, other);
2342
2357
  }
@@ -2395,11 +2410,11 @@ static void iter_int16_pow_int32(na_loop_t* const lp) {
2395
2410
  }
2396
2411
 
2397
2412
  static VALUE int16_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_int16_pow, STRIDE_LOOP, 2, 1, ain, aout};
2402
- ndfunc_t ndf_i = {iter_int16_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout};
2413
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2414
+ ndfunc_arg_in_t ain_i[2] = { { cT, 0 }, { numo_cInt32, 0 } };
2415
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2416
+ ndfunc_t ndf = { iter_int16_pow, STRIDE_LOOP, 2, 1, ain, aout };
2417
+ ndfunc_t ndf_i = { iter_int16_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout };
2403
2418
 
2404
2419
  // fixme : use na.integer?
2405
2420
  if (FIXNUM_P(other) || rb_obj_is_kind_of(other, numo_cInt32)) {
@@ -2495,9 +2510,9 @@ static void iter_int16_minus(na_loop_t* const lp) {
2495
2510
  @return [Numo::Int16] minus of self.
2496
2511
  */
2497
2512
  static VALUE int16_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_int16_minus, FULL_LOOP, 1, 1, ain, aout};
2513
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2514
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2515
+ ndfunc_t ndf = { iter_int16_minus, FULL_LOOP, 1, 1, ain, aout };
2501
2516
 
2502
2517
  return na_ndloop(&ndf, 1, self);
2503
2518
  }
@@ -2570,9 +2585,9 @@ static void iter_int16_reciprocal(na_loop_t* const lp) {
2570
2585
  @return [Numo::Int16] reciprocal of self.
2571
2586
  */
2572
2587
  static VALUE int16_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_int16_reciprocal, FULL_LOOP, 1, 1, ain, aout};
2588
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2589
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2590
+ ndfunc_t ndf = { iter_int16_reciprocal, FULL_LOOP, 1, 1, ain, aout };
2576
2591
 
2577
2592
  return na_ndloop(&ndf, 1, self);
2578
2593
  }
@@ -2645,9 +2660,9 @@ static void iter_int16_sign(na_loop_t* const lp) {
2645
2660
  @return [Numo::Int16] sign of self.
2646
2661
  */
2647
2662
  static VALUE int16_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_int16_sign, FULL_LOOP, 1, 1, ain, aout};
2663
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2664
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2665
+ ndfunc_t ndf = { iter_int16_sign, FULL_LOOP, 1, 1, ain, aout };
2651
2666
 
2652
2667
  return na_ndloop(&ndf, 1, self);
2653
2668
  }
@@ -2720,9 +2735,9 @@ static void iter_int16_square(na_loop_t* const lp) {
2720
2735
  @return [Numo::Int16] square of self.
2721
2736
  */
2722
2737
  static VALUE int16_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_int16_square, FULL_LOOP, 1, 1, ain, aout};
2738
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2739
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2740
+ ndfunc_t ndf = { iter_int16_square, FULL_LOOP, 1, 1, ain, aout };
2726
2741
 
2727
2742
  return na_ndloop(&ndf, 1, self);
2728
2743
  }
@@ -2749,9 +2764,9 @@ static void iter_int16_eq(na_loop_t* const lp) {
2749
2764
  }
2750
2765
 
2751
2766
  static VALUE int16_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_int16_eq, STRIDE_LOOP, 2, 1, ain, aout};
2767
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2768
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
2769
+ ndfunc_t ndf = { iter_int16_eq, STRIDE_LOOP, 2, 1, ain, aout };
2755
2770
 
2756
2771
  return na_ndloop(&ndf, 2, self, other);
2757
2772
  }
@@ -2796,9 +2811,9 @@ static void iter_int16_ne(na_loop_t* const lp) {
2796
2811
  }
2797
2812
 
2798
2813
  static VALUE int16_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_int16_ne, STRIDE_LOOP, 2, 1, ain, aout};
2814
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2815
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
2816
+ ndfunc_t ndf = { iter_int16_ne, STRIDE_LOOP, 2, 1, ain, aout };
2802
2817
 
2803
2818
  return na_ndloop(&ndf, 2, self, other);
2804
2819
  }
@@ -2821,7 +2836,7 @@ static VALUE int16_ne(VALUE self, VALUE other) {
2821
2836
  }
2822
2837
  }
2823
2838
 
2824
- #define check_intdivzero(y) \
2839
+ #define check_intdivzero(y) \
2825
2840
  {}
2826
2841
 
2827
2842
  static void iter_int16_bit_and(na_loop_t* const lp) {
@@ -2836,7 +2851,8 @@ static void iter_int16_bit_and(na_loop_t* const lp) {
2836
2851
  INIT_PTR(lp, 2, p3, s3);
2837
2852
 
2838
2853
  //
2839
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2854
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2855
+ is_aligned(p3, sizeof(dtype))) {
2840
2856
 
2841
2857
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2842
2858
  if (p1 == p3) { // inplace case
@@ -2853,7 +2869,8 @@ static void iter_int16_bit_and(na_loop_t* const lp) {
2853
2869
  return;
2854
2870
  }
2855
2871
 
2856
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2872
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2873
+ is_aligned_step(s3, sizeof(dtype))) {
2857
2874
  //
2858
2875
 
2859
2876
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2911,9 +2928,9 @@ static void iter_int16_bit_and(na_loop_t* const lp) {
2911
2928
  #undef check_intdivzero
2912
2929
 
2913
2930
  static VALUE int16_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_int16_bit_and, STRIDE_LOOP, 2, 1, ain, aout};
2931
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2932
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2933
+ ndfunc_t ndf = { iter_int16_bit_and, STRIDE_LOOP, 2, 1, ain, aout };
2917
2934
 
2918
2935
  return na_ndloop(&ndf, 2, self, other);
2919
2936
  }
@@ -2937,7 +2954,7 @@ static VALUE int16_bit_and(VALUE self, VALUE other) {
2937
2954
  }
2938
2955
  }
2939
2956
 
2940
- #define check_intdivzero(y) \
2957
+ #define check_intdivzero(y) \
2941
2958
  {}
2942
2959
 
2943
2960
  static void iter_int16_bit_or(na_loop_t* const lp) {
@@ -2952,7 +2969,8 @@ static void iter_int16_bit_or(na_loop_t* const lp) {
2952
2969
  INIT_PTR(lp, 2, p3, s3);
2953
2970
 
2954
2971
  //
2955
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2972
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2973
+ is_aligned(p3, sizeof(dtype))) {
2956
2974
 
2957
2975
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2958
2976
  if (p1 == p3) { // inplace case
@@ -2969,7 +2987,8 @@ static void iter_int16_bit_or(na_loop_t* const lp) {
2969
2987
  return;
2970
2988
  }
2971
2989
 
2972
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2990
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2991
+ is_aligned_step(s3, sizeof(dtype))) {
2973
2992
  //
2974
2993
 
2975
2994
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -3027,9 +3046,9 @@ static void iter_int16_bit_or(na_loop_t* const lp) {
3027
3046
  #undef check_intdivzero
3028
3047
 
3029
3048
  static VALUE int16_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_int16_bit_or, STRIDE_LOOP, 2, 1, ain, aout};
3049
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3050
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3051
+ ndfunc_t ndf = { iter_int16_bit_or, STRIDE_LOOP, 2, 1, ain, aout };
3033
3052
 
3034
3053
  return na_ndloop(&ndf, 2, self, other);
3035
3054
  }
@@ -3053,7 +3072,7 @@ static VALUE int16_bit_or(VALUE self, VALUE other) {
3053
3072
  }
3054
3073
  }
3055
3074
 
3056
- #define check_intdivzero(y) \
3075
+ #define check_intdivzero(y) \
3057
3076
  {}
3058
3077
 
3059
3078
  static void iter_int16_bit_xor(na_loop_t* const lp) {
@@ -3068,7 +3087,8 @@ static void iter_int16_bit_xor(na_loop_t* const lp) {
3068
3087
  INIT_PTR(lp, 2, p3, s3);
3069
3088
 
3070
3089
  //
3071
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
3090
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
3091
+ is_aligned(p3, sizeof(dtype))) {
3072
3092
 
3073
3093
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
3074
3094
  if (p1 == p3) { // inplace case
@@ -3085,7 +3105,8 @@ static void iter_int16_bit_xor(na_loop_t* const lp) {
3085
3105
  return;
3086
3106
  }
3087
3107
 
3088
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
3108
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
3109
+ is_aligned_step(s3, sizeof(dtype))) {
3089
3110
  //
3090
3111
 
3091
3112
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -3143,9 +3164,9 @@ static void iter_int16_bit_xor(na_loop_t* const lp) {
3143
3164
  #undef check_intdivzero
3144
3165
 
3145
3166
  static VALUE int16_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_int16_bit_xor, STRIDE_LOOP, 2, 1, ain, aout};
3167
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3168
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3169
+ ndfunc_t ndf = { iter_int16_bit_xor, STRIDE_LOOP, 2, 1, ain, aout };
3149
3170
 
3150
3171
  return na_ndloop(&ndf, 2, self, other);
3151
3172
  }
@@ -3237,14 +3258,14 @@ static void iter_int16_bit_not(na_loop_t* const lp) {
3237
3258
  @return [Numo::Int16] bit_not of self.
3238
3259
  */
3239
3260
  static VALUE int16_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_int16_bit_not, FULL_LOOP, 1, 1, ain, aout};
3261
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3262
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3263
+ ndfunc_t ndf = { iter_int16_bit_not, FULL_LOOP, 1, 1, ain, aout };
3243
3264
 
3244
3265
  return na_ndloop(&ndf, 1, self);
3245
3266
  }
3246
3267
 
3247
- #define check_intdivzero(y) \
3268
+ #define check_intdivzero(y) \
3248
3269
  {}
3249
3270
 
3250
3271
  static void iter_int16_left_shift(na_loop_t* const lp) {
@@ -3259,7 +3280,8 @@ static void iter_int16_left_shift(na_loop_t* const lp) {
3259
3280
  INIT_PTR(lp, 2, p3, s3);
3260
3281
 
3261
3282
  //
3262
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
3283
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
3284
+ is_aligned(p3, sizeof(dtype))) {
3263
3285
 
3264
3286
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
3265
3287
  if (p1 == p3) { // inplace case
@@ -3276,7 +3298,8 @@ static void iter_int16_left_shift(na_loop_t* const lp) {
3276
3298
  return;
3277
3299
  }
3278
3300
 
3279
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
3301
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
3302
+ is_aligned_step(s3, sizeof(dtype))) {
3280
3303
  //
3281
3304
 
3282
3305
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -3334,9 +3357,9 @@ static void iter_int16_left_shift(na_loop_t* const lp) {
3334
3357
  #undef check_intdivzero
3335
3358
 
3336
3359
  static VALUE int16_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_int16_left_shift, STRIDE_LOOP, 2, 1, ain, aout};
3360
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3361
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3362
+ ndfunc_t ndf = { iter_int16_left_shift, STRIDE_LOOP, 2, 1, ain, aout };
3340
3363
 
3341
3364
  return na_ndloop(&ndf, 2, self, other);
3342
3365
  }
@@ -3360,7 +3383,7 @@ static VALUE int16_left_shift(VALUE self, VALUE other) {
3360
3383
  }
3361
3384
  }
3362
3385
 
3363
- #define check_intdivzero(y) \
3386
+ #define check_intdivzero(y) \
3364
3387
  {}
3365
3388
 
3366
3389
  static void iter_int16_right_shift(na_loop_t* const lp) {
@@ -3375,7 +3398,8 @@ static void iter_int16_right_shift(na_loop_t* const lp) {
3375
3398
  INIT_PTR(lp, 2, p3, s3);
3376
3399
 
3377
3400
  //
3378
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
3401
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
3402
+ is_aligned(p3, sizeof(dtype))) {
3379
3403
 
3380
3404
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
3381
3405
  if (p1 == p3) { // inplace case
@@ -3392,7 +3416,8 @@ static void iter_int16_right_shift(na_loop_t* const lp) {
3392
3416
  return;
3393
3417
  }
3394
3418
 
3395
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
3419
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
3420
+ is_aligned_step(s3, sizeof(dtype))) {
3396
3421
  //
3397
3422
 
3398
3423
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -3450,9 +3475,9 @@ static void iter_int16_right_shift(na_loop_t* const lp) {
3450
3475
  #undef check_intdivzero
3451
3476
 
3452
3477
  static VALUE int16_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_int16_right_shift, STRIDE_LOOP, 2, 1, ain, aout};
3478
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3479
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3480
+ ndfunc_t ndf = { iter_int16_right_shift, STRIDE_LOOP, 2, 1, ain, aout };
3456
3481
 
3457
3482
  return na_ndloop(&ndf, 2, self, other);
3458
3483
  }
@@ -3498,9 +3523,9 @@ static void iter_int16_gt(na_loop_t* const lp) {
3498
3523
  }
3499
3524
 
3500
3525
  static VALUE int16_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_int16_gt, STRIDE_LOOP, 2, 1, ain, aout};
3526
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3527
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3528
+ ndfunc_t ndf = { iter_int16_gt, STRIDE_LOOP, 2, 1, ain, aout };
3504
3529
 
3505
3530
  return na_ndloop(&ndf, 2, self, other);
3506
3531
  }
@@ -3545,9 +3570,9 @@ static void iter_int16_ge(na_loop_t* const lp) {
3545
3570
  }
3546
3571
 
3547
3572
  static VALUE int16_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_int16_ge, STRIDE_LOOP, 2, 1, ain, aout};
3573
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3574
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3575
+ ndfunc_t ndf = { iter_int16_ge, STRIDE_LOOP, 2, 1, ain, aout };
3551
3576
 
3552
3577
  return na_ndloop(&ndf, 2, self, other);
3553
3578
  }
@@ -3592,9 +3617,9 @@ static void iter_int16_lt(na_loop_t* const lp) {
3592
3617
  }
3593
3618
 
3594
3619
  static VALUE int16_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_int16_lt, STRIDE_LOOP, 2, 1, ain, aout};
3620
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3621
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3622
+ ndfunc_t ndf = { iter_int16_lt, STRIDE_LOOP, 2, 1, ain, aout };
3598
3623
 
3599
3624
  return na_ndloop(&ndf, 2, self, other);
3600
3625
  }
@@ -3639,9 +3664,9 @@ static void iter_int16_le(na_loop_t* const lp) {
3639
3664
  }
3640
3665
 
3641
3666
  static VALUE int16_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_int16_le, STRIDE_LOOP, 2, 1, ain, aout};
3667
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3668
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3669
+ ndfunc_t ndf = { iter_int16_le, STRIDE_LOOP, 2, 1, ain, aout };
3645
3670
 
3646
3671
  return na_ndloop(&ndf, 2, self, other);
3647
3672
  }
@@ -3760,11 +3785,11 @@ static void iter_int16_clip_max(na_loop_t* const lp) {
3760
3785
  # [3, 4, 2, 3, 4, 5, 6, 7, 8, 8]
3761
3786
  */
3762
3787
  static VALUE int16_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_int16_clip_min, STRIDE_LOOP, 2, 1, ain, aout};
3766
- ndfunc_t ndf_max = {iter_int16_clip_max, STRIDE_LOOP, 2, 1, ain, aout};
3767
- ndfunc_t ndf_both = {iter_int16_clip, STRIDE_LOOP, 3, 1, ain, aout};
3788
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { cT, 0 }, { cT, 0 } };
3789
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3790
+ ndfunc_t ndf_min = { iter_int16_clip_min, STRIDE_LOOP, 2, 1, ain, aout };
3791
+ ndfunc_t ndf_max = { iter_int16_clip_max, STRIDE_LOOP, 2, 1, ain, aout };
3792
+ ndfunc_t ndf_both = { iter_int16_clip, STRIDE_LOOP, 3, 1, ain, aout };
3768
3793
 
3769
3794
  if (RTEST(min)) {
3770
3795
  if (RTEST(max)) {
@@ -3797,14 +3822,15 @@ static void iter_int16_sum(na_loop_t* const lp) {
3797
3822
  sum of self.
3798
3823
  @overload sum(axis:nil, keepdims:false)
3799
3824
  @param [Numeric,Array,Range] axis Performs sum along the axis.
3800
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3825
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3826
+ dimensions with size one.
3801
3827
  @return [Numo::Int16] returns result of sum.
3802
3828
  */
3803
3829
  static VALUE int16_sum(int argc, VALUE* argv, VALUE self) {
3804
3830
  VALUE v, reduce;
3805
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3806
- ndfunc_arg_out_t aout[1] = {{numo_cInt64, 0}};
3807
- ndfunc_t ndf = {iter_int16_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3831
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3832
+ ndfunc_arg_out_t aout[1] = { { numo_cInt64, 0 } };
3833
+ ndfunc_t ndf = { iter_int16_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3808
3834
 
3809
3835
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3810
3836
 
@@ -3829,14 +3855,15 @@ static void iter_int16_prod(na_loop_t* const lp) {
3829
3855
  prod of self.
3830
3856
  @overload prod(axis:nil, keepdims:false)
3831
3857
  @param [Numeric,Array,Range] axis Performs prod along the axis.
3832
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3858
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3859
+ dimensions with size one.
3833
3860
  @return [Numo::Int16] returns result of prod.
3834
3861
  */
3835
3862
  static VALUE int16_prod(int argc, VALUE* argv, VALUE self) {
3836
3863
  VALUE v, reduce;
3837
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3838
- ndfunc_arg_out_t aout[1] = {{numo_cInt64, 0}};
3839
- ndfunc_t ndf = {iter_int16_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3864
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3865
+ ndfunc_arg_out_t aout[1] = { { numo_cInt64, 0 } };
3866
+ ndfunc_t ndf = { iter_int16_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3840
3867
 
3841
3868
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3842
3869
 
@@ -3861,14 +3888,15 @@ static void iter_int16_min(na_loop_t* const lp) {
3861
3888
  min of self.
3862
3889
  @overload min(axis:nil, keepdims:false)
3863
3890
  @param [Numeric,Array,Range] axis Performs min along the axis.
3864
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3891
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3892
+ dimensions with size one.
3865
3893
  @return [Numo::Int16] returns result of min.
3866
3894
  */
3867
3895
  static VALUE int16_min(int argc, VALUE* argv, VALUE self) {
3868
3896
  VALUE v, reduce;
3869
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3870
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3871
- ndfunc_t ndf = {iter_int16_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3897
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3898
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3899
+ ndfunc_t ndf = { iter_int16_min, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3872
3900
 
3873
3901
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3874
3902
 
@@ -3893,14 +3921,15 @@ static void iter_int16_max(na_loop_t* const lp) {
3893
3921
  max of self.
3894
3922
  @overload max(axis:nil, keepdims:false)
3895
3923
  @param [Numeric,Array,Range] axis Performs max along the axis.
3896
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3924
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3925
+ dimensions with size one.
3897
3926
  @return [Numo::Int16] returns result of max.
3898
3927
  */
3899
3928
  static VALUE int16_max(int argc, VALUE* argv, VALUE self) {
3900
3929
  VALUE v, reduce;
3901
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3902
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3903
- ndfunc_t ndf = {iter_int16_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3930
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3931
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3932
+ ndfunc_t ndf = { iter_int16_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3904
3933
 
3905
3934
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3906
3935
 
@@ -3925,14 +3954,15 @@ static void iter_int16_ptp(na_loop_t* const lp) {
3925
3954
  ptp of self.
3926
3955
  @overload ptp(axis:nil, keepdims:false)
3927
3956
  @param [Numeric,Array,Range] axis Performs ptp along the axis.
3928
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3957
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3958
+ dimensions with size one.
3929
3959
  @return [Numo::Int16] returns result of ptp.
3930
3960
  */
3931
3961
  static VALUE int16_ptp(int argc, VALUE* argv, VALUE self) {
3932
3962
  VALUE v, reduce;
3933
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3934
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3935
- ndfunc_t ndf = {iter_int16_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3963
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3964
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3965
+ ndfunc_t ndf = { iter_int16_ptp, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3936
3966
 
3937
3967
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
3938
3968
 
@@ -3978,7 +4008,8 @@ static void iter_int16_max_index_index32(na_loop_t* const lp) {
3978
4008
  /*
3979
4009
  Index of the maximum value.
3980
4010
  @overload max_index(axis:nil)
3981
- @param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d indices**.
4011
+ @param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **flat 1-d
4012
+ indices**.
3982
4013
  @return [Integer,Numo::Int] returns result indices.
3983
4014
  @see #argmax
3984
4015
  @see #max
@@ -3996,9 +4027,9 @@ static void iter_int16_max_index_index32(na_loop_t* const lp) {
3996
4027
  static VALUE int16_max_index(int argc, VALUE* argv, VALUE self) {
3997
4028
  narray_t* na;
3998
4029
  VALUE idx, reduce;
3999
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
4000
- ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
4001
- ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
4030
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
4031
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
4032
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
4002
4033
 
4003
4034
  GetNArray(self, na);
4004
4035
  if (na->ndim == 0) {
@@ -4060,7 +4091,8 @@ static void iter_int16_min_index_index32(na_loop_t* const lp) {
4060
4091
  /*
4061
4092
  Index of the minimum value.
4062
4093
  @overload min_index(axis:nil)
4063
- @param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d indices**.
4094
+ @param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **flat 1-d
4095
+ indices**.
4064
4096
  @return [Integer,Numo::Int] returns result indices.
4065
4097
  @see #argmin
4066
4098
  @see #min
@@ -4078,9 +4110,9 @@ static void iter_int16_min_index_index32(na_loop_t* const lp) {
4078
4110
  static VALUE int16_min_index(int argc, VALUE* argv, VALUE self) {
4079
4111
  narray_t* na;
4080
4112
  VALUE idx, reduce;
4081
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {Qnil, 0}, {sym_reduce, 0}};
4082
- ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
4083
- ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout};
4113
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } };
4114
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
4115
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout };
4084
4116
 
4085
4117
  GetNArray(self, na);
4086
4118
  if (na->ndim == 0) {
@@ -4140,7 +4172,8 @@ static void iter_int16_argmax_arg32(na_loop_t* const lp) {
4140
4172
  /*
4141
4173
  Index of the maximum value.
4142
4174
  @overload argmax(axis:nil)
4143
- @param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices along the axis**.
4175
+ @param [Numeric,Array,Range] axis Finds maximum values along the axis and returns **indices
4176
+ along the axis**.
4144
4177
  @return [Integer,Numo::Int] returns the result indices.
4145
4178
  @see #max_index
4146
4179
  @see #max
@@ -4158,9 +4191,9 @@ static void iter_int16_argmax_arg32(na_loop_t* const lp) {
4158
4191
  static VALUE int16_argmax(int argc, VALUE* argv, VALUE self) {
4159
4192
  narray_t* na;
4160
4193
  VALUE reduce;
4161
- ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
4162
- ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
4163
- ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
4194
+ ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
4195
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
4196
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
4164
4197
 
4165
4198
  GetNArray(self, na);
4166
4199
  if (na->ndim == 0) {
@@ -4217,7 +4250,8 @@ static void iter_int16_argmin_arg32(na_loop_t* const lp) {
4217
4250
  /*
4218
4251
  Index of the minimum value.
4219
4252
  @overload argmin(axis:nil)
4220
- @param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices along the axis**.
4253
+ @param [Numeric,Array,Range] axis Finds minimum values along the axis and returns **indices
4254
+ along the axis**.
4221
4255
  @return [Integer,Numo::Int] returns the result indices.
4222
4256
  @see #min_index
4223
4257
  @see #min
@@ -4235,9 +4269,9 @@ static void iter_int16_argmin_arg32(na_loop_t* const lp) {
4235
4269
  static VALUE int16_argmin(int argc, VALUE* argv, VALUE self) {
4236
4270
  narray_t* na;
4237
4271
  VALUE reduce;
4238
- ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_reduce, 0}};
4239
- ndfunc_arg_out_t aout[1] = {{0, 0, 0}};
4240
- ndfunc_t ndf = {0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout};
4272
+ ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_reduce, 0 } };
4273
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
4274
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 1, ain, aout };
4241
4275
 
4242
4276
  GetNArray(self, na);
4243
4277
  if (na->ndim == 0) {
@@ -4278,14 +4312,17 @@ static void iter_int16_minmax(na_loop_t* const lp) {
4278
4312
  minmax of self.
4279
4313
  @overload minmax(axis:nil, keepdims:false)
4280
4314
  @param [Numeric,Array,Range] axis Finds min-max along the axis.
4281
- @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array as dimensions with size one.
4315
+ @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
4316
+ as dimensions with size one.
4282
4317
  @return [Numo::Int16,Numo::Int16] min and max of self.
4283
4318
  */
4284
4319
  static VALUE int16_minmax(int argc, VALUE* argv, VALUE self) {
4285
4320
  VALUE reduce;
4286
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4287
- ndfunc_arg_out_t aout[2] = {{cT, 0}, {cT, 0}};
4288
- ndfunc_t ndf = {iter_int16_minmax, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 2, ain, aout};
4321
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4322
+ ndfunc_arg_out_t aout[2] = { { cT, 0 }, { cT, 0 } };
4323
+ ndfunc_t ndf = {
4324
+ iter_int16_minmax, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 2, 2, ain, aout
4325
+ };
4289
4326
 
4290
4327
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
4291
4328
 
@@ -4323,9 +4360,9 @@ static void iter_int16_s_maximum(na_loop_t* const lp) {
4323
4360
  static VALUE int16_s_maximum(int argc, VALUE* argv, VALUE mod) {
4324
4361
  VALUE a1 = Qnil;
4325
4362
  VALUE a2 = Qnil;
4326
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
4327
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4328
- ndfunc_t ndf = {iter_int16_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
4363
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
4364
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4365
+ ndfunc_t ndf = { iter_int16_s_maximum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
4329
4366
 
4330
4367
  rb_scan_args(argc, argv, "20", &a1, &a2);
4331
4368
 
@@ -4363,9 +4400,9 @@ static void iter_int16_s_minimum(na_loop_t* const lp) {
4363
4400
  static VALUE int16_s_minimum(int argc, VALUE* argv, VALUE mod) {
4364
4401
  VALUE a1 = Qnil;
4365
4402
  VALUE a2 = Qnil;
4366
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
4367
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4368
- ndfunc_t ndf = {iter_int16_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout};
4403
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
4404
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4405
+ ndfunc_t ndf = { iter_int16_s_minimum, STRIDE_LOOP_NIP, 2, 1, ain, aout };
4369
4406
 
4370
4407
  rb_scan_args(argc, argv, "20", &a1, &a2);
4371
4408
 
@@ -4404,10 +4441,12 @@ static void iter_int16_bincount_32(na_loop_t* const lp) {
4404
4441
  }
4405
4442
 
4406
4443
  static VALUE int16_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_int16_bincount_32, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout};
4444
+ size_t shape_out[1] = { length };
4445
+ ndfunc_arg_in_t ain[1] = { { cT, 1 } };
4446
+ ndfunc_arg_out_t aout[1] = { { numo_cUInt32, 1, shape_out } };
4447
+ ndfunc_t ndf = {
4448
+ iter_int16_bincount_32, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout
4449
+ };
4411
4450
 
4412
4451
  return na_ndloop(&ndf, 1, self);
4413
4452
  }
@@ -4442,10 +4481,12 @@ static void iter_int16_bincount_64(na_loop_t* const lp) {
4442
4481
  }
4443
4482
 
4444
4483
  static VALUE int16_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_int16_bincount_64, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout};
4484
+ size_t shape_out[1] = { length };
4485
+ ndfunc_arg_in_t ain[1] = { { cT, 1 } };
4486
+ ndfunc_arg_out_t aout[1] = { { numo_cUInt64, 1, shape_out } };
4487
+ ndfunc_t ndf = {
4488
+ iter_int16_bincount_64, NO_LOOP | NDF_STRIDE_LOOP | NDF_INDEX_LOOP, 1, 1, ain, aout
4489
+ };
4449
4490
 
4450
4491
  return na_ndloop(&ndf, 1, self);
4451
4492
  }
@@ -4482,10 +4523,10 @@ static void iter_int16_bincount_sf(na_loop_t* const lp) {
4482
4523
  }
4483
4524
 
4484
4525
  static VALUE int16_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_int16_bincount_sf, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout};
4526
+ size_t shape_out[1] = { length };
4527
+ ndfunc_arg_in_t ain[2] = { { cT, 1 }, { numo_cSFloat, 1 } };
4528
+ ndfunc_arg_out_t aout[1] = { { numo_cSFloat, 1, shape_out } };
4529
+ ndfunc_t ndf = { iter_int16_bincount_sf, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout };
4489
4530
 
4490
4531
  return na_ndloop(&ndf, 2, self, weight);
4491
4532
  }
@@ -4519,10 +4560,10 @@ static void iter_int16_bincount_df(na_loop_t* const lp) {
4519
4560
  }
4520
4561
 
4521
4562
  static VALUE int16_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_int16_bincount_df, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout};
4563
+ size_t shape_out[1] = { length };
4564
+ ndfunc_arg_in_t ain[2] = { { cT, 1 }, { numo_cDFloat, 1 } };
4565
+ ndfunc_arg_out_t aout[1] = { { numo_cDFloat, 1, shape_out } };
4566
+ ndfunc_t ndf = { iter_int16_bincount_df, NO_LOOP | NDF_STRIDE_LOOP, 2, 1, ain, aout };
4526
4567
 
4527
4568
  return na_ndloop(&ndf, 2, self, weight);
4528
4569
  }
@@ -4562,9 +4603,9 @@ static VALUE int16_bincount_df(VALUE self, VALUE weight, size_t length) {
4562
4603
  */
4563
4604
  static VALUE int16_bincount(int argc, VALUE* argv, VALUE self) {
4564
4605
  VALUE weight = Qnil, kw = Qnil;
4565
- VALUE opts[1] = {Qundef};
4606
+ VALUE opts[1] = { Qundef };
4566
4607
  VALUE v, wclass;
4567
- ID table[1] = {id_minlength};
4608
+ ID table[1] = { id_minlength };
4568
4609
  size_t length, minlength;
4569
4610
 
4570
4611
  rb_scan_args(argc, argv, "01:", &weight, &kw);
@@ -4610,16 +4651,13 @@ static void iter_int16_cumsum(na_loop_t* const lp) {
4610
4651
  INIT_COUNTER(lp, i);
4611
4652
  INIT_PTR(lp, 0, p1, s1);
4612
4653
  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
4654
 
4615
4655
  GET_DATA_STRIDE(p1, s1, dtype, x);
4616
4656
  SET_DATA_STRIDE(p2, s2, dtype, x);
4617
- // printf("i=%lu x=%f\n",i,x);
4618
4657
  for (i--; i--;) {
4619
4658
  GET_DATA_STRIDE(p1, s1, dtype, y);
4620
4659
  m_cumsum(x, y);
4621
4660
  SET_DATA_STRIDE(p2, s2, dtype, x);
4622
- // printf("i=%lu x=%f\n",i,x);
4623
4661
  }
4624
4662
  }
4625
4663
 
@@ -4632,9 +4670,11 @@ static void iter_int16_cumsum(na_loop_t* const lp) {
4632
4670
  */
4633
4671
  static VALUE int16_cumsum(int argc, VALUE* argv, VALUE self) {
4634
4672
  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_int16_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout};
4673
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4674
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4675
+ ndfunc_t ndf = {
4676
+ iter_int16_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
4677
+ };
4638
4678
 
4639
4679
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
4640
4680
 
@@ -4650,16 +4690,13 @@ static void iter_int16_cumprod(na_loop_t* const lp) {
4650
4690
  INIT_COUNTER(lp, i);
4651
4691
  INIT_PTR(lp, 0, p1, s1);
4652
4692
  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
4693
 
4655
4694
  GET_DATA_STRIDE(p1, s1, dtype, x);
4656
4695
  SET_DATA_STRIDE(p2, s2, dtype, x);
4657
- // printf("i=%lu x=%f\n",i,x);
4658
4696
  for (i--; i--;) {
4659
4697
  GET_DATA_STRIDE(p1, s1, dtype, y);
4660
4698
  m_cumprod(x, y);
4661
4699
  SET_DATA_STRIDE(p2, s2, dtype, x);
4662
- // printf("i=%lu x=%f\n",i,x);
4663
4700
  }
4664
4701
  }
4665
4702
 
@@ -4672,9 +4709,11 @@ static void iter_int16_cumprod(na_loop_t* const lp) {
4672
4709
  */
4673
4710
  static VALUE int16_cumprod(int argc, VALUE* argv, VALUE self) {
4674
4711
  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_int16_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout};
4712
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4713
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4714
+ ndfunc_t ndf = {
4715
+ iter_int16_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
4716
+ };
4678
4717
 
4679
4718
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
4680
4719
 
@@ -4720,9 +4759,9 @@ static void iter_int16_mulsum(na_loop_t* const lp) {
4720
4759
  static VALUE int16_mulsum_self(int argc, VALUE* argv, VALUE self) {
4721
4760
  VALUE v, reduce;
4722
4761
  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_int16_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout};
4762
+ ndfunc_arg_in_t ain[4] = { { cT, 0 }, { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
4763
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4764
+ ndfunc_t ndf = { iter_int16_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout };
4726
4765
 
4727
4766
  if (argc < 1) {
4728
4767
  rb_raise(rb_eArgError, "wrong number of arguments (%d for >=1)", argc);
@@ -4744,7 +4783,8 @@ static VALUE int16_mulsum_self(int argc, VALUE* argv, VALUE self) {
4744
4783
  @overload mulsum(other, axis:nil, keepdims:false)
4745
4784
  @param [Numo::NArray,Numeric] other
4746
4785
  @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.
4786
+ @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
4787
+ as dimensions with size one.
4748
4788
  @return [Numo::NArray] mulsum of self and other.
4749
4789
  */
4750
4790
  static VALUE int16_mulsum(int argc, VALUE* argv, VALUE self) {
@@ -4829,8 +4869,8 @@ static void iter_int16_seq(na_loop_t* const lp) {
4829
4869
  static VALUE int16_seq(int argc, VALUE* args, VALUE self) {
4830
4870
  seq_opt_t* g;
4831
4871
  VALUE vbeg = Qnil, vstep = Qnil;
4832
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
4833
- ndfunc_t ndf = {iter_int16_seq, FULL_LOOP, 1, 0, ain, 0};
4872
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
4873
+ ndfunc_t ndf = { iter_int16_seq, FULL_LOOP, 1, 0, ain, 0 };
4834
4874
 
4835
4875
  g = ALLOCA_N(seq_opt_t, 1);
4836
4876
  g->beg = m_zero;
@@ -4887,8 +4927,8 @@ static void iter_int16_eye(na_loop_t* const lp) {
4887
4927
  @return [Numo::Int16] eye of self.
4888
4928
  */
4889
4929
  static VALUE int16_eye(int argc, VALUE* argv, VALUE self) {
4890
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 2}};
4891
- ndfunc_t ndf = {iter_int16_eye, NO_LOOP, 1, 0, ain, 0};
4930
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 2 } };
4931
+ ndfunc_t ndf = { iter_int16_eye, NO_LOOP, 1, 0, ain, 0 };
4892
4932
  ssize_t kofs;
4893
4933
  dtype data;
4894
4934
  char* g;
@@ -4918,17 +4958,21 @@ static VALUE int16_eye(int argc, VALUE* argv, VALUE self) {
4918
4958
  // Diagonal offset from the main diagonal.
4919
4959
  if (kofs >= 0) {
4920
4960
  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]);
4961
+ rb_raise(
4962
+ rb_eArgError,
4963
+ "invalid diagonal offset(%" SZF "d) for "
4964
+ "last dimension size(%" SZF "d)",
4965
+ kofs, na->shape[nd - 1]
4966
+ );
4925
4967
  }
4926
4968
  } else {
4927
4969
  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]);
4970
+ rb_raise(
4971
+ rb_eArgError,
4972
+ "invalid diagonal offset(%" SZF "d) for "
4973
+ "last-1 dimension size(%" SZF "d)",
4974
+ kofs, na->shape[nd - 2]
4975
+ );
4932
4976
  }
4933
4977
  }
4934
4978
 
@@ -5013,7 +5057,8 @@ static void iter_int16_rand(na_loop_t* const lp) {
5013
5057
  Generate uniformly distributed random numbers on self narray.
5014
5058
  @overload rand([[low],high])
5015
5059
  @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)
5060
+ @param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
5061
+ complex types)
5017
5062
  @return [Numo::Int16] self.
5018
5063
  @example
5019
5064
  Numo::DFloat.new(6).rand
@@ -5032,8 +5077,8 @@ static VALUE int16_rand(int argc, VALUE* args, VALUE self) {
5032
5077
  rand_opt_t g;
5033
5078
  VALUE v1 = Qnil, v2 = Qnil;
5034
5079
  dtype high;
5035
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
5036
- ndfunc_t ndf = {iter_int16_rand, FULL_LOOP, 1, 0, ain, 0};
5080
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
5081
+ ndfunc_t ndf = { iter_int16_rand, FULL_LOOP, 1, 0, ain, 0 };
5037
5082
 
5038
5083
  rb_scan_args(argc, args, "11", &v1, &v2);
5039
5084
  if (v2 == Qnil) {
@@ -5081,8 +5126,8 @@ static VALUE int16_poly(VALUE self, VALUE args) {
5081
5126
  int argc, i;
5082
5127
  VALUE* argv;
5083
5128
  volatile VALUE v, a;
5084
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5085
- ndfunc_t ndf = {iter_int16_poly, NO_LOOP, 0, 1, 0, aout};
5129
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5130
+ ndfunc_t ndf = { iter_int16_poly, NO_LOOP, 0, 1, 0, aout };
5086
5131
 
5087
5132
  argc = (int)RARRAY_LEN(args);
5088
5133
  ndf.nin = argc + 1;
@@ -5162,23 +5207,28 @@ static VALUE int16_poly(VALUE self, VALUE args) {
5162
5207
  * We have modified their original by adding a check for already-sorted input,
5163
5208
  * which seems to be a win per discussions on pgsql-hackers around 2006-03-21.
5164
5209
  */
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); \
5210
+ #define swapcode(TYPE, parmi, parmj, n) \
5211
+ do { \
5212
+ size_t i = (n) / sizeof(TYPE); \
5213
+ TYPE* pi = (TYPE*)(void*)(parmi); \
5214
+ TYPE* pj = (TYPE*)(void*)(parmj); \
5215
+ do { \
5216
+ TYPE t = *pi; \
5217
+ *pi++ = *pj; \
5218
+ *pj++ = t; \
5219
+ } while (--i > 0); \
5175
5220
  } while (0)
5176
5221
 
5177
5222
  #ifdef HAVE_STDINT_H
5178
- #define SWAPINIT(a, es) swaptype = (uintptr_t)(a) % sizeof(long) || (es) % sizeof(long) ? 2 : (es) == sizeof(long) ? 0 : 1;
5223
+ #define SWAPINIT(a, es) \
5224
+ swaptype = (uintptr_t)(a) % sizeof(long) || (es) % sizeof(long) ? 2 \
5225
+ : (es) == sizeof(long) ? 0 \
5226
+ : 1;
5179
5227
  #else
5180
- #define SWAPINIT(a, es) \
5181
- swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2 : (es) == sizeof(long) ? 0 : 1;
5228
+ #define SWAPINIT(a, es) \
5229
+ swaptype = ((char*)(a) - (char*)0) % sizeof(long) || (es) % sizeof(long) ? 2 \
5230
+ : (es) == sizeof(long) ? 0 \
5231
+ : 1;
5182
5232
  #endif
5183
5233
 
5184
5234
  static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
@@ -5188,19 +5238,20 @@ static inline void swapfunc(char* a, char* b, size_t n, int swaptype) {
5188
5238
  swapcode(char, a, b, n);
5189
5239
  }
5190
5240
 
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 \
5241
+ #define swap(a, b) \
5242
+ if (swaptype == 0) { \
5243
+ long t = *(long*)(void*)(a); \
5244
+ *(long*)(void*)(a) = *(long*)(void*)(b); \
5245
+ *(long*)(void*)(b) = t; \
5246
+ } else \
5197
5247
  swapfunc(a, b, es, swaptype)
5198
5248
 
5199
- #define vecswap(a, b, n) \
5249
+ #define vecswap(a, b, n) \
5200
5250
  if ((n) > 0) swapfunc((a), (b), (size_t)(n), swaptype)
5201
5251
 
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)))
5252
+ #define med3(a, b, c, _cmp) \
5253
+ (cmpgt(b, a) ? (cmpgt(c, b) ? b : (cmpgt(c, a) ? c : a)) \
5254
+ : (cmpgt(b, c) ? b : (cmpgt(c, a) ? a : c)))
5204
5255
  #endif
5205
5256
 
5206
5257
  #undef qsort_dtype
@@ -5297,8 +5348,8 @@ static void iter_int16_sort(na_loop_t* const lp) {
5297
5348
  */
5298
5349
  static VALUE int16_sort(int argc, VALUE* argv, VALUE self) {
5299
5350
  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};
5351
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
5352
+ ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 0, ain, 0 };
5302
5353
 
5303
5354
  if (!TEST_INPLACE(self)) {
5304
5355
  self = na_copy(self);
@@ -5399,7 +5450,8 @@ loop:
5399
5450
  pm = med3(pl, pm, pn, cmp);
5400
5451
  }
5401
5452
  swap(a, pm);
5402
- for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc; pb += es, pc -= es) {
5453
+ for (pa = pb = (char*)a + es, pc = pd = (char*)a + (n - 1) * es; pb <= pc;
5454
+ pb += es, pc -= es) {
5403
5455
  while (pb <= pc && (r = cmp(pb, a)) <= 0) {
5404
5456
  if (r == 0) {
5405
5457
  swap(pa, pb);
@@ -5446,7 +5498,6 @@ static void int16_index64_qsort(na_loop_t* const lp) {
5446
5498
 
5447
5499
  ptr = (char**)(lp->opt_ptr);
5448
5500
 
5449
- // printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
5450
5501
  // 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
5502
 
5452
5503
  if (n == 1) {
@@ -5456,21 +5507,17 @@ static void int16_index64_qsort(na_loop_t* const lp) {
5456
5507
 
5457
5508
  for (i = 0; i < n; i++) {
5458
5509
  ptr[i] = d_ptr + d_step * i;
5459
- // printf("(%ld,%.3f)",i,*(double*)ptr[i]);
5460
5510
  }
5461
5511
 
5462
5512
  int16_index_qsort(ptr, n, sizeof(dtype*));
5463
5513
 
5464
5514
  // d_ptr = lp->args[0].ptr;
5465
- // printf("(d_ptr=%lx)\n",(size_t)d_ptr);
5466
5515
 
5467
5516
  for (i = 0; i < n; i++) {
5468
5517
  idx = (ptr[i] - d_ptr) / d_step;
5469
5518
  *(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
5470
- // printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
5471
5519
  o_ptr += o_step;
5472
5520
  }
5473
- // printf("\n");
5474
5521
  }
5475
5522
  #undef idx_t
5476
5523
 
@@ -5488,7 +5535,6 @@ static void int16_index32_qsort(na_loop_t* const lp) {
5488
5535
 
5489
5536
  ptr = (char**)(lp->opt_ptr);
5490
5537
 
5491
- // printf("(ptr=%lx, d_ptr=%lx,d_step=%ld, i_ptr=%lx,i_step=%ld,
5492
5538
  // 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
5539
 
5494
5540
  if (n == 1) {
@@ -5498,21 +5544,17 @@ static void int16_index32_qsort(na_loop_t* const lp) {
5498
5544
 
5499
5545
  for (i = 0; i < n; i++) {
5500
5546
  ptr[i] = d_ptr + d_step * i;
5501
- // printf("(%ld,%.3f)",i,*(double*)ptr[i]);
5502
5547
  }
5503
5548
 
5504
5549
  int16_index_qsort(ptr, n, sizeof(dtype*));
5505
5550
 
5506
5551
  // d_ptr = lp->args[0].ptr;
5507
- // printf("(d_ptr=%lx)\n",(size_t)d_ptr);
5508
5552
 
5509
5553
  for (i = 0; i < n; i++) {
5510
5554
  idx = (ptr[i] - d_ptr) / d_step;
5511
5555
  *(idx_t*)o_ptr = *(idx_t*)(i_ptr + i_step * idx);
5512
- // printf("(idx[%ld]=%ld,%d)",i,idx,*(idx_t*)o_ptr);
5513
5556
  o_ptr += o_step;
5514
5557
  }
5515
- // printf("\n");
5516
5558
  }
5517
5559
  #undef idx_t
5518
5560
 
@@ -5529,9 +5571,9 @@ static VALUE int16_sort_index(int argc, VALUE* argv, VALUE self) {
5529
5571
  narray_t* na;
5530
5572
  VALUE idx, tmp, reduce, res;
5531
5573
  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};
5574
+ ndfunc_arg_in_t ain[3] = { { cT, 0 }, { 0, 0 }, { sym_reduce, 0 } };
5575
+ ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } };
5576
+ ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_CUM, 3, 1, ain, aout };
5535
5577
 
5536
5578
  GetNArray(self, na);
5537
5579
  if (na->ndim == 0) {
@@ -5585,15 +5627,16 @@ static void iter_int16_median(na_loop_t* const lp) {
5585
5627
  median of self.
5586
5628
  @overload median(axis:nil, keepdims:false)
5587
5629
  @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.
5630
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
5631
+ dimensions with size one.
5589
5632
  @return [Numo::Int16] returns median of self.
5590
5633
  */
5591
5634
 
5592
5635
  static VALUE int16_median(int argc, VALUE* argv, VALUE self) {
5593
5636
  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};
5637
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_reduce, 0 } };
5638
+ ndfunc_arg_out_t aout[1] = { { INT2FIX(0), 0 } };
5639
+ ndfunc_t ndf = { 0, NDF_HAS_LOOP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
5597
5640
 
5598
5641
  self = na_copy(self); // as temporary buffer
5599
5642