carray 3.0.7 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/CHANGELOG.md +7 -1940
  4. data/README.md +38 -32
  5. data/carray.gemspec +16 -4
  6. data/docs/changelogs/CHANGELOG-3.0.md +2464 -0
  7. data/ext/ca_array_pool.c +4 -5
  8. data/ext/ca_axis_descriptor.h +45 -30
  9. data/ext/ca_axis_dispatch.c +7 -4
  10. data/ext/ca_axis_group.c +6 -9
  11. data/ext/ca_bincmp_dispatch.h +16 -38
  12. data/ext/ca_binop_dispatch.c +27 -0
  13. data/ext/ca_binop_dispatch.h +22 -47
  14. data/ext/ca_categorical_iterator.c +36 -34
  15. data/ext/ca_compare.c +0 -1
  16. data/ext/ca_compare.h +8 -1
  17. data/ext/ca_composite_dispatch.h +6 -0
  18. data/ext/ca_for_buffer.h +6 -1
  19. data/ext/ca_group_iter.c +17 -18
  20. data/ext/ca_iter_state_fields.h +196 -0
  21. data/ext/ca_iter_substrate.h +84 -103
  22. data/ext/ca_kernel_iterator.c +125 -89
  23. data/ext/ca_kernel_iterator.h +229 -1506
  24. data/ext/ca_kernel_iterator_internal.h +1167 -0
  25. data/ext/ca_moncmp_dispatch.h +17 -24
  26. data/ext/ca_monop_dispatch.h +25 -74
  27. data/ext/ca_obj_array.c +90 -163
  28. data/ext/ca_obj_bincmp.c +47 -46
  29. data/ext/ca_obj_binop.c +38 -38
  30. data/ext/ca_obj_bitarray.c +5 -17
  31. data/ext/ca_obj_bitfield.c +15 -30
  32. data/ext/ca_obj_block.c +11 -12
  33. data/ext/ca_obj_byte_swap.c +32 -30
  34. data/ext/ca_obj_const_string.c +57 -62
  35. data/ext/ca_obj_face.c +99 -91
  36. data/ext/ca_obj_face.h +32 -170
  37. data/ext/ca_obj_fake.c +15 -21
  38. data/ext/ca_obj_farray.c +7 -9
  39. data/ext/ca_obj_field.c +17 -13
  40. data/ext/ca_obj_fixlen_string.c +8 -19
  41. data/ext/ca_obj_grid.c +137 -106
  42. data/ext/ca_obj_meld.c +23 -21
  43. data/ext/ca_obj_moncmp.c +10 -21
  44. data/ext/ca_obj_monop.c +24 -35
  45. data/ext/ca_obj_object.c +51 -37
  46. data/ext/ca_obj_record.c +74 -22
  47. data/ext/ca_obj_reduce.c +8 -10
  48. data/ext/ca_obj_refer.c +42 -29
  49. data/ext/ca_obj_remap.c +11 -29
  50. data/ext/ca_obj_repeat.c +41 -23
  51. data/ext/ca_obj_roll.c +18 -24
  52. data/ext/ca_obj_select.c +10 -22
  53. data/ext/ca_obj_select_axis.c +27 -36
  54. data/ext/ca_obj_shift.c +22 -42
  55. data/ext/ca_obj_source.c +1 -5
  56. data/ext/ca_obj_stack.c +28 -24
  57. data/ext/ca_obj_stride.c +53 -54
  58. data/ext/ca_obj_string.c +6 -18
  59. data/ext/ca_obj_tile.c +12 -12
  60. data/ext/ca_obj_time.c +12 -23
  61. data/ext/ca_obj_timedelta.c +12 -23
  62. data/ext/ca_obj_transpose.c +8 -10
  63. data/ext/ca_obj_triop.c +35 -39
  64. data/ext/ca_obj_window.c +67 -86
  65. data/ext/ca_op_cmplx64.h +4 -0
  66. data/ext/ca_op_ipower.c +34 -12
  67. data/ext/ca_op_powi.h +4 -0
  68. data/ext/ca_pow5_table.h +2 -1
  69. data/ext/ca_rng_normal.h +4 -0
  70. data/ext/ca_rng_xoshiro256pp.h +3 -0
  71. data/ext/ca_sort_kernels.h +20 -26
  72. data/ext/ca_sweep_engine.c +2 -3
  73. data/ext/ca_sweep_engine.h +17 -9
  74. data/ext/ca_transform_common.c +3 -8
  75. data/ext/ca_triop_dispatch.h +20 -32
  76. data/ext/caframe_csv_reader.c +11 -11
  77. data/ext/carray.h +300 -1011
  78. data/ext/carray_access.c +234 -180
  79. data/ext/carray_address_basis.c +33 -38
  80. data/ext/carray_attribute.c +81 -104
  81. data/ext/carray_bincount.c +12 -14
  82. data/ext/carray_broadcast.c +30 -26
  83. data/ext/carray_call_cfunc.c +169 -277
  84. data/ext/carray_call_cfunc.h +36 -28
  85. data/ext/carray_cast.c +912 -346
  86. data/ext/carray_cast_func.rb +31 -3
  87. data/ext/carray_class.c +6 -11
  88. data/ext/carray_conversion.c +43 -38
  89. data/ext/carray_copy.c +28 -26
  90. data/ext/carray_core.c +217 -126
  91. data/ext/carray_count.c +27 -15
  92. data/ext/carray_element.c +40 -25
  93. data/ext/carray_factorize.c +53 -52
  94. data/ext/carray_generate.c +26 -19
  95. data/ext/carray_histogram.c +8 -10
  96. data/ext/carray_hold.c +7 -9
  97. data/ext/carray_index_classifier.c +123 -228
  98. data/ext/carray_index_classifier.h +11 -10
  99. data/ext/carray_integer_total.c +523 -0
  100. data/ext/carray_internal.h +1274 -160
  101. data/ext/carray_key_windows.c +3 -3
  102. data/ext/carray_lazy.c +21 -36
  103. data/ext/carray_loop.c +19 -22
  104. data/ext/carray_mask.c +123 -145
  105. data/ext/carray_math_kernel.h +23 -47
  106. data/ext/carray_mathfunc.c +10 -3
  107. data/ext/carray_median_percentile.c +95 -94
  108. data/ext/carray_memory_view.c +42 -47
  109. data/ext/carray_operator.c +423 -122
  110. data/ext/carray_order.c +121 -85
  111. data/ext/carray_partition.c +13 -15
  112. data/ext/carray_random.c +47 -41
  113. data/ext/carray_round.c +9 -4
  114. data/ext/carray_scatter.c +54 -40
  115. data/ext/carray_segment.c +41 -45
  116. data/ext/carray_slab.c +64 -47
  117. data/ext/carray_slab.h +44 -33
  118. data/ext/carray_sort.c +32 -29
  119. data/ext/carray_sort_kernel.c +12 -10
  120. data/ext/carray_struct.c +38 -43
  121. data/ext/carray_test.c +47 -43
  122. data/ext/carray_time_text.c +24 -31
  123. data/ext/carray_undef.c +50 -7
  124. data/ext/carray_utils.c +258 -94
  125. data/ext/extconf.rb +24 -17
  126. data/ext/mk_call_cfunc.rb +19 -20
  127. data/ext/mk_pow5_table.rb +2 -1
  128. data/ext/mkkernel.rb +782 -461
  129. data/ext/ruby_carray.c +47 -42
  130. data/ext/version.h +7 -5
  131. data/lib/carray/attribute.rb +19 -18
  132. data/lib/carray/autoload_carray.rb +20 -15
  133. data/lib/carray/autoload_method_extension.rb +64 -57
  134. data/lib/carray/axis_group.rb +264 -180
  135. data/lib/carray/basics.rb +272 -48
  136. data/lib/carray/bincount_nd.rb +33 -16
  137. data/lib/carray/block_iterator.rb +123 -102
  138. data/lib/carray/boolean_reduce.rb +7 -4
  139. data/lib/carray/categorical.rb +63 -51
  140. data/lib/carray/categorical_iterator.rb +89 -67
  141. data/lib/carray/complex.rb +61 -41
  142. data/lib/carray/conditional.rb +49 -22
  143. data/lib/carray/const_string.rb +54 -62
  144. data/lib/carray/core_extensions.rb +1 -1
  145. data/lib/carray/distance_limit.rb +7 -5
  146. data/lib/carray/factories.rb +269 -0
  147. data/lib/carray/fixlen_string.rb +25 -24
  148. data/lib/carray/frame/column_verbs.rb +20 -8
  149. data/lib/carray/frame/concat.rb +3 -3
  150. data/lib/carray/frame/convert.rb +2 -1
  151. data/lib/carray/frame/csv_parser.rb +7 -1
  152. data/lib/carray/frame/frame.rb +35 -25
  153. data/lib/carray/frame/group.rb +183 -150
  154. data/lib/carray/frame/io.rb +26 -7
  155. data/lib/carray/frame/join.rb +37 -12
  156. data/lib/carray/frame/records.rb +1 -1
  157. data/lib/carray/frame/reshape.rb +3 -3
  158. data/lib/carray/frame/sort.rb +10 -8
  159. data/lib/carray/frame/verbs.rb +148 -118
  160. data/lib/carray/frame/windows.rb +232 -21
  161. data/lib/carray/frame.rb +1 -2
  162. data/lib/carray/fuse_source.rb +24 -21
  163. data/lib/carray/fusion.rb +30 -30
  164. data/lib/carray/histogram.rb +35 -16
  165. data/lib/carray/inspect.rb +7 -7
  166. data/lib/carray/iterator.rb +97 -24
  167. data/lib/carray/key_windows.rb +83 -57
  168. data/lib/carray/lazy.rb +196 -94
  169. data/lib/carray/limits.rb +80 -0
  170. data/lib/carray/mask_gap_fill.rb +21 -16
  171. data/lib/carray/math.rb +87 -50
  172. data/lib/carray/meld_reduce.rb +30 -8
  173. data/lib/carray/methods/align_addr.rb +29 -17
  174. data/lib/carray/methods/bin.rb +5 -1
  175. data/lib/carray/methods/bincount.rb +4 -2
  176. data/lib/carray/methods/bit_string.rb +19 -31
  177. data/lib/carray/methods/broadcast.rb +8 -3
  178. data/lib/carray/methods/choose.rb +5 -5
  179. data/lib/carray/methods/composition.rb +72 -71
  180. data/lib/carray/methods/{index.rb → coordinate.rb} +13 -13
  181. data/lib/carray/methods/discovery_along.rb +3 -3
  182. data/lib/carray/methods/gather_nd.rb +106 -106
  183. data/lib/carray/methods/insert_block.rb +2 -2
  184. data/lib/carray/methods/is_between.rb +6 -4
  185. data/lib/carray/methods/is_in.rb +165 -145
  186. data/lib/carray/methods/join.rb +2 -1
  187. data/lib/carray/methods/lag.rb +6 -2
  188. data/lib/carray/methods/locate_addr.rb +150 -138
  189. data/lib/carray/methods/mask_duplicates.rb +1 -1
  190. data/lib/carray/methods/meshgrid.rb +28 -16
  191. data/lib/carray/methods/mode.rb +67 -67
  192. data/lib/carray/methods/nunique.rb +9 -7
  193. data/lib/carray/methods/repeat.rb +12 -12
  194. data/lib/carray/methods/resize.rb +1 -1
  195. data/lib/carray/methods/snap.rb +24 -20
  196. data/lib/carray/methods/string_format.rb +2 -2
  197. data/lib/carray/methods/unique.rb +4 -2
  198. data/lib/carray/methods/value_counts.rb +1 -1
  199. data/lib/carray/mkmf.rb +25 -28
  200. data/lib/carray/percentile_arguments.rb +82 -0
  201. data/lib/carray/record_order.rb +18 -17
  202. data/lib/carray/rng.rb +1 -0
  203. data/lib/carray/runtime.rb +190 -22
  204. data/lib/carray/segment_iterator.rb +251 -129
  205. data/lib/carray/serialize.rb +618 -571
  206. data/lib/carray/slab_iterator.rb +114 -114
  207. data/lib/carray/stack.rb +11 -12
  208. data/lib/carray/string.rb +16 -22
  209. data/lib/carray/string_operation_extension.rb +76 -52
  210. data/lib/carray/struct.rb +122 -164
  211. data/lib/carray/struct_builder.rb +243 -72
  212. data/lib/carray/time.rb +496 -342
  213. data/lib/carray/window_iterator.rb +191 -150
  214. data/lib/carray.rb +6 -11
  215. data/yard-stubs/ca_obj_array.rb +20 -135
  216. data/yard-stubs/ca_obj_bitarray.rb +1 -8
  217. data/yard-stubs/ca_obj_bitfield.rb +4 -3
  218. data/yard-stubs/ca_obj_byte_swap.rb +21 -7
  219. data/yard-stubs/ca_obj_fake.rb +3 -1
  220. data/yard-stubs/ca_obj_farray.rb +1 -1
  221. data/yard-stubs/ca_obj_field.rb +8 -6
  222. data/yard-stubs/ca_obj_refer.rb +7 -5
  223. data/yard-stubs/ca_obj_roll.rb +7 -6
  224. data/yard-stubs/ca_obj_shift.rb +2 -3
  225. data/yard-stubs/ca_obj_stride.rb +5 -7
  226. data/yard-stubs/ca_obj_tile.rb +1 -1
  227. data/yard-stubs/ca_obj_time.rb +43 -0
  228. data/yard-stubs/ca_obj_transpose.rb +1 -1
  229. data/yard-stubs/ca_obj_window.rb +26 -15
  230. data/yard-stubs/carray_access.rb +51 -4
  231. data/yard-stubs/carray_attribute.rb +26 -38
  232. data/yard-stubs/carray_cast.rb +118 -165
  233. data/yard-stubs/carray_class.rb +3 -4
  234. data/yard-stubs/carray_conversion.rb +6 -7
  235. data/yard-stubs/carray_copy.rb +2 -1
  236. data/yard-stubs/carray_count.rb +5 -3
  237. data/yard-stubs/carray_element.rb +4 -3
  238. data/yard-stubs/carray_limits.rb +100 -0
  239. data/yard-stubs/carray_loop.rb +0 -20
  240. data/yard-stubs/carray_mask.rb +59 -41
  241. data/yard-stubs/carray_math.rb +157 -100
  242. data/yard-stubs/carray_mathfunc.rb +415 -3
  243. data/yard-stubs/carray_median_percentile.rb +29 -11
  244. data/yard-stubs/carray_memory_view.rb +2 -2
  245. data/yard-stubs/carray_order.rb +67 -34
  246. data/yard-stubs/carray_random.rb +6 -6
  247. data/yard-stubs/carray_reduce.rb +353 -0
  248. data/yard-stubs/carray_rng.rb +92 -0
  249. data/yard-stubs/carray_scatter.rb +10 -2
  250. data/yard-stubs/carray_slab.rb +7 -4
  251. data/yard-stubs/carray_sort.rb +7 -6
  252. data/yard-stubs/carray_undef.rb +44 -5
  253. data/yard-stubs/ruby_carray.rb +75 -40
  254. metadata +62 -24
  255. data/CHANGELOG.v1.md +0 -126
  256. data/ext/carray_build_flags.h +0 -3
  257. data/ext/carray_config.h +0 -28
  258. data/ext/carray_data_type.c +0 -90
  259. data/ext/carray_kernels_bincmp.c +0 -6457
  260. data/ext/carray_kernels_binop.c +0 -31534
  261. data/ext/carray_kernels_init.c +0 -1734
  262. data/ext/carray_kernels_moncmp.c +0 -2104
  263. data/ext/carray_kernels_monop.c +0 -25337
  264. data/ext/carray_kernels_reduce_aggregate.c +0 -27545
  265. data/ext/carray_kernels_reduce_boolean.c +0 -1924
  266. data/ext/carray_kernels_reduce_cumulative.c +0 -11646
  267. data/ext/carray_kernels_reduce_extreme.c +0 -21631
  268. data/ext/carray_kernels_reduce_variance.c +0 -5981
  269. data/ext/carray_kernels_scan.c +0 -4302
  270. data/ext/carray_kernels_search.c +0 -37776
  271. data/ext/carray_kernels_sort.c +0 -10814
  272. data/ext/carray_kernels_triop.c +0 -1864
  273. data/lib/carray/construct.rb +0 -360
  274. data/lib/carray/data_type_extension.rb +0 -262
  275. data/lib/carray/data_type_limits.rb +0 -91
