carray 3.0.1 → 3.0.3

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 (229) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +824 -0
  3. data/README.md +5 -6
  4. data/carray.gemspec +1 -1
  5. data/ext/ca_axis_dispatch.c +258 -4
  6. data/ext/ca_axis_group.c +368 -184
  7. data/ext/ca_binop_dispatch.c +54 -32
  8. data/ext/ca_binop_dispatch.h +1 -0
  9. data/ext/ca_categorical_iterator.c +90 -41
  10. data/ext/ca_compare.c +8 -2
  11. data/ext/ca_for_buffer.h +21 -68
  12. data/ext/ca_group_iter.c +27 -11
  13. data/ext/ca_kernel_iterator.c +960 -245
  14. data/ext/ca_kernel_iterator.h +352 -181
  15. data/ext/ca_monop_dispatch.c +4 -4
  16. data/ext/ca_monop_dispatch.h +4 -0
  17. data/ext/ca_obj_array.c +194 -42
  18. data/ext/ca_obj_bincmp.c +152 -121
  19. data/ext/ca_obj_binop.c +107 -210
  20. data/ext/ca_obj_bitarray.c +37 -24
  21. data/ext/ca_obj_bitfield.c +95 -62
  22. data/ext/ca_obj_block.c +5 -4
  23. data/ext/ca_obj_byte_swap.c +40 -40
  24. data/ext/ca_obj_const_string.c +180 -50
  25. data/ext/ca_obj_face.c +428 -62
  26. data/ext/ca_obj_face.h +107 -47
  27. data/ext/ca_obj_fake.c +21 -50
  28. data/ext/ca_obj_farray.c +1 -0
  29. data/ext/ca_obj_field.c +16 -3
  30. data/ext/ca_obj_fixlen_string.c +39 -26
  31. data/ext/ca_obj_grid.c +181 -124
  32. data/ext/ca_obj_meld.c +235 -55
  33. data/ext/ca_obj_moncmp.c +61 -61
  34. data/ext/ca_obj_monop.c +125 -107
  35. data/ext/ca_obj_object.c +551 -233
  36. data/ext/ca_obj_record.c +51 -16
  37. data/ext/ca_obj_reduce.c +5 -8
  38. data/ext/ca_obj_refer.c +117 -33
  39. data/ext/ca_obj_remap.c +57 -17
  40. data/ext/ca_obj_repeat.c +21 -5
  41. data/ext/ca_obj_roll.c +115 -11
  42. data/ext/ca_obj_select.c +88 -75
  43. data/ext/ca_obj_select_axis.c +58 -60
  44. data/ext/ca_obj_shift.c +22 -102
  45. data/ext/ca_obj_stack.c +223 -123
  46. data/ext/ca_obj_stride.c +267 -35
  47. data/ext/ca_obj_string.c +25 -22
  48. data/ext/ca_obj_tile.c +32 -16
  49. data/ext/ca_obj_time.c +23 -25
  50. data/ext/ca_obj_timedelta.c +21 -23
  51. data/ext/ca_obj_transpose.c +12 -3
  52. data/ext/ca_obj_triop.c +110 -117
  53. data/ext/ca_obj_window.c +157 -29
  54. data/ext/ca_op_ipower.c +25 -13
  55. data/ext/ca_op_powi.h +57 -30
  56. data/ext/ca_pow5_table.h +656 -0
  57. data/ext/ca_rng_normal.h +42 -0
  58. data/ext/ca_rng_xoshiro256pp.h +105 -0
  59. data/ext/ca_sort_kernels.h +70 -0
  60. data/ext/ca_sweep_engine.c +385 -198
  61. data/ext/ca_sweep_engine.h +31 -23
  62. data/ext/ca_triop_dispatch.c +4 -1
  63. data/ext/ca_triop_dispatch.h +5 -2
  64. data/ext/caframe_csv_reader.c +463 -0
  65. data/ext/carray.h +90 -28
  66. data/ext/carray_access.c +487 -231
  67. data/ext/carray_address_basis.c +731 -0
  68. data/ext/carray_attribute.c +45 -3
  69. data/ext/carray_bincount.c +32 -2
  70. data/ext/carray_broadcast.c +49 -17
  71. data/ext/carray_call_cfunc.c +667 -511
  72. data/ext/carray_cast.c +1556 -247
  73. data/ext/carray_cast_func.rb +34 -21
  74. data/ext/carray_conversion.c +197 -73
  75. data/ext/carray_copy.c +84 -38
  76. data/ext/carray_core.c +591 -119
  77. data/ext/carray_count.c +148 -96
  78. data/ext/carray_element.c +18 -27
  79. data/ext/carray_factorize.c +604 -291
  80. data/ext/carray_generate.c +76 -40
  81. data/ext/carray_histogram.c +152 -94
  82. data/ext/carray_hold.c +2 -1
  83. data/ext/carray_index_classifier.c +63 -96
  84. data/ext/carray_internal.h +400 -1
  85. data/ext/carray_lazy.c +834 -79
  86. data/ext/carray_loop.c +88 -66
  87. data/ext/carray_mask.c +705 -324
  88. data/ext/carray_math_kernel.h +1 -0
  89. data/ext/carray_median_percentile.c +263 -63
  90. data/ext/carray_memory_view.c +254 -248
  91. data/ext/carray_operator.c +1093 -363
  92. data/ext/carray_order.c +133 -69
  93. data/ext/carray_partition.c +102 -56
  94. data/ext/carray_random.c +582 -204
  95. data/ext/carray_scatter.c +308 -65
  96. data/ext/carray_segment.c +257 -0
  97. data/ext/carray_slab.c +183 -70
  98. data/ext/carray_sort.c +235 -240
  99. data/ext/carray_sort_kernel.c +8 -1
  100. data/ext/carray_struct.c +99 -21
  101. data/ext/carray_test.c +167 -64
  102. data/ext/carray_time_text.c +1182 -0
  103. data/ext/carray_utils.c +363 -98
  104. data/ext/extconf.rb +27 -2
  105. data/ext/mk_call_cfunc.rb +103 -118
  106. data/ext/mk_pow5_table.rb +35 -0
  107. data/ext/mkkernel.rb +1349 -851
  108. data/ext/ruby_carray.c +17 -2
  109. data/ext/version.h +4 -4
  110. data/ext/version.rb +4 -2
  111. data/lib/carray/attribute.rb +39 -0
  112. data/lib/carray/autoload_carray.rb +24 -3
  113. data/lib/carray/autoload_method_extension.rb +18 -0
  114. data/lib/carray/axis_group.rb +245 -20
  115. data/lib/carray/basics.rb +95 -25
  116. data/lib/carray/bincount_nd.rb +6 -0
  117. data/lib/carray/block_iterator.rb +200 -54
  118. data/lib/carray/boolean_reduce.rb +21 -29
  119. data/lib/carray/categorical.rb +244 -59
  120. data/lib/carray/categorical_iterator.rb +391 -757
  121. data/lib/carray/complex.rb +36 -29
  122. data/lib/carray/conditional.rb +94 -7
  123. data/lib/carray/const_string.rb +177 -27
  124. data/lib/carray/construct.rb +40 -0
  125. data/lib/carray/data_type_extension.rb +3 -0
  126. data/lib/carray/data_type_limits.rb +91 -0
  127. data/lib/carray/fixlen_string.rb +1 -1
  128. data/lib/carray/frame/concat.rb +157 -6
  129. data/lib/carray/frame/convert.rb +13 -7
  130. data/lib/carray/frame/csv_parser.rb +590 -76
  131. data/lib/carray/frame/describe.rb +79 -0
  132. data/lib/carray/frame/frame.rb +205 -35
  133. data/lib/carray/frame/group.rb +199 -40
  134. data/lib/carray/frame/io.rb +452 -60
  135. data/lib/carray/frame/join.rb +134 -46
  136. data/lib/carray/frame/records.rb +54 -19
  137. data/lib/carray/frame/reshape.rb +448 -0
  138. data/lib/carray/frame/sort.rb +26 -2
  139. data/lib/carray/frame/verbs.rb +726 -56
  140. data/lib/carray/frame.rb +2 -0
  141. data/lib/carray/fuse_source.rb +111 -2
  142. data/lib/carray/fusion.rb +229 -38
  143. data/lib/carray/inspect.rb +71 -20
  144. data/lib/carray/iterator.rb +157 -2
  145. data/lib/carray/lazy.rb +54 -67
  146. data/lib/carray/mask_gap_fill.rb +66 -50
  147. data/lib/carray/math.rb +32 -19
  148. data/lib/carray/meld_reduce.rb +40 -7
  149. data/lib/carray/methods/align_addr.rb +8 -4
  150. data/lib/carray/methods/bincount.rb +2 -2
  151. data/lib/carray/methods/bit_string.rb +14 -3
  152. data/lib/carray/methods/composition.rb +16 -10
  153. data/lib/carray/methods/discovery_along.rb +74 -0
  154. data/lib/carray/methods/factorize.rb +50 -0
  155. data/lib/carray/methods/gather_nd.rb +13 -2
  156. data/lib/carray/methods/insert_block.rb +9 -14
  157. data/lib/carray/methods/is_in.rb +130 -6
  158. data/lib/carray/methods/join.rb +1 -1
  159. data/lib/carray/methods/locate_addr.rb +235 -21
  160. data/lib/carray/methods/mask_duplicates.rb +35 -1
  161. data/lib/carray/methods/mode.rb +18 -1
  162. data/lib/carray/methods/nunique.rb +22 -1
  163. data/lib/carray/methods/repeat.rb +91 -0
  164. data/lib/carray/methods/resize.rb +21 -23
  165. data/lib/carray/methods/snap.rb +34 -12
  166. data/lib/carray/methods/unique.rb +52 -3
  167. data/lib/carray/record_order.rb +208 -0
  168. data/lib/carray/rng.rb +86 -0
  169. data/lib/carray/runtime.rb +14 -11
  170. data/lib/carray/segment_iterator.rb +990 -0
  171. data/lib/carray/serialize.rb +197 -27
  172. data/lib/carray/slab_iterator.rb +109 -40
  173. data/lib/carray/stack.rb +10 -4
  174. data/lib/carray/string_operation_extension.rb +9 -4
  175. data/lib/carray/struct.rb +142 -51
  176. data/lib/carray/struct_builder.rb +110 -14
  177. data/lib/carray/table.rb +2 -2
  178. data/lib/carray/time.rb +535 -105
  179. data/lib/carray/window_iterator.rb +259 -82
  180. data/lib/carray.rb +4 -2
  181. data/yard-stubs/ca_obj_array.rb +4 -4
  182. data/yard-stubs/ca_obj_bitarray.rb +7 -0
  183. data/yard-stubs/ca_obj_bitfield.rb +23 -12
  184. data/yard-stubs/ca_obj_block.rb +2 -7
  185. data/yard-stubs/ca_obj_fake.rb +1 -1
  186. data/yard-stubs/ca_obj_field.rb +1 -1
  187. data/yard-stubs/ca_obj_refer.rb +3 -3
  188. data/yard-stubs/ca_obj_roll.rb +0 -1
  189. data/yard-stubs/ca_obj_stride.rb +10 -7
  190. data/yard-stubs/ca_obj_transpose.rb +1 -1
  191. data/yard-stubs/ca_obj_window.rb +11 -4
  192. data/yard-stubs/carray_access.rb +6 -5
  193. data/yard-stubs/carray_broadcast.rb +2 -2
  194. data/yard-stubs/carray_cast.rb +78 -43
  195. data/yard-stubs/carray_conversion.rb +13 -1
  196. data/yard-stubs/carray_copy.rb +8 -3
  197. data/yard-stubs/carray_core.rb +3 -83
  198. data/yard-stubs/carray_count.rb +16 -2
  199. data/yard-stubs/carray_lazy.rb +210 -1
  200. data/yard-stubs/carray_loop.rb +4 -1
  201. data/yard-stubs/carray_mask.rb +34 -10
  202. data/yard-stubs/carray_math.rb +1499 -4
  203. data/yard-stubs/carray_median_percentile.rb +26 -8
  204. data/yard-stubs/carray_order.rb +43 -82
  205. data/yard-stubs/carray_scatter.rb +10 -3
  206. data/yard-stubs/carray_segment.rb +72 -0
  207. data/yard-stubs/carray_slab.rb +11 -8
  208. data/yard-stubs/carray_sort.rb +50 -8
  209. data/yard-stubs/carray_test.rb +10 -0
  210. data/yard-stubs/carray_utils.rb +0 -26
  211. metadata +19 -19
  212. data/ext/ca_for_each_element.h +0 -239
  213. data/ext/carray_build_flags.h +0 -3
  214. data/ext/carray_config.h +0 -28
  215. data/ext/carray_kernels_bincmp.c +0 -4446
  216. data/ext/carray_kernels_binop.c +0 -11001
  217. data/ext/carray_kernels_init.c +0 -1131
  218. data/ext/carray_kernels_map.c +0 -3467
  219. data/ext/carray_kernels_moncmp.c +0 -2097
  220. data/ext/carray_kernels_monop.c +0 -18313
  221. data/ext/carray_kernels_reduce_aggregate.c +0 -25837
  222. data/ext/carray_kernels_reduce_boolean.c +0 -330
  223. data/ext/carray_kernels_reduce_cumulative.c +0 -14593
  224. data/ext/carray_kernels_reduce_extreme.c +0 -16948
  225. data/ext/carray_kernels_reduce_variance.c +0 -3910
  226. data/ext/carray_kernels_scan.c +0 -3693
  227. data/ext/carray_kernels_search.c +0 -32138
  228. data/ext/carray_kernels_sort.c +0 -10626
  229. data/ext/carray_kernels_triop.c +0 -1392
