carray 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/{LICENSES → LICENSE} +0 -0
  3. data/NEWS.md +42 -0
  4. data/README.md +5 -5
  5. data/TODO.md +16 -0
  6. data/carray.gemspec +9 -5
  7. data/ext/ca_iter_block.c +3 -5
  8. data/ext/ca_iter_dimension.c +4 -5
  9. data/ext/ca_iter_window.c +2 -4
  10. data/ext/ca_obj_array.c +394 -124
  11. data/ext/ca_obj_bitarray.c +3 -5
  12. data/ext/ca_obj_bitfield.c +3 -5
  13. data/ext/ca_obj_block.c +6 -8
  14. data/ext/ca_obj_fake.c +3 -5
  15. data/ext/ca_obj_farray.c +3 -5
  16. data/ext/ca_obj_field.c +15 -17
  17. data/ext/ca_obj_grid.c +5 -6
  18. data/ext/ca_obj_mapping.c +2 -4
  19. data/ext/ca_obj_object.c +3 -5
  20. data/ext/ca_obj_reduce.c +2 -4
  21. data/ext/ca_obj_refer.c +5 -7
  22. data/ext/ca_obj_repeat.c +2 -4
  23. data/ext/ca_obj_select.c +2 -4
  24. data/ext/ca_obj_shift.c +3 -5
  25. data/ext/ca_obj_transpose.c +3 -5
  26. data/ext/ca_obj_unbound_repeat.c +58 -81
  27. data/ext/ca_obj_window.c +7 -9
  28. data/ext/carray.h +13 -8
  29. data/ext/carray_access.c +111 -18
  30. data/ext/carray_attribute.c +136 -197
  31. data/ext/carray_call_cfunc.c +1 -3
  32. data/ext/carray_cast.c +344 -143
  33. data/ext/carray_cast_func.rb +1 -2
  34. data/ext/carray_class.c +28 -36
  35. data/ext/carray_conversion.c +49 -59
  36. data/ext/carray_copy.c +16 -32
  37. data/ext/carray_core.c +51 -44
  38. data/ext/carray_element.c +25 -44
  39. data/ext/carray_generate.c +71 -50
  40. data/ext/carray_iterator.c +13 -15
  41. data/ext/carray_loop.c +53 -82
  42. data/ext/carray_mask.c +87 -117
  43. data/ext/carray_math.rb +8 -10
  44. data/ext/carray_mathfunc.c +1 -3
  45. data/ext/carray_numeric.c +19 -3
  46. data/ext/carray_operator.c +45 -32
  47. data/ext/carray_order.c +72 -65
  48. data/ext/carray_sort_addr.c +14 -21
  49. data/ext/carray_stat.c +1 -3
  50. data/ext/carray_stat_proc.rb +2 -4
  51. data/ext/carray_test.c +28 -30
  52. data/ext/carray_undef.c +1 -3
  53. data/ext/carray_utils.c +12 -4
  54. data/ext/extconf.rb +1 -1
  55. data/ext/mkmath.rb +1 -1
  56. data/ext/ruby_carray.c +11 -6
  57. data/ext/ruby_ccomplex.c +1 -3
  58. data/ext/ruby_float_func.c +1 -3
  59. data/ext/version.h +5 -7
  60. data/lib/carray.rb +2 -0
  61. data/lib/carray/autoload/autoload_gem_numo_narray.rb +6 -6
  62. data/lib/carray/broadcast.rb +45 -0
  63. data/lib/carray/construct.rb +21 -4
  64. data/lib/carray/iterator.rb +1 -0
  65. data/lib/carray/ordering.rb +28 -2
  66. data/spec/Classes/CABitfield_spec.rb +58 -0
  67. data/spec/Classes/CABlockIterator_spec.rb +114 -0
  68. data/spec/Classes/CABlock_spec.rb +205 -0
  69. data/spec/Classes/CAField_spec.rb +39 -0
  70. data/spec/Classes/CAGrid_spec.rb +75 -0
  71. data/spec/Classes/CAMap_spec.rb +0 -0
  72. data/{test/test_CAMapping.rb → spec/Classes/CAMapping_spec.rb} +35 -36
  73. data/spec/Classes/CAObject_attribute_spec.rb +33 -0
  74. data/spec/Classes/CAObject_spec.rb +33 -0
  75. data/spec/Classes/CARefer_spec.rb +93 -0
  76. data/spec/Classes/CARepeat_spec.rb +65 -0
  77. data/spec/Classes/CASelect_spec.rb +22 -0
  78. data/spec/Classes/CAShift_spec.rb +16 -0
  79. data/spec/Classes/CAStruct_spec.rb +71 -0
  80. data/{test/test_CATranspose.rb → spec/Classes/CATranspose_spec.rb} +20 -21
  81. data/spec/Classes/CAUnboudRepeat_spec.rb +78 -0
  82. data/spec/Classes/CAWindow_spec.rb +54 -0
  83. data/spec/Classes/CAWrap_spec.rb +8 -0
  84. data/{test/test_CArray.rb → spec/Classes/CArray_spec.rb} +48 -92
  85. data/spec/Classes/CScalar_spec.rb +55 -0
  86. data/spec/Features/feature_130_spec.rb +19 -0
  87. data/spec/Features/feature_attributes_spec.rb +280 -0
  88. data/spec/Features/feature_boolean_spec.rb +97 -0
  89. data/spec/Features/feature_broadcast.rb +100 -0
  90. data/spec/Features/feature_cast_function.rb +19 -0
  91. data/spec/Features/feature_cast_spec.rb +33 -0
  92. data/spec/Features/feature_class_spec.rb +84 -0
  93. data/spec/Features/feature_complex_spec.rb +42 -0
  94. data/{test/test_composite.rb → spec/Features/feature_composite_spec.rb} +17 -18
  95. data/spec/Features/feature_convert_spec.rb +46 -0
  96. data/spec/Features/feature_copy_spec.rb +123 -0
  97. data/spec/Features/feature_creation_spec.rb +84 -0
  98. data/spec/Features/feature_element_spec.rb +144 -0
  99. data/spec/Features/feature_extream_spec.rb +54 -0
  100. data/spec/Features/feature_generate_spec.rb +74 -0
  101. data/spec/Features/feature_index_spec.rb +69 -0
  102. data/spec/Features/feature_mask_spec.rb +574 -0
  103. data/spec/Features/feature_math_spec.rb +97 -0
  104. data/spec/Features/feature_order_spec.rb +146 -0
  105. data/spec/Features/feature_ref_store_spec.rb +209 -0
  106. data/spec/Features/feature_serialization_spec.rb +125 -0
  107. data/spec/Features/feature_stat_spec.rb +397 -0
  108. data/spec/Features/feature_virtual_spec.rb +48 -0
  109. data/spec/Features/method_eq_spec.rb +81 -0
  110. data/spec/Features/method_is_nan_spec.rb +12 -0
  111. data/spec/Features/method_map_spec.rb +54 -0
  112. data/spec/Features/method_max_with.rb +20 -0
  113. data/spec/Features/method_min_with.rb +19 -0
  114. data/spec/Features/method_ne_spec.rb +18 -0
  115. data/spec/Features/method_project_spec.rb +188 -0
  116. data/spec/Features/method_ref_spec.rb +27 -0
  117. data/spec/Features/method_round_spec.rb +11 -0
  118. data/spec/Features/method_s_linspace_spec.rb +48 -0
  119. data/spec/Features/method_s_span_spec.rb +14 -0
  120. data/spec/Features/method_seq_spec.rb +47 -0
  121. data/spec/Features/method_sort_with.rb +43 -0
  122. data/spec/Features/method_sorted_with.rb +29 -0
  123. data/spec/Features/method_span_spec.rb +42 -0
  124. data/spec/Features/method_wrap_readonly_spec.rb +43 -0
  125. data/{test → spec/UnitTest}/test_CAVirtual.rb +0 -0
  126. data/spec/spec_all.rb +0 -1
  127. data/utils/convert_test.rb +73 -0
  128. data/utils/{extract_rdoc.rb → extract_yard.rb} +7 -12
  129. metadata +77 -60
  130. data/spec/CABlockIterator/CABlockIterator_spec.rb +0 -113
  131. data/spec/CArray/bug/store_spec.rb +0 -27
  132. data/spec/CArray/index/repeat_spec.rb +0 -10
  133. data/spec/CArray/method/eq_spec.rb +0 -80
  134. data/spec/CArray/method/is_nan_spec.rb +0 -12
  135. data/spec/CArray/method/ne_spec.rb +0 -18
  136. data/spec/CArray/method/round_spec.rb +0 -11
  137. data/spec/CArray/object/_attribute_spec.rb +0 -32
  138. data/spec/CArray/object/s_new_spec.rb +0 -31
  139. data/spec/CArray/serialize/Serialization_spec.rb +0 -89
  140. data/test/test_130.rb +0 -23
  141. data/test/test_ALL.rb +0 -49
  142. data/test/test_CABitfield.rb +0 -59
  143. data/test/test_CABlock.rb +0 -208
  144. data/test/test_CAField.rb +0 -40
  145. data/test/test_CAGrid.rb +0 -76
  146. data/test/test_CAMmap.rb +0 -11
  147. data/test/test_CARefer.rb +0 -94
  148. data/test/test_CARepeat.rb +0 -66
  149. data/test/test_CASelect.rb +0 -23
  150. data/test/test_CAShift.rb +0 -17
  151. data/test/test_CAWindow.rb +0 -55
  152. data/test/test_CAWrap.rb +0 -9
  153. data/test/test_CComplex.rb +0 -83
  154. data/test/test_CScalar.rb +0 -91
  155. data/test/test_attribute.rb +0 -281
  156. data/test/test_block_iterator.rb +0 -17
  157. data/test/test_boolean.rb +0 -99
  158. data/test/test_cast.rb +0 -33
  159. data/test/test_class.rb +0 -85
  160. data/test/test_complex.rb +0 -43
  161. data/test/test_convert.rb +0 -79
  162. data/test/test_copy.rb +0 -141
  163. data/test/test_creation.rb +0 -85
  164. data/test/test_element.rb +0 -146
  165. data/test/test_extream.rb +0 -55
  166. data/test/test_generate.rb +0 -75
  167. data/test/test_index.rb +0 -71
  168. data/test/test_mask.rb +0 -578
  169. data/test/test_math.rb +0 -98
  170. data/test/test_order.rb +0 -147
  171. data/test/test_ref_store.rb +0 -211
  172. data/test/test_stat.rb +0 -406
  173. data/test/test_struct.rb +0 -72
  174. data/test/test_virtual.rb +0 -49
