carray 1.5.1 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +32 -0
  3. data/{LICENSES → LICENSE} +0 -0
  4. data/NEWS.md +83 -0
  5. data/README.md +34 -18
  6. data/Rakefile +1 -1
  7. data/TODO.md +17 -0
  8. data/carray.gemspec +10 -7
  9. data/ext/ca_iter_block.c +3 -5
  10. data/ext/ca_iter_dimension.c +4 -5
  11. data/ext/ca_iter_window.c +2 -4
  12. data/ext/ca_obj_array.c +394 -124
  13. data/ext/ca_obj_bitarray.c +6 -11
  14. data/ext/ca_obj_bitfield.c +5 -9
  15. data/ext/ca_obj_block.c +5 -12
  16. data/ext/ca_obj_fake.c +3 -5
  17. data/ext/ca_obj_farray.c +3 -5
  18. data/ext/ca_obj_field.c +15 -17
  19. data/ext/ca_obj_grid.c +5 -6
  20. data/ext/ca_obj_mapping.c +2 -4
  21. data/ext/ca_obj_object.c +3 -5
  22. data/ext/ca_obj_reduce.c +2 -4
  23. data/ext/ca_obj_refer.c +11 -15
  24. data/ext/ca_obj_repeat.c +2 -4
  25. data/ext/ca_obj_select.c +2 -4
  26. data/ext/ca_obj_shift.c +3 -5
  27. data/ext/ca_obj_transpose.c +3 -5
  28. data/ext/ca_obj_unbound_repeat.c +68 -122
  29. data/ext/ca_obj_window.c +7 -9
  30. data/ext/carray.h +17 -8
  31. data/ext/carray_access.c +183 -58
  32. data/ext/carray_attribute.c +151 -197
  33. data/ext/carray_call_cfunc.c +1 -3
  34. data/ext/carray_cast.c +345 -144
  35. data/ext/carray_cast_func.rb +1 -2
  36. data/ext/carray_class.c +28 -36
  37. data/ext/carray_conversion.c +56 -59
  38. data/ext/carray_copy.c +16 -32
  39. data/ext/carray_core.c +73 -60
  40. data/ext/carray_element.c +25 -44
  41. data/ext/carray_generate.c +74 -53
  42. data/ext/carray_iterator.c +13 -15
  43. data/ext/carray_loop.c +53 -82
  44. data/ext/carray_mask.c +99 -119
  45. data/ext/carray_math.rb +28 -12
  46. data/ext/carray_mathfunc.c +1 -3
  47. data/ext/carray_numeric.c +42 -45
  48. data/ext/carray_operator.c +45 -32
  49. data/ext/carray_order.c +231 -65
  50. data/ext/carray_sort_addr.c +14 -21
  51. data/ext/carray_stat.c +1 -3
  52. data/ext/carray_stat_proc.rb +2 -4
  53. data/ext/carray_test.c +41 -30
  54. data/ext/carray_undef.c +1 -11
  55. data/ext/carray_utils.c +138 -51
  56. data/ext/extconf.rb +14 -2
  57. data/ext/mkmath.rb +2 -2
  58. data/ext/ruby_carray.c +15 -7
  59. data/ext/ruby_ccomplex.c +2 -4
  60. data/ext/ruby_float_func.c +1 -3
  61. data/ext/version.h +5 -7
  62. data/lib/carray.rb +9 -9
  63. data/lib/carray/autoload.rb +0 -2
  64. data/lib/carray/autoload/autoload_gem_numo_narray.rb +6 -6
  65. data/lib/carray/basic.rb +1 -3
  66. data/lib/carray/broadcast.rb +101 -0
  67. data/lib/carray/compose.rb +34 -10
  68. data/lib/carray/construct.rb +57 -18
  69. data/lib/carray/info.rb +1 -3
  70. data/lib/carray/inspect.rb +3 -5
  71. data/lib/carray/io/imagemagick.rb +1 -3
  72. data/lib/carray/iterator.rb +3 -3
  73. data/lib/carray/mask.rb +18 -7
  74. data/lib/carray/math.rb +4 -6
  75. data/lib/carray/math/histogram.rb +1 -3
  76. data/lib/carray/math/recurrence.rb +1 -3
  77. data/lib/carray/mkmf.rb +1 -3
  78. data/lib/carray/object/ca_obj_iterator.rb +1 -3
  79. data/lib/carray/object/ca_obj_link.rb +1 -3
  80. data/lib/carray/object/ca_obj_pack.rb +1 -3
  81. data/lib/carray/obsolete.rb +1 -17
  82. data/lib/carray/ordering.rb +29 -5
  83. data/lib/carray/serialize.rb +34 -25
  84. data/lib/carray/string.rb +1 -3
  85. data/lib/carray/struct.rb +3 -5
  86. data/lib/carray/testing.rb +5 -10
  87. data/lib/carray/time.rb +1 -3
  88. data/lib/carray/transform.rb +12 -3
  89. data/misc/NOTE +16 -38
  90. data/spec/Classes/CABitfield_spec.rb +58 -0
  91. data/spec/Classes/CABlockIterator_spec.rb +114 -0
  92. data/spec/Classes/CABlock_spec.rb +205 -0
  93. data/spec/Classes/CAField_spec.rb +39 -0
  94. data/spec/Classes/CAGrid_spec.rb +75 -0
  95. data/spec/Classes/CAMap_spec.rb +0 -0
  96. data/{test/test_CAMapping.rb → spec/Classes/CAMapping_spec.rb} +35 -36
  97. data/spec/Classes/CAObject_attribute_spec.rb +33 -0
  98. data/spec/Classes/CAObject_spec.rb +33 -0
  99. data/spec/Classes/CARefer_spec.rb +93 -0
  100. data/spec/Classes/CARepeat_spec.rb +65 -0
  101. data/spec/Classes/CASelect_spec.rb +22 -0
  102. data/spec/Classes/CAShift_spec.rb +16 -0
  103. data/spec/Classes/CAStruct_spec.rb +71 -0
  104. data/{test/test_CATranspose.rb → spec/Classes/CATranspose_spec.rb} +20 -21
  105. data/spec/Classes/CAUnboudRepeat_spec.rb +102 -0
  106. data/spec/Classes/CAWindow_spec.rb +54 -0
  107. data/spec/Classes/CAWrap_spec.rb +8 -0
  108. data/{test/test_CArray.rb → spec/Classes/CArray_spec.rb} +48 -92
  109. data/spec/Classes/CScalar_spec.rb +55 -0
  110. data/spec/Features/feature_130_spec.rb +19 -0
  111. data/spec/Features/feature_attributes_spec.rb +280 -0
  112. data/spec/Features/feature_boolean_spec.rb +98 -0
  113. data/spec/Features/feature_broadcast.rb +116 -0
  114. data/spec/Features/feature_cast_function.rb +19 -0
  115. data/spec/Features/feature_cast_spec.rb +33 -0
  116. data/spec/Features/feature_class_spec.rb +84 -0
  117. data/spec/Features/feature_complex_spec.rb +42 -0
  118. data/{test/test_composite.rb → spec/Features/feature_composite_spec.rb} +17 -18
  119. data/spec/Features/feature_convert_spec.rb +46 -0
  120. data/spec/Features/feature_copy_spec.rb +123 -0
  121. data/spec/Features/feature_creation_spec.rb +84 -0
  122. data/spec/Features/feature_element_spec.rb +144 -0
  123. data/spec/Features/feature_extream_spec.rb +54 -0
  124. data/spec/Features/feature_generate_spec.rb +74 -0
  125. data/spec/Features/feature_index_spec.rb +69 -0
  126. data/spec/Features/feature_mask_spec.rb +580 -0
  127. data/spec/Features/feature_math_spec.rb +97 -0
  128. data/spec/Features/feature_order_spec.rb +146 -0
  129. data/spec/Features/feature_ref_store_spec.rb +209 -0
  130. data/spec/Features/feature_serialization_spec.rb +125 -0
  131. data/spec/Features/feature_stat_spec.rb +397 -0
  132. data/spec/Features/feature_virtual_spec.rb +48 -0
  133. data/spec/Features/method_eq_spec.rb +81 -0
  134. data/spec/Features/method_is_nan_spec.rb +12 -0
  135. data/spec/Features/method_map_spec.rb +54 -0
  136. data/spec/Features/method_max_with.rb +20 -0
  137. data/spec/Features/method_min_with.rb +19 -0
  138. data/spec/Features/method_ne_spec.rb +18 -0
  139. data/spec/Features/method_project_spec.rb +188 -0
  140. data/spec/Features/method_ref_spec.rb +27 -0
  141. data/spec/Features/method_round_spec.rb +11 -0
  142. data/spec/Features/method_s_linspace_spec.rb +48 -0
  143. data/spec/Features/method_s_span_spec.rb +14 -0
  144. data/spec/Features/method_seq_spec.rb +47 -0
  145. data/spec/Features/method_sort_with.rb +43 -0
  146. data/spec/Features/method_sorted_with.rb +29 -0
  147. data/spec/Features/method_span_spec.rb +42 -0
  148. data/spec/Features/method_wrap_readonly_spec.rb +43 -0
  149. data/{test → spec/UnitTest}/test_CAVirtual.rb +0 -0
  150. data/spec/spec_all.rb +0 -1
  151. data/utils/convert_test.rb +73 -0
  152. data/utils/{extract_rdoc.rb → extract_yard.rb} +7 -12
  153. metadata +74 -58
  154. data/spec/CABlockIterator/CABlockIterator_spec.rb +0 -113
  155. data/spec/CArray/bug/store_spec.rb +0 -27
  156. data/spec/CArray/index/repeat_spec.rb +0 -10
  157. data/spec/CArray/method/eq_spec.rb +0 -80
  158. data/spec/CArray/method/is_nan_spec.rb +0 -12
  159. data/spec/CArray/method/ne_spec.rb +0 -18
  160. data/spec/CArray/method/round_spec.rb +0 -11
  161. data/spec/CArray/object/_attribute_spec.rb +0 -32
  162. data/spec/CArray/object/s_new_spec.rb +0 -31
  163. data/spec/CArray/serialize/Serialization_spec.rb +0 -89
  164. data/test/test_130.rb +0 -23
  165. data/test/test_ALL.rb +0 -49
  166. data/test/test_CABitfield.rb +0 -59
  167. data/test/test_CABlock.rb +0 -208
  168. data/test/test_CAField.rb +0 -40
  169. data/test/test_CAGrid.rb +0 -76
  170. data/test/test_CAMmap.rb +0 -11
  171. data/test/test_CARefer.rb +0 -94
  172. data/test/test_CARepeat.rb +0 -66
  173. data/test/test_CASelect.rb +0 -23
  174. data/test/test_CAShift.rb +0 -17
  175. data/test/test_CAWindow.rb +0 -55
  176. data/test/test_CAWrap.rb +0 -9
  177. data/test/test_CComplex.rb +0 -83
  178. data/test/test_CScalar.rb +0 -91
  179. data/test/test_attribute.rb +0 -281
  180. data/test/test_block_iterator.rb +0 -17
  181. data/test/test_boolean.rb +0 -99
  182. data/test/test_cast.rb +0 -33
  183. data/test/test_class.rb +0 -85
  184. data/test/test_complex.rb +0 -43
  185. data/test/test_convert.rb +0 -79
  186. data/test/test_copy.rb +0 -141
  187. data/test/test_creation.rb +0 -85
  188. data/test/test_element.rb +0 -146
  189. data/test/test_extream.rb +0 -55
  190. data/test/test_generate.rb +0 -75
  191. data/test/test_index.rb +0 -71
  192. data/test/test_mask.rb +0 -578
  193. data/test/test_math.rb +0 -98
  194. data/test/test_order.rb +0 -147
  195. data/test/test_ref_store.rb +0 -211
  196. data/test/test_stat.rb +0 -406
  197. data/test/test_struct.rb +0 -72
  198. data/test/test_virtual.rb +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9609f31c4eacaf87ca9881eff5e29e30cfde413086a30b0ee99e02d9142b105f