@@ -17,7 +17,216 @@ class CArray
17
17
  # materialise. The marker is transient — a Ruby reference can
18
18
  # re-consume it (`m = a.lazy; m.sqrt + m.sin`) without side
19
19
  # effects on `self`.
20
- # @return [CALazyMarker]
20
+ #
21
+ # A Face (`CATime`, `CACategorical`, a string array, ...) returns
22
+ # `self`: a lazy tree computes on storage and would drop what the
23
+ # Face means, so operations on a Face stay eager.
24
+ # @return [CALazyMarker, CArray] the marker, or `self` for a Face
21
25
  def lazy; end
22
26
  # @!endgroup
23
27
  end
28
+
29
+ class CAMonOp
30
+ # @!group Copy and conversion
31
+
32
+ # @overload to_ca
33
+ # Evaluates the expression and returns the result as a new entity.
34
+ #
35
+ # A one-operand element-wise operation holds no data of its own, so there is nothing to
36
+ # hand over unevaluated: unlike `CArray#to_ca`, which returns
37
+ # `self`, this materialises -- the Ruby `Enumerable#to_a` /
38
+ # lazy `force` convention.
39
+ #
40
+ # The entity is detached from the operands, so writes to it reach
41
+ # nothing. `writable: true` is therefore refused rather than
42
+ # answered with a result that would swallow them.
43
+ # @param writable [Boolean] whether the caller needs writes to
44
+ # land back in the source; only `false` can be satisfied.
45
+ # @return [CArray] a newly evaluated entity.
46
+ # @raise [RuntimeError] when `writable: true` is requested.
47
+ def to_ca(writable: false); end
48
+
49
+ # @overload copy
50
+ # Evaluates the expression and returns the result as a new entity.
51
+ #
52
+ # If an expression evaluator is registered through
53
+ # {CArray.expression_evaluator} it is asked first; the ordinary
54
+ # element-wise walk is what happens when it declines, when none is
55
+ # registered, or when the array is small enough that walking is
56
+ # the faster answer.
57
+ # @return [CArray] a newly evaluated entity.
58
+ def copy; end
59
+
60
+ # @!endgroup
61
+ end
62
+
63
+ class CABinOp
64
+ # @!group Copy and conversion
65
+
66
+ # @overload to_ca
67
+ # Evaluates the expression and returns the result as a new entity.
68
+ #
69
+ # A two-operand element-wise operation holds no data of its own, so there is nothing to
70
+ # hand over unevaluated: unlike `CArray#to_ca`, which returns
71
+ # `self`, this materialises -- the Ruby `Enumerable#to_a` /
72
+ # lazy `force` convention.
73
+ #
74
+ # The entity is detached from the operands, so writes to it reach
75
+ # nothing. `writable: true` is therefore refused rather than
76
+ # answered with a result that would swallow them.
77
+ # @param writable [Boolean] whether the caller needs writes to
78
+ # land back in the source; only `false` can be satisfied.
79
+ # @return [CArray] a newly evaluated entity.
80
+ # @raise [RuntimeError] when `writable: true` is requested.
81
+ def to_ca(writable: false); end
82
+
83
+ # @overload copy
84
+ # Evaluates the expression and returns the result as a new entity.
85
+ #
86
+ # If an expression evaluator is registered through
87
+ # {CArray.expression_evaluator} it is asked first; the ordinary
88
+ # element-wise walk is what happens when it declines, when none is
89
+ # registered, or when the array is small enough that walking is
90
+ # the faster answer.
91
+ # @return [CArray] a newly evaluated entity.
92
+ def copy; end
93
+
94
+ # @!endgroup
95
+ end
96
+
97
+ class CATriOp
98
+ # @!group Copy and conversion
99
+
100
+ # @overload to_ca
101
+ # Evaluates the expression and returns the result as a new entity.
102
+ #
103
+ # A three-operand element-wise operation holds no data of its own, so there is nothing to
104
+ # hand over unevaluated: unlike `CArray#to_ca`, which returns
105
+ # `self`, this materialises -- the Ruby `Enumerable#to_a` /
106
+ # lazy `force` convention.
107
+ #
108
+ # The entity is detached from the operands, so writes to it reach
109
+ # nothing. `writable: true` is therefore refused rather than
110
+ # answered with a result that would swallow them.
111
+ # @param writable [Boolean] whether the caller needs writes to
112
+ # land back in the source; only `false` can be satisfied.
113
+ # @return [CArray] a newly evaluated entity.
114
+ # @raise [RuntimeError] when `writable: true` is requested.
115
+ def to_ca(writable: false); end
116
+
117
+ # @overload copy
118
+ # Evaluates the expression and returns the result as a new entity.
119
+ #
120
+ # If an expression evaluator is registered through
121
+ # {CArray.expression_evaluator} it is asked first; the ordinary
122
+ # element-wise walk is what happens when it declines, when none is
123
+ # registered, or when the array is small enough that walking is
124
+ # the faster answer.
125
+ # @return [CArray] a newly evaluated entity.
126
+ def copy; end
127
+
128
+ # @!endgroup
129
+ end
130
+
131
+ class CAMonCmp
132
+ # @!group Copy and conversion
133
+
134
+ # @overload to_ca
135
+ # Evaluates the expression and returns the result as a new entity.
136
+ #
137
+ # A one-operand element-wise predicate holds no data of its own, so there is nothing to
138
+ # hand over unevaluated: unlike `CArray#to_ca`, which returns
139
+ # `self`, this materialises -- the Ruby `Enumerable#to_a` /
140
+ # lazy `force` convention.
141
+ #
142
+ # The entity is detached from the operands, so writes to it reach
143
+ # nothing. `writable: true` is therefore refused rather than
144
+ # answered with a result that would swallow them.
145
+ # @param writable [Boolean] whether the caller needs writes to
146
+ # land back in the source; only `false` can be satisfied.
147
+ # @return [CArray] a newly evaluated entity.
148
+ # @raise [RuntimeError] when `writable: true` is requested.
149
+ def to_ca(writable: false); end
150
+
151
+ # @overload copy
152
+ # Evaluates the expression and returns the result as a new entity.
153
+ #
154
+ # If an expression evaluator is registered through
155
+ # {CArray.expression_evaluator} it is asked first; the ordinary
156
+ # element-wise walk is what happens when it declines, when none is
157
+ # registered, or when the array is small enough that walking is
158
+ # the faster answer.
159
+ # @return [CArray] a newly evaluated entity.
160
+ def copy; end
161
+
162
+ # @!endgroup
163
+ end
164
+
165
+ class CABinCmp
166
+ # @!group Copy and conversion
167
+
168
+ # @overload to_ca
169
+ # Evaluates the expression and returns the result as a new entity.
170
+ #
171
+ # A two-operand element-wise comparison holds no data of its own, so there is nothing to
172
+ # hand over unevaluated: unlike `CArray#to_ca`, which returns
173
+ # `self`, this materialises -- the Ruby `Enumerable#to_a` /
174
+ # lazy `force` convention.
175
+ #
176
+ # The entity is detached from the operands, so writes to it reach
177
+ # nothing. `writable: true` is therefore refused rather than
178
+ # answered with a result that would swallow them.
179
+ # @param writable [Boolean] whether the caller needs writes to
180
+ # land back in the source; only `false` can be satisfied.
181
+ # @return [CArray] a newly evaluated entity.
182
+ # @raise [RuntimeError] when `writable: true` is requested.
183
+ def to_ca(writable: false); end
184
+
185
+ # @overload copy
186
+ # Evaluates the expression and returns the result as a new entity.
187
+ #
188
+ # If an expression evaluator is registered through
189
+ # {CArray.expression_evaluator} it is asked first; the ordinary
190
+ # element-wise walk is what happens when it declines, when none is
191
+ # registered, or when the array is small enough that walking is
192
+ # the faster answer.
193
+ # @return [CArray] a newly evaluated entity.
194
+ def copy; end
195
+
196
+ # @!endgroup
197
+ end
198
+
199
+ class CALazyMarker
200
+ # @!group Copy and conversion
201
+
202
+ # @overload to_ca
203
+ # Evaluates the expression and returns the result as a new entity.
204
+ #
205
+ # A lazy marker holds no data of its own, so there is nothing to
206
+ # hand over unevaluated: unlike `CArray#to_ca`, which returns
207
+ # `self`, this materialises -- the Ruby `Enumerable#to_a` /
208
+ # lazy `force` convention.
209
+ #
210
+ # The entity is detached from the operands, so writes to it reach
211
+ # nothing. `writable: true` is therefore refused rather than
212
+ # answered with a result that would swallow them.
213
+ # @param writable [Boolean] whether the caller needs writes to
214
+ # land back in the source; only `false` can be satisfied.
215
+ # @return [CArray] a newly evaluated entity.
216
+ # @raise [RuntimeError] when `writable: true` is requested.
217
+ def to_ca(writable: false); end
218
+
219
+ # @overload copy
220
+ # Evaluates the expression and returns the result as a new entity.
221
+ #
222
+ # If an expression evaluator is registered through
223
+ # {CArray.expression_evaluator} it is asked first; the ordinary
224
+ # element-wise walk is what happens when it declines, when none is
225
+ # registered, or when the array is small enough that walking is
226
+ # the faster answer.
227
+ # @return [CArray] a newly evaluated entity.
228
+ def copy; end
229
+
230
+ # @!endgroup
231
+ end
232
+
@@ -53,7 +53,10 @@ class CArray
53
53
 