@@ -3,11 +3,21 @@
3
3
  # ext/carray_mathfunc.c. Most CAMath entries (atan2 / hypot / expm1
4
4
  # / log1p / copysign / logaddexp / nextafter / fmod / min / max) live
5
5
  # in lib/carray/math.rb and are documented at the source. This file
6
- # covers only the C-defined module functions.
6
+ # covers only the C-defined module functions, the one-argument ones
7
+ # (ext/mkkernel.rb defines them beside the array methods) among them.
7
8
  # See yard-stubs/README.md and yard-stubs/STYLE.md.
8
9
 
9
- # Namespace for math module functions that operate on CArray (and
10
- # auto-wrappable scalar) inputs.
10
+ # Namespace for math module functions over CArrays.
11
+ #
12
+ # A one-argument function (`CAMath.sqrt`, `CAMath.abs`, `CAMath.sign`, ...)
13
+ # given a CArray answers through the array's method (`CAMath.abs(a)` is
14
+ # `a.abs`). Given a number, it answers as it answers for an array of that
15
+ # number, and returns the one cell as a Ruby value: an Integer in the int64
16
+ # range is read as int64, a Float as float64, a Complex as cmplx128, and
17
+ # any other number (a larger Integer, a Rational) as an object cell. So
18
+ # `CAMath.abs(-2.5)` is `2.5`, `CAMath.sqrt(-1.0)` is NaN, and
19
+ # `CAMath.floor(2.7)` is `2.0`. A Ruby Array, a Range and an object that
20
+ # is not a number are refused with TypeError.
11
21
  module CAMath