4
- data.tar.gz: 68c4a6919c28b78ee9c9fd7a469b65ef8069a6ceba880f37a1a32f37f3de24d2
3
+ metadata.gz: baf289b957e96d1df3156ea74f06a7bb44cbd856005f42a9f7531367413c9cff
4
+ data.tar.gz: 06feaeef398f1e130e658df742d370d54b003cd6af67bac47a2ae40b58e40007
5
5
  SHA512:
6
- metadata.gz: 910d317c356accdc8852490a209991443f964e2e9e3896b41b62456104699049fa99d59341a176eba752d83b49765044c1282b9b1a439f8ba949c661b2950689
7
- data.tar.gz: 7036c72836edf32445979d8d72312da7b2c8a68e9a15101f75caa4a6ea804d97254ba9cc76c99b8bde691d0049ca8474ab88924c0acfdc6e73b84d9098077d37
6
+ metadata.gz: 0f62fb53d5344bdc400c211d6938460f136215e0a629c60d047bef313e053d3500c2b0c02e30a77810fa4b6ed7e67ab52edbc93f7ebc264d3441a20bc01b4207
7
+ data.tar.gz: acb0098036a13fff4a483aa6fb5fe5fc0dc65bd0e8d356b6037a44b4aa285f231e98d39687090de73b225a540c3b946c3be5a75746e68194ca9b0d7bfdd823e4
data/.yardopts ADDED
@@ -0,0 +1,32 @@
1
+ --markup markdown
2
+ --markup-provider redcarpet
3
+ --no-private
4
+ --exclude lib/carray/obsolete.rb
5
+ --exclude lib/carray/autoload.rb
6
+ --exclude 'lib/carray/autoload/'
7
+ --readme README.md
8
+ --files NEWS.md,TODO.md
9
+ lib/carray.rb
10
+ ext/ruby_carray.c
11
+ ext/ca_obj_array.c
12
+ ext/ca_obj_bitarray.c
13
+ ext/ca_obj_bitfield.c
14
+ ext/ca_obj_block.c
15
+ ext/carray_attribute.c
16
+ ext/carray_call_cfunc.c
17
+ ext/carray_cast.c
18
+ ext/carray_class.c
19
+ ext/carray_conversion.c
20
+ ext/carray_copy.c
21
+ ext/carray_core.c
22
+ ext/carray_data_type.c
23
+ ext/carray_element.c
24
+ ext/carray_generate.c
25
+ ext/carray_loop.c
26
+ ext/carray_mask.c
27
+ ext/carray_operator.c
28
+ ext/carray_order.c
29
+ ext/carray_sort_addr.c
30
+ ext/carray_test.c
31
+ ext/carray_utils.c
32
+
File without changes
data/NEWS.md ADDED
@@ -0,0 +1,83 @@
1
+ ChangeLog of Ruby/CArray
2
+ ========================
3
+
4
+ 1.5.4 -> 1.5.5
5
+
6
+ * [Fix] Fix recognition of "atan2", ... in "math.h"
7
+ * [Fix] Fix serialize.rb of keyword parameters for Ruby2.7
8
+
9
+ 1.5.3 -> 1.5.4
10
+ --------------
11
+
12
+ * [New] Import method 'CArray#section' from gem 'carray-calculus'
13
+ * [New] Add new method 'CArray#pull', 'CArray#pulled'
14
+ * [New] Add new option 'expand_scalar' to 'CArray.broadcast'
15
+ * [Mod] Modify the method 'CArray.broadcast' to accept block.
16
+ * [Mod] Modify the method 'CArray.meshgrid' to accept block.
17
+ * [Mod] Modify 'CScalar#broadcast_to' to return CArray
18
+ * [Mod] Modify 'CScalar#is_masked' and 'CScalar#is_masked' to return CScalar
19
+ * [Fix] Fix order of repetitive dimensions in 'CArray#meshgrid'
20
+ * [Fix] Fix errors in installing on MinGW+msys2
21
+
22
+ 1.5.2 -> 1.5.3
23
+ --------------
24
+
25
+ * [New] Add new method 'CArray#exp2'
26
+ * [New] Add new method 'CArray#log2'
27
+ * [New] Add new method 'CArray#logb'
28
+ * [New] Add new method 'CArray#remainder'
29
+ * [New] Add new method 'CArray.guard_undef'
30
+ * [New] Add new method 'CArray#data_class='
31
+ * [New] Add new method 'CArray.data_class?'
32
+ * [Mod] Modify 'CArray#pmax' to use 'fmax' for float type
33
+ * [Mod] Modify 'CArray#pmin' to use 'fmin' for float type
34
+ * [Mod] Remove method 'Object#undef?'
35
+ * [Mod] Remove method '::nan', '::inf'
36
+ * [Mod] Remove method 'TrueClass#*', 'FalseClass#*' (unknown origin)
37
+ * [Fix] Fix invalid access for CAUnboundRepeat using index
38
+ * [Fix] Fix treatment of extra :* in operation between CAUnboundRepeat objects
39
+ * [Fix] Fix to accept Symbol for the name of data_class member
40
+ * [Fix] Fix 'CArray#uniq' to accept the array with the dimension more than 2.
41
+ * [Fix] Fix for CArray serialization to include data_class
42
+ * [Fix] Fix data_class inheritance in some methods in which new CArray is created.
43
+ * [Fix] Fix 'CArray#broadcast_to' to accept the case of dimension extension.
44
+
45
+ 1.5.1 -> 1.5.2
46
+ --------------
47
+
48
+ * [New] Add new method 'CArray#sorted_with'
49
+ * [New] Add new method 'CArray#sort_with'
50
+ * [New] Add new method 'CArray#max_with'
51
+ * [New] Add new method 'CArray#min_with'
52
+ * [New] Add new method 'CArray.broadcast'
53
+ * [New] Add new method 'CArray#broadcast_to', 'CScalar#broadcast_to'
54
+ * [New] Add new API function `rb_ca_wrap_new`
55
+ * [Mod] Modify 'CArray#linspace' to return float64 array for integer arguments
56
+ * [Mod] Modify CAUnboundRepeat to have `ndim` same as the bounded array (before `ndim` same as parent array)
57
+ * [Mod] Remove the obsolete mothod 'CArray#dump'.
58
+ * [Mod] Remove the obsolete mothod 'CArray#load'.
59
+ * [Mod] Modify CArray.wrap_readonly to wrap string as array.
60
+ * [Fix] Add support for Integer (same as for Fixnum, Bignum)
61
+
62
+ 1.5.0 -> 1.5.1
63
+ --------------
64
+
65
+ * [New] Add data type classes like 'Float64' ... to provide the methods like 'CArray::Float64.linspace'
66
+ * [Mod] Modify 'CArray.float64' ... without aruguments to return the corresponding data type class
67
+ * [Mod] Set obsolete flag to 'CAIterator#sort_with'
68
+ * [Fix] Move C extension files into 'ext/'
69
+ * [Fix] Rename member 'rank' to 'ndim' in struct CArray in C extension
70
+ * [Fix] Remove 'CArray#shuffle' (gone to 'carray-random' gem)
71
+ * [Fix] Remove dependencies on 'rb_secure()' and 'rb_safe_level()'
72
+ * [Fix] Modify 'CArray#span' to handle fractional step for integer array
73
+
74
+ 1.4.0 -> 1.5.0
75
+ --------------
76
+
77
+ * [Mod] Remove 'Carray#random!' (gone to 'carray-random' gem)
78
+ * [Mod] Relocate file 'lib/carray/io/table.rb' to 'lib/carray/table.rb'
79
+ * [Mod] Rename class 'CA::TableMethods' to 'CArray::TableMethods'
80
+ * [Mod] Rename method 'CArray#cast_other' to 'CArray#cast_with'
81
+ * [Mod] Change license from "Ruby's" to "MIT"
82
+ * [Mod] Remove files 'COPYING', 'LEGAL'(for MT), 'GPL'
83
+ * [Fix] Fix bug lib/carray/struct.rb
data/README.md CHANGED
@@ -6,16 +6,16 @@ Ruby/CArray is an extension library for the multi-dimensional array class.
6
6
  Features