@@ -3,10 +3,8 @@
3
3
  carray_element.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -15,11 +13,9 @@
15
13
 
16
14
  /* ------------------------------------------------------------------- */
17
15
 
18
- /* rdoc:
19
- class CArray
20
- def elem_swap
21
- end
22
- end
16
+ /* @overload elem_swap (idx1, idx2)
17
+
18
+ (Element) Swaps the values at the elements which are specified by arguments.
23
19
  */
24
20
 
25
21
  VALUE
@@ -127,11 +123,9 @@ rb_ca_elem_swap (VALUE self, VALUE ridx1, VALUE ridx2)
127
123
  return self;
128
124
  }
129
125
 
130
- /* rdoc:
131
- class CArray
132
- def elem_copy
133
- end
134
- end
126
+ /* @overload elem_copy (idx1, idx2)
127
+
128
+ (Element) Copies the value of the element of idx1 to the element of idx2
135
129
  */
136
130
 
137
131
  VALUE
@@ -207,11 +201,9 @@ rb_ca_elem_copy (VALUE self, VALUE ridx1, VALUE ridx2)
207
201
  return self;
208
202
  }
209
203
 
210
- /* rdoc:
211
- class CArray
212
- def elem_store
213
- end
214
- end
204
+ /* @overload elem_store (idx, obj)
205
+
206
+ (Element) Stores the object value in the element of idx.
215
207
  */