54
54
  # @overload map!
55
55
  # Replaces each element of `self` with the block's return value.
56
- # Mutates `self`.
56
+ # Mutates `self`. When the block raises or breaks part way, or
57
+ # returns a value that cannot be stored, the cells already replaced
58
+ # stay replaced -- through a view as well, which writes them back to
59
+ # its parent. The same holds for every `map_*!` below.
57
60
  # @yieldparam elem [Object]
58
61
  # @yieldreturn [Object] new value for the cell.
59
62
  # @return [self]
@@ -74,7 +74,8 @@ class CArray
74
74
  # Clears the mask state and overwrites the data at previously
75
75
  # masked positions with `fill_value`. Mutates `self`.
76
76
  # @param fill_value [Object] value to store at each previously
77
- # masked position. Cast to `self.data_type`.
77
+ # masked position, converted as a store into `self` converts it.
78
+ # `UNDEF` leaves the masked cells masked.
78
79
  # @return [self]
79
80
  # @overload unmask(method:, axis: nil)
80
81
  # Fills masked cells in place from neighbouring valid cells along
@@ -106,7 +107,8 @@ class CArray
106
107
  #
107
108
  # Replaces the removed `unmask_copy(fill)` from 2.x.
108
109
  # @param fill_value [Object] value to substitute at masked