7
7
  --------
8
8
 
9
- * Multidimensional array for storing uniform data
10
- * Various ways to access data elements
11
- * Masks for each element to handle missing values
12
- * Element-wise operations and mathematical functions
13
- * Statistical functions for the elements
14
- * Indirect data manipulation for original array by virtual array
9
+ * Collection class for multidimensional array storing the value with uniform data type
10
+ * Element-wise mathematical operations and functions
11
+ * Statistical operation for the elements
12
+ * Various methods for referencing data elements
13
+ * Internally included element-wise mask to handle missing values
14
+ * Indirect data manipulation to referent by virtual array
15
15
  * Special iterators (dimension, block, window, categorical)
16
- * User-defined array
17
- * Storing fixed length data with data_class
18
- * Memory sharing with other objects (Experimental)
16
+ * User-defined array class with same multi-dimensional interfaces as CArray
17
+ * Accessing the partial data in fixed length data via data_class interface
18
+ * Wrapping the memory block owned by the other object (such as NArray).
19
19
 
20
20
  Requirements
21
21
  ------------
@@ -25,16 +25,32 @@ Requirements
25
25
  + IEEE754 floating point number
26
26
  + C99 complex number
27
27
 
28
- Directories
29
- -----------
28
+ What is Ruby/CArray
29
+ ------------------
30
30
 
31
- . - Ruby/CArray extension source codes
32
- lib - Ruby/CArray standard library in Ruby
33
- test - some unit tests (incomplete)
34
- spec - some rspec (incomplete)
35
- utils - support tools for development.
31
+ Ruby/CArray is an extension library for the multi-dimensional numerical array class. The name "CArray" comes from a wrapper's meaning to a numerical array handled by the C language. CArray stores integers or floating-point numbers in memory block and treats them collectively to ensure efficient performance. Therefore, Ruby/CArray is suitable for numerical computation and data analysis.
36
32
 
