numo-narray-alt 0.9.4 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/README.md +22 -3
  4. data/Rakefile +8 -0
  5. data/ext/numo/narray/SFMT-params19937.h +16 -12
  6. data/ext/numo/narray/SFMT.c +12 -5
  7. data/ext/numo/narray/array.c +51 -21
  8. data/ext/numo/narray/data.c +88 -86
  9. data/ext/numo/narray/index.c +51 -28
  10. data/ext/numo/narray/kwargs.c +11 -9
  11. data/ext/numo/narray/math.c +14 -6
  12. data/ext/numo/narray/narray.c +93 -58
  13. data/ext/numo/narray/ndloop.c +52 -63
  14. data/ext/numo/narray/numo/intern.h +9 -3
  15. data/ext/numo/narray/numo/narray.h +20 -20
  16. data/ext/numo/narray/numo/ndloop.h +1 -1
  17. data/ext/numo/narray/numo/template.h +85 -81
  18. data/ext/numo/narray/numo/types/bit.h +76 -0
  19. data/ext/numo/narray/numo/types/complex.h +7 -3
  20. data/ext/numo/narray/numo/types/complex_macro.h +28 -25
  21. data/ext/numo/narray/numo/types/float_macro.h +21 -17
  22. data/ext/numo/narray/numo/types/real_accum.h +22 -22
  23. data/ext/numo/narray/numo/types/robj_macro.h +20 -12
  24. data/ext/numo/narray/numo/types/xint_macro.h +51 -8
  25. data/ext/numo/narray/rand.c +7 -0
  26. data/ext/numo/narray/src/mh/mean.h +102 -0
  27. data/ext/numo/narray/src/mh/rms.h +102 -0
  28. data/ext/numo/narray/src/mh/stddev.h +103 -0
  29. data/ext/numo/narray/src/mh/var.h +102 -0
  30. data/ext/numo/narray/src/t_bit.c +206 -147
  31. data/ext/numo/narray/src/t_dcomplex.c +531 -641
  32. data/ext/numo/narray/src/t_dfloat.c +1341 -1421
  33. data/ext/numo/narray/src/t_int16.c +562 -468
  34. data/ext/numo/narray/src/t_int32.c +562 -468
  35. data/ext/numo/narray/src/t_int64.c +561 -467
  36. data/ext/numo/narray/src/t_int8.c +520 -448
  37. data/ext/numo/narray/src/t_robject.c +519 -619
  38. data/ext/numo/narray/src/t_scomplex.c +524 -659
  39. data/ext/numo/narray/src/t_sfloat.c +1332 -1410
  40. data/ext/numo/narray/src/t_uint16.c +562 -468
  41. data/ext/numo/narray/src/t_uint32.c +562 -468
  42. data/ext/numo/narray/src/t_uint64.c +562 -468
  43. data/ext/numo/narray/src/t_uint8.c +522 -448
  44. data/ext/numo/narray/step.c +7 -2
  45. data/ext/numo/narray/struct.c +31 -24
  46. data/lib/numo/narray/extra.rb +74 -30
  47. data/numo-narray-alt.gemspec +38 -0
  48. metadata +10 -1
@@ -32,14 +32,21 @@ static ID id_to_a;
32
32
 
33
33
  #include <numo/types/dcomplex.h>
34
34
 
35
- VALUE cT;
36
- extern VALUE cRT;
37
-
38
35
  /*
39
36
  class definition: Numo::DComplex
40
37
  */
41
-
42
38
  VALUE cT;
39
+ extern VALUE cRT;
40
+
41
+ #include "mh/mean.h"
42
+ #include "mh/var.h"
43
+ #include "mh/stddev.h"
44
+ #include "mh/rms.h"
45
+
46
+ DEF_NARRAY_FLT_MEAN_METHOD_FUNC(dcomplex, dcomplex, numo_cDComplex, numo_cDComplex)
47
+ DEF_NARRAY_FLT_VAR_METHOD_FUNC(dcomplex, double, numo_cDComplex, numo_cDFloat)
48
+ DEF_NARRAY_FLT_STDDEV_METHOD_FUNC(dcomplex, double, numo_cDComplex, numo_cDFloat)
49
+ DEF_NARRAY_FLT_RMS_METHOD_FUNC(dcomplex, double, numo_cDComplex, numo_cDFloat)
43
50
 
44
51
  static VALUE dcomplex_store(VALUE, VALUE);
45
52
 
