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
@@ -161,8 +161,7 @@ puts %{
161
161
  the Ruby\'s licence.
162
162
 
163
163
  This file is automatically generated from carray_math.rb.
164
-
165
- Copyright (C) 2005 Hiroki Motoyoshi
164
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
166
165
 
167
166
  ---------------------------------------------------------------------------- */
168
167
 
@@ -3,22 +3,19 @@
3
3
  carray_class.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
 
13
11
  #include "carray.h"
14
12
 
15
- /* rdoc:
16
- # returns the machine endianness.
17
- # CArray.endian #=> 0 (CA_LITTLE_ENDIAN)
18
- # CArray.endian #=> 1 (CA_BIG_ENDIAN)
13
+ /* @overload endian
19
14
 
20
- def CArray.endian
21
- end
15
+ (Inquiry)
16
+ Returns the machine endianness.
17
+ 0 (CA_LITTLE_ENDIAN)
18
+ 1 (CA_BIG_ENDIAN)
22
19
  */
23
20
 
24
21
  static VALUE
@@ -27,12 +24,10 @@ rb_ca_s_endian (VALUE klass)
27
24
  return INT2NUM(ca_endian);
28
25
  }
29
26
 
30
- /* rdoc:
31
- # returns true if the byte order of the architecture is
32
- # big endian.
33
-
34
- def CArray.big_endian?
35
- end
27
+ /* @overload big_endian?
28
+
29
+ (Inquiry)
30
+ Returns true if the byte order of the architecture is big endian.
36
31
  */
37
32
 
38
33
  static VALUE
@@ -41,12 +36,11 @@ rb_ca_s_big_endian_p (VALUE klass)
41
36
  return ( ca_endian == CA_BIG_ENDIAN ) ? Qtrue : Qfalse;
42
37
  }
43
38
 
44
- /* rdoc:
45
- # returns true if the byte order of the architecture is
46
- # little endian.
39
+ /* @overload little_endian?
47
40
 
48
- def CArray.little_endian?
49
- end
41
+ (Inquiry)
42
+ Returns true if the byte order of the architecture is
43
+ little endian.
50
44
  */
51
45
 
52
46
  static VALUE
@@ -55,15 +49,15 @@ rb_ca_s_little_endian_p (VALUE klass)
55
49
  return ( ca_endian == CA_LITTLE_ENDIAN ) ? Qtrue : Qfalse;
56
50
  }
57
51
 
58
- /* rdoc:
59
- # Returns the byte length of an element of the given data type.
60
- # Retruns <code>0</code> if data_type is equal to CA_FIXLEN.
61
- # CArray.sizeof(CA_INT32) #=> 4
62
- # CArray.sizeof(CA_DOUBLE) #=> 8
63
- # CArray.sizeof(CA_FIXLEN) #=> 0
52
+ /* @overload sizeof (data_type)
53
+
54
+ (Inquiry)
55
+ Returns the byte length of an element of the given data type.
56
+ Retruns <code>0</code> if data_type is equal to CA_FIXLEN.
57
+ CArray.sizeof(CA_INT32) #=> 4
58
+ CArray.sizeof(CA_DOUBLE) #=> 8
59
+ CArray.sizeof(CA_FIXLEN) #=> 0
64
60
 
65
- def CArray.sizeof (data_type)
66
- end
67
61
  */
68
62
 
69
63
  static VALUE
@@ -76,11 +70,10 @@ rb_ca_s_sizeof (VALUE klass, VALUE rtype)
76
70
  }
77
71
 
78
72
 
79
- /* rdoc:
80
- # Returns true if the given data_type indicate the valid data_type.
73
+ /* @overload data_type?(data_type)
81
74
 
82
- def CArray.data_type?(data_type)
83
- end
75
+ (Inquiry)
76
+ Returns true if the given data_type indicate the valid data_type.
84
77
  */
85
78
 
86
79
  static VALUE
@@ -94,11 +87,10 @@ rb_ca_s_data_type (VALUE klass, VALUE rtype)
94
87
  return ca_valid[data_type] == 1 ? Qtrue : Qfalse;
95
88
  }
96
89
 