12
22
  module_function
13
23
 
@@ -42,4 +52,406 @@ module CAMath
42
52
  # @return [CArray]
43
53
  # @raise [RuntimeError] when the build lacks `lgamma`.
44
54
  def lgamma(x); end
55
+
56
+ # @!group One-argument functions
57
+
58
+ # @overload zero(x)
59
+ # Returns zero in the type of `x`. The types and the special values are
60
+ # those of {CArray#zero}.
61
+ # @param x [CArray, Numeric]
62
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
63
+ # for a number.
64
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
65
+ def zero(x); end
66
+
67
+ # @overload one(x)
68
+ # Returns one in the type of `x`. The types and the special values are
69
+ # those of {CArray#one}.
70
+ # @param x [CArray, Numeric]
71
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
72
+ # for a number.
73
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
74
+ def one(x); end
75
+
76
+ # @overload neg(x)
77
+ # Returns `x` negated. The types and the special values are those of
78
+ # {CArray#neg}.
79
+ # @param x [CArray, Numeric]
80
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
81
+ # for a number.
82
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
83
+ def neg(x); end
84
+
85
+ # @overload abs(x)
86
+ # Returns the magnitude of `x`. The types and the special values are
87
+ # those of {CArray#abs}.
88
+ # @param x [CArray, Numeric]
89
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
90
+ # for a number.
91
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
92
+ def abs(x); end
93
+
94
+ # @overload abs2(x)
95
+ # Returns the squared magnitude of `x`. The types and the special values
96
+ # are those of {CArray#abs2}.
97
+ # @param x [CArray, Numeric]
98
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
99
+ # for a number.
100
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
101
+ def abs2(x); end
102
+
103
+ # @overload sign(x)
104
+ # Returns `-1`, `0` or `1` by the sign of `x`, in the type of `x`. The
105
+ # types and the special values are those of {CArray#sign}.
106
+ # @param x [CArray, Numeric]
107
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
108
+ # for a number.
109
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
110
+ def sign(x); end
111
+
112
+ # @overload square(x)
113
+ # Returns `x * x`. The types and the special values are those of
114
+ # {CArray#square}.
115
+ # @param x [CArray, Numeric]
116
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
117
+ # for a number.
118
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
119
+ def square(x); end
120
+
121
+ # @overload rcp(x)
122
+ # Returns the reciprocal `1 / x`, in the type of `x`. The types and the
123
+ # special values are those of {CArray#rcp}.
124
+ # @param x [CArray, Numeric]
125
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
126
+ # for a number.
127
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
128
+ def rcp(x); end
129
+
130
+ # @overload sqrt(x)
131
+ # Returns the square root of `x`. The types and the special values are
132
+ # those of {CArray#sqrt}.
133
+ # @param x [CArray, Numeric]
134
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
135
+ # for a number.
136
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
137
+ def sqrt(x); end
138
+
139
+ # @overload rsqrt(x)
140
+ # Returns the reciprocal square root `1 / sqrt(x)`. The types and the
141
+ # special values are those of {CArray#rsqrt}.
142
+ # @param x [CArray, Numeric]
143
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
144
+ # for a number.
145
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
146
+ def rsqrt(x); end
147
+
148
+ # @overload conj(x)
149
+ # Returns the complex conjugate of `x`. The types and the special values
150
+ # are those of {CArray#conj}.
151
+ # @param x [CArray, Numeric]
152
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
153
+ # for a number.
154
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
155
+ def conj(x); end
156
+
157
+ # @overload arg(x)
158
+ # Returns the argument (phase angle, in radians) of `x`, in `(-pi, pi]`.
159
+ # The types and the special values are those of {CArray#arg}.
160
+ # @param x [CArray, Numeric]
161
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
162
+ # for a number.
163
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
164
+ def arg(x); end
165
+
166
+ # @overload bit_neg(x)
167
+ # Returns the complement of `x`: a bitwise NOT for an integer. The types
168
+ # and the special values are those of {CArray#bit_neg}.
169
+ # @param x [CArray, Numeric]
170
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
171
+ # for a number.
172
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
173
+ def bit_neg(x); end
174
+
175
+ # @overload not(x)
176
+ # Returns the logical negation of a boolean array `x`, as {CArray#not}
177
+ # does.
178
+ # @param x [CArray] a boolean array.
179
+ # @return [CArray]
180
+ # @raise [CArray::DataTypeError] when `x` is not boolean.
181
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
182
+ def not(x); end
183
+
184
+ # @overload floor(x)
185
+ # Returns the largest integral value not greater than `x`, in the type
186
+ # of `x`. The types and the special values are those of {CArray#floor}.
187
+ # @param x [CArray, Numeric]
188
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
189
+ # for a number.
190
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
191
+ def floor(x); end
192
+
193
+ # @overload ceil(x)
194
+ # Returns the smallest integral value not less than `x`, in the type of
195
+ # `x`. The types and the special values are those of {CArray#ceil}.
196
+ # @param x [CArray, Numeric]
197
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
198
+ # for a number.
199
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
200
+ def ceil(x); end
201
+
202
+ # @overload round(x)
203
+ # Returns `x` rounded to the nearest integral value, half away from
204
+ # zero, in the type of `x`. The types and the special values are those
205
+ # of {CArray#round}.
206
+ # @param x [CArray, Numeric]
207
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
208
+ # for a number.
209
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
210
+ def round(x); end
211
+
212
+ # @overload trunc(x)
213
+ # Returns `x` with its fractional part removed, in the type of `x`. The
214
+ # types and the special values are those of {CArray#trunc}.
215
+ # @param x [CArray, Numeric]
216
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
217
+ # for a number.
218
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
219
+ def trunc(x); end
220
+
221
+ # @overload frac(x)
222
+ # Returns the fractional part of `x`, with the sign of `x`. The types
223
+ # and the special values are those of {CArray#frac}.
224
+ # @param x [CArray, Numeric]
225
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
226
+ # for a number.
227
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
228
+ def frac(x); end
229
+
230
+ # @overload exp(x)
231
+ # Returns `e` raised to `x`. The types and the special values are those
232
+ # of {CArray#exp}.
233
+ # @param x [CArray, Numeric]
234
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
235
+ # for a number.
236
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
237
+ def exp(x); end
238
+
239
+ # @overload exp2(x)
240
+ # Returns `2` raised to `x`. The types and the special values are those
241
+ # of {CArray#exp2}.
242
+ # @param x [CArray, Numeric]
243
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
244
+ # for a number.
245
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
246
+ def exp2(x); end
247
+
248
+ # @overload exp10(x)
249
+ # Returns `10` raised to `x`. The types and the special values are those
250
+ # of {CArray#exp10}.
251
+ # @param x [CArray, Numeric]
252
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
253
+ # for a number.
254
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
255
+ def exp10(x); end
256
+
257
+ # @overload log(x)
258
+ # Returns the natural logarithm of `x`. The types and the special values
259
+ # are those of {CArray#log}.
260
+ # @param x [CArray, Numeric]
261
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
262
+ # for a number.
263
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
264
+ def log(x); end
265
+
266
+ # @overload log2(x)
267
+ # Returns the base-2 logarithm of `x`. The types and the special values
268
+ # are those of {CArray#log2}.
269
+ # @param x [CArray, Numeric]
270
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
271
+ # for a number.
272
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
273
+ def log2(x); end
274
+
275
+ # @overload log10(x)
276
+ # Returns the base-10 logarithm of `x`. The types and the special values
277
+ # are those of {CArray#log10}.
278
+ # @param x [CArray, Numeric]
279
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
280
+ # for a number.
281
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
282
+ def log10(x); end
283
+
284
+ # @overload logb(x)
285
+ # Returns the exponent of `x` in the floating-point radix, as a
286
+ # floating-point value. The types and the special values are those of
287
+ # {CArray#logb}.
288
+ # @param x [CArray, Numeric]
289
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
290
+ # for a number.
291
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
292
+ def logb(x); end
293
+
294
+ # @overload sin(x)
295
+ # Returns the sine of `x`, taken in radians. The types and the special
296
+ # values are those of {CArray#sin}.
297
+ # @param x [CArray, Numeric]
298
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
299
+ # for a number.
300
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
301
+ def sin(x); end
302
+
303
+ # @overload cos(x)
304
+ # Returns the cosine of `x`, taken in radians. The types and the special
305
+ # values are those of {CArray#cos}.
306
+ # @param x [CArray, Numeric]
307
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
308
+ # for a number.
309
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
310
+ def cos(x); end
311
+
312
+ # @overload tan(x)
313
+ # Returns the tangent of `x`, taken in radians. The types and the
314
+ # special values are those of {CArray#tan}.
315
+ # @param x [CArray, Numeric]
316
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
317
+ # for a number.
318
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
319
+ def tan(x); end
320
+
321
+ # @overload asin(x)
322
+ # Returns the arc sine of `x`, in radians. The types and the special
323
+ # values are those of {CArray#asin}.
324
+ # @param x [CArray, Numeric]
325
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
326
+ # for a number.
327
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
328
+ def asin(x); end
329
+
330
+ # @overload acos(x)
331
+ # Returns the arc cosine of `x`, in radians. The types and the special
332
+ # values are those of {CArray#acos}.
333
+ # @param x [CArray, Numeric]
334
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
335
+ # for a number.
336
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
337
+ def acos(x); end
338
+
339
+ # @overload atan(x)
340
+ # Returns the arc tangent of `x`, in radians. The types and the special
341
+ # values are those of {CArray#atan}.
342
+ # @param x [CArray, Numeric]
343
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
344
+ # for a number.
345
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
346
+ def atan(x); end
347
+
348
+ # @overload sinh(x)
349
+ # Returns the hyperbolic sine of `x`. The types and the special values
350
+ # are those of {CArray#sinh}.
351
+ # @param x [CArray, Numeric]
352
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
353
+ # for a number.
354
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
355
+ def sinh(x); end
356
+
357
+ # @overload cosh(x)
358
+ # Returns the hyperbolic cosine of `x`. The types and the special values
359
+ # are those of {CArray#cosh}.
360
+ # @param x [CArray, Numeric]
361
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
362
+ # for a number.
363
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
364
+ def cosh(x); end
365
+
366
+ # @overload tanh(x)
367
+ # Returns the hyperbolic tangent of `x`. The types and the special
368
+ # values are those of {CArray#tanh}.
369
+ # @param x [CArray, Numeric]
370
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
371
+ # for a number.
372
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
373
+ def tanh(x); end
374
+
375
+ # @overload asinh(x)
376
+ # Returns the inverse hyperbolic sine of `x`. The types and the special
377
+ # values are those of {CArray#asinh}.
378
+ # @param x [CArray, Numeric]
379
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
380
+ # for a number.
381
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
382
+ def asinh(x); end
383
+
384
+ # @overload acosh(x)
385
+ # Returns the inverse hyperbolic cosine of `x`. The types and the
386
+ # special values are those of {CArray#acosh}.
387
+ # @param x [CArray, Numeric]
388
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
389
+ # for a number.
390
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
391
+ def acosh(x); end
392
+
393
+ # @overload atanh(x)
394
+ # Returns the inverse hyperbolic tangent of `x`. The types and the
395
+ # special values are those of {CArray#atanh}.
396
+ # @param x [CArray, Numeric]
397
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
398
+ # for a number.
399
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
400
+ def atanh(x); end
401
+
402
+ # @overload rad(x)
403
+ # Returns `x` converted from degrees to radians. The types and the
404
+ # special values are those of {CArray#rad}.
405
+ # @param x [CArray, Numeric]
406
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
407
+ # for a number.
408
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
409
+ def rad(x); end
410
+
411
+ # @overload deg(x)
412
+ # Returns `x` converted from radians to degrees. The types and the
413
+ # special values are those of {CArray#deg}.
414
+ # @param x [CArray, Numeric]
415
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
416
+ # for a number.
417
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
418
+ def deg(x); end
419
+
420
+ # @overload deg_360(x)
421
+ # Returns `x`, taken in degrees, wrapped into `[0, 360)`. The types and
422
+ # the special values are those of {CArray#deg_360}.
423
+ # @param x [CArray, Numeric]
424
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
425
+ # for a number.
426
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
427
+ def deg_360(x); end
428
+
429
+ # @overload deg_180(x)
430
+ # Returns `x`, taken in degrees, wrapped into `(-180, 180]`. The types
431
+ # and the special values are those of {CArray#deg_180}.
432
+ # @param x [CArray, Numeric]
433
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
434
+ # for a number.
435
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
436
+ def deg_180(x); end
437
+
438
+ # @overload rad_2pi(x)
439
+ # Returns `x`, taken in radians, wrapped into `[0, 2*pi)`. The types and
440
+ # the special values are those of {CArray#rad_2pi}.
441
+ # @param x [CArray, Numeric]
442
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
443
+ # for a number.
444
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
445
+ def rad_2pi(x); end
446
+
447
+ # @overload rad_pi(x)
448
+ # Returns `x`, taken in radians, wrapped into `(-pi, pi]`. The types and
449
+ # the special values are those of {CArray#rad_pi}.
450
+ # @param x [CArray, Numeric]
451
+ # @return [CArray, Object] a CArray for a CArray, one Ruby value
452
+ # for a number.
453
+ # @raise [TypeError] when `x` is neither a CArray nor a number.
454
+ def rad_pi(x); end
455
+
456
+ # @!endgroup
45
457
  end