216
208
 
217
209
  VALUE
@@ -245,11 +237,9 @@ rb_ca_elem_store (VALUE self, VALUE ridx, VALUE obj)
245
237
  return obj;
246
238
  }
247
239
 
248
- /* rdoc:
249
- class CArray
250
- def elem_fetch
251
- end
252
- end
240
+ /* @overload elem_fetch (idx)
241
+
242
+ (Element) Fetches the object value at the element of idx.
253
243
  */
254
244
 
255
245
  VALUE
@@ -279,11 +269,9 @@ rb_ca_elem_fetch (VALUE self, VALUE ridx)
279
269
  }
280
270
  }
281
271
 
282
- /* rdoc:
283
- class CArray
284
- def elem_incr
285
- end
286
- end
272
+ /* @overload elem_incr (idx)
273
+
274
+ (Element) Increments the value by 1 at the element of idx.
287
275
  */
288
276
 
289
277
  VALUE
@@ -366,11 +354,9 @@ rb_ca_elem_incr (VALUE self, VALUE ridx1)
366
354
  return out;
367
355
  }
368
356
 
369
- /* rdoc:
370
- class CArray
371
- def elem_decr
372
- end
373
- end
357
+ /* @overload elem_decr (idx)
358
+
359
+ (Element) Decrements the value by 1 at the element of idx.
374
360
  */