97
- /* rdoc:
98
- # Returns string representaion of the data_type specifier.
90
+ /* @overload data_type_name(data_type)
99
91
 
100
- def CArray.data_type_name(data_type)
101
- end
92
+ (Inquiry)
93
+ Returns string representaion of the data_type specifier.
102
94
  */
103
95
 
104
96
 
@@ -3,10 +3,8 @@
3
3
  carray_conversion.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,13 +41,12 @@ rb_ca_to_a_loop (VALUE self, int32_t level, ca_size_t *idx, VALUE ary)
43
41
  }
44
42
  }
45
43
 
46
- /* rdoc:
47
- class CArray
48
- # Converts the array to Ruby's array. For higher dimension,
49
- # the array is nested ndim-1 times.
50
- def to_a
51
- end
52
- end
44
+ /*
45
+ @overload to_a
46
+
47
+ (Conversion)
48
+ Converts the array to Ruby's array. For higher dimension,
49
+ the array is nested ndim-1 times.
53
50
  */
54
51
 
55
52
  VALUE
@@ -66,13 +63,12 @@ rb_ca_to_a (VALUE self)
66
63
  return ary;
67
64
  }
68
65
 
69
- /* rdoc:
70
- class CArray
71
- # Convert the
72
- def convert (data_type=nil, dim=nil)
73
- yield
74
- end
75
- end
66
+ /* @overload convert (data_type=nil, dim=nil) { |elem| ... }
67
+
68
+ (Conversion)
69
+ Returns new array which elements are caluculated
70
+ in the iteration block. The output array is internally created
71
+ using `CArray#template` to which the arguments is passed.
76
72
  */
77
73
 
78
74
  static VALUE
@@ -106,12 +102,10 @@ rb_ca_convert (int argc, VALUE *argv, VALUE self)
106
102
  return obj;
107
103
  }
108
104
 
109
- /* rdoc:
110
- class CArray
111
- # dumps the value array to the given IO stream
112
- def dump_binary(io)
113
- end
114
- end
105
+ /* @overload dump_binary
106
+
107
+ (IO)
108
+ Dumps the value array to the given IO stream
115
109
  */
116
110
 
117
111
  static VALUE
@@ -187,19 +181,10 @@ rb_ca_dump_binary (int argc, VALUE *argv, VALUE self)
187
181
  return io;
188
182
  }
189
183
 
190
- static VALUE
191
- rb_ca_dump (int argc, VALUE *argv, VALUE self)
192
- {
193
- rb_warn("CArray#dump will be obsolete, use CArray#dump_binary");
194
- return rb_ca_dump_binary(argc, argv, self);
195
- }
184
+ /* @overload to_s
196
185
 
197
- /* rdoc:
198
- class CArray
199
- # dumps the value array to a string.
200
- def to_s
201
- end
202
- end
186
+ (Conversion)
187
+ Dumps the value array to a string.
203
188
  */
204
189
 
205
190
  static VALUE
@@ -208,12 +193,10 @@ rb_ca_to_s (VALUE self)
208
193
  return rb_ca_dump_binary(0, NULL, self);
209
194
  }
210
195
 
211
- /* rdoc:
212
- class CArray
213
- # loads the value array from the given IO stream
214
- def load_binary (io)
215
- end
216
- end
196
+ /* @overload load_binary (io)
197
+
198
+ (IO)
199
+ Loads the value array from the given IO stream
217
200
  */
218
201
 
219
202
  static VALUE
@@ -256,13 +239,6 @@ rb_ca_load_binary (VALUE self, VALUE io)
256
239
  return self;
257
240
  }
258
241
 
259
- static VALUE
260
- rb_ca_load (VALUE self, VALUE io)
261
- {
262
- rb_warn("CArray#load will be obsolete, use CArray#load_binary");
263
- return rb_ca_load_binary(self, io);
264
- }
265
-
266
242
  void *
267
243
  ca_to_cptr (void *ap)
268
244
  {
@@ -314,13 +290,11 @@ ca_to_cptr (void *ap)
314
290
  }
315
291
 
316
292
 