109
- # positions. Cast to `self.data_type`.
110
+ # positions, converted as a store into `self` converts it.
111
+ # `UNDEF` leaves them masked (the copy keeps the mask).
110
112
  # @return [CArray]
111
113
  # @overload strip_mask(method:, axis: nil)
112
114
  # Returns a new array with masked cells filled from neighbouring
@@ -151,6 +153,8 @@ class CArray
151
153
  # Flips the mask state of every element of `self` in place
152
154
  # (masked ↔ not masked). Mutates `self`.
153
155
  # @return [self]
156
+ # @raise [FrozenError] if `self` is frozen or a view of a frozen array.
157
+ # @raise [RuntimeError] if `self` is read-only (a lazy expression, for one).
154
158
  def invert_mask; end
155
159
 
156
160
  # @overload inherit_mask(*others)
@@ -174,23 +178,43 @@ class CArray
174
178
  # @overload count_masked
175
179
  # Returns the total number of masked elements in `self`.
176
180
  # @return [Integer]
177
- # @overload count_masked(axis:)
181
+ # @overload count_masked(axis:, keep_axis: false, min_count: nil, fill_value: nil)
178
182
  # Returns the per-slice count of masked elements along the given
179
183
  # axis or axes. The result is an int64 CArray with `axis` removed