375
361
 
376
362
  VALUE
@@ -453,11 +439,9 @@ rb_ca_elem_decr (VALUE self, VALUE ridx1)
453
439
  return out;
454
440
  }
455
441
 
456
- /* rdoc:
457
- class CArray
458
- def elem_masked?
459
- end
460
- end
442
+ /* @overload elem_masked? (idx)
443
+
444
+ (Masking, Element) Returns true if the element at given idx is masked.
461
445
  */
462
446
 
463
447
  VALUE
@@ -498,12 +482,9 @@ rb_ca_elem_test_masked (VALUE self, VALUE ridx1)
498
482
 
499
483
  /* ----------------------------------------------------------------- */
500
484
 
501
- /* rdoc:
502
- class CArray
503
- # used in CAHistogram.
504
- def incr_addr
505
- end
506
- end
485
+ /* @overload incr_addr (addr)
486
+
487
+ (Element) Increment the value at the element of addr.
507
488
  */
508
489
 
509
490
  static VALUE
@@ -3,10 +3,8 @@
3
3
  carray_generate.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -15,17 +13,11 @@
15
13
 
16
14
  /* ----------------------------------------------------------------- */
17
15
 
18
- /* rdoc:
19
- class CArray
20
- # Sets true at the given index for the boolean array and returns self.
21
- # It accept the arguments same as for CArray#[].
22
- def set (*argv)
23
- end
24
- # Sets false at the given index for the boolean array and returns self.
25
- # It accept the arguments same as for CArray#[].
26
- def unset (*argv)
27
- end
28
- end
16
+ /* @overload set (*idx)
17
+
18
+ (Boolean, Modification)
19
+ Sets true at the given index for the boolean array and returns self.
20
+ It accept the arguments same as for CArray#[].
29
21
  */
30
22
 
31
23
  static VALUE
@@ -40,6 +32,13 @@ rb_ca_boolean_set (int argc, VALUE *argv, VALUE self)
40
32
  return self;
41
33
  }
42
34
 
35
+ /* @overload unset (*idx)
36
+
37
+ (Boolean, Modification)
38
+ Sets false at the given index for the boolean array and returns self.
39
+ It accept the arguments same as for CArray#[].
40
+ */
41
+
43
42
  static VALUE
44
43
  rb_ca_boolean_unset (int argc, VALUE *argv, VALUE self)