37
- Licenses
38
- --------
33
+ #### Multi-dimensional uniform array ####
34
+
35
+ CArray is a collection class that can store the array of values with a uniform data type of one of fixed-width integer (8,16,32,64bits), floating-point number (32,64bits), complex number (64,128bits), fixed-length string, ruby object. These values are stored in memory block as binary data. CArray has multi-dimensional interfaces for the array to access their values. The multi-dimensional array has the attributes of the dimension size (1,2,3,...) and the shape of dimension ([dim0], [dim0,dim1], [dim0,dim1,dim2],...) which define the size of array.
36
+
37
+ #### Collective mathematical operations ####
38
+
39
+ CArray supports the collective calculation for the element-wise arithmetic operations and elementary mathematical functions. Additionally, some basic statistical summarization along specific dimensions are also provided.
40
+
41
+ #### Referencing data and virtual arrays ####
42
+
43
+ CArray provides various methods for referencing data, such as addressing, slicing, selection by condition, address mapping, grid reference, transposing, shifting, rolling, data type conversion, reshaping, and so on. These data referencing are realized by the creation of virtual arrays, so-called 'view'. The virtual array doesn't have its data and retrieves the data from the referent only on-demand, including dereferencing, copying, or calculation. Since virtual array classes are sub-class of CArray, it has the same interfaces to access data as CArray. The changes in a virtual array by storing data are also reflected in the referent (if not a read_only array). Multiple heterogeneous chains of reference are also allowed, although the trade-offs with performance must be carefully considered.
44
+
45
+ #### Built-in element-wise mask handling ####
46
+
47
+ CArray possesses masked states about each element (so-called "element-wise mask"). By referring the element-wise mask, CArray can perform mathematical and statistical calculations on the data with missing values by appropriate handling of masked elements. , which include the propagation of mask state to result in element-wise arithmetics and ignoring the masked elements in a statistical calculation, and so on.
48
+
49
+ #### User-defined array ####
50
+
51
+ Users can define a new virtual array class in Ruby level or C-extension level with TemplateMethod pattern. They are defined as a subclass of CAObject in Ruby level and as a subclass of CAVirtual in C-extension level. In particular, at the Ruby level, you can easily define a CArray-like class by implementing just a few template methods.
52
+
53
+ License
54
+ -------
39
55
 
40
56
  MIT (after version 1.5.0)
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ task :install do
15
15
  exit(1)
16
16
  end
17
17
  system %{
18
- gem build #{GEMSPEC}; gem install #{spec.full_name}.gem
18
+ gem build #{GEMSPEC}; gem install #{spec.full_name}.gem --no-document
19
19
  }
20
20
  end
21
21
 
data/TODO.md ADDED
@@ -0,0 +1,17 @@
1
+ ToDo List
2
+ =========
3
+
4
+ ToDo
5
+ -------
6
+ * Implement CArray.broadcast in C
7
+ * Implement Integer#{|,&,^,<<,>>} with Refinement (remove monkey patch)
8
+ * Remove RSTRUCT hack in carray_access.c for handling of Range object.
9
+ * Solve abs probrems
10
+ * Create spec
11
+ - str_format (cyclic format)
12
+ - CA_SIZE
13
+ - serialization of carray which has data_class
14
+
15
+ Done
16
+ -------
17
+
data/carray.gemspec CHANGED
@@ -1,28 +1,31 @@
1
1
  Gem::Specification::new do |s|
2
2
 
3
- version = "1.5.1"
3
+ version = "1.5.6"
4
4
 
5
- files = Dir.glob("**/*") - [
5
+ files = Dir.glob("**/*") + [".yardopts"] -
6
+ [
6
7
  Dir.glob("carray-*.gem"),
7
8
  Dir.glob("ext/**/{Makefile,mkmf.log}"),
8
9
  Dir.glob("**/*.{o,so,bundle}"),
9
10
  Dir.glob("**/*~"),
10
11
  Dir.glob("doc/**/*"),
12
+ Dir.glob("test/**/*"),
11
13
  ].flatten
12
14
 
13
15
  s.platform = Gem::Platform::RUBY
14
16
  s.name = "carray"
15
17
  s.summary = "Multi-dimesional array class for Ruby"
16
18
  s.description = <<-HERE
17
- CArray is a uniform multi-dimensional rectangular array class.
18
- It provides the various types of sub-arrays and references
19
- pointing the data elements of original array (slice, grid, selection ...).
20
- Element-wise masking and mathematical operations are natively supported.
19
+ Ruby/CArray is an extension library for the multi-dimensional numerical array
20
+ class. The name "CArray" comes from the meaning of a wrapper to a numerical array
21
+ handled by the C language. CArray stores integers or floating-point numbers in
22
+ memory block and treats them collectively to ensure efficient performance.
23
+ Therefore, Ruby/CArray is suitable for numerical computation and data analysis.
21
24
  HERE
22
25
  s.version = version
23
26
  s.author = "Hiroki Motoyoshi"
24
27
  s.email = ""
25
- s.licenses = ['MIT']
28
+ s.license = 'MIT'
26
29
  s.homepage = 'https://github.com/himotoyoshi/carray'
27
30
  s.files = files
28
31
  s.extensions = [ "ext/extconf.rb" ]
data/ext/ca_iter_block.c CHANGED
@@ -3,16 +3,14 @@
3
3
  ca_iter_block.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:
13
+ /* yard:
16
14
  class CABlockIterator < CAIterator # :nodoc:
17
15
  end
18
16
  */
@@ -202,7 +200,7 @@ rb_bi_initialize_copy (VALUE self, VALUE other)
202
200
  return self;
203
201
  }
204
202
 
205
- /* rdoc:
203
+ /* yard:
206
204
  class CArray
207
205
  # Create block iterator.
208
206
  def blocks (*args)
@@ -3,10 +3,8 @@
3
3
  ca_iter_dimension.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,7 +13,7 @@
15
13
 
16
14
  VALUE rb_cCADimIterator;
17
15
 
18
- /* rdoc:
16
+ /* yard:
19
17
  class CADimensionIterator < CAIterator # :nodoc:
20
18
  end
21
19
  */
@@ -239,6 +237,7 @@ rb_ca_dim_iterator (int argc, VALUE *argv, VALUE self)
239
237
 
240
238
  Data_Get_Struct(self, CArray, ca);
241
239
 
240
+ info.range_check = 1;
242
241
  rb_ca_scan_index(ca->ndim, ca->dim, ca->elements, argc, argv, &info);
243
242
 
244
243
  obj = rb_di_s_allocate(rb_cCADimIterator);
@@ -258,7 +257,7 @@ rb_dim_iter_new (VALUE rref, CAIndexInfo *info)
258
257
  return obj;
259
258
  }
260
259
 
261
- /* rdoc:
260
+ /* yard:
262
261
  class CADimensionIterator
263
262
  def sym2dim (sym)
264
263
  end
data/ext/ca_iter_window.c CHANGED
@@ -3,10 +3,8 @@
3
3
  ca_iter_window.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
 
@@ -27,7 +25,7 @@ typedef struct {
27
25
 
28
26
  VALUE rb_cCAWindowIterator;
29
27
 
30
- /* rdoc:
28
+ /* yard:
31
29
  class CAWindowIterator < CAIterator # :nodoc:
32
30
  end
33
31
  */