180
- # from `shape`.
184
+ # from `shape` (kept as length 1 with `keep_axis: true`). Naming
185
+ # every axis without `keep_axis:` returns an Integer, as the form
186
+ # without `axis:` does. The answer is the same whether or not
187
+ # `self` has a mask.
181
188
  # @param axis [Integer, Array<Integer>] axis or axes to reduce.
182
- # @return [CArray] int64 CArray.
189
+ # @param keep_axis [Boolean] keep the reduced axes as length 1.
190
+ # @param min_count [Integer, nil] cells with fewer than this many
191
+ # elements are UNDEF. A count of the mask reads every element,
192
+ # masked or not, so this compares with the slice size.
193
+ # @param fill_value [Object, nil] value written into UNDEF cells.
194
+ # @return [CArray, Integer]
195
+ # @raise [ArgumentError] if an axis is out of range, repeated, or
196
+ # the axis list is empty.
183
197
  def count_masked(*, **); end
184
198
 
185
199
  # @overload count_not_masked
186
200
  # Returns the total number of not-masked elements in `self`.
187
201
  # @return [Integer]
188
- # @overload count_not_masked(axis:)
189
- # Returns the per-slice count of not-masked elements along the
190
- # given axis or axes. The result is an int64 CArray with `axis`
191
- # removed from `shape`.
202
+ # @overload count_not_masked(axis:, keep_axis: false, min_count: nil, fill_value: nil)
203
+ # Returns the per-slice count of not-masked elements along the given
204
+ # axis or axes. The result is an int64 CArray with `axis` removed
205
+ # from `shape` (kept as length 1 with `keep_axis: true`). Naming
206
+ # every axis without `keep_axis:` returns an Integer, as the form
207
+ # without `axis:` does. The answer is the same whether or not
208
+ # `self` has a mask.
192
209
  # @param axis [Integer, Array<Integer>] axis or axes to reduce.
193
- # @return [CArray] int64 CArray.
210
+ # @param keep_axis [Boolean] keep the reduced axes as length 1.
211
+ # @param min_count [Integer, nil] cells with fewer than this many
212
+ # elements are UNDEF. A count of the mask reads every element,
213
+ # masked or not, so this compares with the slice size.
214
+ # @param fill_value [Object, nil] value written into UNDEF cells.
215
+ # @return [CArray, Integer]
216
+ # @raise [ArgumentError] if an axis is out of range, repeated, or
217
+ # the axis list is empty.
194
218
  def count_not_masked(*, **); end
195
219
 
196
220
  # @!endgroup