45
44
  {
@@ -54,12 +53,10 @@ rb_ca_boolean_unset (int argc, VALUE *argv, VALUE self)
54
53
 
55
54
  /* ----------------------------------------------------------------- */
56
55
 
57
- /* rdoc:
58
- class CArray
59
- # Returns the 1d index array for non-zero elements of self
60
- def where
61
- end
62
- end
56
+ /* @overload where
57
+
58
+ (Conversion)
59
+ Returns the 1d index array for non-zero elements of self
63
60
  */
64
61
 
65
62
  VALUE
@@ -245,8 +242,13 @@ rb_ca_seq_bang_object (int argc, VALUE *argv, VALUE self)
245
242
  return self;
246
243
  }
247
244
 
248
- /* rdoc:
249
- class CArray
245
+ /* @overload seq! (init_val=0, step=1) {|elem| ... }
246
+
247
+ (Conversion, Destructive)
248
+ Generates sequential data with initial value `init_val`
249
+ and step value `step`. For object array, if the second argument
250
+ is Symbol object, it will be interpreted as stepping method and
251
+ it is called for the last element in each step.
250
252
  # call-seq:
251
253
  # seq (init_val=0, step=1)
252
254
  # seq (init_val=0, step=1) {|x| ... }
@@ -258,12 +260,6 @@ rb_ca_seq_bang_object (int argc, VALUE *argv, VALUE self)
258
260
  # is Symbol object, it will be interpreted as stepping method and
259
261
  # it is called for the last element in each step.
260
262
  #
261
- def seq (init_val=0, step=1)
262
- end
263
- #
264
- def seq! (init_val=0, step=1)
265
- end
266
- end
267
263
  */
268
264
 
269
265
  static VALUE
@@ -339,6 +335,26 @@ rb_ca_seq_bang_method (int argc, VALUE *argv, VALUE self)
339
335
  return self;
340
336
  }
341
337
 
338
+ /* @overload seq (init_val=0, step=1) {|elem| ... }
339
+
340
+ (Conversion)
341
+ Generates sequential data with initial value `init_val`
342
+ and step value `step`. For object array, if the second argument
343
+ is Symbol object, it will be interpreted as stepping method and
344
+ it is called for the last element in each step.
345
+ # call-seq:
346
+ # seq (init_val=0, step=1)
347
+ # seq (init_val=0, step=1) {|x| ... }
348
+ # seq (init_val=0, step=A_symbol) ### for object array
349
+ # seq (init_val=0, step=A_symbol) {|x| ...} ### for object array
350
+ #
351
+ # Generates sequential data with initial value `init_val`
352
+ # and step value `step`. For object array, if the second argument
353
+ # is Symbol object, it will be interpreted as stepping method and
354
+ # it is called for the last element in each step.
355
+ #
356
+ */
357
+
342
358
  static VALUE
343
359
  rb_ca_seq_method (int argc, VALUE *argv, VALUE self)
344
360
  {
@@ -456,15 +472,10 @@ ca_swap_bytes (char *ptr, ca_size_t bytes, ca_size_t elements)
456
472
 
457
473
  }
458
474
 
459
- /* rdoc:
460
- class CArray
461
- # Swaps the byte order of each element.
462
- def swap_bytes
463
- end
464
- #
465
- def swap_bytes!
466
- end
467
- end
475
+ /* @overload swap_bytes!
476
+
477
+ (Conversion, Destructive)
478
+ Swaps the byte order of each element.
468
479
  */
469
480
 
470
481
  VALUE
@@ -553,6 +564,12 @@ rb_ca_swap_bytes_bang (VALUE self)
553
564
  return self;
554
565
  }
555
566
 
567
+ /* @overload swap_bytes
568
+
569
+ (Conversion)
570
+ Swaps the byte order of each element.
571
+ */
572
+
556
573
  VALUE
557
574
  rb_ca_swap_bytes (VALUE self)
558
575
  {
@@ -664,20 +681,17 @@ rb_ca_swap_bytes (VALUE self)
664
681
  } \
665
682
  } \
666
683
  } \
667
- } \
684
+ } \
668
685
  }
669
686
 