data/ext/ca_obj_array.c CHANGED
@@ -3,10 +3,8 @@
3
3
  ca_obj_array.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
 
@@ -19,7 +17,7 @@
19
17
 
20
18
  VALUE rb_cCArray, rb_cCAWrap, rb_cCScalar, rb_cCAVirtual;
21
19
 
22
- /* rdoc:
20
+ /* yard:
23
21
  class CArray
24
22
  end
25
23
  class CAWrap < CArray # :nodoc:
@@ -60,27 +58,22 @@ ca_check_mem_count()
60
58
  }
61
59
  }
62
60
 
63
- /* rdoc:
64
- # returns the threshold of incremented memory (MB) used by carray object
65
- # until start GC.
66
- def CArray.gc_interval ()
67
- end
68
- # set the threshold of incremented memory (MB) used by carray object
69
- # until start GC.
70
- def CArray.gc_interval= (val)
71
- end
72
- # reset the counter for the GC start when the incremented memory
73
- # get larger than `CArray.gc_interval`.
74
- def CArray.reset_gc_interval ()
75
- end
76
- */
61
+ /* @private gc_interval
77
62
 
63
+ Returns the threshold of incremented memory (MB) used by carray object
64
+ until start GC.
65
+ */
78
66
  static VALUE
79
67
  rb_ca_get_gc_interval (VALUE self)
80
68
  {
81
69
  return rb_float_new(ca_gc_interval);
82
70
  }
83
71
 
72
+ /* @private gc_interval= (val)
73
+
74
+ Sets the threshold of incremented memory (MB) used by carray object
75
+ until start GC.
76
+ */
84
77
  static VALUE
85
78
  rb_ca_set_gc_interval (VALUE self, VALUE rth)
86
79
  {
@@ -92,6 +85,11 @@ rb_ca_set_gc_interval (VALUE self, VALUE rth)
92
85
  return rb_float_new(ca_gc_interval);
93
86
  }
94
87
 
88
+ /* @private reset_gc_inverval
89
+
90
+ Reset the counter for the GC start when the incremented memory
91
+ get larger than `CArray.gc_interval`.
92
+ */
95
93
  static VALUE
96
94
  rb_ca_reset_gc_interval (VALUE self)
97
95
  {
@@ -669,6 +667,15 @@ rb_carray_new_safe (int8_t data_type, int8_t ndim, ca_size_t *dim, ca_size_t byt
669
667
  return ca_wrap_struct(ca);
670
668
  }
671
669
 
670
+
671
+ VALUE
672
+ rb_ca_wrap_new (int8_t data_type, int8_t ndim, ca_size_t *dim, ca_size_t bytes,
673
+ CArray *mask, char *ptr)
674
+ {
675
+ CAWrap *ca = ca_wrap_new(data_type, ndim, dim, bytes, mask, ptr);
676
+ return ca_wrap_struct(ca);
677
+ }
678
+
672
679
  VALUE
673
680
  rb_cscalar_new (int8_t data_type, ca_size_t bytes, CArray *mask)
674
681
  {
@@ -699,20 +706,16 @@ rb_ca_s_allocate (VALUE klass)
699
706
  return Data_Make_Struct(klass, CArray, ca_mark, ca_free, ca);
700
707
  }
701
708
 
702
- /* rdoc:
703
- # call-seq:
704
- # CArray.new(data_type, dim, bytes=0) { ... }
705
- #
706
- # Constructs a new CArray object of <i>data_type</i>, which has the
707
- # ndim and the dimensions specified by an <code>Array</code> of
708
- # <code>Integer</code> or an argument list of <code>Integer</code>.
709
- # The byte size of each element for the fixed length data type
710
- # (<code>data_type == CA_FIXLEN</code>) is specified optional argument
711
- # <i>bytes</i>. Otherwise, this optional argument has no
712
- # effect. If the block is given, the new CArray
713
- # object will be initialized by the value returned from the block.
714
- def CArray.new(data_type, dim, bytes=0)
715
- end
709
+ /* @overload initialize(data_type, dim, bytes=0) { ... }
710
+
711
+ Constructs a new CArray object of <i>data_type</i>, which has the
712
+ ndim and the dimensions specified by an <code>Array</code> of
713
+ <code>Integer</code> or an argument list of <code>Integer</code>.
714
+ The byte size of each element for the fixed length data type
715
+ (<code>data_type == CA_FIXLEN</code>) is specified optional argument
716
+ <i>bytes</i>. Otherwise, this optional argument has no
717
+ effect. If the block is given, the new CArray
718
+ object will be initialized by the value returned from the block.
716
719
  */
717
720
 
718
721
  static VALUE
@@ -750,6 +753,12 @@ rb_ca_initialize (int argc, VALUE *argv, VALUE self)
750
753
  return Qnil;
751
754
  }
752
755
 
756
+ /* @overload fixlen(*dim, bytes: ) { ... }
757
+
758
+ (Construction)
759
+ Short-Hand of `CArray.new(:fixlen, dim, bytes: ) { ... }`
760
+ */
761
+
753
762
  static VALUE
754
763
  rb_ca_s_fixlen (int argc, VALUE *argv, VALUE klass)
755
764
  {
@@ -759,8 +768,7 @@ rb_ca_s_fixlen (int argc, VALUE *argv, VALUE klass)
759
768
  return rb_class_new_instance(3, args, klass);
760
769
  }
761
770
 
762
- #define rb_ca_s_type(type, code) \
763
- rb_ca_s_## type (int argc, VALUE *argv, VALUE klass) \
771
+ #define rb_ca_s_body(code) \
764
772
  { \
765
773
  if ( argc == 0 ) { \
766
774
  return ca_data_type_class(code); \
@@ -773,47 +781,171 @@ rb_ca_s_## type (int argc, VALUE *argv, VALUE klass) \
773
781
  } \
774
782
  }
775
783
 