317
- /* rdoc:
318
- class CArray
319
- # Convert the
320
- def convert (data_type=nil, dim=nil)
321
- yield
322
- end
323
- end
293
+ /* @overload str_format (*fmts)
294
+
295
+ (Conversion)
296
+ Creates object type array consist of string using the "::format" method.
297
+ The Multiple format strings are given, they are applied cyclic in turn.
324
298
  */
325
299
 
326
300
 
@@ -366,9 +340,15 @@ rb_ca_format (int argc, VALUE *argv, VALUE self)
366
340
  }
367
341
 
368
342
 
369
-
370
343
  #include <time.h>
371
344
 
345
+ /* @overload str_strptime (fmt)
346
+
347
+ (Conversion)
348
+ Creates object type array consist of Time objects
349
+ which are created by 'Time.strptime' applied to the elements of the object.
350
+ This method assumes all the elements of the objetct to be String.
351
+ */
372
352
 
373
353
  static VALUE
374
354
  rb_ca_strptime (VALUE self, VALUE rfmt)
@@ -385,6 +365,7 @@ rb_ca_strptime (VALUE self, VALUE rfmt)
385
365
  rb_raise(rb_eRuntimeError, "strptime can be applied only to object type.");
386
366
  }
387
367
 
368
+ Check_Type(rfmt, T_STRING);
388
369
  fmt = (char *) StringValuePtr(rfmt);
389
370
 
390
371
  obj = rb_ca_template(self);
@@ -423,6 +404,13 @@ rb_ca_strptime (VALUE self, VALUE rfmt)
423
404
  return obj;
424
405
  }
425
406
 
407
+ /* @overload time_strptime (fmt)
408
+
409
+ (Conversion)
410
+ Creates object type array consist of strings
411
+ which are created by 'Time#strftime' applied to the elements of the object.
412
+ This method assumes all the elements of the objetct to be Time or DateTime.
413
+ */
426
414
 
427
415
  static VALUE
428
416
  rb_ca_strftime (VALUE self, VALUE rfmt)
@@ -463,6 +451,10 @@ rb_ca_strftime (VALUE self, VALUE rfmt)
463
451
  return obj;
464
452
  }
465
453
 
454
+ /* @private
455
+
456
+ */
457
+
466
458
  static VALUE
467
459
  rb_test_ca_to_cptr (VALUE self)
468
460
  {
@@ -497,10 +489,8 @@ Init_carray_conversion ()
497
489
  rb_define_method(rb_cCArray, "to_a", rb_ca_to_a, 0);
498
490
  rb_define_method(rb_cCArray, "convert", rb_ca_convert, -1);
499
491
 
500
- rb_define_method(rb_cCArray, "dump", rb_ca_dump, -1);
501
492
  rb_define_method(rb_cCArray, "dump_binary", rb_ca_dump_binary, -1);
502
493
  rb_define_method(rb_cCArray, "to_s", rb_ca_to_s, 0);
503
- rb_define_method(rb_cCArray, "load", rb_ca_load, 1);
504
494
  rb_define_method(rb_cCArray, "load_binary", rb_ca_load_binary, 1);
505
495
 
506
496
  /* DO NOT define CArray#to_ary, it makes trouble with various situations */
@@ -509,7 +499,7 @@ Init_carray_conversion ()
509
499
  rb_define_method(rb_cCArray, "str_format", rb_ca_format, -1);
510
500
 
511
501
  rb_define_method(rb_cCArray, "str_strptime", rb_ca_strptime, 1);
512
- rb_define_method(rb_cCArray, "str_strftime", rb_ca_strftime, 1);
502
+ rb_define_method(rb_cCArray, "time_strftime", rb_ca_strftime, 1);
513
503
 
514
504
  rb_define_method(rb_cCArray, "test_ca_to_cptr", rb_test_ca_to_cptr, 0);
515
505
 
@@ -3,10 +3,8 @@
3
3
  carray_copy.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,12 +41,9 @@ ca_copy (void *ap)
43
41
  return co;
44
42
  }
45
43
 
46
- /* rdoc:
47
- class CArray
48
- # create CArray object from `self` with same contents includes mask state.
49
- def to_ca
50
- end
51
- end
44
+ /* @overload to_ca
45
+
46
+ (Copy) Creates CArray object from `self` with same contents includes mask state.
52
47
  */