670
- /* rdoc:
671
- class CArray
672
- # trims the data into the range between min and max. If `fill_value`
673
- # is given, the element out of the range between min and max is filled
674
- # by `fill_value`
675
- def trim (min, max, fill_value=nil)
676
- end
677
- #
678
- def trim! (min, max, fill_value=nil)
679
- end
680
- end
687
+
688
+
689
+ /* @overload trim! (min, max, fill_value=nil)
690
+
691
+ (Conversion)
692
+ Trims the data into the range between min and max. If `fill_value`
693
+ is given, the element out of the range between min and max is filled
694
+ by `fill_value`
681
695
  */
682
696
 
683
697
  static VALUE
@@ -720,6 +734,14 @@ rb_ca_trim_bang (int argc, VALUE *argv, VALUE self)
720
734
  return self;
721
735
  }
722
736
 
737
+ /* @overload trim (min, max, fill_value=nil)
738
+
739
+ (Conversion)
740
+ Trims the data into the range between min and max. If `fill_value`
741
+ is given, the element out of the range between min and max is filled
742
+ by `fill_value`
743
+ */
744
+
723
745
  static VALUE
724
746
  rb_ca_trim (int argc, VALUE *argv, VALUE self)
725
747
  {
@@ -727,7 +749,6 @@ rb_ca_trim (int argc, VALUE *argv, VALUE self)
727
749
  return rb_ca_trim_bang(argc, argv, out);
728
750
  }
729
751
 
730
-
731
752
  void
732
753
  Init_carray_generate ()