@@ -147,8 +154,8 @@ static VALUE dcomplex_allocate(VALUE self) {
147
154
  /*
148
155
  Extract an element only if self is a dimensionless NArray.
149
156
  @overload extract
150
- @return [Numeric,Numo::NArray]
151
- --- Extract element value as Ruby Object if self is a dimensionless NArray,
157
+ @return [Numeric,Numo::NArray]
158
+ --- Extract element value as Ruby Object if self is a dimensionless NArray,
152
159
  otherwise returns self.
153
160
  */
154
161
  static VALUE dcomplex_extract(VALUE self) {
@@ -233,8 +240,8 @@ static void iter_dcomplex_store_bit(na_loop_t* const lp) {
233
240
  }
234
241
 
235
242
  static VALUE dcomplex_store_bit(VALUE self, VALUE obj) {
236
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
237
- ndfunc_t ndf = {iter_dcomplex_store_bit, FULL_LOOP, 2, 0, ain, 0};
243
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
244
+ ndfunc_t ndf = { iter_dcomplex_store_bit, FULL_LOOP, 2, 0, ain, 0 };
238
245
 
239
246
  na_ndloop(&ndf, 2, self, obj);
240
247
  return self;
@@ -282,8 +289,8 @@ static void iter_dcomplex_store_dcomplex(na_loop_t* const lp) {
282
289
  }
283
290
 
284
291
  static VALUE dcomplex_store_dcomplex(VALUE self, VALUE obj) {
285
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
286
- ndfunc_t ndf = {iter_dcomplex_store_dcomplex, FULL_LOOP, 2, 0, ain, 0};
292
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
293
+ ndfunc_t ndf = { iter_dcomplex_store_dcomplex, FULL_LOOP, 2, 0, ain, 0 };
287
294
 
288
295
  na_ndloop(&ndf, 2, self, obj);
289
296
  return self;
@@ -331,8 +338,8 @@ static void iter_dcomplex_store_scomplex(na_loop_t* const lp) {
331
338
  }
332
339
 
333
340
  static VALUE dcomplex_store_scomplex(VALUE self, VALUE obj) {
334
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
335
- ndfunc_t ndf = {iter_dcomplex_store_scomplex, FULL_LOOP, 2, 0, ain, 0};
341
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
342
+ ndfunc_t ndf = { iter_dcomplex_store_scomplex, FULL_LOOP, 2, 0, ain, 0 };
336
343
 
337
344
  na_ndloop(&ndf, 2, self, obj);
338
345
  return self;
@@ -380,8 +387,8 @@ static void iter_dcomplex_store_dfloat(na_loop_t* const lp) {
380
387
  }
381
388
 
382
389
  static VALUE dcomplex_store_dfloat(VALUE self, VALUE obj) {
383
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
384
- ndfunc_t ndf = {iter_dcomplex_store_dfloat, FULL_LOOP, 2, 0, ain, 0};
390
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
391
+ ndfunc_t ndf = { iter_dcomplex_store_dfloat, FULL_LOOP, 2, 0, ain, 0 };
385
392
 
386
393
  na_ndloop(&ndf, 2, self, obj);
387
394
  return self;
@@ -429,8 +436,8 @@ static void iter_dcomplex_store_sfloat(na_loop_t* const lp) {
429
436
  }
430
437
 
431
438
  static VALUE dcomplex_store_sfloat(VALUE self, VALUE obj) {
432
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
433
- ndfunc_t ndf = {iter_dcomplex_store_sfloat, FULL_LOOP, 2, 0, ain, 0};
439
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
440
+ ndfunc_t ndf = { iter_dcomplex_store_sfloat, FULL_LOOP, 2, 0, ain, 0 };
434
441
 
435
442
  na_ndloop(&ndf, 2, self, obj);
436
443
  return self;
@@ -478,8 +485,8 @@ static void iter_dcomplex_store_int64(na_loop_t* const lp) {
478
485
  }
479
486
 
480
487
  static VALUE dcomplex_store_int64(VALUE self, VALUE obj) {
481
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
482
- ndfunc_t ndf = {iter_dcomplex_store_int64, FULL_LOOP, 2, 0, ain, 0};
488
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
489
+ ndfunc_t ndf = { iter_dcomplex_store_int64, FULL_LOOP, 2, 0, ain, 0 };
483
490
 
484
491
  na_ndloop(&ndf, 2, self, obj);
485
492
  return self;
@@ -527,8 +534,8 @@ static void iter_dcomplex_store_int32(na_loop_t* const lp) {
527
534
  }
528
535
 
529
536
  static VALUE dcomplex_store_int32(VALUE self, VALUE obj) {
530
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
531
- ndfunc_t ndf = {iter_dcomplex_store_int32, FULL_LOOP, 2, 0, ain, 0};
537
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
538
+ ndfunc_t ndf = { iter_dcomplex_store_int32, FULL_LOOP, 2, 0, ain, 0 };
532
539
 
533
540
  na_ndloop(&ndf, 2, self, obj);
534
541
  return self;
@@ -576,8 +583,8 @@ static void iter_dcomplex_store_int16(na_loop_t* const lp) {
576
583
  }
577
584
 
578
585
  static VALUE dcomplex_store_int16(VALUE self, VALUE obj) {
579
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
580
- ndfunc_t ndf = {iter_dcomplex_store_int16, FULL_LOOP, 2, 0, ain, 0};
586
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
587
+ ndfunc_t ndf = { iter_dcomplex_store_int16, FULL_LOOP, 2, 0, ain, 0 };
581
588
 
582
589
  na_ndloop(&ndf, 2, self, obj);
583
590
  return self;
@@ -625,8 +632,8 @@ static void iter_dcomplex_store_int8(na_loop_t* const lp) {
625
632
  }
626
633
 
627
634
  static VALUE dcomplex_store_int8(VALUE self, VALUE obj) {
628
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
629
- ndfunc_t ndf = {iter_dcomplex_store_int8, FULL_LOOP, 2, 0, ain, 0};
635
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
636
+ ndfunc_t ndf = { iter_dcomplex_store_int8, FULL_LOOP, 2, 0, ain, 0 };
630
637
 
631
638
  na_ndloop(&ndf, 2, self, obj);
632
639
  return self;
@@ -674,8 +681,8 @@ static void iter_dcomplex_store_uint64(na_loop_t* const lp) {
674
681
  }
675
682
 
676
683
  static VALUE dcomplex_store_uint64(VALUE self, VALUE obj) {
677
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
678
- ndfunc_t ndf = {iter_dcomplex_store_uint64, FULL_LOOP, 2, 0, ain, 0};
684
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
685
+ ndfunc_t ndf = { iter_dcomplex_store_uint64, FULL_LOOP, 2, 0, ain, 0 };
679
686
 
680
687
  na_ndloop(&ndf, 2, self, obj);
681
688
  return self;
@@ -723,8 +730,8 @@ static void iter_dcomplex_store_uint32(na_loop_t* const lp) {
723
730
  }
724
731
 
725
732
  static VALUE dcomplex_store_uint32(VALUE self, VALUE obj) {
726
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
727
- ndfunc_t ndf = {iter_dcomplex_store_uint32, FULL_LOOP, 2, 0, ain, 0};
733
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
734
+ ndfunc_t ndf = { iter_dcomplex_store_uint32, FULL_LOOP, 2, 0, ain, 0 };
728
735
 
729
736
  na_ndloop(&ndf, 2, self, obj);
730
737
  return self;
@@ -772,8 +779,8 @@ static void iter_dcomplex_store_uint16(na_loop_t* const lp) {
772
779
  }
773
780
 
774
781
  static VALUE dcomplex_store_uint16(VALUE self, VALUE obj) {
775
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
776
- ndfunc_t ndf = {iter_dcomplex_store_uint16, FULL_LOOP, 2, 0, ain, 0};
782
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
783
+ ndfunc_t ndf = { iter_dcomplex_store_uint16, FULL_LOOP, 2, 0, ain, 0 };
777
784
 
778
785
  na_ndloop(&ndf, 2, self, obj);
779
786
  return self;
@@ -821,8 +828,8 @@ static void iter_dcomplex_store_uint8(na_loop_t* const lp) {
821
828
  }
822
829
 
823
830
  static VALUE dcomplex_store_uint8(VALUE self, VALUE obj) {
824
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
825
- ndfunc_t ndf = {iter_dcomplex_store_uint8, FULL_LOOP, 2, 0, ain, 0};
831
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
832
+ ndfunc_t ndf = { iter_dcomplex_store_uint8, FULL_LOOP, 2, 0, ain, 0 };
826
833
 
827
834
  na_ndloop(&ndf, 2, self, obj);
828
835
  return self;
@@ -870,8 +877,8 @@ static void iter_dcomplex_store_robject(na_loop_t* const lp) {
870
877
  }
871
878
 
872
879
  static VALUE dcomplex_store_robject(VALUE self, VALUE obj) {
873
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {Qnil, 0}};
874
- ndfunc_t ndf = {iter_dcomplex_store_robject, FULL_LOOP, 2, 0, ain, 0};
880
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } };
881
+ ndfunc_t ndf = { iter_dcomplex_store_robject, FULL_LOOP, 2, 0, ain, 0 };
875
882
 
876
883
  na_ndloop(&ndf, 2, self, obj);
877
884
  return self;
@@ -979,8 +986,8 @@ loop_end:
979
986
  }
980
987
 
981
988
  static VALUE dcomplex_store_array(VALUE self, VALUE rary) {
982
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {rb_cArray, 0}};
983
- ndfunc_t ndf = {iter_dcomplex_store_array, FULL_LOOP, 2, 0, ain, 0};
989
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { rb_cArray, 0 } };
990
+ ndfunc_t ndf = { iter_dcomplex_store_array, FULL_LOOP, 2, 0, ain, 0 };
984
991
 
985
992
  na_ndloop_store_rarray(&ndf, self, rary);
986
993
  return self;
@@ -989,8 +996,8 @@ static VALUE dcomplex_store_array(VALUE self, VALUE rary) {
989
996
  /*
990
997
  Store elements to Numo::DComplex from other.
991
998
  @overload store(other)
992
- @param [Object] other
993
- @return [Numo::DComplex] self
999
+ @param [Object] other
1000
+ @return [Numo::DComplex] self
994
1001
  */
995
1002
  static VALUE dcomplex_store(VALUE self, VALUE obj) {
996
1003
  VALUE r, klass;
@@ -1085,8 +1092,10 @@ static VALUE dcomplex_store(VALUE self, VALUE obj) {
1085
1092
  }
1086
1093
  }
1087
1094
 
1088
- rb_raise(nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
1089
- rb_class2name(rb_obj_class(self)));
1095
+ rb_raise(
1096
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
1097
+ rb_class2name(rb_obj_class(self))
1098
+ );
1090
1099
 
1091
1100
  return self;
1092
1101
  }
@@ -1196,7 +1205,10 @@ static dtype dcomplex_extract_data(VALUE obj) {
1196
1205
  return dcomplex_extract_data(r);
1197
1206
  }
1198
1207
 
1199
- rb_raise(nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)), rb_class2name(cT));
1208
+ rb_raise(
1209
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)),
1210
+ rb_class2name(cT)
1211
+ );
1200
1212
  }
1201
1213
  if (TYPE(obj) == T_ARRAY) {
1202
1214
  if (RARRAY_LEN(obj) != 1) {
@@ -1223,9 +1235,9 @@ static VALUE dcomplex_cast_array(VALUE rary) {
1223
1235
  Cast object to Numo::DComplex.
1224
1236
  @overload [](elements)
1225
1237
  @overload cast(array)
1226
- @param [Numeric,Array] elements
1227
- @param [Array] array
1228
- @return [Numo::DComplex]
1238
+ @param [Numeric,Array] elements
1239
+ @param [Array] array
1240
+ @return [Numo::DComplex]
1229
1241
  */
1230
1242
  static VALUE dcomplex_s_cast(VALUE type, VALUE obj) {
1231
1243
  VALUE v;
@@ -1265,9 +1277,9 @@ static VALUE dcomplex_s_cast(VALUE type, VALUE obj) {
1265
1277
  /*
1266
1278
  Multi-dimensional element reference.
1267
1279
  @overload [](dim0,...,dimL)
1268
- @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol] dim0,...,dimL multi-dimensional
1269
- indices.
1270
- @return [Numeric,Numo::DComplex] an element or NArray view.
1280
+ @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
1281
+ dim0,...,dimL multi-dimensional indices.
1282
+ @return [Numeric,Numo::DComplex] an element or NArray view.
1271
1283
  @see Numo::NArray#[]
1272
1284
  @see #[]=
1273
1285
  */
@@ -1288,10 +1300,10 @@ static VALUE dcomplex_aref(int argc, VALUE* argv, VALUE self) {
1288
1300
  /*
1289
1301
  Multi-dimensional element assignment.
1290
1302
  @overload []=(dim0,...,dimL,val)
1291
- @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol] dim0,...,dimL multi-dimensional
1292
- indices.
1293
- @param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
1294
- @return [Numeric,Numo::NArray,Array] returns `val` (last argument).
1303
+ @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
1304
+ dim0,...,dimL multi-dimensional indices.
1305
+ @param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
1306
+ @return [Numeric,Numo::NArray,Array] returns `val` (last argument).
1295
1307
  @see Numo::NArray#[]=
1296
1308
  @see #[]
1297
1309
  */
@@ -1322,7 +1334,7 @@ static VALUE dcomplex_aset(int argc, VALUE* argv, VALUE self) {
1322
1334
  /*
1323
1335
  return NArray with cast to the type of self.
1324
1336
  @overload coerce_cast(type)
1325
- @return [nil]
1337
+ @return [nil]
1326
1338
  */
1327
1339
  static VALUE dcomplex_coerce_cast(VALUE self, VALUE type) {
1328
1340
  return Qnil;
@@ -1357,12 +1369,12 @@ static void iter_dcomplex_to_a(na_loop_t* const lp) {
1357
1369
  /*
1358
1370
  Convert self to Array.
1359
1371
  @overload to_a
1360
- @return [Array]
1372
+ @return [Array]
1361
1373
  */
1362
1374
  static VALUE dcomplex_to_a(VALUE self) {
1363
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
1364
- ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
1365
- ndfunc_t ndf = {iter_dcomplex_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
1375
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
1376
+ ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
1377
+ ndfunc_t ndf = { iter_dcomplex_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
1366
1378
  return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
1367
1379
  }
1368
1380
 
@@ -1390,12 +1402,12 @@ static void iter_dcomplex_fill(na_loop_t* const lp) {
1390
1402
  /*
1391
1403
  Fill elements with other.
1392
1404
  @overload fill other
1393
- @param [Numeric] other
1394
- @return [Numo::DComplex] self.
1405
+ @param [Numeric] other
1406
+ @return [Numo::DComplex] self.
1395
1407
  */
1396
1408
  static VALUE dcomplex_fill(VALUE self, VALUE val) {
1397
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {sym_option}};
1398
- ndfunc_t ndf = {iter_dcomplex_fill, FULL_LOOP, 2, 0, ain, 0};
1409
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
1410
+ ndfunc_t ndf = { iter_dcomplex_fill, FULL_LOOP, 2, 0, ain, 0 };
1399
1411
 
1400
1412
  na_ndloop(&ndf, 2, self, val);
1401
1413
  return self;
@@ -1444,15 +1456,15 @@ static void iter_dcomplex_format(na_loop_t* const lp) {
1444
1456
  /*
1445
1457
  Format elements into strings.
1446
1458
  @overload format format
1447
- @param [String] format
1448
- @return [Numo::RObject] array of formatted strings.
1459
+ @param [String] format
1460
+ @return [Numo::RObject] array of formatted strings.
1449
1461
  */
1450
1462
  static VALUE dcomplex_format(int argc, VALUE* argv, VALUE self) {
1451
1463
  VALUE fmt = Qnil;
1452
1464
 
1453
- ndfunc_arg_in_t ain[2] = {{Qnil, 0}, {sym_option}};
1454
- ndfunc_arg_out_t aout[1] = {{numo_cRObject, 0}};
1455
- ndfunc_t ndf = {iter_dcomplex_format, FULL_LOOP_NIP, 2, 1, ain, aout};
1465
+ ndfunc_arg_in_t ain[2] = { { Qnil, 0 }, { sym_option } };
1466
+ ndfunc_arg_out_t aout[1] = { { numo_cRObject, 0 } };
1467
+ ndfunc_t ndf = { iter_dcomplex_format, FULL_LOOP_NIP, 2, 1, ain, aout };
1456
1468
 
1457
1469
  rb_scan_args(argc, argv, "01", &fmt);
1458
1470
  return na_ndloop(&ndf, 2, self, fmt);
@@ -1491,14 +1503,14 @@ static void iter_dcomplex_format_to_a(na_loop_t* const lp) {
1491
1503
  /*
1492
1504
  Format elements into strings.
1493
1505
  @overload format_to_a format
1494
- @param [String] format
1495
- @return [Array] array of formatted strings.
1506
+ @param [String] format
1507
+ @return [Array] array of formatted strings.
1496
1508
  */
1497
1509
  static VALUE dcomplex_format_to_a(int argc, VALUE* argv, VALUE self) {
1498
1510
  VALUE fmt = Qnil;
1499
- ndfunc_arg_in_t ain[3] = {{Qnil, 0}, {sym_loop_opt}, {sym_option}};
1500
- ndfunc_arg_out_t aout[1] = {{rb_cArray, 0}}; // dummy?
1501
- ndfunc_t ndf = {iter_dcomplex_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout};
1511
+ ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
1512
+ ndfunc_arg_out_t aout[1] = { { rb_cArray, 0 } }; // dummy?
1513
+ ndfunc_t ndf = { iter_dcomplex_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
1502
1514
 
1503
1515
  rb_scan_args(argc, argv, "01", &fmt);
1504
1516
  return na_ndloop_cast_narray_to_rarray(&ndf, self, fmt);
@@ -1511,7 +1523,7 @@ static VALUE iter_dcomplex_inspect(char* ptr, size_t pos, VALUE fmt) {
1511
1523
  /*
1512
1524
  Returns a string containing a human-readable representation of NArray.
1513
1525
  @overload inspect
1514
- @return [String]
1526
+ @return [String]
1515
1527
  */
1516
1528
  static VALUE dcomplex_inspect(VALUE ary) {
1517
1529
  return na_ndloop_inspect(ary, iter_dcomplex_inspect, Qnil);
@@ -1545,15 +1557,15 @@ static void iter_dcomplex_each(na_loop_t* const lp) {
1545
1557
  Calls the given block once for each element in self,
1546
1558
  passing that element as a parameter.
1547
1559
  @overload each
1548
- @return [Numo::NArray] self
1549
- For a block `{|x| ... }`,
1550
- @yieldparam [Numeric] x an element of NArray.
1560
+ @return [Numo::NArray] self
1561
+ For a block `{|x| ... }`,
1562
+ @yieldparam [Numeric] x an element of NArray.
1551
1563
  @see #each_with_index
1552
1564
  @see #map
1553
1565
  */
1554
1566
  static VALUE dcomplex_each(VALUE self) {
1555
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1556
- ndfunc_t ndf = {iter_dcomplex_each, FULL_LOOP_NIP, 1, 0, ain, 0};
1567
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1568
+ ndfunc_t ndf = { iter_dcomplex_each, FULL_LOOP_NIP, 1, 0, ain, 0 };
1557
1569
 
1558
1570
  na_ndloop(&ndf, 1, self);
1559
1571
  return self;
@@ -1624,12 +1636,12 @@ static void iter_dcomplex_map(na_loop_t* const lp) {
1624
1636
  /*
1625
1637
  Unary map.
1626
1638
  @overload map
1627
- @return [Numo::DComplex] map of self.
1639
+ @return [Numo::DComplex] map of self.
1628
1640
  */
1629
1641
  static VALUE dcomplex_map(VALUE self) {
1630
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
1631
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1632
- ndfunc_t ndf = {iter_dcomplex_map, FULL_LOOP, 1, 1, ain, aout};
1642
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
1643
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1644
+ ndfunc_t ndf = { iter_dcomplex_map, FULL_LOOP, 1, 1, ain, aout };
1633
1645
 
1634
1646
  return na_ndloop(&ndf, 1, self);
1635
1647
  }
@@ -1683,16 +1695,16 @@ static void iter_dcomplex_each_with_index(na_loop_t* const lp) {
1683
1695
  Invokes the given block once for each element of self,
1684
1696
  passing that element and indices along each axis as parameters.
1685
1697
  @overload each_with_index
1686
- For a block `{|x,i,j,...| ... }`,
1687
- @yieldparam [Numeric] x an element
1688
- @yieldparam [Integer] i,j,... multitimensional indices
1689
- @return [Numo::NArray] self
1698
+ For a block `{|x,i,j,...| ... }`,
1699
+ @yieldparam [Numeric] x an element
1700
+ @yieldparam [Integer] i,j,... multitimensional indices
1701
+ @return [Numo::NArray] self
1690
1702
  @see #each
1691
1703
  @see #map_with_index
1692
1704
  */
1693
1705
  static VALUE dcomplex_each_with_index(VALUE self) {
1694
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1695
- ndfunc_t ndf = {iter_dcomplex_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0};
1706
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1707
+ ndfunc_t ndf = { iter_dcomplex_each_with_index, FULL_LOOP_NIP, 1, 0, ain, 0 };
1696
1708
 
1697
1709
  na_ndloop_with_index(&ndf, 1, self);
1698
1710
  return self;
@@ -1774,17 +1786,17 @@ static void iter_dcomplex_map_with_index(na_loop_t* const lp) {
1774
1786
  Creates a new NArray containing the values returned by the block.
1775
1787
  Inplace option is allowed, i.e., `nary.inplace.map` overwrites `nary`.
1776
1788
  @overload map_with_index
1777
- For a block `{|x,i,j,...| ... }`,
1778
- @yieldparam [Numeric] x an element
1779
- @yieldparam [Integer] i,j,... multitimensional indices
1780
- @return [Numo::NArray] mapped array
1789
+ For a block `{|x,i,j,...| ... }`,
1790
+ @yieldparam [Numeric] x an element
1791
+ @yieldparam [Integer] i,j,... multitimensional indices
1792
+ @return [Numo::NArray] mapped array
1781
1793
  @see #map
1782
1794
  @see #each_with_index
1783
1795
  */
1784
1796
  static VALUE dcomplex_map_with_index(VALUE self) {
1785
- ndfunc_arg_in_t ain[1] = {{Qnil, 0}};
1786
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1787
- ndfunc_t ndf = {iter_dcomplex_map_with_index, FULL_LOOP, 1, 1, ain, aout};
1797
+ ndfunc_arg_in_t ain[1] = { { Qnil, 0 } };
1798
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1799
+ ndfunc_t ndf = { iter_dcomplex_map_with_index, FULL_LOOP, 1, 1, ain, aout };
1788
1800
 
1789
1801
  return na_ndloop_with_index(&ndf, 1, self);
1790
1802
  }
@@ -1833,17 +1845,17 @@ static void iter_dcomplex_abs(na_loop_t* const lp) {
1833
1845
  /*
1834
1846
  abs of self.
1835
1847
  @overload abs
1836
- @return [Numo::DFloat] abs of self.
1848
+ @return [Numo::DFloat] abs of self.
1837
1849
  */
1838
1850
  static VALUE dcomplex_abs(VALUE self) {
1839
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
1840
- ndfunc_arg_out_t aout[1] = {{cRT, 0}};
1841
- ndfunc_t ndf = {iter_dcomplex_abs, FULL_LOOP, 1, 1, ain, aout};
1851
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
1852
+ ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
1853
+ ndfunc_t ndf = { iter_dcomplex_abs, FULL_LOOP, 1, 1, ain, aout };
1842
1854
 
1843
1855
  return na_ndloop(&ndf, 1, self);
1844
1856
  }
1845
1857
 
1846
- #define check_intdivzero(y) \
1858
+ #define check_intdivzero(y) \
1847
1859
  {}
1848
1860
 
1849
1861
  static void iter_dcomplex_add(na_loop_t* const lp) {
@@ -1858,7 +1870,8 @@ static void iter_dcomplex_add(na_loop_t* const lp) {
1858
1870
  INIT_PTR(lp, 2, p3, s3);
1859
1871
 
1860
1872
  //
1861
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
1873
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
1874
+ is_aligned(p3, sizeof(dtype))) {
1862
1875
 
1863
1876
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
1864
1877
  if (p1 == p3) { // inplace case
@@ -1875,7 +1888,8 @@ static void iter_dcomplex_add(na_loop_t* const lp) {
1875
1888
  return;
1876
1889
  }
1877
1890
 
1878
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
1891
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
1892
+ is_aligned_step(s3, sizeof(dtype))) {
1879
1893
  //
1880
1894
 
1881
1895
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -1933,9 +1947,9 @@ static void iter_dcomplex_add(na_loop_t* const lp) {
1933
1947
  #undef check_intdivzero
1934
1948
 
1935
1949
  static VALUE dcomplex_add_self(VALUE self, VALUE other) {
1936
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
1937
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
1938
- ndfunc_t ndf = {iter_dcomplex_add, STRIDE_LOOP, 2, 1, ain, aout};
1950
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
1951
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
1952
+ ndfunc_t ndf = { iter_dcomplex_add, STRIDE_LOOP, 2, 1, ain, aout };
1939
1953
 
1940
1954
  return na_ndloop(&ndf, 2, self, other);
1941
1955
  }
@@ -1943,8 +1957,8 @@ static VALUE dcomplex_add_self(VALUE self, VALUE other) {
1943
1957
  /*
1944
1958
  Binary add.
1945
1959
  @overload + other
1946
- @param [Numo::NArray,Numeric] other
1947
- @return [Numo::NArray] self + other
1960
+ @param [Numo::NArray,Numeric] other
1961
+ @return [Numo::NArray] self + other
1948
1962
  */
1949
1963
  static VALUE dcomplex_add(VALUE self, VALUE other) {
1950
1964
 
@@ -1959,7 +1973,7 @@ static VALUE dcomplex_add(VALUE self, VALUE other) {
1959
1973
  }
1960
1974
  }
1961
1975
 
1962
- #define check_intdivzero(y) \
1976
+ #define check_intdivzero(y) \
1963
1977
  {}
1964
1978
 
1965
1979
  static void iter_dcomplex_sub(na_loop_t* const lp) {
@@ -1974,7 +1988,8 @@ static void iter_dcomplex_sub(na_loop_t* const lp) {
1974
1988
  INIT_PTR(lp, 2, p3, s3);
1975
1989
 
1976
1990
  //
1977
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
1991
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
1992
+ is_aligned(p3, sizeof(dtype))) {
1978
1993
 
1979
1994
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
1980
1995
  if (p1 == p3) { // inplace case
@@ -1991,7 +2006,8 @@ static void iter_dcomplex_sub(na_loop_t* const lp) {
1991
2006
  return;
1992
2007
  }
1993
2008
 
1994
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2009
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2010
+ is_aligned_step(s3, sizeof(dtype))) {
1995
2011
  //
1996
2012
 
1997
2013
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2049,9 +2065,9 @@ static void iter_dcomplex_sub(na_loop_t* const lp) {
2049
2065
  #undef check_intdivzero
2050
2066
 
2051
2067
  static VALUE dcomplex_sub_self(VALUE self, VALUE other) {
2052
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2053
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2054
- ndfunc_t ndf = {iter_dcomplex_sub, STRIDE_LOOP, 2, 1, ain, aout};
2068
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2069
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2070
+ ndfunc_t ndf = { iter_dcomplex_sub, STRIDE_LOOP, 2, 1, ain, aout };
2055
2071
 
2056
2072
  return na_ndloop(&ndf, 2, self, other);
2057
2073
  }
@@ -2059,8 +2075,8 @@ static VALUE dcomplex_sub_self(VALUE self, VALUE other) {
2059
2075
  /*
2060
2076
  Binary sub.
2061
2077
  @overload - other
2062
- @param [Numo::NArray,Numeric] other
2063
- @return [Numo::NArray] self - other
2078
+ @param [Numo::NArray,Numeric] other
2079
+ @return [Numo::NArray] self - other
2064
2080
  */
2065
2081
  static VALUE dcomplex_sub(VALUE self, VALUE other) {
2066
2082
 
@@ -2075,7 +2091,7 @@ static VALUE dcomplex_sub(VALUE self, VALUE other) {
2075
2091
  }
2076
2092
  }
2077
2093
 
2078
- #define check_intdivzero(y) \
2094
+ #define check_intdivzero(y) \
2079
2095
  {}
2080
2096
 
2081
2097
  static void iter_dcomplex_mul(na_loop_t* const lp) {
@@ -2090,7 +2106,8 @@ static void iter_dcomplex_mul(na_loop_t* const lp) {
2090
2106
  INIT_PTR(lp, 2, p3, s3);
2091
2107
 
2092
2108
  //
2093
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2109
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2110
+ is_aligned(p3, sizeof(dtype))) {
2094
2111
 
2095
2112
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2096
2113
  if (p1 == p3) { // inplace case
@@ -2107,7 +2124,8 @@ static void iter_dcomplex_mul(na_loop_t* const lp) {
2107
2124
  return;
2108
2125
  }
2109
2126
 
2110
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2127
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2128
+ is_aligned_step(s3, sizeof(dtype))) {
2111
2129
  //
2112
2130
 
2113
2131
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2165,9 +2183,9 @@ static void iter_dcomplex_mul(na_loop_t* const lp) {
2165
2183
  #undef check_intdivzero
2166
2184
 
2167
2185
  static VALUE dcomplex_mul_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_dcomplex_mul, STRIDE_LOOP, 2, 1, ain, aout};
2186
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2187
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2188
+ ndfunc_t ndf = { iter_dcomplex_mul, STRIDE_LOOP, 2, 1, ain, aout };
2171
2189
 
2172
2190
  return na_ndloop(&ndf, 2, self, other);
2173
2191
  }
@@ -2175,8 +2193,8 @@ static VALUE dcomplex_mul_self(VALUE self, VALUE other) {
2175
2193
  /*
2176
2194
  Binary mul.
2177
2195
  @overload * other
2178
- @param [Numo::NArray,Numeric] other
2179
- @return [Numo::NArray] self * other
2196
+ @param [Numo::NArray,Numeric] other
2197
+ @return [Numo::NArray] self * other
2180
2198
  */
2181
2199
  static VALUE dcomplex_mul(VALUE self, VALUE other) {
2182
2200
 
@@ -2191,7 +2209,7 @@ static VALUE dcomplex_mul(VALUE self, VALUE other) {
2191
2209
  }
2192
2210
  }
2193
2211
 
2194
- #define check_intdivzero(y) \
2212
+ #define check_intdivzero(y) \
2195
2213
  {}
2196
2214
 
2197
2215
  static void iter_dcomplex_div(na_loop_t* const lp) {
@@ -2206,7 +2224,8 @@ static void iter_dcomplex_div(na_loop_t* const lp) {
2206
2224
  INIT_PTR(lp, 2, p3, s3);
2207
2225
 
2208
2226
  //
2209
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
2227
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
2228
+ is_aligned(p3, sizeof(dtype))) {
2210
2229
 
2211
2230
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
2212
2231
  if (p1 == p3) { // inplace case
@@ -2223,7 +2242,8 @@ static void iter_dcomplex_div(na_loop_t* const lp) {
2223
2242
  return;
2224
2243
  }
2225
2244
 
2226
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
2245
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
2246
+ is_aligned_step(s3, sizeof(dtype))) {
2227
2247
  //
2228
2248
 
2229
2249
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -2281,9 +2301,9 @@ static void iter_dcomplex_div(na_loop_t* const lp) {
2281
2301
  #undef check_intdivzero
2282
2302
 
2283
2303
  static VALUE dcomplex_div_self(VALUE self, VALUE other) {
2284
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2285
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2286
- ndfunc_t ndf = {iter_dcomplex_div, STRIDE_LOOP, 2, 1, ain, aout};
2304
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2305
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2306
+ ndfunc_t ndf = { iter_dcomplex_div, STRIDE_LOOP, 2, 1, ain, aout };
2287
2307
 
2288
2308
  return na_ndloop(&ndf, 2, self, other);
2289
2309
  }
@@ -2291,8 +2311,8 @@ static VALUE dcomplex_div_self(VALUE self, VALUE other) {
2291
2311
  /*
2292
2312
  Binary div.
2293
2313
  @overload / other
2294
- @param [Numo::NArray,Numeric] other
2295
- @return [Numo::NArray] self / other
2314
+ @param [Numo::NArray,Numeric] other
2315
+ @return [Numo::NArray] self / other
2296
2316
  */
2297
2317
  static VALUE dcomplex_div(VALUE self, VALUE other) {
2298
2318
 
@@ -2343,11 +2363,11 @@ static void iter_dcomplex_pow_int32(na_loop_t* const lp) {
2343
2363
  }
2344
2364
 
2345
2365
  static VALUE dcomplex_pow_self(VALUE self, VALUE other) {
2346
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
2347
- ndfunc_arg_in_t ain_i[2] = {{cT, 0}, {numo_cInt32, 0}};
2348
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2349
- ndfunc_t ndf = {iter_dcomplex_pow, STRIDE_LOOP, 2, 1, ain, aout};
2350
- ndfunc_t ndf_i = {iter_dcomplex_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout};
2366
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
2367
+ ndfunc_arg_in_t ain_i[2] = { { cT, 0 }, { numo_cInt32, 0 } };
2368
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2369
+ ndfunc_t ndf = { iter_dcomplex_pow, STRIDE_LOOP, 2, 1, ain, aout };
2370
+ ndfunc_t ndf_i = { iter_dcomplex_pow_int32, STRIDE_LOOP, 2, 1, ain_i, aout };
2351
2371
 
2352
2372
  // fixme : use na.integer?
2353
2373
  if (FIXNUM_P(other) || rb_obj_is_kind_of(other, numo_cInt32)) {
@@ -2360,8 +2380,8 @@ static VALUE dcomplex_pow_self(VALUE self, VALUE other) {
2360
2380
  /*
2361
2381
  Binary power.
2362
2382
  @overload ** other
2363
- @param [Numo::NArray,Numeric] other
2364
- @return [Numo::NArray] self to the other-th power.
2383
+ @param [Numo::NArray,Numeric] other
2384
+ @return [Numo::NArray] self to the other-th power.
2365
2385
  */
2366
2386
  static VALUE dcomplex_pow(VALUE self, VALUE other) {
2367
2387
 
@@ -2440,12 +2460,12 @@ static void iter_dcomplex_minus(na_loop_t* const lp) {
2440
2460
  /*
2441
2461
  Unary minus.
2442
2462
  @overload -@
2443
- @return [Numo::DComplex] minus of self.
2463
+ @return [Numo::DComplex] minus of self.
2444
2464
  */
2445
2465
  static VALUE dcomplex_minus(VALUE self) {
2446
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2447
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2448
- ndfunc_t ndf = {iter_dcomplex_minus, FULL_LOOP, 1, 1, ain, aout};
2466
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2467
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2468
+ ndfunc_t ndf = { iter_dcomplex_minus, FULL_LOOP, 1, 1, ain, aout };
2449
2469
 
2450
2470
  return na_ndloop(&ndf, 1, self);
2451
2471
  }
@@ -2515,12 +2535,12 @@ static void iter_dcomplex_reciprocal(na_loop_t* const lp) {
2515
2535
  /*
2516
2536
  Unary reciprocal.
2517
2537
  @overload reciprocal
2518
- @return [Numo::DComplex] reciprocal of self.
2538
+ @return [Numo::DComplex] reciprocal of self.
2519
2539
  */
2520
2540
  static VALUE dcomplex_reciprocal(VALUE self) {
2521
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2522
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2523
- ndfunc_t ndf = {iter_dcomplex_reciprocal, FULL_LOOP, 1, 1, ain, aout};
2541
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2542
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2543
+ ndfunc_t ndf = { iter_dcomplex_reciprocal, FULL_LOOP, 1, 1, ain, aout };
2524
2544
 
2525
2545
  return na_ndloop(&ndf, 1, self);
2526
2546
  }
@@ -2590,12 +2610,12 @@ static void iter_dcomplex_sign(na_loop_t* const lp) {
2590
2610
  /*
2591
2611
  Unary sign.
2592
2612
  @overload sign
2593
- @return [Numo::DComplex] sign of self.
2613
+ @return [Numo::DComplex] sign of self.
2594
2614
  */
2595
2615
  static VALUE dcomplex_sign(VALUE self) {
2596
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2597
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2598
- ndfunc_t ndf = {iter_dcomplex_sign, FULL_LOOP, 1, 1, ain, aout};
2616
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2617
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2618
+ ndfunc_t ndf = { iter_dcomplex_sign, FULL_LOOP, 1, 1, ain, aout };
2599
2619
 
2600
2620
  return na_ndloop(&ndf, 1, self);
2601
2621
  }
@@ -2665,12 +2685,12 @@ static void iter_dcomplex_square(na_loop_t* const lp) {
2665
2685
  /*
2666
2686
  Unary square.
2667
2687
  @overload square
2668
- @return [Numo::DComplex] square of self.
2688
+ @return [Numo::DComplex] square of self.
2669
2689
  */
2670
2690
  static VALUE dcomplex_square(VALUE self) {
2671
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2672
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2673
- ndfunc_t ndf = {iter_dcomplex_square, FULL_LOOP, 1, 1, ain, aout};
2691
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2692
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2693
+ ndfunc_t ndf = { iter_dcomplex_square, FULL_LOOP, 1, 1, ain, aout };
2674
2694
 
2675
2695
  return na_ndloop(&ndf, 1, self);
2676
2696
  }
@@ -2740,12 +2760,12 @@ static void iter_dcomplex_conj(na_loop_t* const lp) {
2740
2760
  /*
2741
2761
  Unary conj.
2742
2762
  @overload conj
2743
- @return [Numo::DComplex] conj of self.
2763
+ @return [Numo::DComplex] conj of self.
2744
2764
  */
2745
2765
  static VALUE dcomplex_conj(VALUE self) {
2746
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2747
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2748
- ndfunc_t ndf = {iter_dcomplex_conj, FULL_LOOP, 1, 1, ain, aout};
2766
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2767
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2768
+ ndfunc_t ndf = { iter_dcomplex_conj, FULL_LOOP, 1, 1, ain, aout };
2749
2769
 
2750
2770
  return na_ndloop(&ndf, 1, self);
2751
2771
  }
@@ -2815,12 +2835,12 @@ static void iter_dcomplex_im(na_loop_t* const lp) {
2815
2835
  /*
2816
2836
  Unary im.
2817
2837
  @overload im
2818
- @return [Numo::DComplex] im of self.
2838
+ @return [Numo::DComplex] im of self.
2819
2839
  */
2820
2840
  static VALUE dcomplex_im(VALUE self) {
2821
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2822
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
2823
- ndfunc_t ndf = {iter_dcomplex_im, FULL_LOOP, 1, 1, ain, aout};
2841
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2842
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
2843
+ ndfunc_t ndf = { iter_dcomplex_im, FULL_LOOP, 1, 1, ain, aout };
2824
2844
 
2825
2845
  return na_ndloop(&ndf, 1, self);
2826
2846
  }
@@ -2869,12 +2889,12 @@ static void iter_dcomplex_real(na_loop_t* const lp) {
2869
2889
  /*
2870
2890
  real of self.
2871
2891
  @overload real
2872
- @return [Numo::DFloat] real of self.
2892
+ @return [Numo::DFloat] real of self.
2873
2893
  */
2874
2894
  static VALUE dcomplex_real(VALUE self) {
2875
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2876
- ndfunc_arg_out_t aout[1] = {{cRT, 0}};
2877
- ndfunc_t ndf = {iter_dcomplex_real, FULL_LOOP, 1, 1, ain, aout};
2895
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2896
+ ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
2897
+ ndfunc_t ndf = { iter_dcomplex_real, FULL_LOOP, 1, 1, ain, aout };
2878
2898
 
2879
2899
  return na_ndloop(&ndf, 1, self);
2880
2900
  }
@@ -2923,12 +2943,12 @@ static void iter_dcomplex_imag(na_loop_t* const lp) {
2923
2943
  /*
2924
2944
  imag of self.
2925
2945
  @overload imag
2926
- @return [Numo::DFloat] imag of self.
2946
+ @return [Numo::DFloat] imag of self.
2927
2947
  */
2928
2948
  static VALUE dcomplex_imag(VALUE self) {
2929
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2930
- ndfunc_arg_out_t aout[1] = {{cRT, 0}};
2931
- ndfunc_t ndf = {iter_dcomplex_imag, FULL_LOOP, 1, 1, ain, aout};
2949
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
2950
+ ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
2951
+ ndfunc_t ndf = { iter_dcomplex_imag, FULL_LOOP, 1, 1, ain, aout };
2932
2952
 
2933
2953
  return na_ndloop(&ndf, 1, self);
2934
2954
  }
@@ -2977,12 +2997,12 @@ static void iter_dcomplex_arg(na_loop_t* const lp) {
2977
2997
  /*
2978
2998
  arg of self.
2979
2999
  @overload arg
2980
- @return [Numo::DFloat] arg of self.
3000
+ @return [Numo::DFloat] arg of self.
2981
3001
  */
2982
3002
  static VALUE dcomplex_arg(VALUE self) {
2983
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
2984
- ndfunc_arg_out_t aout[1] = {{cRT, 0}};
2985
- ndfunc_t ndf = {iter_dcomplex_arg, FULL_LOOP, 1, 1, ain, aout};
3003
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3004
+ ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
3005
+ ndfunc_t ndf = { iter_dcomplex_arg, FULL_LOOP, 1, 1, ain, aout };
2986
3006
 
2987
3007
  return na_ndloop(&ndf, 1, self);
2988
3008
  }
@@ -3033,8 +3053,8 @@ static void iter_dcomplex_set_imag(na_loop_t* const lp) {
3033
3053
  }
3034
3054
 
3035
3055
  static VALUE dcomplex_set_imag(VALUE self, VALUE a1) {
3036
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {cRT, 0}};
3037
- ndfunc_t ndf = {iter_dcomplex_set_imag, FULL_LOOP, 2, 0, ain, 0};
3056
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { cRT, 0 } };
3057
+ ndfunc_t ndf = { iter_dcomplex_set_imag, FULL_LOOP, 2, 0, ain, 0 };
3038
3058
 
3039
3059
  na_ndloop(&ndf, 2, self, a1);
3040
3060
  return a1;
@@ -3086,8 +3106,8 @@ static void iter_dcomplex_set_real(na_loop_t* const lp) {
3086
3106
  }
3087
3107
 
3088
3108
  static VALUE dcomplex_set_real(VALUE self, VALUE a1) {
3089
- ndfunc_arg_in_t ain[2] = {{OVERWRITE, 0}, {cRT, 0}};
3090
- ndfunc_t ndf = {iter_dcomplex_set_real, FULL_LOOP, 2, 0, ain, 0};
3109
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { cRT, 0 } };
3110
+ ndfunc_t ndf = { iter_dcomplex_set_real, FULL_LOOP, 2, 0, ain, 0 };
3091
3111
 
3092
3112
  na_ndloop(&ndf, 2, self, a1);
3093
3113
  return a1;
@@ -3115,9 +3135,9 @@ static void iter_dcomplex_eq(na_loop_t* const lp) {
3115
3135
  }
3116
3136
 
3117
3137
  static VALUE dcomplex_eq_self(VALUE self, VALUE other) {
3118
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3119
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3120
- ndfunc_t ndf = {iter_dcomplex_eq, STRIDE_LOOP, 2, 1, ain, aout};
3138
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3139
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3140
+ ndfunc_t ndf = { iter_dcomplex_eq, STRIDE_LOOP, 2, 1, ain, aout };
3121
3141
 
3122
3142
  return na_ndloop(&ndf, 2, self, other);
3123
3143
  }
@@ -3125,8 +3145,8 @@ static VALUE dcomplex_eq_self(VALUE self, VALUE other) {
3125
3145
  /*
3126
3146
  Comparison eq other.
3127
3147
  @overload eq other
3128
- @param [Numo::NArray,Numeric] other
3129
- @return [Numo::Bit] result of self eq other.
3148
+ @param [Numo::NArray,Numeric] other
3149
+ @return [Numo::Bit] result of self eq other.
3130
3150
  */
3131
3151
  static VALUE dcomplex_eq(VALUE self, VALUE other) {
3132
3152
 
@@ -3162,9 +3182,9 @@ static void iter_dcomplex_ne(na_loop_t* const lp) {
3162
3182
  }
3163
3183
 
3164
3184
  static VALUE dcomplex_ne_self(VALUE self, VALUE other) {
3165
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3166
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3167
- ndfunc_t ndf = {iter_dcomplex_ne, STRIDE_LOOP, 2, 1, ain, aout};
3185
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3186
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3187
+ ndfunc_t ndf = { iter_dcomplex_ne, STRIDE_LOOP, 2, 1, ain, aout };
3168
3188
 
3169
3189
  return na_ndloop(&ndf, 2, self, other);
3170
3190
  }
@@ -3172,8 +3192,8 @@ static VALUE dcomplex_ne_self(VALUE self, VALUE other) {
3172
3192
  /*
3173
3193
  Comparison ne other.
3174
3194
  @overload ne other
3175
- @param [Numo::NArray,Numeric] other
3176
- @return [Numo::Bit] result of self ne other.
3195
+ @param [Numo::NArray,Numeric] other
3196
+ @return [Numo::Bit] result of self ne other.
3177
3197
  */
3178
3198
  static VALUE dcomplex_ne(VALUE self, VALUE other) {
3179
3199
 
@@ -3209,9 +3229,9 @@ static void iter_dcomplex_nearly_eq(na_loop_t* const lp) {
3209
3229
  }
3210
3230
 
3211
3231
  static VALUE dcomplex_nearly_eq_self(VALUE self, VALUE other) {
3212
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3213
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3214
- ndfunc_t ndf = {iter_dcomplex_nearly_eq, STRIDE_LOOP, 2, 1, ain, aout};
3232
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3233
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3234
+ ndfunc_t ndf = { iter_dcomplex_nearly_eq, STRIDE_LOOP, 2, 1, ain, aout };
3215
3235
 
3216
3236
  return na_ndloop(&ndf, 2, self, other);
3217
3237
  }
@@ -3219,8 +3239,8 @@ static VALUE dcomplex_nearly_eq_self(VALUE self, VALUE other) {
3219
3239
  /*
3220
3240
  Comparison nearly_eq other.
3221
3241
  @overload nearly_eq other
3222
- @param [Numo::NArray,Numeric] other
3223
- @return [Numo::Bit] result of self nearly_eq other.
3242
+ @param [Numo::NArray,Numeric] other
3243
+ @return [Numo::Bit] result of self nearly_eq other.
3224
3244
  */
3225
3245
  static VALUE dcomplex_nearly_eq(VALUE self, VALUE other) {
3226
3246
 
@@ -3299,12 +3319,12 @@ static void iter_dcomplex_floor(na_loop_t* const lp) {
3299
3319
  /*
3300
3320
  Unary floor.
3301
3321
  @overload floor
3302
- @return [Numo::DComplex] floor of self.
3322
+ @return [Numo::DComplex] floor of self.
3303
3323
  */
3304
3324
  static VALUE dcomplex_floor(VALUE self) {
3305
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3306
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3307
- ndfunc_t ndf = {iter_dcomplex_floor, FULL_LOOP, 1, 1, ain, aout};
3325
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3326
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3327
+ ndfunc_t ndf = { iter_dcomplex_floor, FULL_LOOP, 1, 1, ain, aout };
3308
3328
 
3309
3329
  return na_ndloop(&ndf, 1, self);
3310
3330
  }
@@ -3374,12 +3394,12 @@ static void iter_dcomplex_round(na_loop_t* const lp) {
3374
3394
  /*
3375
3395
  Unary round.
3376
3396
  @overload round
3377
- @return [Numo::DComplex] round of self.
3397
+ @return [Numo::DComplex] round of self.
3378
3398
  */
3379
3399
  static VALUE dcomplex_round(VALUE self) {
3380
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3381
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3382
- ndfunc_t ndf = {iter_dcomplex_round, FULL_LOOP, 1, 1, ain, aout};
3400
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3401
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3402
+ ndfunc_t ndf = { iter_dcomplex_round, FULL_LOOP, 1, 1, ain, aout };
3383
3403
 
3384
3404
  return na_ndloop(&ndf, 1, self);
3385
3405
  }
@@ -3449,12 +3469,12 @@ static void iter_dcomplex_ceil(na_loop_t* const lp) {
3449
3469
  /*
3450
3470
  Unary ceil.
3451
3471
  @overload ceil
3452
- @return [Numo::DComplex] ceil of self.
3472
+ @return [Numo::DComplex] ceil of self.
3453
3473
  */
3454
3474
  static VALUE dcomplex_ceil(VALUE self) {
3455
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3456
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3457
- ndfunc_t ndf = {iter_dcomplex_ceil, FULL_LOOP, 1, 1, ain, aout};
3475
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3476
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3477
+ ndfunc_t ndf = { iter_dcomplex_ceil, FULL_LOOP, 1, 1, ain, aout };
3458
3478
 
3459
3479
  return na_ndloop(&ndf, 1, self);
3460
3480
  }
@@ -3524,12 +3544,12 @@ static void iter_dcomplex_trunc(na_loop_t* const lp) {
3524
3544
  /*
3525
3545
  Unary trunc.
3526
3546
  @overload trunc
3527
- @return [Numo::DComplex] trunc of self.
3547
+ @return [Numo::DComplex] trunc of self.
3528
3548
  */
3529
3549
  static VALUE dcomplex_trunc(VALUE self) {
3530
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3531
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3532
- ndfunc_t ndf = {iter_dcomplex_trunc, FULL_LOOP, 1, 1, ain, aout};
3550
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3551
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3552
+ ndfunc_t ndf = { iter_dcomplex_trunc, FULL_LOOP, 1, 1, ain, aout };
3533
3553
 
3534
3554
  return na_ndloop(&ndf, 1, self);
3535
3555
  }
@@ -3599,17 +3619,17 @@ static void iter_dcomplex_rint(na_loop_t* const lp) {
3599
3619
  /*
3600
3620
  Unary rint.
3601
3621
  @overload rint
3602
- @return [Numo::DComplex] rint of self.
3622
+ @return [Numo::DComplex] rint of self.
3603
3623
  */
3604
3624
  static VALUE dcomplex_rint(VALUE self) {
3605
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3606
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3607
- ndfunc_t ndf = {iter_dcomplex_rint, FULL_LOOP, 1, 1, ain, aout};
3625
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3626
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3627
+ ndfunc_t ndf = { iter_dcomplex_rint, FULL_LOOP, 1, 1, ain, aout };
3608
3628
 
3609
3629
  return na_ndloop(&ndf, 1, self);
3610
3630
  }
3611
3631
 
3612
- #define check_intdivzero(y) \
3632
+ #define check_intdivzero(y) \
3613
3633
  {}
3614
3634
 
3615
3635
  static void iter_dcomplex_copysign(na_loop_t* const lp) {
@@ -3624,7 +3644,8 @@ static void iter_dcomplex_copysign(na_loop_t* const lp) {
3624
3644
  INIT_PTR(lp, 2, p3, s3);
3625
3645
 
3626
3646
  //
3627
- if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) && is_aligned(p3, sizeof(dtype))) {
3647
+ if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype)) &&
3648
+ is_aligned(p3, sizeof(dtype))) {
3628
3649
 
3629
3650
  if (s1 == sizeof(dtype) && s2 == sizeof(dtype) && s3 == sizeof(dtype)) {
3630
3651
  if (p1 == p3) { // inplace case
@@ -3641,7 +3662,8 @@ static void iter_dcomplex_copysign(na_loop_t* const lp) {
3641
3662
  return;
3642
3663
  }
3643
3664
 
3644
- if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) && is_aligned_step(s3, sizeof(dtype))) {
3665
+ if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype)) &&
3666
+ is_aligned_step(s3, sizeof(dtype))) {
3645
3667
  //
3646
3668
 
3647
3669
  if (s2 == 0) { // Broadcasting from scalar value.
@@ -3699,9 +3721,9 @@ static void iter_dcomplex_copysign(na_loop_t* const lp) {
3699
3721
  #undef check_intdivzero
3700
3722
 
3701
3723
  static VALUE dcomplex_copysign_self(VALUE self, VALUE other) {
3702
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {cT, 0}};
3703
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3704
- ndfunc_t ndf = {iter_dcomplex_copysign, STRIDE_LOOP, 2, 1, ain, aout};
3724
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
3725
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3726
+ ndfunc_t ndf = { iter_dcomplex_copysign, STRIDE_LOOP, 2, 1, ain, aout };
3705
3727
 
3706
3728
  return na_ndloop(&ndf, 2, self, other);
3707
3729
  }
@@ -3709,8 +3731,8 @@ static VALUE dcomplex_copysign_self(VALUE self, VALUE other) {
3709
3731
  /*
3710
3732
  Binary copysign.
3711
3733
  @overload copysign other
3712
- @param [Numo::NArray,Numeric] other
3713
- @return [Numo::NArray] self copysign other
3734
+ @param [Numo::NArray,Numeric] other
3735
+ @return [Numo::NArray] self copysign other
3714
3736
  */
3715
3737
  static VALUE dcomplex_copysign(VALUE self, VALUE other) {
3716
3738
 
@@ -3757,12 +3779,12 @@ static void iter_dcomplex_isnan(na_loop_t* const lp) {
3757
3779
  /*
3758
3780
  Condition of isnan.
3759
3781
  @overload isnan
3760
- @return [Numo::Bit] Condition of isnan.
3782
+ @return [Numo::Bit] Condition of isnan.
3761
3783
  */
3762
3784
  static VALUE dcomplex_isnan(VALUE self) {
3763
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3764
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3765
- ndfunc_t ndf = {iter_dcomplex_isnan, FULL_LOOP, 1, 1, ain, aout};
3785
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3786
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3787
+ ndfunc_t ndf = { iter_dcomplex_isnan, FULL_LOOP, 1, 1, ain, aout };
3766
3788
 
3767
3789
  return na_ndloop(&ndf, 1, self);
3768
3790
  }
@@ -3799,12 +3821,12 @@ static void iter_dcomplex_isinf(na_loop_t* const lp) {
3799
3821
  /*
3800
3822
  Condition of isinf.
3801
3823
  @overload isinf
3802
- @return [Numo::Bit] Condition of isinf.
3824
+ @return [Numo::Bit] Condition of isinf.
3803
3825
  */
3804
3826
  static VALUE dcomplex_isinf(VALUE self) {
3805
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3806
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3807
- ndfunc_t ndf = {iter_dcomplex_isinf, FULL_LOOP, 1, 1, ain, aout};
3827
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3828
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3829
+ ndfunc_t ndf = { iter_dcomplex_isinf, FULL_LOOP, 1, 1, ain, aout };
3808
3830
 
3809
3831
  return na_ndloop(&ndf, 1, self);
3810
3832
  }
@@ -3841,12 +3863,12 @@ static void iter_dcomplex_isposinf(na_loop_t* const lp) {
3841
3863
  /*
3842
3864
  Condition of isposinf.
3843
3865
  @overload isposinf
3844
- @return [Numo::Bit] Condition of isposinf.
3866
+ @return [Numo::Bit] Condition of isposinf.
3845
3867
  */
3846
3868
  static VALUE dcomplex_isposinf(VALUE self) {
3847
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3848
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3849
- ndfunc_t ndf = {iter_dcomplex_isposinf, FULL_LOOP, 1, 1, ain, aout};
3869
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3870
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3871
+ ndfunc_t ndf = { iter_dcomplex_isposinf, FULL_LOOP, 1, 1, ain, aout };
3850
3872
 
3851
3873
  return na_ndloop(&ndf, 1, self);
3852
3874
  }
@@ -3883,12 +3905,12 @@ static void iter_dcomplex_isneginf(na_loop_t* const lp) {
3883
3905
  /*
3884
3906
  Condition of isneginf.
3885
3907
  @overload isneginf
3886
- @return [Numo::Bit] Condition of isneginf.
3908
+ @return [Numo::Bit] Condition of isneginf.
3887
3909
  */
3888
3910
  static VALUE dcomplex_isneginf(VALUE self) {
3889
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3890
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3891
- ndfunc_t ndf = {iter_dcomplex_isneginf, FULL_LOOP, 1, 1, ain, aout};
3911
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3912
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3913
+ ndfunc_t ndf = { iter_dcomplex_isneginf, FULL_LOOP, 1, 1, ain, aout };
3892
3914
 
3893
3915
  return na_ndloop(&ndf, 1, self);
3894
3916
  }
@@ -3925,12 +3947,12 @@ static void iter_dcomplex_isfinite(na_loop_t* const lp) {
3925
3947
  /*
3926
3948
  Condition of isfinite.
3927
3949
  @overload isfinite
3928
- @return [Numo::Bit] Condition of isfinite.
3950
+ @return [Numo::Bit] Condition of isfinite.
3929
3951
  */
3930
3952
  static VALUE dcomplex_isfinite(VALUE self) {
3931
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
3932
- ndfunc_arg_out_t aout[1] = {{numo_cBit, 0}};
3933
- ndfunc_t ndf = {iter_dcomplex_isfinite, FULL_LOOP, 1, 1, ain, aout};
3953
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
3954
+ ndfunc_arg_out_t aout[1] = { { numo_cBit, 0 } };
3955
+ ndfunc_t ndf = { iter_dcomplex_isfinite, FULL_LOOP, 1, 1, ain, aout };
3934
3956
 
3935
3957
  return na_ndloop(&ndf, 1, self);
3936
3958
  }
@@ -3961,16 +3983,18 @@ static void iter_dcomplex_sum_nan(na_loop_t* const lp) {
3961
3983
  /*
3962
3984
  sum of self.
3963
3985
  @overload sum(axis:nil, keepdims:false, nan:false)
3964
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
3965
- @param [Numeric,Array,Range] axis Performs sum along the axis.
3966
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
3967
- @return [Numo::DComplex] returns result of sum.
3986
+ @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
3987
+ return NaN for min/max etc).
3988
+ @param [Numeric,Array,Range] axis Performs sum along the axis.
3989
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
3990
+ dimensions with size one.
3991
+ @return [Numo::DComplex] returns result of sum.
3968
3992
  */
3969
3993
  static VALUE dcomplex_sum(int argc, VALUE* argv, VALUE self) {
3970
3994
  VALUE v, reduce;
3971
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
3972
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
3973
- ndfunc_t ndf = {iter_dcomplex_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
3995
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
3996
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
3997
+ ndfunc_t ndf = { iter_dcomplex_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
3974
3998
 
3975
3999
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_sum_nan);
3976
4000
 
@@ -4005,16 +4029,18 @@ static void iter_dcomplex_prod_nan(na_loop_t* const lp) {
4005
4029
  /*
4006
4030
  prod of self.
4007
4031
  @overload prod(axis:nil, keepdims:false, nan:false)
4008
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
4009
- @param [Numeric,Array,Range] axis Performs prod along the axis.
4010
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
4011
- @return [Numo::DComplex] returns result of prod.
4032
+ @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
4033
+ return NaN for min/max etc).
4034
+ @param [Numeric,Array,Range] axis Performs prod along the axis.
4035
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
4036
+ dimensions with size one.
4037
+ @return [Numo::DComplex] returns result of prod.
4012
4038
  */
4013
4039
  static VALUE dcomplex_prod(int argc, VALUE* argv, VALUE self) {
4014
4040
  VALUE v, reduce;
4015
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4016
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4017
- ndfunc_t ndf = {iter_dcomplex_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
4041
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4042
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4043
+ ndfunc_t ndf = { iter_dcomplex_prod, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
4018
4044
 
4019
4045
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_prod_nan);
4020
4046
 
@@ -4049,16 +4075,20 @@ static void iter_dcomplex_kahan_sum_nan(na_loop_t* const lp) {
4049
4075
  /*
4050
4076
  kahan_sum of self.
4051
4077
  @overload kahan_sum(axis:nil, keepdims:false, nan:false)
4052
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
4053
- @param [Numeric,Array,Range] axis Performs kahan_sum along the axis.
4054
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
4055
- @return [Numo::DComplex] returns result of kahan_sum.
4078
+ @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
4079
+ return NaN for min/max etc).
4080
+ @param [Numeric,Array,Range] axis Performs kahan_sum along the axis.
4081
+ @param [TrueClass] keepdims If true, the reduced axes are left in the result array as
4082
+ dimensions with size one.
4083
+ @return [Numo::DComplex] returns result of kahan_sum.
4056
4084
  */
4057
4085
  static VALUE dcomplex_kahan_sum(int argc, VALUE* argv, VALUE self) {
4058
4086
  VALUE v, reduce;
4059
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4060
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4061
- ndfunc_t ndf = {iter_dcomplex_kahan_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
4087
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4088
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4089
+ ndfunc_t ndf = {
4090
+ iter_dcomplex_kahan_sum, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout
4091
+ };
4062
4092
 
4063
4093
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_kahan_sum_nan);
4064
4094
 
@@ -4067,182 +4097,6 @@ static VALUE dcomplex_kahan_sum(int argc, VALUE* argv, VALUE self) {
4067
4097
  return dcomplex_extract(v);
4068
4098
  }
4069
4099
 
4070
- static void iter_dcomplex_mean(na_loop_t* const lp) {
4071
- size_t n;
4072
- char *p1, *p2;
4073
- ssize_t s1;
4074
-
4075
- INIT_COUNTER(lp, n);
4076
- INIT_PTR(lp, 0, p1, s1);
4077
- p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
4078
-
4079
- *(dtype*)p2 = f_mean(n, p1, s1);
4080
- }
4081
- static void iter_dcomplex_mean_nan(na_loop_t* const lp) {
4082
- size_t n;
4083
- char *p1, *p2;
4084
- ssize_t s1;
4085
-
4086
- INIT_COUNTER(lp, n);
4087
- INIT_PTR(lp, 0, p1, s1);
4088
- p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
4089
-
4090
- *(dtype*)p2 = f_mean_nan(n, p1, s1);
4091
- }
4092
-
4093
- /*
4094
- mean of self.
4095
- @overload mean(axis:nil, keepdims:false, nan:false)
4096
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
4097
- @param [Numeric,Array,Range] axis Performs mean along the axis.
4098
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
4099
- @return [Numo::DComplex] returns result of mean.
4100
- */
4101
- static VALUE dcomplex_mean(int argc, VALUE* argv, VALUE self) {
4102
- VALUE v, reduce;
4103
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4104
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4105
- ndfunc_t ndf = {iter_dcomplex_mean, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
4106
-
4107
- reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_mean_nan);
4108
-
4109
- v = na_ndloop(&ndf, 2, self, reduce);
4110
-
4111
- return dcomplex_extract(v);
4112
- }
4113
-
4114
- static void iter_dcomplex_stddev(na_loop_t* const lp) {
4115
- size_t n;
4116
- char *p1, *p2;
4117
- ssize_t s1;
4118
-
4119
- INIT_COUNTER(lp, n);
4120
- INIT_PTR(lp, 0, p1, s1);
4121
- p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
4122
-
4123
- *(rtype*)p2 = f_stddev(n, p1, s1);
4124
- }
4125
- static void iter_dcomplex_stddev_nan(na_loop_t* const lp) {
4126
- size_t n;
4127
- char *p1, *p2;
4128
- ssize_t s1;
4129
-
4130
- INIT_COUNTER(lp, n);
4131
- INIT_PTR(lp, 0, p1, s1);
4132
- p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
4133
-
4134
- *(rtype*)p2 = f_stddev_nan(n, p1, s1);
4135
- }
4136
-
4137
- /*
4138
- stddev of self.
4139
- @overload stddev(axis:nil, keepdims:false, nan:false)
4140
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
4141
- @param [Numeric,Array,Range] axis Performs stddev along the axis.
4142
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
4143
- @return [Numo::DComplex] returns result of stddev.
4144
- */
4145
- static VALUE dcomplex_stddev(int argc, VALUE* argv, VALUE self) {
4146
- VALUE v, reduce;
4147
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4148
- ndfunc_arg_out_t aout[1] = {{cRT, 0}};
4149
- ndfunc_t ndf = {iter_dcomplex_stddev, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
4150
-
4151
- reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_stddev_nan);
4152
-
4153
- v = na_ndloop(&ndf, 2, self, reduce);
4154
-
4155
- return rb_funcall(v, rb_intern("extract"), 0);
4156
- }
4157
-
4158
- static void iter_dcomplex_var(na_loop_t* const lp) {
4159
- size_t n;
4160
- char *p1, *p2;
4161
- ssize_t s1;
4162
-
4163
- INIT_COUNTER(lp, n);
4164
- INIT_PTR(lp, 0, p1, s1);
4165
- p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
4166
-
4167
- *(rtype*)p2 = f_var(n, p1, s1);
4168
- }
4169
- static void iter_dcomplex_var_nan(na_loop_t* const lp) {
4170
- size_t n;
4171
- char *p1, *p2;
4172
- ssize_t s1;
4173
-
4174
- INIT_COUNTER(lp, n);
4175
- INIT_PTR(lp, 0, p1, s1);
4176
- p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
4177
-
4178
- *(rtype*)p2 = f_var_nan(n, p1, s1);
4179
- }
4180
-
4181
- /*
4182
- var of self.
4183
- @overload var(axis:nil, keepdims:false, nan:false)
4184
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
4185
- @param [Numeric,Array,Range] axis Performs var along the axis.
4186
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
4187
- @return [Numo::DComplex] returns result of var.
4188
- */
4189
- static VALUE dcomplex_var(int argc, VALUE* argv, VALUE self) {
4190
- VALUE v, reduce;
4191
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4192
- ndfunc_arg_out_t aout[1] = {{cRT, 0}};
4193
- ndfunc_t ndf = {iter_dcomplex_var, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
4194
-
4195
- reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_var_nan);
4196
-
4197
- v = na_ndloop(&ndf, 2, self, reduce);
4198
-
4199
- return rb_funcall(v, rb_intern("extract"), 0);
4200
- }
4201
-
4202
- static void iter_dcomplex_rms(na_loop_t* const lp) {
4203
- size_t n;
4204
- char *p1, *p2;
4205
- ssize_t s1;
4206
-
4207
- INIT_COUNTER(lp, n);
4208
- INIT_PTR(lp, 0, p1, s1);
4209
- p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
4210
-
4211
- *(rtype*)p2 = f_rms(n, p1, s1);
4212
- }
4213
- static void iter_dcomplex_rms_nan(na_loop_t* const lp) {
4214
- size_t n;
4215
- char *p1, *p2;
4216
- ssize_t s1;
4217
-
4218
- INIT_COUNTER(lp, n);
4219
- INIT_PTR(lp, 0, p1, s1);
4220
- p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
4221
-
4222
- *(rtype*)p2 = f_rms_nan(n, p1, s1);
4223
- }
4224
-
4225
- /*
4226
- rms of self.
4227
- @overload rms(axis:nil, keepdims:false, nan:false)
4228
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
4229
- @param [Numeric,Array,Range] axis Performs rms along the axis.
4230
- @param [TrueClass] keepdims If true, the reduced axes are left in the result array as dimensions with size one.
4231
- @return [Numo::DComplex] returns result of rms.
4232
- */
4233
- static VALUE dcomplex_rms(int argc, VALUE* argv, VALUE self) {
4234
- VALUE v, reduce;
4235
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4236
- ndfunc_arg_out_t aout[1] = {{cRT, 0}};
4237
- ndfunc_t ndf = {iter_dcomplex_rms, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout};
4238
-
4239
- reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_rms_nan);
4240
-
4241
- v = na_ndloop(&ndf, 2, self, reduce);
4242
-
4243
- return rb_funcall(v, rb_intern("extract"), 0);
4244
- }
4245
-
4246
4100
  static void iter_dcomplex_cumsum(na_loop_t* const lp) {
4247
4101
  size_t i;
4248
4102
  char *p1, *p2;
@@ -4252,16 +4106,13 @@ static void iter_dcomplex_cumsum(na_loop_t* const lp) {
4252
4106
  INIT_COUNTER(lp, i);
4253
4107
  INIT_PTR(lp, 0, p1, s1);
4254
4108
  INIT_PTR(lp, 1, p2, s2);
4255
- // printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
4256
4109
 
4257
4110
  GET_DATA_STRIDE(p1, s1, dtype, x);
4258
4111
  SET_DATA_STRIDE(p2, s2, dtype, x);
4259
- // printf("i=%lu x=%f\n",i,x);
4260
4112
  for (i--; i--;) {
4261
4113
  GET_DATA_STRIDE(p1, s1, dtype, y);
4262
4114
  m_cumsum(x, y);
4263
4115
  SET_DATA_STRIDE(p2, s2, dtype, x);
4264
- // printf("i=%lu x=%f\n",i,x);
4265
4116
  }
4266
4117
  }
4267
4118
  static void iter_dcomplex_cumsum_nan(na_loop_t* const lp) {
@@ -4273,31 +4124,30 @@ static void iter_dcomplex_cumsum_nan(na_loop_t* const lp) {
4273
4124
  INIT_COUNTER(lp, i);
4274
4125
  INIT_PTR(lp, 0, p1, s1);
4275
4126
  INIT_PTR(lp, 1, p2, s2);
4276
- // printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
4277
4127
 
4278
4128
  GET_DATA_STRIDE(p1, s1, dtype, x);
4279
4129
  SET_DATA_STRIDE(p2, s2, dtype, x);
4280
- // printf("i=%lu x=%f\n",i,x);
4281
4130
  for (i--; i--;) {
4282
4131
  GET_DATA_STRIDE(p1, s1, dtype, y);
4283
4132
  m_cumsum_nan(x, y);
4284
4133
  SET_DATA_STRIDE(p2, s2, dtype, x);
4285
- // printf("i=%lu x=%f\n",i,x);
4286
4134
  }
4287
4135
  }
4288
4136
 
4289
4137
  /*
4290
4138
  cumsum of self.
4291
4139
  @overload cumsum(axis:nil, nan:false)
4292
- @param [Numeric,Array,Range] axis Performs cumsum along the axis.
4293
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
4294
- @return [Numo::DComplex] cumsum of self.
4140
+ @param [Numeric,Array,Range] axis Performs cumsum along the axis.
4141
+ @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
4142
+ @return [Numo::DComplex] cumsum of self.
4295
4143
  */
4296
4144
  static VALUE dcomplex_cumsum(int argc, VALUE* argv, VALUE self) {
4297
4145
  VALUE reduce;
4298
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4299
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4300
- ndfunc_t ndf = {iter_dcomplex_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout};
4146
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4147
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4148
+ ndfunc_t ndf = {
4149
+ iter_dcomplex_cumsum, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
4150
+ };
4301
4151
 
4302
4152
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_cumsum_nan);
4303
4153
 
@@ -4313,16 +4163,13 @@ static void iter_dcomplex_cumprod(na_loop_t* const lp) {
4313
4163
  INIT_COUNTER(lp, i);
4314
4164
  INIT_PTR(lp, 0, p1, s1);
4315
4165
  INIT_PTR(lp, 1, p2, s2);
4316
- // printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
4317
4166
 
4318
4167
  GET_DATA_STRIDE(p1, s1, dtype, x);
4319
4168
  SET_DATA_STRIDE(p2, s2, dtype, x);
4320
- // printf("i=%lu x=%f\n",i,x);
4321
4169
  for (i--; i--;) {
4322
4170
  GET_DATA_STRIDE(p1, s1, dtype, y);
4323
4171
  m_cumprod(x, y);
4324
4172
  SET_DATA_STRIDE(p2, s2, dtype, x);
4325
- // printf("i=%lu x=%f\n",i,x);
4326
4173
  }
4327
4174
  }
4328
4175
  static void iter_dcomplex_cumprod_nan(na_loop_t* const lp) {
@@ -4334,31 +4181,30 @@ static void iter_dcomplex_cumprod_nan(na_loop_t* const lp) {
4334
4181
  INIT_COUNTER(lp, i);
4335
4182
  INIT_PTR(lp, 0, p1, s1);
4336
4183
  INIT_PTR(lp, 1, p2, s2);
4337
- // printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);
4338
4184
 
4339
4185
  GET_DATA_STRIDE(p1, s1, dtype, x);
4340
4186
  SET_DATA_STRIDE(p2, s2, dtype, x);
4341
- // printf("i=%lu x=%f\n",i,x);
4342
4187
  for (i--; i--;) {
4343
4188
  GET_DATA_STRIDE(p1, s1, dtype, y);
4344
4189
  m_cumprod_nan(x, y);
4345
4190
  SET_DATA_STRIDE(p2, s2, dtype, x);
4346
- // printf("i=%lu x=%f\n",i,x);
4347
4191
  }
4348
4192
  }
4349
4193
 
4350
4194
  /*
4351
4195
  cumprod of self.
4352
4196
  @overload cumprod(axis:nil, nan:false)
4353
- @param [Numeric,Array,Range] axis Performs cumprod along the axis.
4354
- @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
4355
- @return [Numo::DComplex] cumprod of self.
4197
+ @param [Numeric,Array,Range] axis Performs cumprod along the axis.
4198
+ @param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
4199
+ @return [Numo::DComplex] cumprod of self.
4356
4200
  */
4357
4201
  static VALUE dcomplex_cumprod(int argc, VALUE* argv, VALUE self) {
4358
4202
  VALUE reduce;
4359
- ndfunc_arg_in_t ain[2] = {{cT, 0}, {sym_reduce, 0}};
4360
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4361
- ndfunc_t ndf = {iter_dcomplex_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout};
4203
+ ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
4204
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4205
+ ndfunc_t ndf = {
4206
+ iter_dcomplex_cumprod, STRIDE_LOOP | NDF_FLAT_REDUCE | NDF_CUM, 2, 1, ain, aout
4207
+ };
4362
4208
 
4363
4209
  reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_cumprod_nan);
4364
4210
 
@@ -4438,9 +4284,9 @@ static void iter_dcomplex_mulsum_nan(na_loop_t* const lp) {
4438
4284
  static VALUE dcomplex_mulsum_self(int argc, VALUE* argv, VALUE self) {
4439
4285
  VALUE v, reduce;
4440
4286
  VALUE naryv[2];
4441
- ndfunc_arg_in_t ain[4] = {{cT, 0}, {cT, 0}, {sym_reduce, 0}, {sym_init, 0}};
4442
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4443
- ndfunc_t ndf = {iter_dcomplex_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout};
4287
+ ndfunc_arg_in_t ain[4] = { { cT, 0 }, { cT, 0 }, { sym_reduce, 0 }, { sym_init, 0 } };
4288
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4289
+ ndfunc_t ndf = { iter_dcomplex_mulsum, STRIDE_LOOP_NIP, 4, 1, ain, aout };
4444
4290
 
4445
4291
  if (argc < 1) {
4446
4292
  rb_raise(rb_eArgError, "wrong number of arguments (%d for >=1)", argc);
@@ -4460,11 +4306,12 @@ static VALUE dcomplex_mulsum_self(int argc, VALUE* argv, VALUE self) {
4460
4306
  Binary mulsum.
4461
4307
 
4462
4308
  @overload mulsum(other, axis:nil, keepdims:false, nan:false)
4463
- @param [Numo::NArray,Numeric] other
4464
- @param [Numeric,Array,Range] axis Performs mulsum along the axis.
4465
- @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array as dimensions with size one.
4466
- @param [TrueClass] nan (keyword) If true, apply NaN-aware algorithm (avoid NaN if exists).
4467
- @return [Numo::NArray] mulsum of self and other.
4309
+ @param [Numo::NArray,Numeric] other
4310
+ @param [Numeric,Array,Range] axis Performs mulsum along the axis.
4311
+ @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
4312
+ as dimensions with size one.
4313
+ @param [TrueClass] nan (keyword) If true, apply NaN-aware algorithm (avoid NaN if exists).
4314
+ @return [Numo::NArray] mulsum of self and other.
4468
4315
  */
4469
4316
  static VALUE dcomplex_mulsum(int argc, VALUE* argv, VALUE self) {
4470
4317
  //
@@ -4533,9 +4380,9 @@ static void iter_dcomplex_seq(na_loop_t* const lp) {
4533
4380
  beg+i*step
4534
4381
  where i is 1-dimensional index.
4535
4382
  @overload seq([beg,[step]])
4536
- @param [Numeric] beg beginning of sequence. (default=0)
4537
- @param [Numeric] step step of sequence. (default=1)
4538
- @return [Numo::DComplex] self.
4383
+ @param [Numeric] beg beginning of sequence. (default=0)
4384
+ @param [Numeric] step step of sequence. (default=1)
4385
+ @return [Numo::DComplex] self.
4539
4386
  @example
4540
4387
  Numo::DFloat.new(6).seq(1,-0.2)
4541
4388
  # => Numo::DFloat#shape=[6]
@@ -4545,17 +4392,17 @@ static void iter_dcomplex_seq(na_loop_t* const lp) {
4545
4392
  # => Numo::DComplex#shape=[6]
4546
4393
  # [1+0i, 0.8+0.2i, 0.6+0.4i, 0.4+0.6i, 0.2+0.8i, 0+1i]
4547
4394
  */
4548
- static VALUE dcomplex_seq(int argc, VALUE* args, VALUE self) {
4395
+ static VALUE dcomplex_seq(int argc, VALUE* argv, VALUE self) {
4549
4396
  seq_opt_t* g;
4550
4397
  VALUE vbeg = Qnil, vstep = Qnil;
4551
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
4552
- ndfunc_t ndf = {iter_dcomplex_seq, FULL_LOOP, 1, 0, ain, 0};
4398
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
4399
+ ndfunc_t ndf = { iter_dcomplex_seq, FULL_LOOP, 1, 0, ain, 0 };
4553
4400
 
4554
4401
  g = ALLOCA_N(seq_opt_t, 1);
4555
4402
  g->beg = m_zero;
4556
4403
  g->step = m_one;
4557
4404
  g->count = 0;
4558
- rb_scan_args(argc, args, "02", &vbeg, &vstep);
4405
+ rb_scan_args(argc, argv, "02", &vbeg, &vstep);
4559
4406
  if (vbeg != Qnil) {
4560
4407
  g->beg = m_num_to_data(vbeg);
4561
4408
  }
@@ -4614,10 +4461,10 @@ static void iter_dcomplex_logseq(na_loop_t* const lp) {
4614
4461
  Applicable classes: DFloat, SFloat, DComplex, SCopmplex.
4615
4462
 
4616
4463
  @overload logseq(beg,step,[base])
4617
- @param [Numeric] beg The beginning of sequence.
4618
- @param [Numeric] step The step of sequence.
4619
- @param [Numeric] base The base of log space. (default=10)
4620
- @return [Numo::DComplex] self.
4464
+ @param [Numeric] beg The beginning of sequence.
4465
+ @param [Numeric] step The step of sequence.
4466
+ @param [Numeric] base The base of log space. (default=10)
4467
+ @return [Numo::DComplex] self.
4621
4468
 
4622
4469
  @example
4623
4470
  Numo::DFloat.new(5).logseq(4,-1,2)
@@ -4628,14 +4475,14 @@ static void iter_dcomplex_logseq(na_loop_t* const lp) {
4628
4475
  # => Numo::DComplex#shape=[5]
4629
4476
  # [1+7.26156e-310i, 0.5+0.866025i, -0.5+0.866025i, -1+1.22465e-16i, ...]
4630
4477
  */
4631
- static VALUE dcomplex_logseq(int argc, VALUE* args, VALUE self) {
4478
+ static VALUE dcomplex_logseq(int argc, VALUE* argv, VALUE self) {
4632
4479
  logseq_opt_t* g;
4633
4480
  VALUE vbeg, vstep, vbase;
4634
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
4635
- ndfunc_t ndf = {iter_dcomplex_logseq, FULL_LOOP, 1, 0, ain, 0};
4481
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
4482
+ ndfunc_t ndf = { iter_dcomplex_logseq, FULL_LOOP, 1, 0, ain, 0 };
4636
4483
 
4637
4484
  g = ALLOCA_N(logseq_opt_t, 1);
4638
- rb_scan_args(argc, args, "21", &vbeg, &vstep, &vbase);
4485
+ rb_scan_args(argc, argv, "21", &vbeg, &vstep, &vbase);
4639
4486
  g->beg = m_num_to_data(vbeg);
4640
4487
  g->step = m_num_to_data(vstep);
4641
4488
  if (vbase == Qnil) {
@@ -4679,15 +4526,15 @@ static void iter_dcomplex_eye(na_loop_t* const lp) {
4679
4526
  /*
4680
4527
  Eye: Set a value to diagonal components, set 0 to non-diagonal components.
4681
4528
  @overload eye([element,offset])
4682
- @param [Numeric] element Diagonal element to be stored. Default is 1.
4683
- @param [Integer] offset Diagonal offset from the main diagonal. The
4684
- default is 0. k>0 for diagonals above the main diagonal, and k<0
4685
- for diagonals below the main diagonal.
4686
- @return [Numo::DComplex] eye of self.
4529
+ @param [Numeric] element Diagonal element to be stored. Default is 1.
4530
+ @param [Integer] offset Diagonal offset from the main diagonal. The
4531
+ default is 0. k>0 for diagonals above the main diagonal, and k<0
4532
+ for diagonals below the main diagonal.
4533
+ @return [Numo::DComplex] eye of self.
4687
4534
  */
4688
4535
  static VALUE dcomplex_eye(int argc, VALUE* argv, VALUE self) {
4689
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 2}};
4690
- ndfunc_t ndf = {iter_dcomplex_eye, NO_LOOP, 1, 0, ain, 0};
4536
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 2 } };
4537
+ ndfunc_t ndf = { iter_dcomplex_eye, NO_LOOP, 1, 0, ain, 0 };
4691
4538
  ssize_t kofs;
4692
4539
  dtype data;
4693
4540
  char* g;
@@ -4717,17 +4564,21 @@ static VALUE dcomplex_eye(int argc, VALUE* argv, VALUE self) {
4717
4564
  // Diagonal offset from the main diagonal.
4718
4565
  if (kofs >= 0) {
4719
4566
  if ((size_t)(kofs) >= na->shape[nd - 1]) {
4720
- rb_raise(rb_eArgError,
4721
- "invalid diagonal offset(%" SZF "d) for "
4722
- "last dimension size(%" SZF "d)",
4723
- kofs, na->shape[nd - 1]);
4567
+ rb_raise(
4568
+ rb_eArgError,
4569
+ "invalid diagonal offset(%" SZF "d) for "
4570
+ "last dimension size(%" SZF "d)",
4571
+ kofs, na->shape[nd - 1]
4572
+ );
4724
4573
  }
4725
4574
  } else {
4726
4575
  if ((size_t)(-kofs) >= na->shape[nd - 2]) {
4727
- rb_raise(rb_eArgError,
4728
- "invalid diagonal offset(%" SZF "d) for "
4729
- "last-1 dimension size(%" SZF "d)",
4730
- kofs, na->shape[nd - 2]);
4576
+ rb_raise(
4577
+ rb_eArgError,
4578
+ "invalid diagonal offset(%" SZF "d) for "
4579
+ "last-1 dimension size(%" SZF "d)",
4580
+ kofs, na->shape[nd - 2]
4581
+ );
4731
4582
  }
4732
4583
  }
4733
4584
 
@@ -4776,9 +4627,10 @@ static void iter_dcomplex_rand(na_loop_t* const lp) {
4776
4627
  /*
4777
4628
  Generate uniformly distributed random numbers on self narray.
4778
4629
  @overload rand([[low],high])
4779
- @param [Numeric] low lower inclusive boundary of random numbers. (default=0)
4780
- @param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for complex types)
4781
- @return [Numo::DComplex] self.
4630
+ @param [Numeric] low lower inclusive boundary of random numbers. (default=0)
4631
+ @param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
4632
+ complex types)
4633
+ @return [Numo::DComplex] self.
4782
4634
  @example
4783
4635
  Numo::DFloat.new(6).rand
4784
4636
  # => Numo::DFloat#shape=[6]
@@ -4792,14 +4644,14 @@ static void iter_dcomplex_rand(na_loop_t* const lp) {
4792
4644
  # => Numo::Int32#shape=[6]
4793
4645
  # [4, 3, 3, 2, 4, 2]
4794
4646
  */
4795
- static VALUE dcomplex_rand(int argc, VALUE* args, VALUE self) {
4647
+ static VALUE dcomplex_rand(int argc, VALUE* argv, VALUE self) {
4796
4648
  rand_opt_t g;
4797
4649
  VALUE v1 = Qnil, v2 = Qnil;
4798
4650
  dtype high;
4799
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
4800
- ndfunc_t ndf = {iter_dcomplex_rand, FULL_LOOP, 1, 0, ain, 0};
4651
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
4652
+ ndfunc_t ndf = { iter_dcomplex_rand, FULL_LOOP, 1, 0, ain, 0 };
4801
4653
 
4802
- rb_scan_args(argc, args, "02", &v1, &v2);
4654
+ rb_scan_args(argc, argv, "02", &v1, &v2);
4803
4655
  if (v2 == Qnil) {
4804
4656
  g.low = m_zero;
4805
4657
  if (v1 == Qnil) {
@@ -4865,9 +4717,9 @@ static void iter_dcomplex_rand_norm(na_loop_t* const lp) {
4865
4717
  Generates random numbers from the normal distribution on self narray
4866
4718
  using Box-Muller Transformation.
4867
4719
  @overload rand_norm([mu,[sigma]])
4868
- @param [Numeric] mu mean of normal distribution. (default=0)
4869
- @param [Numeric] sigma standard deviation of normal distribution. (default=1)
4870
- @return [Numo::DComplex] self.
4720
+ @param [Numeric] mu mean of normal distribution. (default=0)
4721
+ @param [Numeric] sigma standard deviation of normal distribution. (default=1)
4722
+ @return [Numo::DComplex] self.
4871
4723
  @example
4872
4724
  Numo::DFloat.new(5,5).rand_norm
4873
4725
  # => Numo::DFloat#shape=[5,5]
@@ -4891,14 +4743,14 @@ static void iter_dcomplex_rand_norm(na_loop_t* const lp) {
4891
4743
  # [4.26477+3.99655i, 4.90052+5.00763i, 4.46607+2.3444i],
4892
4744
  # [4.5528+7.11003i, 5.62117+6.69094i, 5.05443+5.35133i]]
4893
4745
  */
4894
- static VALUE dcomplex_rand_norm(int argc, VALUE* args, VALUE self) {
4746
+ static VALUE dcomplex_rand_norm(int argc, VALUE* argv, VALUE self) {
4895
4747
  int n;
4896
4748
  randn_opt_t g;
4897
4749
  VALUE v1 = Qnil, v2 = Qnil;
4898
- ndfunc_arg_in_t ain[1] = {{OVERWRITE, 0}};
4899
- ndfunc_t ndf = {iter_dcomplex_rand_norm, FULL_LOOP, 1, 0, ain, 0};
4750
+ ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
4751
+ ndfunc_t ndf = { iter_dcomplex_rand_norm, FULL_LOOP, 1, 0, ain, 0 };
4900
4752
 
4901
- n = rb_scan_args(argc, args, "02", &v1, &v2);
4753
+ n = rb_scan_args(argc, argv, "02", &v1, &v2);
4902
4754
  if (n == 0) {
4903
4755
  g.mu = m_zero;
4904
4756
  } else {
@@ -4933,15 +4785,15 @@ static void iter_dcomplex_poly(na_loop_t* const lp) {
4933
4785
  Calculate polynomial.
4934
4786
  `x.poly(a0,a1,a2,...,an) = a0 + a1*x + a2*x**2 + ... + an*x**n`
4935
4787
  @overload poly a0, a1, ..., an
4936
- @param [Numo::NArray,Numeric] a0,a1,...,an
4937
- @return [Numo::DComplex]
4788
+ @param [Numo::NArray,Numeric] a0,a1,...,an
4789
+ @return [Numo::DComplex]
4938
4790
  */
4939
4791
  static VALUE dcomplex_poly(VALUE self, VALUE args) {
4940
4792
  int argc, i;
4941
4793
  VALUE* argv;
4942
4794
  volatile VALUE v, a;
4943
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
4944
- ndfunc_t ndf = {iter_dcomplex_poly, NO_LOOP, 0, 1, 0, aout};
4795
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4796
+ ndfunc_t ndf = { iter_dcomplex_poly, NO_LOOP, 0, 1, 0, aout };
4945
4797
 
4946
4798
  argc = (int)RARRAY_LEN(args);
4947
4799
  ndf.nin = argc + 1;
@@ -4959,10 +4811,6 @@ static VALUE dcomplex_poly(VALUE self, VALUE args) {
4959
4811
  return dcomplex_extract(v);
4960
4812
  }
4961
4813
 
4962
- /*
4963
- module definition: Numo::DComplex::NMath
4964
- */
4965
-
4966
4814
  VALUE mTM;
4967
4815
 
4968
4816
  static void iter_dcomplex_math_s_sqrt(na_loop_t* const lp) {
@@ -5032,13 +4880,13 @@ static void iter_dcomplex_math_s_sqrt(na_loop_t* const lp) {
5032
4880
  /*
5033
4881
  Calculate sqrt(x).
5034
4882
  @overload sqrt(x)
5035
- @param [Numo::NArray,Numeric] x input value
5036
- @return [Numo::DComplex] result of sqrt(x).
4883
+ @param [Numo::NArray,Numeric] x input value
4884
+ @return [Numo::DComplex] result of sqrt(x).
5037
4885
  */
5038
4886
  static VALUE dcomplex_math_s_sqrt(VALUE mod, VALUE a1) {
5039
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5040
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5041
- ndfunc_t ndf = {iter_dcomplex_math_s_sqrt, FULL_LOOP, 1, 1, ain, aout};
4887
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
4888
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4889
+ ndfunc_t ndf = { iter_dcomplex_math_s_sqrt, FULL_LOOP, 1, 1, ain, aout };
5042
4890
 
5043
4891
  return na_ndloop(&ndf, 1, a1);
5044
4892
  }
@@ -5110,13 +4958,13 @@ static void iter_dcomplex_math_s_cbrt(na_loop_t* const lp) {
5110
4958
  /*
5111
4959
  Calculate cbrt(x).
5112
4960
  @overload cbrt(x)
5113
- @param [Numo::NArray,Numeric] x input value
5114
- @return [Numo::DComplex] result of cbrt(x).
4961
+ @param [Numo::NArray,Numeric] x input value
4962
+ @return [Numo::DComplex] result of cbrt(x).
5115
4963
  */
5116
4964
  static VALUE dcomplex_math_s_cbrt(VALUE mod, VALUE a1) {
5117
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5118
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5119
- ndfunc_t ndf = {iter_dcomplex_math_s_cbrt, FULL_LOOP, 1, 1, ain, aout};
4965
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
4966
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
4967
+ ndfunc_t ndf = { iter_dcomplex_math_s_cbrt, FULL_LOOP, 1, 1, ain, aout };
5120
4968
 
5121
4969
  return na_ndloop(&ndf, 1, a1);
5122
4970
  }
@@ -5188,13 +5036,13 @@ static void iter_dcomplex_math_s_log(na_loop_t* const lp) {
5188
5036
  /*
5189
5037
  Calculate log(x).
5190
5038
  @overload log(x)
5191
- @param [Numo::NArray,Numeric] x input value
5192
- @return [Numo::DComplex] result of log(x).
5039
+ @param [Numo::NArray,Numeric] x input value
5040
+ @return [Numo::DComplex] result of log(x).
5193
5041
  */
5194
5042
  static VALUE dcomplex_math_s_log(VALUE mod, VALUE a1) {
5195
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5196
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5197
- ndfunc_t ndf = {iter_dcomplex_math_s_log, FULL_LOOP, 1, 1, ain, aout};
5043
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5044
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5045
+ ndfunc_t ndf = { iter_dcomplex_math_s_log, FULL_LOOP, 1, 1, ain, aout };
5198
5046
 
5199
5047
  return na_ndloop(&ndf, 1, a1);
5200
5048
  }
@@ -5266,13 +5114,13 @@ static void iter_dcomplex_math_s_log2(na_loop_t* const lp) {
5266
5114
  /*
5267
5115
  Calculate log2(x).
5268
5116
  @overload log2(x)
5269
- @param [Numo::NArray,Numeric] x input value
5270
- @return [Numo::DComplex] result of log2(x).
5117
+ @param [Numo::NArray,Numeric] x input value
5118
+ @return [Numo::DComplex] result of log2(x).
5271
5119
  */
5272
5120
  static VALUE dcomplex_math_s_log2(VALUE mod, VALUE a1) {
5273
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5274
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5275
- ndfunc_t ndf = {iter_dcomplex_math_s_log2, FULL_LOOP, 1, 1, ain, aout};
5121
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5122
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5123
+ ndfunc_t ndf = { iter_dcomplex_math_s_log2, FULL_LOOP, 1, 1, ain, aout };
5276
5124
 
5277
5125
  return na_ndloop(&ndf, 1, a1);
5278
5126
  }
@@ -5344,13 +5192,13 @@ static void iter_dcomplex_math_s_log10(na_loop_t* const lp) {
5344
5192
  /*
5345
5193
  Calculate log10(x).
5346
5194
  @overload log10(x)
5347
- @param [Numo::NArray,Numeric] x input value
5348
- @return [Numo::DComplex] result of log10(x).
5195
+ @param [Numo::NArray,Numeric] x input value
5196
+ @return [Numo::DComplex] result of log10(x).
5349
5197
  */
5350
5198
  static VALUE dcomplex_math_s_log10(VALUE mod, VALUE a1) {
5351
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5352
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5353
- ndfunc_t ndf = {iter_dcomplex_math_s_log10, FULL_LOOP, 1, 1, ain, aout};
5199
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5200
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5201
+ ndfunc_t ndf = { iter_dcomplex_math_s_log10, FULL_LOOP, 1, 1, ain, aout };
5354
5202
 
5355
5203
  return na_ndloop(&ndf, 1, a1);
5356
5204
  }
@@ -5422,13 +5270,13 @@ static void iter_dcomplex_math_s_exp(na_loop_t* const lp) {
5422
5270
  /*
5423
5271
  Calculate exp(x).
5424
5272
  @overload exp(x)
5425
- @param [Numo::NArray,Numeric] x input value
5426
- @return [Numo::DComplex] result of exp(x).
5273
+ @param [Numo::NArray,Numeric] x input value
5274
+ @return [Numo::DComplex] result of exp(x).
5427
5275
  */
5428
5276
  static VALUE dcomplex_math_s_exp(VALUE mod, VALUE a1) {
5429
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5430
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5431
- ndfunc_t ndf = {iter_dcomplex_math_s_exp, FULL_LOOP, 1, 1, ain, aout};
5277
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5278
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5279
+ ndfunc_t ndf = { iter_dcomplex_math_s_exp, FULL_LOOP, 1, 1, ain, aout };
5432
5280
 
5433
5281
  return na_ndloop(&ndf, 1, a1);
5434
5282
  }
@@ -5500,13 +5348,13 @@ static void iter_dcomplex_math_s_exp2(na_loop_t* const lp) {
5500
5348
  /*
5501
5349
  Calculate exp2(x).
5502
5350
  @overload exp2(x)
5503
- @param [Numo::NArray,Numeric] x input value
5504
- @return [Numo::DComplex] result of exp2(x).
5351
+ @param [Numo::NArray,Numeric] x input value
5352
+ @return [Numo::DComplex] result of exp2(x).
5505
5353
  */
5506
5354
  static VALUE dcomplex_math_s_exp2(VALUE mod, VALUE a1) {
5507
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5508
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5509
- ndfunc_t ndf = {iter_dcomplex_math_s_exp2, FULL_LOOP, 1, 1, ain, aout};
5355
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5356
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5357
+ ndfunc_t ndf = { iter_dcomplex_math_s_exp2, FULL_LOOP, 1, 1, ain, aout };
5510
5358
 
5511
5359
  return na_ndloop(&ndf, 1, a1);
5512
5360
  }
@@ -5578,13 +5426,13 @@ static void iter_dcomplex_math_s_exp10(na_loop_t* const lp) {
5578
5426
  /*
5579
5427
  Calculate exp10(x).
5580
5428
  @overload exp10(x)
5581
- @param [Numo::NArray,Numeric] x input value
5582
- @return [Numo::DComplex] result of exp10(x).
5429
+ @param [Numo::NArray,Numeric] x input value
5430
+ @return [Numo::DComplex] result of exp10(x).
5583
5431
  */
5584
5432
  static VALUE dcomplex_math_s_exp10(VALUE mod, VALUE a1) {
5585
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5586
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5587
- ndfunc_t ndf = {iter_dcomplex_math_s_exp10, FULL_LOOP, 1, 1, ain, aout};
5433
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5434
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5435
+ ndfunc_t ndf = { iter_dcomplex_math_s_exp10, FULL_LOOP, 1, 1, ain, aout };
5588
5436
 
5589
5437
  return na_ndloop(&ndf, 1, a1);
5590
5438
  }
@@ -5656,13 +5504,13 @@ static void iter_dcomplex_math_s_sin(na_loop_t* const lp) {
5656
5504
  /*
5657
5505
  Calculate sin(x).
5658
5506
  @overload sin(x)
5659
- @param [Numo::NArray,Numeric] x input value
5660
- @return [Numo::DComplex] result of sin(x).
5507
+ @param [Numo::NArray,Numeric] x input value
5508
+ @return [Numo::DComplex] result of sin(x).
5661
5509
  */
5662
5510
  static VALUE dcomplex_math_s_sin(VALUE mod, VALUE a1) {
5663
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5664
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5665
- ndfunc_t ndf = {iter_dcomplex_math_s_sin, FULL_LOOP, 1, 1, ain, aout};
5511
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5512
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5513
+ ndfunc_t ndf = { iter_dcomplex_math_s_sin, FULL_LOOP, 1, 1, ain, aout };
5666
5514
 
5667
5515
  return na_ndloop(&ndf, 1, a1);
5668
5516
  }
@@ -5734,13 +5582,13 @@ static void iter_dcomplex_math_s_cos(na_loop_t* const lp) {
5734
5582
  /*
5735
5583
  Calculate cos(x).
5736
5584
  @overload cos(x)
5737
- @param [Numo::NArray,Numeric] x input value
5738
- @return [Numo::DComplex] result of cos(x).
5585
+ @param [Numo::NArray,Numeric] x input value
5586
+ @return [Numo::DComplex] result of cos(x).
5739
5587
  */
5740
5588
  static VALUE dcomplex_math_s_cos(VALUE mod, VALUE a1) {
5741
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5742
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5743
- ndfunc_t ndf = {iter_dcomplex_math_s_cos, FULL_LOOP, 1, 1, ain, aout};
5589
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5590
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5591
+ ndfunc_t ndf = { iter_dcomplex_math_s_cos, FULL_LOOP, 1, 1, ain, aout };
5744
5592
 
5745
5593
  return na_ndloop(&ndf, 1, a1);
5746
5594
  }
@@ -5812,13 +5660,13 @@ static void iter_dcomplex_math_s_tan(na_loop_t* const lp) {
5812
5660
  /*
5813
5661
  Calculate tan(x).
5814
5662
  @overload tan(x)
5815
- @param [Numo::NArray,Numeric] x input value
5816
- @return [Numo::DComplex] result of tan(x).
5663
+ @param [Numo::NArray,Numeric] x input value
5664
+ @return [Numo::DComplex] result of tan(x).
5817
5665
  */
5818
5666
  static VALUE dcomplex_math_s_tan(VALUE mod, VALUE a1) {
5819
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5820
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5821
- ndfunc_t ndf = {iter_dcomplex_math_s_tan, FULL_LOOP, 1, 1, ain, aout};
5667
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5668
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5669
+ ndfunc_t ndf = { iter_dcomplex_math_s_tan, FULL_LOOP, 1, 1, ain, aout };
5822
5670
 
5823
5671
  return na_ndloop(&ndf, 1, a1);
5824
5672
  }
@@ -5890,13 +5738,13 @@ static void iter_dcomplex_math_s_asin(na_loop_t* const lp) {
5890
5738
  /*
5891
5739
  Calculate asin(x).
5892
5740
  @overload asin(x)
5893
- @param [Numo::NArray,Numeric] x input value
5894
- @return [Numo::DComplex] result of asin(x).
5741
+ @param [Numo::NArray,Numeric] x input value
5742
+ @return [Numo::DComplex] result of asin(x).
5895
5743
  */
5896
5744
  static VALUE dcomplex_math_s_asin(VALUE mod, VALUE a1) {
5897
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5898
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5899
- ndfunc_t ndf = {iter_dcomplex_math_s_asin, FULL_LOOP, 1, 1, ain, aout};
5745
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5746
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5747
+ ndfunc_t ndf = { iter_dcomplex_math_s_asin, FULL_LOOP, 1, 1, ain, aout };
5900
5748
 
5901
5749
  return na_ndloop(&ndf, 1, a1);
5902
5750
  }
@@ -5968,13 +5816,13 @@ static void iter_dcomplex_math_s_acos(na_loop_t* const lp) {
5968
5816
  /*
5969
5817
  Calculate acos(x).
5970
5818
  @overload acos(x)
5971
- @param [Numo::NArray,Numeric] x input value
5972
- @return [Numo::DComplex] result of acos(x).
5819
+ @param [Numo::NArray,Numeric] x input value
5820
+ @return [Numo::DComplex] result of acos(x).
5973
5821
  */
5974
5822
  static VALUE dcomplex_math_s_acos(VALUE mod, VALUE a1) {
5975
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
5976
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
5977
- ndfunc_t ndf = {iter_dcomplex_math_s_acos, FULL_LOOP, 1, 1, ain, aout};
5823
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5824
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5825
+ ndfunc_t ndf = { iter_dcomplex_math_s_acos, FULL_LOOP, 1, 1, ain, aout };
5978
5826
 
5979
5827
  return na_ndloop(&ndf, 1, a1);
5980
5828
  }
@@ -6046,13 +5894,13 @@ static void iter_dcomplex_math_s_atan(na_loop_t* const lp) {
6046
5894
  /*
6047
5895
  Calculate atan(x).
6048
5896
  @overload atan(x)
6049
- @param [Numo::NArray,Numeric] x input value
6050
- @return [Numo::DComplex] result of atan(x).
5897
+ @param [Numo::NArray,Numeric] x input value
5898
+ @return [Numo::DComplex] result of atan(x).
6051
5899
  */
6052
5900
  static VALUE dcomplex_math_s_atan(VALUE mod, VALUE a1) {
6053
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
6054
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
6055
- ndfunc_t ndf = {iter_dcomplex_math_s_atan, FULL_LOOP, 1, 1, ain, aout};
5901
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5902
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5903
+ ndfunc_t ndf = { iter_dcomplex_math_s_atan, FULL_LOOP, 1, 1, ain, aout };
6056
5904
 
6057
5905
  return na_ndloop(&ndf, 1, a1);
6058
5906
  }
@@ -6124,13 +5972,13 @@ static void iter_dcomplex_math_s_sinh(na_loop_t* const lp) {
6124
5972
  /*
6125
5973
  Calculate sinh(x).
6126
5974
  @overload sinh(x)
6127
- @param [Numo::NArray,Numeric] x input value
6128
- @return [Numo::DComplex] result of sinh(x).
5975
+ @param [Numo::NArray,Numeric] x input value
5976
+ @return [Numo::DComplex] result of sinh(x).
6129
5977
  */
6130
5978
  static VALUE dcomplex_math_s_sinh(VALUE mod, VALUE a1) {
6131
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
6132
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
6133
- ndfunc_t ndf = {iter_dcomplex_math_s_sinh, FULL_LOOP, 1, 1, ain, aout};
5979
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
5980
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
5981
+ ndfunc_t ndf = { iter_dcomplex_math_s_sinh, FULL_LOOP, 1, 1, ain, aout };
6134
5982
 
6135
5983
  return na_ndloop(&ndf, 1, a1);
6136
5984
  }
@@ -6202,13 +6050,13 @@ static void iter_dcomplex_math_s_cosh(na_loop_t* const lp) {
6202
6050
  /*
6203
6051
  Calculate cosh(x).
6204
6052
  @overload cosh(x)
6205
- @param [Numo::NArray,Numeric] x input value
6206
- @return [Numo::DComplex] result of cosh(x).
6053
+ @param [Numo::NArray,Numeric] x input value
6054
+ @return [Numo::DComplex] result of cosh(x).
6207
6055
  */
6208
6056
  static VALUE dcomplex_math_s_cosh(VALUE mod, VALUE a1) {
6209
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
6210
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
6211
- ndfunc_t ndf = {iter_dcomplex_math_s_cosh, FULL_LOOP, 1, 1, ain, aout};
6057
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
6058
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
6059
+ ndfunc_t ndf = { iter_dcomplex_math_s_cosh, FULL_LOOP, 1, 1, ain, aout };
6212
6060
 
6213
6061
  return na_ndloop(&ndf, 1, a1);
6214
6062
  }
@@ -6280,13 +6128,13 @@ static void iter_dcomplex_math_s_tanh(na_loop_t* const lp) {
6280
6128
  /*
6281
6129
  Calculate tanh(x).
6282
6130
  @overload tanh(x)
6283
- @param [Numo::NArray,Numeric] x input value
6284
- @return [Numo::DComplex] result of tanh(x).
6131
+ @param [Numo::NArray,Numeric] x input value
6132
+ @return [Numo::DComplex] result of tanh(x).
6285
6133
  */
6286
6134
  static VALUE dcomplex_math_s_tanh(VALUE mod, VALUE a1) {
6287
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
6288
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
6289
- ndfunc_t ndf = {iter_dcomplex_math_s_tanh, FULL_LOOP, 1, 1, ain, aout};
6135
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
6136
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
6137
+ ndfunc_t ndf = { iter_dcomplex_math_s_tanh, FULL_LOOP, 1, 1, ain, aout };
6290
6138
 
6291
6139
  return na_ndloop(&ndf, 1, a1);
6292
6140
  }
@@ -6358,13 +6206,13 @@ static void iter_dcomplex_math_s_asinh(na_loop_t* const lp) {
6358
6206
  /*
6359
6207
  Calculate asinh(x).
6360
6208
  @overload asinh(x)
6361
- @param [Numo::NArray,Numeric] x input value
6362
- @return [Numo::DComplex] result of asinh(x).
6209
+ @param [Numo::NArray,Numeric] x input value
6210
+ @return [Numo::DComplex] result of asinh(x).
6363
6211
  */
6364
6212
  static VALUE dcomplex_math_s_asinh(VALUE mod, VALUE a1) {
6365
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
6366
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
6367
- ndfunc_t ndf = {iter_dcomplex_math_s_asinh, FULL_LOOP, 1, 1, ain, aout};
6213
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
6214
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
6215
+ ndfunc_t ndf = { iter_dcomplex_math_s_asinh, FULL_LOOP, 1, 1, ain, aout };
6368
6216
 
6369
6217
  return na_ndloop(&ndf, 1, a1);
6370
6218
  }
@@ -6436,13 +6284,13 @@ static void iter_dcomplex_math_s_acosh(na_loop_t* const lp) {
6436
6284
  /*
6437
6285
  Calculate acosh(x).
6438
6286
  @overload acosh(x)
6439
- @param [Numo::NArray,Numeric] x input value
6440
- @return [Numo::DComplex] result of acosh(x).
6287
+ @param [Numo::NArray,Numeric] x input value
6288
+ @return [Numo::DComplex] result of acosh(x).
6441
6289
  */
6442
6290
  static VALUE dcomplex_math_s_acosh(VALUE mod, VALUE a1) {
6443
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
6444
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
6445
- ndfunc_t ndf = {iter_dcomplex_math_s_acosh, FULL_LOOP, 1, 1, ain, aout};
6291
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
6292
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
6293
+ ndfunc_t ndf = { iter_dcomplex_math_s_acosh, FULL_LOOP, 1, 1, ain, aout };
6446
6294
 
6447
6295
  return na_ndloop(&ndf, 1, a1);
6448
6296
  }
@@ -6514,13 +6362,13 @@ static void iter_dcomplex_math_s_atanh(na_loop_t* const lp) {
6514
6362
  /*
6515
6363
  Calculate atanh(x).
6516
6364
  @overload atanh(x)
6517
- @param [Numo::NArray,Numeric] x input value
6518
- @return [Numo::DComplex] result of atanh(x).
6365
+ @param [Numo::NArray,Numeric] x input value
6366
+ @return [Numo::DComplex] result of atanh(x).
6519
6367
  */
6520
6368
  static VALUE dcomplex_math_s_atanh(VALUE mod, VALUE a1) {
6521
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
6522
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
6523
- ndfunc_t ndf = {iter_dcomplex_math_s_atanh, FULL_LOOP, 1, 1, ain, aout};
6369
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
6370
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
6371
+ ndfunc_t ndf = { iter_dcomplex_math_s_atanh, FULL_LOOP, 1, 1, ain, aout };
6524
6372
 
6525
6373
  return na_ndloop(&ndf, 1, a1);
6526
6374
  }
@@ -6592,13 +6440,13 @@ static void iter_dcomplex_math_s_sinc(na_loop_t* const lp) {
6592
6440
  /*
6593
6441
  Calculate sinc(x).
6594
6442
  @overload sinc(x)
6595
- @param [Numo::NArray,Numeric] x input value
6596
- @return [Numo::DComplex] result of sinc(x).
6443
+ @param [Numo::NArray,Numeric] x input value
6444
+ @return [Numo::DComplex] result of sinc(x).
6597
6445
  */
6598
6446
  static VALUE dcomplex_math_s_sinc(VALUE mod, VALUE a1) {
6599
- ndfunc_arg_in_t ain[1] = {{cT, 0}};
6600
- ndfunc_arg_out_t aout[1] = {{cT, 0}};
6601
- ndfunc_t ndf = {iter_dcomplex_math_s_sinc, FULL_LOOP, 1, 1, ain, aout};
6447
+ ndfunc_arg_in_t ain[1] = { { cT, 0 } };
6448
+ ndfunc_arg_out_t aout[1] = { { cT, 0 } };
6449
+ ndfunc_t ndf = { iter_dcomplex_math_s_sinc, FULL_LOOP, 1, 1, ain, aout };
6602
6450
 
6603
6451
  return na_ndloop(&ndf, 1, a1);
6604
6452
  }
@@ -6619,16 +6467,18 @@ void Init_numo_dcomplex(void) {
6619
6467
  id_real = rb_intern("real");
6620
6468
  id_to_a = rb_intern("to_a");
6621
6469
 
6622
- /*
6623
- Document-class: Numo::DComplex
6624
-
6625
- */
6470
+ /**
6471
+ * Document-class: Numo::DComplex
6472
+ *
6473
+ * Double precision floating point complex number N-dimensional array class.
6474
+ */
6626
6475
  cT = rb_define_class_under(mNumo, "DComplex", cNArray);
6627
6476
 
6628
6477
  // alias of DComplex
6629
6478
  rb_define_const(mNumo, "Complex64", numo_cDComplex);
6630
6479
 
6631
6480
  hCast = rb_hash_new();
6481
+ /* Upcasting rules of DComplex. */
6632
6482
  rb_define_const(cT, "UPCAST", hCast);
6633
6483
  rb_hash_aset(hCast, rb_cArray, cT);
6634
6484
 
@@ -6655,17 +6505,17 @@ void Init_numo_dcomplex(void) {
6655
6505
  rb_hash_aset(hCast, numo_cUInt8, numo_cDComplex);
6656
6506
  rb_obj_freeze(hCast);
6657
6507
 
6658
- /**/
6508
+ /* Element size of DComplex in bits. */
6659
6509
  rb_define_const(cT, "ELEMENT_BIT_SIZE", INT2FIX(sizeof(dtype) * 8));
6660
- /**/
6510
+ /* Element size of DComplex in bytes. */
6661
6511
  rb_define_const(cT, "ELEMENT_BYTE_SIZE", INT2FIX(sizeof(dtype)));
6662
- /**/
6512
+ /* Stride size of contiguous DComplex array. */
6663
6513
  rb_define_const(cT, "CONTIGUOUS_STRIDE", INT2FIX(sizeof(dtype)));
6664
- /**/
6514
+ /* Machine epsilon of DComplex. */
6665
6515
  rb_define_const(cT, "EPSILON", M_EPSILON);
6666
- /**/
6516
+ /* The largest representable value of DComplex. */
6667
6517
  rb_define_const(cT, "MAX", M_MAX);
6668
- /**/
6518
+ /* The smallest representable value of DComplex. */
6669
6519
  rb_define_const(cT, "MIN", M_MIN);
6670
6520
  rb_define_alloc_func(cT, dcomplex_s_alloc_func);
6671
6521
  rb_define_method(cT, "allocate", dcomplex_allocate, 0);
@@ -6726,9 +6576,49 @@ void Init_numo_dcomplex(void) {
6726
6576
  rb_define_method(cT, "sum", dcomplex_sum, -1);
6727
6577
  rb_define_method(cT, "prod", dcomplex_prod, -1);
6728
6578
  rb_define_method(cT, "kahan_sum", dcomplex_kahan_sum, -1);
6579
+ /**
6580
+ * mean of self.
6581
+ * @overload mean(axis: nil, keepdims: false, nan: false)
6582
+ * @param axis [Numeric, Array, Range] Performs mean along the axis.
6583
+ * @param keepdims [Boolean] If true, the reduced axes are left in the result array as
6584
+ * dimensions with size one.
6585
+ * @param nan [Boolean] If true, apply NaN-aware algorithm
6586
+ * (avoid NaN for sum/mean etc, or return NaN for min/max etc).
6587
+ * @return [Numo::DComplex] returns result of mean.
6588
+ */
6729
6589
  rb_define_method(cT, "mean", dcomplex_mean, -1);
6730
- rb_define_method(cT, "stddev", dcomplex_stddev, -1);
6590
+ /**
6591
+ * var of self.
6592
+ * @overload var(axis: nil, keepdims: false, nan: false)
6593
+ * @param axis [Numeric, Array, Range] Performs var along the axis.
6594
+ * @param keepdims [Boolean] If true, the reduced axes are left in the result array as
6595
+ * dimensions with size one.
6596
+ * @param nan [Boolean] If true, apply NaN-aware algorithm
6597
+ * (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
6598
+ * @return [Numo::DFloat] returns result of var.
6599
+ */
6731
6600
  rb_define_method(cT, "var", dcomplex_var, -1);
6601
+ /**
6602
+ * stddev of self.
6603
+ * @overload stddev(axis: nil, keepdims: false, nan: false)
6604
+ * @param axis [Numeric, Array, Range] Performs stddev along the axis.
6605
+ * @param keepdims [Boolean] If true, the reduced axes are left in the result array as
6606
+ * dimensions with size one.
6607
+ * @param nan [Boolean] If true, apply NaN-aware algorithm
6608
+ * (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
6609
+ * @return [Numo::DFloat] returns result of stddev.
6610
+ */
6611
+ rb_define_method(cT, "stddev", dcomplex_stddev, -1);
6612
+ /**
6613
+ * rms of self.
6614
+ * @overload rms(axis: nil, keepdims: false, nan: false)
6615
+ * @param axis [Numeric, Array, Range] Performs rms along the axis.
6616
+ * @param keepdims [Boolean] If true, the reduced axes are left in the result array as
6617
+ * dimensions with size one.
6618
+ * @param nan [Boolean] If true, apply NaN-aware algorithm
6619
+ * (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
6620
+ * @return [Numo::DFloat] returns result of rms.
6621
+ */
6732
6622
  rb_define_method(cT, "rms", dcomplex_rms, -1);
6733
6623
  rb_define_method(cT, "cumsum", dcomplex_cumsum, -1);
6734
6624
  rb_define_method(cT, "cumprod", dcomplex_cumprod, -1);
@@ -6742,11 +6632,11 @@ void Init_numo_dcomplex(void) {
6742
6632
  rb_define_method(cT, "poly", dcomplex_poly, -2);
6743
6633
  rb_define_singleton_method(cT, "[]", dcomplex_s_cast, -2);
6744
6634
 
6745
- /*
6746
- Document-module: Numo::DComplex::NMath
6747
-
6748
- */
6749
-
6635
+ /**
6636
+ * Document-module: Numo::DComplex::Math
6637
+ *
6638
+ * This module contains mathematical functions for Numo::DComplex.
6639
+ */
6750
6640
  mTM = rb_define_module_under(cT, "Math");
6751
6641
 
6752
6642
  rb_define_module_function(mTM, "sqrt", dcomplex_math_s_sqrt, 1);