53
48
 
54
49
  VALUE
@@ -101,15 +96,12 @@ ca_template_safe2 (void *ap, int8_t data_type, ca_size_t bytes)
101
96
  }
102
97
  }
103
98
 
104
- /* rdoc:
105
- class CArray
106
- # returns CArray object with same dimension with `self`
107
- # The data type of the new carray object can be specified by `data_type`.
108
- # For fixlen data type, the option `:bytes` is used to specified the
109
- # data length.
110
- def template(data_type=self.data_type, options={:bytes=>0})
111
- end
112
- end
99
+ /* @overload template(data_type=self.data_type, bytes: 0)
100
+
101
+ (Copy) Returns CArray object with same dimension with `self`
102
+ The data type of the new carray object can be specified by `data_type`.
103
+ For fixlen data type, the option `:bytes` is used to specified the
104
+ data length.
113
105
  */
114
106
 
115
107
  static VALUE
@@ -284,14 +276,10 @@ ca_paste (void *ap, ca_size_t *offset, void *sp)
284
276
  ca_detach_n(2, ca, cs);
285
277
  }
286
278
 
287
- /* rdoc:
288
- class CArray
289
- # pastes `ary` to `self` at the index `idx`.
290
- # `idx` should be Array object with the length same as `self.ndim`.
291
- # `ary` should have same shape with `self`.
292
- def paste (idx, ary)
293
- end
294
- end
279
+ /* @overload paste (idx, ary)
280
+ (Copy) Pastes `ary` to `self` at the index `idx`.
281
+ `idx` should be Array object with the length same as `self.ndim`.
282
+ `ary` should have same shape with `self`.
295
283
  */
296
284
 
297
285
  static VALUE
@@ -402,12 +390,8 @@ ca_clip (void *ap, ca_size_t *offset, void *sp)
402
390
  ca_detach_n(2, ca, cs);
403
391
  }
404
392
 
405
- /* rdoc:
406
- class CArray
407
- # clips the data at `idx` from `self` to `ary`.
408
- def clip (idx, ary)
409
- end
410
- end
393
+ /* @overload clip (idx, ary)
394
+ (copy) Clips the data at `idx` from `self` to `ary`.
411
395
  */
412
396
 
413
397
  static VALUE
@@ -3,10 +3,8 @@
3
3
  carray_core.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
 
@@ -998,10 +996,13 @@ rb_ca_s_ensure_detach (VALUE list)
998
996
  return Qnil;
999
997
  }
1000
998
 
1001
- /* rdoc:
1002
- def CArray.attach(*argv) # :nodoc:
1003
- yield
1004
- end
999
+ /* @overload attach (*arrays)
1000
+
1001
+ (Internal) Guarantees that the reference memory block is attached.
1002
+ The memory block is detached at the end of the block evaluation.
1003
+ It is not ensured the syncing the memory block at the end of the block evaluation.
1004
+
1005
+ @yield
1005
1006
  */
1006
1007
 
1007
1008
  static VALUE
@@ -1035,10 +1036,13 @@ rb_ca_s_ensure_sync_detach (VALUE list)
1035
1036
  return Qnil;
1036
1037
  }
1037
1038
 
1038
- /* rdoc:
1039
- def CArray.attach!(*argv) # :nodoc:
1040
- yield
1041
- end
1039
+ /* @overload attach! (*arrays)
1040
+
1041
+ (Internal) Guarantees that the reference memory block is attached.
1042
+ The memory block is detached at the end of the block evaluation.
1043
+ It is ensured the syncing the memory block at the end of the block evaluation.
1044
+
1045
+ @yield
1042
1046
  */
1043
1047
 
1044
1048
  static VALUE
@@ -1065,12 +1069,13 @@ rb_ca_ensure_detach (VALUE self)
1065
1069
  return Qnil;
1066
1070
  }
1067
1071
 