733
754
  {
@@ -3,10 +3,8 @@
3
3
  carray_iterator.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -209,7 +207,7 @@ ca_iter_prepare_output (VALUE self, VALUE rtype, VALUE rbytes)
209
207
 
210
208
  /* -------------------------------------------------------------------- */
211
209
 
212
- /* rdoc:
210
+ /* yard:
213
211
  class CAIterator
214
212
  def ndim
215
213
  end
@@ -223,7 +221,7 @@ rb_ca_iter_ndim (VALUE self)
223
221
  return LONG2NUM(ca_iter_ndim(self));
224
222
  }
225
223
 
226
- /* rdoc:
224
+ /* yard:
227
225
  class CAIterator
228
226
  def dim
229
227
  end
@@ -245,7 +243,7 @@ rb_ca_iter_dim (VALUE self)
245
243
  return rdim;
246
244
  }
247
245
 
248
- /* rdoc:
246
+ /* yard:
249
247
  class CAIterator
250
248
  def elements
251
249
  end
@@ -258,7 +256,7 @@ rb_ca_iter_elements (VALUE self)
258
256
  return SIZE2NUM(ca_iter_elements(self));
259
257
  }
260
258
 
261
- /* rdoc:
259
+ /* yard:
262
260
  class CAIterator
263
261
  def reference
264
262
  end
@@ -271,7 +269,7 @@ rb_ca_iter_reference (VALUE self)
271
269
  return ca_iter_reference(self);
272
270
  }
273
271
 
274
- /* rdoc:
272
+ /* yard:
275
273
  class CAIterator
276
274
  def kernel_at_addr
277
275
  end
@@ -289,7 +287,7 @@ rb_ca_iter_kernel_at_addr (int argc, VALUE *argv, VALUE self)
289
287
  return ca_iter_kernel_at_addr(self, NUM2SIZE(raddr), rcarray);
290
288
  }
291
289
 
292
- /* rdoc:
290
+ /* yard:
293
291
  class CAIterator
294
292
  def kernel_at_index
295
293
  end
@@ -317,7 +315,7 @@ rb_ca_iter_kernel_at_index (int argc, VALUE *argv, VALUE self)
317
315
  return ca_iter_kernel_at_index(self, idx, rcarray);
318
316
  }
319
317
 
320
- /* rdoc:
318
+ /* yard:
321
319
  class CAIterator
322
320
  def kernel_move_to_addr
323
321
  end
@@ -330,7 +328,7 @@ rb_ca_iter_kernel_move_to_addr (VALUE self, VALUE raddr, VALUE rker)
330
328
  return ca_iter_kernel_move_to_addr(self, NUM2SIZE(raddr), rker);
331
329
  }
332
330
 
333
- /* rdoc:
331
+ /* yard:
334
332
  class CAIterator
335
333
  def kernel_move_to_index
336
334
  end
@@ -351,7 +349,7 @@ rb_ca_iter_kernel_move_to_index (VALUE self, VALUE rindex, VALUE rker)
351
349
  return ca_iter_kernel_move_to_index(self, idx, rker);
352
350
  }
353
351
 
354
- /* rdoc:
352
+ /* yard:
355
353
  class CAIterator
356
354
  def prepare_output
357
355
  end
@@ -371,7 +369,7 @@ rb_ca_iter_prepare_output (int argc, VALUE *argv, VALUE self)
371
369
 
372
370
  /* -------------------------------------------------------------------- */
373
371
 
374
- /* rdoc:
372
+ /* yard:
375
373
  class CAIterator
376
374
  def calculate
377
375
  end
@@ -470,7 +468,7 @@ rb_ca_iter_calculate (int argc, VALUE *argv, VALUE self)
470
468
  return routput;
471
469
  }
472
470
 
473
- /* rdoc:
471
+ /* yard:
474
472
  class CAIterator
475
473
  def filter
476
474
  end
@@ -547,7 +545,7 @@ rb_ca_iter_filter (int argc, VALUE *argv, VALUE self)
547
545
  return routput;
548
546
  }
549
547
 
550
- /* rdoc:
548
+ /* yard:
551
549
  class CAIterator
552
550
  def evaluate
553
551
  end
@@ -3,10 +3,8 @@
3
3
  carray_loop.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -43,18 +41,14 @@ rb_ca_s_each_index_internal (int ndim, VALUE *dim, uint8_t indim, VALUE ridx)
43
41
  return ret;
44
42
  }
45
43
 
46
- /* rdoc:
47
- # Iterates with the multi-dimensional indeces for the given
48
- # dimension numbers.
49
- #
50
- # CArray.each_index(3,2){|i,j| print "(#{i} #{j}) " }
51
- #
52
- # produces:
53
- #
54
- # (0 0) (0 1) (1 0) (1 1) (2 0) (2 1) (3 0) (3 1)
55
- #
56
- def CArray.each_index(*argv) # :yields: i0, i1, ...
57
- end
44
+ /* @overload each_index (*shape)
45
+
46
+ (Iterator) Iterates with the multi-dimensional indeces for the given
47
+ dimension numbers.
48
+
49
+ CArray.each_index(3,2){|i,j| print "(#{i} #{j}) " }
50
+ produces:
51
+ (0 0) (0 1) (1 0) (1 1) (2 0) (2 1) (3 0) (3 1)
58
52
  */
59
53
 
60
54
  static VALUE
@@ -69,12 +63,10 @@ rb_ca_s_each_index (int ndim, VALUE *dim, VALUE self)
69
63
 
70
64
  /* ------------------------------------------------------------------- */
71
65
 
72
- /* rdoc:
73
- class CArray
74
- #
75
- def each # :yields: v
76
- end
77
- end
66
+ /* @overload each () {|elem| ... }
67
+
68
+ (Iterator) Iterates all the elements of the object.
69
+
78
70
  */
79
71
 
80
72
  static VALUE
@@ -92,12 +84,10 @@ rb_ca_each (VALUE self)
92
84
  return ret;
93
85
  }
94
86
 
95
- /* rdoc:
96
- class CArray
97
- #
98
- def each_with_addr # :yields: v, addr
99
- end
100
- end
87
+ /* @overload each_with_addr () {|elem, addr| ... }
88
+
89
+ (Iterator) Iterates all the elements of the object.
90
+
101
91
  */
102
92
 
103
93
  static VALUE
@@ -115,12 +105,9 @@ rb_ca_each_with_addr (VALUE self)
115
105
  return ret;
116
106
  }
117
107
 
118
- /* rdoc:
119
- class CArray
120
- #
121
- def each_addr() # :yields: addr
122
- end
123
- end
108
+ /* @overload each_addr () {|addr| ... }
109
+
110
+ (Iterator) Iterates all address of the object.
124
111
  */