776
- /*
777
- * call-seq:
778
- * CArray.int8(dim0, dim1, ...) { ... } -> CArray
779
- * CArray.uint8(dim0, dim1, ...) { ... } -> CArray
780
- * CArray.int16(dim0, dim1, ...) { ... } -> CArray
781
- * CArray.uint16(dim0, dim1, ...) { ... } -> CArray
782
- * CArray.int32(dim0, dim1, ...) { ... } -> CArray
783
- * CArray.uint32(dim0, dim1, ...) { ... } -> CArray
784
- * CArray.int64(dim0, dim1, ...) { ... } -> CArray
785
- * CArray.uint64(dim0, dim1, ...) { ... } -> CArray
786
- * CArray.float32(dim0, dim1, ...) { ... } -> CArray
787
- * CArray.float64(dim0, dim1, ...) { ... } -> CArray
788
- * CArray.float128(dim0, dim1, ...) { ... } -> CArray
789
- * CArray.cmplx64(dim0, dim1, ...) { ... } -> CArray
790
- * CArray.cmplx128(dim0, dim1, ...) { ... } -> CArray
791
- * CArray.cmplx256(dim0, dim1, ...) { ... } -> CArray
792
- * CArray.object(dim0, dim1, ...) { ... } -> CArray
793
- *
794
- */
784
+ /* @overload boolean(*dim) { ... }
785
+
786
+ (Construction)
787
+ Short-Hand of `CArray.new(:boolean, dim, bytes: bytes) { ... }`
788
+ */
789
+ static VALUE rb_ca_s_boolean (int argc, VALUE *argv, VALUE klass)
790
+ {
791
+ rb_ca_s_body(CA_BOOLEAN);
792
+ }
793
+
794
+ /* @overload int8(*dim) { ... }
795
+
796
+ (Construction)
797
+ Short-Hand of `CArray.new(:int8, dim, bytes: bytes) { ... }`
798
+ */
799
+ static VALUE rb_ca_s_int8 (int argc, VALUE *argv, VALUE klass)
800
+ {
801
+ rb_ca_s_body(CA_INT8);
802
+ }
803
+
804
+ /* @overload uint8(*dim) { ... }
805
+
806
+ (Construction)
807
+ Short-Hand of `CArray.new(:uint8, dim, bytes: bytes) { ... }`
808
+ */
809
+ static VALUE rb_ca_s_uint8 (int argc, VALUE *argv, VALUE klass)
810
+ {
811
+ rb_ca_s_body(CA_UINT8);
812
+ }
813
+
814
+ /* @overload int16(*dim) { ... }
815
+
816
+ (Construction)
817
+ Short-Hand of `CArray.new(:int16, dim, bytes: bytes) { ... }`
818
+ */
819
+ static VALUE rb_ca_s_int16 (int argc, VALUE *argv, VALUE klass)
820
+ {
821
+ rb_ca_s_body(CA_INT16);
822
+ }
823
+
824
+ /* @overload uint16(*dim) { ... }
825
+
826
+ (Construction)
827
+ Short-Hand of `CArray.new(:uint16, dim, bytes: bytes) { ... }`
828
+ */
829
+ static VALUE rb_ca_s_uint16 (int argc, VALUE *argv, VALUE klass)
830
+ {
831
+ rb_ca_s_body(CA_UINT16);
832
+ }
833
+
834
+ /* @overload int32(*dim) { ... }
835
+
836
+ (Construction)
837
+ Short-Hand of `CArray.new(:int32, dim, bytes: bytes) { ... }`
838
+ */
839
+ static VALUE rb_ca_s_int32 (int argc, VALUE *argv, VALUE klass)
840
+ {
841
+ rb_ca_s_body(CA_INT32);
842
+ }
843
+
844
+ /* @overload uint32(*dim) { ... }
845
+
846
+ (Construction)
847
+ Short-Hand of `CArray.new(:uint32, dim, bytes: bytes) { ... }`
848
+ */
849
+ static VALUE rb_ca_s_uint32 (int argc, VALUE *argv, VALUE klass)
850
+ {
851
+ rb_ca_s_body(CA_UINT32);
852
+ }
853
+
854
+ /* @overload int64(*dim) { ... }
855
+
856
+ (Construction)
857
+ Short-Hand of `CArray.new(:int64, dim, bytes: bytes) { ... }`
858
+ */
859
+ static VALUE rb_ca_s_int64 (int argc, VALUE *argv, VALUE klass)
860
+ {
861
+ rb_ca_s_body(CA_INT64);
862
+ }
863
+
864
+ /* @overload uint64(*dim) { ... }
865
+
866
+ (Construction)
867
+ Short-Hand of `CArray.new(:uint64, dim, bytes: bytes) { ... }`
868
+ */
869
+ static VALUE rb_ca_s_uint64 (int argc, VALUE *argv, VALUE klass)
870
+ {
871
+ rb_ca_s_body(CA_UINT64);
872
+ }
873
+
874
+ /* @overload float32(*dim) { ... }
875
+
876
+ (Construction)
877
+ Short-Hand of `CArray.new(:float32, dim, bytes: bytes) { ... }`
878
+ */
879
+ static VALUE rb_ca_s_float32 (int argc, VALUE *argv, VALUE klass)
880
+ {
881
+ rb_ca_s_body(CA_FLOAT32);
882
+ }
883
+
884
+ /* @overload float64(*dim) { ... }
885
+
886
+ (Construction)
887
+ Short-Hand of `CArray.new(:float64, dim, bytes: bytes) { ... }`
888
+ */
889
+ static VALUE rb_ca_s_float64 (int argc, VALUE *argv, VALUE klass)
890
+ {
891
+ rb_ca_s_body(CA_FLOAT64);
892
+ }
893
+
894
+ /* @overload float128(*dim) { ... }
895
+
896
+ (Construction)
897
+ Short-Hand of `CArray.new(:float128, dim, bytes: bytes) { ... }`
898
+ */
899
+ static VALUE rb_ca_s_float128 (int argc, VALUE *argv, VALUE klass)
900
+ {
901
+ rb_ca_s_body(CA_FLOAT128);
902
+ }
795
903
 
796
- static VALUE rb_ca_s_VALUE();
797
-
798
- static VALUE rb_ca_s_type(boolean, CA_BOOLEAN);
799
- static VALUE rb_ca_s_type(int8, CA_INT8);
800
- static VALUE rb_ca_s_type(uint8, CA_UINT8);
801
- static VALUE rb_ca_s_type(int16, CA_INT16);
802
- static VALUE rb_ca_s_type(uint16, CA_UINT16);
803
- static VALUE rb_ca_s_type(int32, CA_INT32);
804
- static VALUE rb_ca_s_type(uint32, CA_UINT32);
805
- static VALUE rb_ca_s_type(int64, CA_INT64);
806
- static VALUE rb_ca_s_type(uint64, CA_UINT64);
807
- static VALUE rb_ca_s_type(float32, CA_FLOAT32);
808
- static VALUE rb_ca_s_type(float64, CA_FLOAT64);
809
- static VALUE rb_ca_s_type(float128, CA_FLOAT128);
810
904
  #ifdef HAVE_COMPLEX_H
811
- static VALUE rb_ca_s_type(cmplx64, CA_CMPLX64);
812
- static VALUE rb_ca_s_type(cmplx128, CA_CMPLX128);
813
- static VALUE rb_ca_s_type(cmplx256, CA_CMPLX256);
905
+ /* @overload cmplx64(*dim) { ... }
906
+
907
+ (Construction)
908
+ Short-Hand of `CArray.new(:cmplx64, dim, bytes: bytes) { ... }`
909
+ */
910
+ static VALUE rb_ca_s_cmplx64 (int argc, VALUE *argv, VALUE klass)
911
+ {
912
+ rb_ca_s_body(CA_CMPLX64);
913
+ }
914
+
915
+ /* @overload cmplx128(*dim) { ... }
916
+
917
+ (Construction)
918
+ Short-Hand of `CArray.new(:cmplx128, dim, bytes: bytes) { ... }`
919
+ */
920
+ static VALUE rb_ca_s_cmplx128 (int argc, VALUE *argv, VALUE klass)
921
+ {
922
+ rb_ca_s_body(CA_CMPLX128);
923
+ }
924
+
925
+ /* @overload cmplx256(*dim) { ... }
926
+
927
+ (Construction)
928
+ Short-Hand of `CArray.new(:cmplx256, dim, bytes: bytes) { ... }`
929
+ */
930
+ static VALUE rb_ca_s_cmplx256 (int argc, VALUE *argv, VALUE klass)
931
+ {
932
+ rb_ca_s_body(CA_CMPLX256);
933
+ }
814
934
  #endif
