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
@@ -255,8 +255,8 @@ static void iter_bit_store_bit(na_loop_t* const lp) {
255
255
  }
256
256
 
257
257
  static VALUE bit_store_bit(VALUE self, VALUE obj) {
258
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
259
- ndfunc_t ndf = {iter_bit_store_bit, FULL_LOOP, 2, 0, ain, 0};
258
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
259
+ ndfunc_t ndf = { iter_bit_store_bit, FULL_LOOP, 2, 0, ain, 0 };
260
260
 
261
261
  na_ndloop(&ndf, 2, self, obj);
262
262
  return self;
@@ -311,8 +311,8 @@ static void iter_bit_store_dfloat(na_loop_t* const lp) {
311
311
  }
312
312
 
313
313
  static VALUE bit_store_dfloat(VALUE self, VALUE obj) {
314
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
315
- ndfunc_t ndf = {iter_bit_store_dfloat, FULL_LOOP, 2, 0, ain, 0};
314
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
315
+ ndfunc_t ndf = { iter_bit_store_dfloat, FULL_LOOP, 2, 0, ain, 0 };
316
316
 
317
317
  na_ndloop(&ndf, 2, self, obj);
318
318
  return self;
@@ -367,8 +367,8 @@ static void iter_bit_store_sfloat(na_loop_t* const lp) {
367
367
  }
368
368
 
369
369
  static VALUE bit_store_sfloat(VALUE self, VALUE obj) {
370
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
371
- ndfunc_t ndf = {iter_bit_store_sfloat, FULL_LOOP, 2, 0, ain, 0};
370
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
371
+ ndfunc_t ndf = { iter_bit_store_sfloat, FULL_LOOP, 2, 0, ain, 0 };
372
372
 
373
373
  na_ndloop(&ndf, 2, self, obj);
374
374
  return self;
@@ -423,8 +423,8 @@ static void iter_bit_store_int64(na_loop_t* const lp) {
423
423
  }
424
424
 
425
425
  static VALUE bit_store_int64(VALUE self, VALUE obj) {
426
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
427
- ndfunc_t ndf = {iter_bit_store_int64, FULL_LOOP, 2, 0, ain, 0};
426
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
427
+ ndfunc_t ndf = { iter_bit_store_int64, FULL_LOOP, 2, 0, ain, 0 };
428
428
 
429
429
  na_ndloop(&ndf, 2, self, obj);
430
430
  return self;
@@ -479,8 +479,8 @@ static void iter_bit_store_int32(na_loop_t* const lp) {
479
479
  }
480
480
 
481
481
  static VALUE bit_store_int32(VALUE self, VALUE obj) {
482
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
483
- ndfunc_t ndf = {iter_bit_store_int32, FULL_LOOP, 2, 0, ain, 0};
482
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
483
+ ndfunc_t ndf = { iter_bit_store_int32, FULL_LOOP, 2, 0, ain, 0 };
484
484
 
485
485
  na_ndloop(&ndf, 2, self, obj);
486
486
  return self;
@@ -535,8 +535,8 @@ static void iter_bit_store_int16(na_loop_t* const lp) {
535
535
  }
536
536
 
537
537
  static VALUE bit_store_int16(VALUE self, VALUE obj) {
538
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
539
- ndfunc_t ndf = {iter_bit_store_int16, FULL_LOOP, 2, 0, ain, 0};
538
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
539
+ ndfunc_t ndf = { iter_bit_store_int16, FULL_LOOP, 2, 0, ain, 0 };
540
540
 
541
541
  na_ndloop(&ndf, 2, self, obj);
542
542
  return self;
@@ -591,8 +591,8 @@ static void iter_bit_store_int8(na_loop_t* const lp) {
591
591
  }
592
592
 
593
593
  static VALUE bit_store_int8(VALUE self, VALUE obj) {
594
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
595
- ndfunc_t ndf = {iter_bit_store_int8, FULL_LOOP, 2, 0, ain, 0};
594
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
595
+ ndfunc_t ndf = { iter_bit_store_int8, FULL_LOOP, 2, 0, ain, 0 };
596
596
 
597
597
  na_ndloop(&ndf, 2, self, obj);
598
598
  return self;
@@ -647,8 +647,8 @@ static void iter_bit_store_uint64(na_loop_t* const lp) {
647
647
  }
648
648
 
649
649
  static VALUE bit_store_uint64(VALUE self, VALUE obj) {
650
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
651
- ndfunc_t ndf = {iter_bit_store_uint64, FULL_LOOP, 2, 0, ain, 0};
650
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
651
+ ndfunc_t ndf = { iter_bit_store_uint64, FULL_LOOP, 2, 0, ain, 0 };
652
652
 
653
653
  na_ndloop(&ndf, 2, self, obj);
654
654
  return self;
@@ -703,8 +703,8 @@ static void iter_bit_store_uint32(na_loop_t* const lp) {
703
703
  }
704
704
 
705
705
  static VALUE bit_store_uint32(VALUE self, VALUE obj) {
706
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
707
- ndfunc_t ndf = {iter_bit_store_uint32, FULL_LOOP, 2, 0, ain, 0};
706
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
707
+ ndfunc_t ndf = { iter_bit_store_uint32, FULL_LOOP, 2, 0, ain, 0 };
708
708
 
709
709
  na_ndloop(&ndf, 2, self, obj);
710
710
  return self;
@@ -759,8 +759,8 @@ static void iter_bit_store_uint16(na_loop_t* const lp) {
759
759
  }
760
760
 
761
761
  static VALUE bit_store_uint16(VALUE self, VALUE obj) {
762
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
763
- ndfunc_t ndf = {iter_bit_store_uint16, FULL_LOOP, 2, 0, ain, 0};
762
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
763
+ ndfunc_t ndf = { iter_bit_store_uint16, FULL_LOOP, 2, 0, ain, 0 };
764
764
 
765
765
  na_ndloop(&ndf, 2, self, obj);
766
766
  return self;
@@ -815,8 +815,8 @@ static void iter_bit_store_uint8(na_loop_t* const lp) {
815
815
  }
816
816
 
817
817
  static VALUE bit_store_uint8(VALUE self, VALUE obj) {
818
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
819
- ndfunc_t ndf = {iter_bit_store_uint8, FULL_LOOP, 2, 0, ain, 0};
818
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
819
+ ndfunc_t ndf = { iter_bit_store_uint8, FULL_LOOP, 2, 0, ain, 0 };
820
820
 
821
821
  na_ndloop(&ndf, 2, self, obj);
822
822
  return self;
@@ -871,8 +871,8 @@ static void iter_bit_store_robject(na_loop_t* const lp) {
871
871
  }
872
872
 
873
873
  static VALUE bit_store_robject(VALUE self, VALUE obj) {
874
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
875
- ndfunc_t ndf = {iter_bit_store_robject, FULL_LOOP, 2, 0, ain, 0};
874
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
875
+ ndfunc_t ndf = { iter_bit_store_robject, FULL_LOOP, 2, 0, ain, 0 };
876
876
 
877
877
  na_ndloop(&ndf, 2, self, obj);
878
878
  return self;
@@ -990,8 +990,8 @@ loop_end:
990
990
  }
991
991
 
992
992
  static VALUE bit_store_array(VALUE self, VALUE rary) {
993
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {rb_cArray, 0}};
994
- ndfunc_t ndf = {iter_bit_store_array, FULL_LOOP, 2, 0, ain, 0};
993
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { rb_cArray, 0 } };
994
+ ndfunc_t ndf = { iter_bit_store_array, FULL_LOOP, 2, 0, ain, 0 };
995
995
 
996
996
  na_ndloop_store_rarray(&ndf, self, rary);
997
997
  return self;
@@ -1086,8 +1086,10 @@ static VALUE bit_store(VALUE self, VALUE obj) {
1086
1086
  }
1087
1087
  }
1088
1088
 
1089
- rb_raise(nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
1090
- rb_class2name(rb_obj_class(self)));
1089
+ rb_raise(
1090
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
1091
+ rb_class2name(rb_obj_class(self))
1092
+ );
1091
1093
 
1092
1094
  return self;
1093
1095
  }
@@ -1181,7 +1183,10 @@ static dtype bit_extract_data(VALUE obj) {
1181
1183
  return bit_extract_data(r);
1182
1184
  }
1183
1185
 
1184
- rb_raise(nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)), rb_class2name(cT));
1186
+ rb_raise(
1187
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
1188
+ rb_class2name(cT)
1189
+ );
1185
1190
  }
1186
1191
  if (TYPE(obj) == T_ARRAY) {
1187
1192
  if (RARRAY_LEN(obj) != 1) {
@@ -1250,8 +1255,8 @@ static VALUE bit_s_cast(VALUE type, VALUE obj) {
1250
1255
  /*
1251
1256
  Multi-dimensional element reference.
1252
1257
  @overload [](dim0,...,dimL)
1253
- @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol] dim0,...,dimL multi-dimensional
1254
- indices.
1258
+ @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
1259
+ dim0,...,dimL multi-dimensional indices.
1255
1260
  @return [Numeric,Numo::Bit] an element or NArray view.
1256
1261
  @see Numo::NArray#[]
1257
1262
  @see #[]=
@@ -1297,8 +1302,8 @@ static VALUE bit_aref(int argc, VALUE* argv, VALUE self) {
1297
1302
  /*
1298
1303
  Multi-dimensional element assignment.
1299
1304
  @overload []=(dim0,...,dimL,val)
1300
- @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol] dim0,...,dimL multi-dimensional
1301
- indices.
1305
+ @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
1306
+ dim0,...,dimL multi-dimensional indices.
1302
1307
  @param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
1303
1308
  @return [Numeric,Numo::NArray,Array] returns `val` (last argument).
1304
1309
  @see Numo::NArray#[]=
@@ -1389,9 +1394,9 @@ static void iter_bit_to_a(na_loop_t* const lp) {
1389
1394
  @return [Array]
1390
1395
  */
1391
1396
  static VALUE bit_to_a(VALUE self) {
1392
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
1393
- ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
1394
- ndfunc_t ndf = {iter_bit_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
1397
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
1398
+ ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
1399
+ ndfunc_t ndf = { iter_bit_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
1395
1400
  return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
1396
1401
  }
1397
1402
 
@@ -1451,8 +1456,8 @@ static void iter_bit_fill(na_loop_t* const lp) {
1451
1456
  @return [Numo::Bit] self.
1452
1457
  */
1453
1458
  static VALUE bit_fill(VALUE self, VALUE val) {
1454
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_option}};
1455
- ndfunc_t ndf = {iter_bit_fill, FULL_LOOP, 2, 0, ain, 0};
1459
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
1460
+ ndfunc_t ndf = { iter_bit_fill, FULL_LOOP, 2, 0, ain, 0 };
1456
1461
 
1457
1462
  na_ndloop(&ndf, 2, self, val);
1458
1463
  return self;
@@ -1508,9 +1513,9 @@ static void iter_bit_format(na_loop_t* const lp) {
1508
1513
  static VALUE bit_format(int argc, VALUE* argv, VALUE self) {
1509
1514
  VALUE fmt = Qnil;
1510
1515
 
1511
- ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_option}};
1512
- ndfunc_arg_out_t aout[1] = {{numo_cRObject, 0}};
1513
- ndfunc_t ndf = {iter_bit_format, FULL_LOOP_NIP, 2, 1, ain, aout};
1516
+ ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_option } };
1517
+ ndfunc_arg_out_t aout[1] = { { numo_cRObject, 0 } };
1518
+ ndfunc_t ndf = { iter_bit_format, FULL_LOOP_NIP, 2, 1, ain, aout };
1514
1519
 
1515
1520
  rb_scan_args(argc, argv, "01", &fmt);
1516
1521
  return na_ndloop(&ndf, 2, self, fmt);
@@ -1555,9 +1560,9 @@ static void iter_bit_format_to_a(na_loop_t* const lp) {
1555
1560
  */
1556
1561
  static VALUE bit_format_to_a(int argc, VALUE* argv, VALUE self) {
1557
1562
  VALUE fmt = Qnil;
1558
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
1559
- ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
1560
- ndfunc_t ndf = {iter_bit_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
1563
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
1564
+ ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
1565
+ ndfunc_t ndf = { iter_bit_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
1561
1566
 
1562
1567
  rb_scan_args(argc, argv, "01", &fmt);
1563
1568
  return na_ndloop_cast_narray_to_rarray(&ndf, self, fmt);
@@ -1614,8 +1619,8 @@ static void iter_bit_each(na_loop_t* const lp) {
1614
1619
  @yield [x] x is element of NArray.
1615
1620
  */
1616
1621
  static VALUE bit_each(VALUE self) {
1617
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1618
- ndfunc_t ndf = {iter_bit_each, FULL_LOOP_NIP, 1, 0, ain, 0};
1622
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1623
+ ndfunc_t ndf = { iter_bit_each, FULL_LOOP_NIP, 1, 0, ain, 0 };
1619
1624
 
1620
1625
  na_ndloop(&ndf, 1, self);
1621
1626
  return self;
@@ -1676,8 +1681,8 @@ static void iter_bit_each_with_index(na_loop_t* const lp) {
1676
1681
  @yield [x,i,j,...] x is an element, i,j,... are multidimensional indices.
1677
1682
  */
1678
1683
  static VALUE bit_each_with_index(VALUE self) {
1679
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1680
- ndfunc_t ndf = {iter_bit_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0};
1684
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1685
+ ndfunc_t ndf = { iter_bit_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0 };
1681
1686
 
1682
1687
  na_ndloop_with_index(&ndf, 1, self);
1683
1688
  return self;
@@ -1770,9 +1775,9 @@ static void iter_bit_copy(na_loop_t* const lp) {
1770
1775
  @return [Numo::Bit] copy of self.
1771
1776
  */
1772
1777
  static VALUE bit_copy(VALUE self) {
1773
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
1774
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1775
- ndfunc_t ndf = {iter_bit_copy, FULL_LOOP, 1, 1, ain, aout};
1778
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
1779
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1780
+ ndfunc_t ndf = { iter_bit_copy, FULL_LOOP, 1, 1, ain, aout };
1776
1781
 
1777
1782
  return na_ndloop(&ndf, 1, self);
1778
1783
  }
@@ -1864,9 +1869,9 @@ static void iter_bit_not(na_loop_t* const lp) {
1864
1869
  @return [Numo::Bit] not of self.
1865
1870
  */
1866
1871
  static VALUE bit_not(VALUE self) {
1867
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
1868
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1869
- ndfunc_t ndf = {iter_bit_not, FULL_LOOP, 1, 1, ain, aout};
1872
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
1873
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1874
+ ndfunc_t ndf = { iter_bit_not, FULL_LOOP, 1, 1, ain, aout };
1870
1875
 
1871
1876
  return na_ndloop(&ndf, 1, self);
1872
1877
  }
@@ -1993,9 +1998,9 @@ static void iter_bit_and(na_loop_t* const lp) {
1993
1998
  @return [Numo::NArray] and of self and other.
1994
1999
  */
1995
2000
  static VALUE bit_and(VALUE self, VALUE other) {
1996
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
1997
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1998
- ndfunc_t ndf = {iter_bit_and, FULL_LOOP, 2, 1, ain, aout};
2001
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2002
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2003
+ ndfunc_t ndf = { iter_bit_and, FULL_LOOP, 2, 1, ain, aout };
1999
2004
 
2000
2005
  return na_ndloop(&ndf, 2, self, other);
2001
2006
  }
@@ -2122,9 +2127,9 @@ static void iter_bit_or(na_loop_t* const lp) {
2122
2127
  @return [Numo::NArray] or of self and other.
2123
2128
  */
2124
2129
  static VALUE bit_or(VALUE self, VALUE other) {
2125
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2126
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2127
- ndfunc_t ndf = {iter_bit_or, FULL_LOOP, 2, 1, ain, aout};
2130
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2131
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2132
+ ndfunc_t ndf = { iter_bit_or, FULL_LOOP, 2, 1, ain, aout };
2128
2133
 
2129
2134
  return na_ndloop(&ndf, 2, self, other);
2130
2135
  }
@@ -2251,9 +2256,9 @@ static void iter_bit_xor(na_loop_t* const lp) {
2251
2256
  @return [Numo::NArray] xor of self and other.
2252
2257
  */
2253
2258
  static VALUE bit_xor(VALUE self, VALUE other) {
2254
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2255
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2256
- ndfunc_t ndf = {iter_bit_xor, FULL_LOOP, 2, 1, ain, aout};
2259
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2260
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2261
+ ndfunc_t ndf = { iter_bit_xor, FULL_LOOP, 2, 1, ain, aout };
2257
2262
 
2258
2263
  return na_ndloop(&ndf, 2, self, other);
2259
2264
  }
@@ -2380,9 +2385,9 @@ static void iter_bit_eq(na_loop_t* const lp) {
2380
2385
  @return [Numo::NArray] eq of self and other.
2381
2386
  */
2382
2387
  static VALUE bit_eq(VALUE self, VALUE other) {
2383
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2384
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2385
- ndfunc_t ndf = {iter_bit_eq, FULL_LOOP, 2, 1, ain, aout};
2388
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2389
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2390
+ ndfunc_t ndf = { iter_bit_eq, FULL_LOOP, 2, 1, ain, aout };
2386
2391
 
2387
2392
  return na_ndloop(&ndf, 2, self, other);
2388
2393
  }
@@ -2455,15 +2460,16 @@ static void iter_bit_count_true(na_loop_t* const lp) {
2455
2460
  If argument is supplied, return Int-array counted along the axes.
2456
2461
  @overload count_true(axis:nil, keepdims:false)
2457
2462
  @param [Integer,Array,Range] axis (keyword) axes to be counted.
2458
- @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array as dimensions with size one.
2463
+ @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
2464
+ as dimensions with size one.
2459
2465
  @return [Numo::Int64]
2460
2466
  */
2461
2467
  static VALUE bit_count_true(int argc, VALUE* argv, VALUE self) {
2462
2468
  VALUE v, reduce;
2463
2469
  narray_t* na;
2464
- ndfunc_arg_in_t ain[3] = {{cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
2465
- ndfunc_arg_out_t aout[1] = {{numo_cInt64, 0}};
2466
- ndfunc_t ndf = {iter_bit_count_true, FULL_LOOP_NIP, 3, 1, ain, aout};
2470
+ ndfunc_arg_in_t ain[3] = { { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
2471
+ ndfunc_arg_out_t aout[1] = { { numo_cInt64, 0 } };
2472
+ ndfunc_t ndf = { iter_bit_count_true, FULL_LOOP_NIP, 3, 1, ain, aout };
2467
2473
 
2468
2474
  GetNArray(self, na);
2469
2475
  if (NA_SIZE(na) == 0) {
@@ -2542,15 +2548,16 @@ static void iter_bit_count_false(na_loop_t* const lp) {
2542
2548
  If argument is supplied, return Int-array counted along the axes.
2543
2549
  @overload count_false(axis:nil, keepdims:false)
2544
2550
  @param [Integer,Array,Range] axis (keyword) axes to be counted.
2545
- @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array as dimensions with size one.
2551
+ @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
2552
+ as dimensions with size one.
2546
2553
  @return [Numo::Int64]
2547
2554
  */
2548
2555
  static VALUE bit_count_false(int argc, VALUE* argv, VALUE self) {
2549
2556
  VALUE v, reduce;
2550
2557
  narray_t* na;
2551
- ndfunc_arg_in_t ain[3] = {{cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
2552
- ndfunc_arg_out_t aout[1] = {{numo_cInt64, 0}};
2553
- ndfunc_t ndf = {iter_bit_count_false, FULL_LOOP_NIP, 3, 1, ain, aout};
2558
+ ndfunc_arg_in_t ain[3] = { { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
2559
+ ndfunc_arg_out_t aout[1] = { { numo_cInt64, 0 } };
2560
+ ndfunc_t ndf = { iter_bit_count_false, FULL_LOOP_NIP, 3, 1, ain, aout };
2554
2561
 
2555
2562
  GetNArray(self, na);
2556
2563
  if (NA_SIZE(na) == 0) {
@@ -2656,15 +2663,16 @@ static void iter_bit_all_p(na_loop_t* const lp) {
2656
2663
  If argument is supplied, return Bit-array reduced along the axes.
2657
2664
  @overload all?(axis:nil, keepdims:false)
2658
2665
  @param [Integer,Array,Range] axis (keyword) axes to be reduced.
2659
- @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array as dimensions with size one.
2666
+ @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
2667
+ as dimensions with size one.
2660
2668
  @return [Numo::Bit] .
2661
2669
  */
2662
2670
  static VALUE bit_all_p(int argc, VALUE* argv, VALUE self) {
2663
2671
  VALUE v, reduce;
2664
2672
  narray_t* na;
2665
- ndfunc_arg_in_t ain[3] = {{cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
2666
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
2667
- ndfunc_t ndf = {iter_bit_all_p, FULL_LOOP_NIP, 3, 1, ain, aout};
2673
+ ndfunc_arg_in_t ain[3] = { { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
2674
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
2675
+ ndfunc_t ndf = { iter_bit_all_p, FULL_LOOP_NIP, 3, 1, ain, aout };
2668
2676
 
2669
2677
  GetNArray(self, na);
2670
2678
  if (NA_SIZE(na) == 0) {
@@ -2783,15 +2791,16 @@ static void iter_bit_any_p(na_loop_t* const lp) {
2783
2791
  If argument is supplied, return Bit-array reduced along the axes.
2784
2792
  @overload any?(axis:nil, keepdims:false)
2785
2793
  @param [Integer,Array,Range] axis (keyword) axes to be reduced.
2786
- @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array as dimensions with size one.
2794
+ @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
2795
+ as dimensions with size one.
2787
2796
  @return [Numo::Bit] .
2788
2797
  */
2789
2798
  static VALUE bit_any_p(int argc, VALUE* argv, VALUE self) {
2790
2799
  VALUE v, reduce;
2791
2800
  narray_t* na;
2792
- ndfunc_arg_in_t ain[3] = {{cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
2793
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
2794
- ndfunc_t ndf = {iter_bit_any_p, FULL_LOOP_NIP, 3, 1, ain, aout};
2801
+ ndfunc_arg_in_t ain[3] = { { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
2802
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
2803
+ ndfunc_t ndf = { iter_bit_any_p, FULL_LOOP_NIP, 3, 1, ain, aout };
2795
2804
 
2796
2805
  GetNArray(self, na);
2797
2806
  if (NA_SIZE(na) == 0) {
@@ -2889,8 +2898,8 @@ static VALUE bit_where(VALUE self) {
2889
2898
  size_t size, n_1;
2890
2899
  where_opt_t* g;
2891
2900
 
2892
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2893
- ndfunc_t ndf = {iter_bit_where, FULL_LOOP, 1, 0, ain, 0};
2901
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2902
+ ndfunc_t ndf = { iter_bit_where, FULL_LOOP, 1, 0, ain, 0 };
2894
2903
 
2895
2904
  size = RNARRAY_SIZE(self);
2896
2905
  n_1 = NUM2SIZET(bit_count_true(0, NULL, self));
@@ -2973,8 +2982,8 @@ static VALUE bit_where2(VALUE self) {
2973
2982
  size_t size, n_1, n_0;
2974
2983
  where_opt_t* g;
2975
2984
 
2976
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2977
- ndfunc_t ndf = {iter_bit_where2, FULL_LOOP, 1, 0, ain, 0};
2985
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2986
+ ndfunc_t ndf = { iter_bit_where2, FULL_LOOP, 1, 0, ain, 0 };
2978
2987
 
2979
2988
  size = RNARRAY_SIZE(self);
2980
2989
  n_1 = NUM2SIZET(bit_count_true(0, NULL, self));
@@ -3092,8 +3101,8 @@ static VALUE bit_mask(VALUE mask, VALUE val) {
3092
3101
  stridx_t stridx0;
3093
3102
  size_t n_1;
3094
3103
  where_opt_t g;
3095
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {Qnil, 0}};
3096
- ndfunc_t ndf = {iter_bit_mask, FULL_LOOP, 2, 0, ain, 0};
3104
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { Qnil, 0 } };
3105
+ ndfunc_t ndf = { iter_bit_mask, FULL_LOOP, 2, 0, ain, 0 };
3097
3106
 
3098
3107
  // cast val to NArray
3099
3108
  if (!rb_obj_is_kind_of(val, numo_cNArray)) {