125
112
 
126
113
  static VALUE
@@ -160,19 +147,16 @@ rb_ca_each_index_internal (VALUE self, int8_t level, VALUE ridx)
160
147
  return ret;
161
148
  }
162
149
 
163
- /* rdoc:
164
- class CArray
165
- # Iterates with the multi-dimensional indeces for the dimension of <i>ca</i>.
166
- #
167
- # CArray.int(3,2).each_index(){|i,j| print "(#{i} #{j}) " }
168
- #
169
- # <em>produces:</em>
170
- #
171
- # (0 0) (0 1) (1 0) (1 1) (2 0) (2 1) (3 0) (3 1)
172
- #
173
- def each_index # :yields: i0, i1, ...
174
- end
175
- end
150
+ /* @overload each_index () {|idx| ... }
151
+
152
+ (Iterator) Iterates all index of the object.
153
+
154
+ CArray.int(3,2).each_index(){|i,j| print "(#{i} #{j}) " }
155
+
156
+ <em>produces:</em>
157
+
158
+ (0 0) (0 1) (1 0) (1 1) (2 0) (2 1) (3 0) (3 1)
159
+
176
160
  */
177
161
 
178
162
  static VALUE
@@ -187,12 +171,9 @@ rb_ca_each_index (VALUE self)
187
171
  return rb_ca_each_index_internal(self, 0, ridx);
188
172
  }
189
173
 
190
- /* rdoc:
191
- class CArray
192
- #
193
- def map! # :yields: v
194
- end
195
- end
174
+ /* @overload map! () {|elem| ... }
175
+
176
+ (Iterator, Destructive) Iterates all elements of the object and stores the return from the block to the element.
196
177
  */
197
178
 
198
179
  static VALUE
@@ -243,12 +224,10 @@ rb_ca_each_with_index_internal (VALUE self,
243
224
  return ret;
244
225
  }
245
226
 
246
- /* rdoc:
247
- class CArray
248
- #
249
- def each_with_index # :yields: v, idx
250
- end
251
- end
227
+ /* @overload each_with_index () {|elem, idx| ... }
228
+
229
+ [TBD]
230
+
252
231
  */
253
232
 
254
233
  static VALUE
@@ -293,12 +272,10 @@ rb_ca_map_with_index_bang_internal (VALUE self,
293
272
  }
294
273
  }
295
274
 
296
- /* rdoc:
297
- class CArray
298
- #
299
- def map_with_index! # :yields: v, idx
300
- end
301
- end
275
+ /* @overload map_with_index () {|elem, idx| ... }
276
+
277
+ [TBD]
278
+
302
279
  */
303
280
 
304
281
  static VALUE
@@ -347,12 +324,10 @@ rb_ca_map_index_bang_internal (VALUE self,
347
324
  }
348
325
  }
349
326
 
350
- /* rdoc:
351
- class CArray
352
- #
353
- def map_index! # :yields: i0, i1, ...
354
- end
355
- end
327
+ /* @overload map_index! () {|idx| ... }
328
+
329
+ [TBD]
330
+
356
331
  */
357
332
 
358
333
  static VALUE
@@ -375,12 +350,10 @@ rb_ca_map_index_bang (VALUE self)
375
350
  return self;
376
351
  }
377
352
 
378
- /* rdoc:
379
- class CArray
380
- #
381
- def map_with_addr! # :yields: v, addr
382
- end
383
- end
353
+ /* @overload map_with_addr! () {|elem, addr| ... }
354
+
355
+ [TBD]
356
+
384
357
  */
385
358
 
386
359
  static VALUE
@@ -406,12 +379,10 @@ rb_ca_map_with_addr_bang (VALUE self)
406
379
  }
407
380
 
408
381
 
409
- /* rdoc:
410
- class CArray
411
- #
412
- def map_addr! # :yields: addr
413
- end
414
- end
382
+ /* @overload map_addr! () {|addr| ... }
383
+
384
+ [TBD]
385
+
415
386
  */
416
387
 
417
388
  static VALUE