815
- static VALUE rb_ca_s_type(VALUE, CA_OBJECT);
816
935
 
936
+ /* @overload object(*dim) { ... }
937
+
938
+ (Construction)
939
+ Short-Hand of `CArray.new(:object, dim, bytes: bytes) { ... }`
940
+ */
941
+ static VALUE rb_ca_s_VALUE (int argc, VALUE *argv, VALUE klass)
942
+ {
943
+ rb_ca_s_body(CA_OBJECT);
944
+ }
945
+
946
+ /* @overload initialize_copy(other)
947
+
948
+ */
817
949
  static VALUE
818
950
  rb_ca_initialize_copy (VALUE self, VALUE other)
819
951
  {
@@ -832,9 +964,10 @@ rb_ca_initialize_copy (VALUE self, VALUE other)
832
964
  return self;
833
965
  }
834
966
 
835
- /* rdoc:
836
- def CArray.wrap (data_type, dim, bytes=0) # { wrapped_object }
837
- end
967
+ /* @overload wrap (data_type, dim, bytes=0) { target }
968
+
969
+ [TBD] (Construction)
970
+ target should have method "wrap_as_carray(obj)"
838
971
  */
839
972
 
840
973
  static VALUE
@@ -893,16 +1026,16 @@ rb_cs_s_allocate (VALUE klass)
893
1026
  return Data_Make_Struct(klass, CScalar, ca_mark, ca_free, ca);
894
1027
  }
895
1028
 
896
- /* rdoc:
897
- # call-seq:
898
- # CScalar.new(data_type, bytes=0) { ... }
899
- #
900
- # Constructs a new CScalar object of <i>data_type</i>.
901
- # The byte size of each element for the fixed length data type
902
- # (<code>data_type == CA_FIXLEN</code>) is specified optional argument
903
- # <i>bytes</i>. Otherwise, this optional argument has no
904
- # effect. If the block is given, the new CScalar
905
- # object will be initialized by the value returned from the block.
1029
+ /*
1030
+ call-seq:
1031
+ CScalar.new(data_type, bytes=0) { ... }
1032
+
1033
+ Constructs a new CScalar object of <i>data_type</i>.
1034
+ The byte size of each element for the fixed length data type
1035
+ (<code>data_type == CA_FIXLEN</code>) is specified optional argument
1036
+ <i>bytes</i>. Otherwise, this optional argument has no
1037
+ effect. If the block is given, the new CScalar
1038
+ object will be initialized by the value returned from the block.
906
1039
  def CScalar.new(data_type,bytes=0)
907
1040
  end
908
1041
  */
@@ -934,6 +1067,12 @@ rb_cs_initialize (int argc, VALUE *argv, VALUE self)
934
1067
  return Qnil;
935
1068
  }
936
1069
 
1070
+ /* @overload fixlen(*dim, bytes: ) { ... }
1071
+
1072
+ (Construction)
1073
+ Short-Hand of `CScalar.new(:fixlen, bytes: ) { ... }`
1074
+ */
1075
+
937
1076
  static VALUE
938
1077
  rb_cs_s_fixlen (int argc, VALUE *argv, VALUE klass)
939
1078
  {
@@ -945,8 +1084,7 @@ rb_cs_s_fixlen (int argc, VALUE *argv, VALUE klass)
945
1084
  return rb_class_new_instance(2, args, klass);
946
1085
  }
947
1086
 
948
- #define rb_cs_s_type(type, code) \
949
- rb_cs_s_## type (int argc, VALUE *argv, VALUE klass) \
1087
+ #define rb_cs_s_body(code) \
950
1088
  { \
951
1089
  volatile VALUE ropt = rb_pop_options(&argc, &argv); \
952
1090
  VALUE args[2] = { INT2NUM(code), ropt }; \
@@ -956,47 +1094,172 @@ rb_cs_s_## type (int argc, VALUE *argv, VALUE klass) \
956
1094
  return rb_class_new_instance(2, args, klass); \
957
1095
  }
958
1096
 
959
- static VALUE rb_cs_s_type(boolean, CA_BOOLEAN);
960
- static VALUE rb_cs_s_type(int8, CA_INT8);
961
- static VALUE rb_cs_s_type(uint8, CA_UINT8);
962
- static VALUE rb_cs_s_type(int16, CA_INT16);
963
- static VALUE rb_cs_s_type(uint16, CA_UINT16);
964
- static VALUE rb_cs_s_type(int32, CA_INT32);
965
- static VALUE rb_cs_s_type(uint32, CA_UINT32);
966
- static VALUE rb_cs_s_type(int64, CA_INT64);
967
- static VALUE rb_cs_s_type(uint64, CA_UINT64);
968
- static VALUE rb_cs_s_type(float32, CA_FLOAT32);
969
- static VALUE rb_cs_s_type(float64, CA_FLOAT64);
970
- static VALUE rb_cs_s_type(float128, CA_FLOAT128);
1097
+ /* @overload boolean() { ... }
1098
+
1099
+ (Construction)
1100
+ Short-Hand of `CArray.new(:boolean) { ... }`
1101
+ */
1102
+ static VALUE
1103
+ rb_cs_s_boolean (int argc, VALUE *argv, VALUE klass) {
1104
+ rb_cs_s_body(CA_BOOLEAN);
1105
+ }
1106
+
1107
+ /* @overload int8() { ... }
1108
+
1109
+ (Construction)
1110
+ Short-Hand of `CScalar.new(:int8) { ... }`
1111
+ */
1112
+ static VALUE
1113
+ rb_cs_s_int8 (int argc, VALUE *argv, VALUE klass) {
1114
+ rb_cs_s_body(CA_INT8);
1115
+ }
1116
+
1117
+ /* @overload uint8() { ... }
1118
+
1119
+ (Construction)
1120
+ Short-Hand of `CScalar.new(:uint8) { ... }`
1121
+ */
1122
+ static VALUE
1123
+ rb_cs_s_uint8 (int argc, VALUE *argv, VALUE klass) {
1124
+ rb_cs_s_body(CA_UINT8);
1125
+ }
1126
+
1127
+
1128
+ /* @overload int16() { ... }
1129
+
1130
+ (Construction)
1131
+ Short-Hand of `CScalar.new(:int16) { ... }`
1132
+ */
1133
+ static VALUE
1134
+ rb_cs_s_int16 (int argc, VALUE *argv, VALUE klass) {
1135
+ rb_cs_s_body(CA_INT16);
1136
+ }
1137
+
1138
+ /* @overload uint16() { ... }
1139
+
1140
+ (Construction)
1141
+ Short-Hand of `CScalar.new(:uint16) { ... }`
1142
+ */
1143
+ static VALUE
1144
+ rb_cs_s_uint16 (int argc, VALUE *argv, VALUE klass) {
1145
+ rb_cs_s_body(CA_UINT16);
1146
+ }
1147
+
1148
+ /* @overload int32() { ... }
1149
+
1150
+ (Construction)
1151
+ Short-Hand of `CScalar.new(:int32) { ... }`
1152
+ */
1153
+ static VALUE
1154
+ rb_cs_s_int32 (int argc, VALUE *argv, VALUE klass) {
1155
+ rb_cs_s_body(CA_INT32);
1156
+ }
1157
+
1158
+ /* @overload uint32() { ... }
1159
+
1160
+ (Construction)
1161
+ Short-Hand of `CScalar.new(:uint32) { ... }`
1162
+ */
1163
+ static VALUE
1164
+ rb_cs_s_uint32 (int argc, VALUE *argv, VALUE klass) {
1165
+ rb_cs_s_body(CA_UINT32);
1166
+ }
1167
+
1168
+ /* @overload int64() { ... }
1169
+
1170
+ (Construction)
1171
+ Short-Hand of `CScalar.new(:int64) { ... }`
1172
+ */
1173
+ static VALUE
1174
+ rb_cs_s_int64 (int argc, VALUE *argv, VALUE klass) {
1175
+ rb_cs_s_body(CA_INT64);
1176
+ }
1177
+
1178
+ /* @overload uint64() { ... }
1179
+
1180
+ (Construction)
1181
+ Short-Hand of `CScalar.new(:uint64) { ... }`
1182
+ */
1183
+ static VALUE
1184
+ rb_cs_s_uint64 (int argc, VALUE *argv, VALUE klass) {
1185
+ rb_cs_s_body(CA_UINT64);
1186
+ }
1187
+
1188
+ /* @overload float32() { ... }
1189
+
1190
+ (Construction)
1191
+ Short-Hand of `CScalar.new(:float32) { ... }`
1192
+ */
1193
+ static VALUE
1194
+ rb_cs_s_float32 (int argc, VALUE *argv, VALUE klass) {
1195
+ rb_cs_s_body(CA_FLOAT32);
1196
+ }
1197
+
1198
+ /* @overload float64() { ... }
1199
+
1200
+ (Construction)
1201
+ Short-Hand of `CScalar.new(:float64) { ... }`
1202
+ */
1203
+ static VALUE
1204
+ rb_cs_s_float64 (int argc, VALUE *argv, VALUE klass) {
1205
+ rb_cs_s_body(CA_FLOAT64);
1206
+ }
1207
+
1208
+ /* @overload float128() { ... }
1209
+
1210
+ (Construction)
1211
+ Short-Hand of `CScalar.new(:float128) { ... }`
1212
+ */
1213
+ static VALUE
1214
+ rb_cs_s_float128 (int argc, VALUE *argv, VALUE klass) {
1215
+ rb_cs_s_body(CA_FLOAT128);
1216
+ }
1217
+
971
1218
  #ifdef HAVE_COMPLEX_H