1068
- /* rdoc:
1069
- class CArray
1070
- def attach () # :nodoc:
1071
- yield
1072
- end
1073
- end
1072
+ /* @overload attach
1073
+
1074
+ (Internal) Guarantees that the reference memory block is attached.
1075
+ The memory block is detached at the end of the block evaluation.
1076
+ It is ensured the syncing the memory block at the end of the block evaluation.
1077
+
1078
+ @yield
1074
1079
  */
1075
1080
 
1076
1081
  static VALUE
@@ -1088,12 +1093,13 @@ rb_ca_ensure_sync_detach (VALUE self)
1088
1093
  return Qnil;
1089
1094
  }
1090
1095
 
1091
- /* rdoc:
1092
- class CArray
1093
- def attach! () # :nodoc:
1094
- yield
1095
- end
1096
- end
1096
+ /* @overload attach!
1097
+
1098
+ (Internal) Guarantees that the reference memory block is attached.
1099
+ The memory block is detached at the end of the block evaluation.
1100
+ It is ensured the syncing the memory block at the end of the block evaluation.
1101
+
1102
+ @yield
1097
1103
  */
1098
1104
 
1099
1105
  static VALUE
@@ -1104,7 +1110,11 @@ rb_ca_attach_bang (VALUE self)
1104
1110
  return rb_ensure(rb_yield, self, rb_ca_ensure_sync_detach, self);
1105
1111
  }
1106
1112
 
1107
- /* CArray#__attach__ */
1113
+ /* @overload __attach__
1114
+
1115
+ (Internal, DevelopperOnly) Attaches the reference memory block.
1116
+ User must call "CArray#__detach__" appropreate timing.
1117
+ */
1108
1118
 
1109
1119
  static VALUE
1110
1120
  rb_ca__attach__ (VALUE self)
@@ -1113,7 +1123,10 @@ rb_ca__attach__ (VALUE self)
1113
1123
  return self;
1114
1124
  }
1115
1125
 
1116
- /* CArray#__sync__ */
1126
+ /* @overload __detach__
1127
+
1128
+ (Internal, DevelopperOnly) Syncs the reference memory block to the parent array.
1129
+ */
1117
1130
 
1118
1131
  static VALUE
1119
1132
  rb_ca__sync__ (VALUE self)
@@ -1123,7 +1136,10 @@ rb_ca__sync__ (VALUE self)
1123
1136
  return self;
1124
1137
  }
1125
1138
 
1126
- /* CArray#__detach__ */
1139
+ /* @overload __detach__
1140
+
1141
+ (Internal, DevelopperOnly) Detaches the reference memory block.
1142
+ */
1127
1143
 
1128
1144
  static VALUE
1129
1145
  rb_ca__detach__ (VALUE self)
@@ -1162,12 +1178,9 @@ rb_ca_data_class_encode (VALUE self, VALUE obj)
1162
1178
 
1163
1179
  /* ------------------------------------------------------------------- */
1164
1180
 
1165
- /* rdoc:
1166
- class CArray
1167
- # Returns data class member names
1168
- def members
1169
- end
1170
- end
1181
+ /* @overload members
1182
+
1183
+ (Inquiry) Returns data class member names
1171
1184
  */
1172
1185
 
1173
1186
  VALUE
@@ -1228,12 +1241,9 @@ rb_ca_field_as_member (VALUE self, VALUE sym)
1228
1241
  }
1229
1242
  }
1230
1243
 
1231
- /* rdoc:
1232
- class CArray
1233
- # Returns an array of data class members (fields)
1234
- def fields
1235
- end
1236
- end
1244
+ /* @overload fields
1245
+
1246
+ (Reference) Returns an array of data class members (fields)
1237
1247
  */
1238
1248
 
1239
1249
  VALUE
@@ -1254,12 +1264,9 @@ rb_ca_fields (VALUE self)
1254
1264
  return list;
1255
1265
  }
1256
1266
 
1257
- /* rdoc:
1258
- class CArray
1259
- # Returns an array of data class members (fields) with names specified
1260
- def fields_at (*names)
1261
- end
1262
- end
1267
+ /* @overload fields_at (*names)
1268
+
1269
+ Returns an array of data class members (fields) with names specified
1263
1270
  */
1264
1271
 
1265
1272
  VALUE