@@ -46,13 +46,25 @@ class CArray
46
46
  # Returns percentile values at each `p` (each in `[0, 100]`)
47
47
  # along `axis` or over all elements.
48
48
  #
49
- # `p` may be given as individual positional arguments, a single
50
- # `Array<Numeric>`, or a single 1-D `CArray`. When the effective
51
- # `p` count (after flattening) is 1, the result is unwrapped:
52
- # flat form returns a `Float`, per-axis form returns a `CArray`
53
- # (a bare value along the only axis of a 1-D array, as {#median}).
54
- # With 2 or more `p` values the result is an `Array` whose length
55
- # matches the number of requested `p` values.
49
+ # The form in which `p` is given decides the form of the result.
50
+ # Below, "one answer" is what one `p` gives: a `Float` (or the
51
+ # element, for an object array) over all elements, and the reduced
52
+ # `CArray` along `axis` (a bare value along the only axis of a 1-D
53
+ # array, as {#median}).
54
+ #
55
+ # - one Numeric, `percentile(50)`: one answer. A `CScalar` is one
56
+ # Numeric here, as it is to an operator.
57
+ # - one `Array`, `percentile([25, 75])`: an `Array` with one answer
58
+ # per `p`, also when the Array has one element. Use this form when
59
+ # the number of `p` values is not fixed.
60
+ # - one `CArray` that is not a `CScalar`, `percentile(ps)`: one `CArray` of shape
61
+ # `ps.shape + ` the shape of one answer.
62
+ # - several Numerics, `percentile(25, 75)`: one `CArray` of shape
63
+ # `[2] + ` the shape of one answer. `r[0, ...]` is the answer for
64
+ # the first `p`.
65
+ #
66
+ # An `Array` or a `CArray` cannot be given together with other `p`
67
+ # values.
56
68
  #