972
- static VALUE rb_cs_s_type(cmplx64, CA_CMPLX64);
973
- static VALUE rb_cs_s_type(cmplx128, CA_CMPLX128);
974
- static VALUE rb_cs_s_type(cmplx256, CA_CMPLX256);
1219
+ /* @overload cmplx64() { ... }
1220
+
1221
+ (Construction)
1222
+ Short-Hand of `CScalar.new(:cmplx64) { ... }`
1223
+ */
1224
+ static VALUE
1225
+ rb_cs_s_cmplx64 (int argc, VALUE *argv, VALUE klass) {
1226
+ rb_cs_s_body(CA_CMPLX64);
1227
+ }
1228
+
1229
+ /* @overload cmplx128() { ... }
1230
+
1231
+ (Construction)
1232
+ Short-Hand of `CScalar.new(:cmplx128) { ... }`
1233
+ */
1234
+ static VALUE
1235
+ rb_cs_s_cmplx128 (int argc, VALUE *argv, VALUE klass) {
1236
+ rb_cs_s_body(CA_CMPLX128);
1237
+ }
1238
+
1239
+ /* @overload cmplx256() { ... }
1240
+
1241
+ (Construction)
1242
+ Short-Hand of `CScalar.new(:cmplx256) { ... }`
1243
+ */
1244
+ static VALUE
1245
+ rb_cs_s_cmplx256 (int argc, VALUE *argv, VALUE klass) {
1246
+ rb_cs_s_body(CA_CMPLX256);
1247
+ }
975
1248
  #endif
976
- static VALUE rb_cs_s_type(VALUE, CA_OBJECT);
977
1249
 
978
- /*
979
- * call-seq:
980
- * CScalar.int8() { ... } -> CScalar
981
- * CScalar.uint8() { ... } -> CScalar
982
- * CScalar.int16() { ... } -> CScalar
983
- * CScalar.uint16() { ... } -> CScalar
984
- * CScalar.int32() { ... } -> CScalar
985
- * CScalar.uint32() { ... } -> CScalar
986
- * CScalar.int64() { ... } -> CScalar
987
- * CScalar.uint64() { ... } -> CScalar
988
- * CScalar.float32() { ... } -> CScalar
989
- * CScalar.float64() { ... } -> CScalar
990
- * CScalar.float128() { ... } -> CScalar
991
- * CScalar.cmplx64() { ... } -> CScalar
992
- * CScalar.cmplx128() { ... } -> CScalar
993
- * CScalar.cmplx256() { ... } -> CScalar
994
- * CScalar.object() { ... } -> CScalar
995
- *
996
- */
1250
+ /* @overload object() { ... }
997
1251
 
998
- static VALUE
999
- rb_cs_s_VALUE();
1252
+ (Construction)
1253
+ Short-Hand of `CScalar.new(:object) { ... }`
1254
+ */
1255
+ static VALUE
1256
+ rb_cs_s_VALUE (int argc, VALUE *argv, VALUE klass) {
1257
+ rb_cs_s_body(CA_OBJECT);
1258
+ }
1259
+
1260
+ /* @overload initialize_copy(other)
1261
+
1262
+ */
1000
1263
 
1001
1264
  static VALUE
1002
1265
  rb_cs_initialize_copy (VALUE self, VALUE other)
@@ -1031,6 +1294,10 @@ rb_cs_coerce (VALUE self, VALUE other)
1031
1294
  }
1032
1295
  */
1033
1296
 
1297
+ /* @private
1298
+ @overload mem_usage
1299
+ */
1300
+
1034
1301
  static VALUE
1035
1302
  rb_ca_mem_usage (VALUE self)
1036
1303
  {
@@ -1046,7 +1313,10 @@ Init_ca_obj_array ()
1046
1313
 
1047
1314
  /* ------------------------------------------------------------------- */
1048
1315
  ca_gc_interval = ca_default_gc_interval;
1316
+
1317
+ /* @private */
1049
1318
  rb_define_const(rb_cCArray, "DEFAULT_GC_INTERVAL", rb_float_new(ca_default_gc_interval));
1319
+
1050
1320
  rb_define_singleton_method(rb_cCArray, "gc_interval", rb_ca_get_gc_interval, 0);
1051
1321
  rb_define_singleton_method(rb_cCArray, "gc_interval=", rb_ca_set_gc_interval, 1);
1052
1322
  rb_define_singleton_method(rb_cCArray, "reset_gc_interval", rb_ca_reset_gc_interval, 0);
@@ -1135,7 +1405,7 @@ Init_ca_obj_array ()
1135
1405
  }
1136
1406
 
1137
1407
 
1138
- /* rdoc:
1408
+ /* yard:
1139
1409
  # call-seq:
1140
1410
  # CArray.boolean(...) { init_value }
1141
1411
  # CArray.int8(...) { init_value }