57
69
  # `method` picks the interpolation rule between adjacent order
58
70
  # statistics:
@@ -85,23 +97,29 @@ class CArray
85
97
  # @param method [Symbol] one of `:linear`, `:lower`, `:higher`,
86
98
  # `:nearest`, `:midpoint`.
87
99
  # @param keep_axis [Boolean]
88
- # @return [Float, CArray, Object, Array<Float>, Array<CArray>, Array<Object>]
100
+ # @return [Float, Object, CArray, Array<Float>, Array<CArray>, Array<Object>]
101
+ # one answer for one Numeric `p`, an `Array` for an `Array` of `p`,
102
+ # and a `CArray` for several `p` or a `CArray` of `p`.
89
103
  # @raise [CArray::DataTypeError] for fixlen data_type, or when an
90
104
  # interpolating `method` is asked to interpolate between objects
91
105
  # that have no arithmetic.
92
106
  # @raise [ArgumentError] on empty `p` list, `p` outside `[0, 100]`,
93
- # empty axis, unknown `method`, or invalid option combinations.
107
+ # an `Array` or `CArray` of `p` given with other `p` values, a
108
+ # `CArray` of `p` with masked elements, empty axis, unknown
109
+ # `method`, or invalid option combinations.
94
110
  def percentile(*); end
95
111
 
96
- # @overload quantile(axis: nil, keep_axis: false)
112
+ # @overload quantile(axis: nil, keep_axis: false, min_count: nil, fill_value: nil)
97
113
  # Returns the five quartile percentiles
98
114
  # `[p0, p25, p50, p75, p100]` — shorthand for
99
- # `percentile(0, 25, 50, 75, 100, axis: axis, keep_axis: keep_axis)`.
115
+ # `percentile([0, 25, 50, 75, 100], ...)` with the same keywords.
100
116
  # Accepts no positional arguments. Flat form returns
101
117
  # `Array<Float>` of length 5; per-axis form returns `Array<CArray>`
102
118
  # of length 5, each CArray reduced along `axis`.
103
119
  # @param axis [Integer, nil]
104
120
  # @param keep_axis [Boolean]
121
+ # @param min_count [Integer, nil] as for {#percentile}.
122
+ # @param fill_value [Object, nil] as for {#percentile}.
105
123
  # @return [Array<Float>, Array<CArray>]
106
124
  # @raise [ArgumentError] on any positional argument.
107
125
  def quantile(*); end
@@ -63,7 +63,7 @@ class CArray
63
63
  # The result is a plain `CArray` whatever the receiver; a
64
64
  # receiver other than `CArray` or a `CAWrap` raises `TypeError`.
65
65
  # @param src [Object] any MemoryView producer.
66
- # @param data_type [Symbol, Integer, Class, nil] target data
66
+ # @param data_type [Symbol, nil] target data
67
67
  # type. Required for typeless producers; optional (must match
68
68
  # producer format) for typed ones.
69
69
  # @param mask [Object, nil] optional paired mask MemoryView
@@ -143,7 +143,7 @@ class CArray
143
143
  # algebra. For semantic identity that does survive it, see
144
144
  # {file:docs/topics/CAFace.md CAFace}.
145
145
  # @param src [Object] any MemoryView producer.
146
- # @param data_type [Symbol, Integer, Class, nil] target data
146
+ # @param data_type [Symbol, nil] target data
147
147
  # type, same rules as {.from_memory_view}.
148
148
  # @param mask [Object, nil] optional paired mask MemoryView
149
149
  # source.