carray 2.0.1 → 3.0.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 (339) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +5 -25
  3. data/CHANGELOG.md +16 -0
  4. data/LICENSE +1 -1
  5. data/NEWS.md +3 -0
  6. data/README.md +128 -44
  7. data/carray.gemspec +22 -24
  8. data/ext/ca_array_pool.c +91 -0
  9. data/ext/ca_axis_descriptor.h +186 -0
  10. data/ext/ca_axis_dispatch.c +924 -0
  11. data/ext/ca_axis_group.c +1208 -0
  12. data/ext/ca_bincmp_dispatch.c +76 -0
  13. data/ext/ca_bincmp_dispatch.h +85 -0
  14. data/ext/ca_binop_dispatch.c +125 -0
  15. data/ext/ca_binop_dispatch.h +159 -0
  16. data/ext/ca_categorical_iterator.c +1375 -0
  17. data/ext/ca_compare.c +94 -0
  18. data/ext/ca_compare.h +26 -0
  19. data/ext/ca_composite_dispatch.c +414 -0
  20. data/ext/ca_composite_dispatch.h +116 -0
  21. data/ext/ca_for_buffer.h +96 -0
  22. data/ext/ca_for_each_element.h +241 -0
  23. data/ext/ca_group_iter.c +304 -0
  24. data/ext/ca_iter_substrate.h +325 -0
  25. data/ext/ca_kernel_iterator.c +4321 -0
  26. data/ext/ca_kernel_iterator.h +2603 -0
  27. data/ext/ca_moncmp_dispatch.c +37 -0
  28. data/ext/ca_moncmp_dispatch.h +62 -0
  29. data/ext/ca_monop_dispatch.c +200 -0
  30. data/ext/ca_monop_dispatch.h +235 -0
  31. data/ext/ca_obj_array.c +355 -359
  32. data/ext/ca_obj_bincmp.c +809 -0
  33. data/ext/ca_obj_binop.c +892 -0
  34. data/ext/ca_obj_bitarray.c +369 -164
  35. data/ext/ca_obj_bitfield.c +294 -234
  36. data/ext/ca_obj_block.c +189 -711
  37. data/ext/ca_obj_byte_swap.c +766 -0
  38. data/ext/ca_obj_const_string.c +965 -0
  39. data/ext/ca_obj_face.c +670 -0
  40. data/ext/ca_obj_face.h +247 -0
  41. data/ext/ca_obj_fake.c +228 -100
  42. data/ext/ca_obj_farray.c +54 -441
  43. data/ext/ca_obj_field.c +82 -529
  44. data/ext/ca_obj_fixlen_string.c +306 -0
  45. data/ext/ca_obj_grid.c +858 -440
  46. data/ext/ca_obj_meld.c +1034 -0
  47. data/ext/ca_obj_moncmp.c +569 -0
  48. data/ext/ca_obj_monop.c +1111 -0
  49. data/ext/ca_obj_object.c +772 -297
  50. data/ext/ca_obj_record.c +468 -0
  51. data/ext/ca_obj_reduce.c +97 -82
  52. data/ext/ca_obj_refer.c +569 -459
  53. data/ext/ca_obj_remap.c +475 -0
  54. data/ext/ca_obj_repeat.c +92 -477
  55. data/ext/ca_obj_roll.c +616 -0
  56. data/ext/ca_obj_select.c +344 -296
  57. data/ext/ca_obj_select_axis.c +1296 -0
  58. data/ext/ca_obj_shift.c +229 -791
  59. data/ext/ca_obj_source.c +78 -0
  60. data/ext/ca_obj_stack.c +1173 -0
  61. data/ext/ca_obj_stride.c +2501 -0
  62. data/ext/ca_obj_string.c +268 -0
  63. data/ext/ca_obj_tile.c +614 -0
  64. data/ext/ca_obj_time.c +546 -0
  65. data/ext/ca_obj_timedelta.c +435 -0
  66. data/ext/ca_obj_transpose.c +62 -516
  67. data/ext/ca_obj_triop.c +746 -0
  68. data/ext/ca_obj_unbound_repeat.c +207 -240
  69. data/ext/ca_obj_window.c +1131 -563
  70. data/ext/ca_op_byte_swap.c +175 -0
  71. data/ext/ca_op_ipower.c +319 -0
  72. data/ext/ca_op_powi.h +88 -0
  73. data/ext/ca_sort_kernels.h +132 -0
  74. data/ext/ca_sweep_engine.c +430 -0
  75. data/ext/ca_sweep_engine.h +157 -0
  76. data/ext/ca_transform_common.c +228 -0
  77. data/ext/ca_triop_dispatch.c +55 -0
  78. data/ext/ca_triop_dispatch.h +62 -0
  79. data/ext/carray.h +795 -402
  80. data/ext/carray_access.c +831 -711
  81. data/ext/carray_attribute.c +98 -329
  82. data/ext/carray_bincount.c +255 -0
  83. data/ext/carray_broadcast.c +283 -0
  84. data/ext/carray_call_cfunc.c +1360 -828
  85. data/ext/carray_call_cfunc.h +160 -0
  86. data/ext/carray_cast.c +1212 -301
  87. data/ext/carray_cast_func.rb +81 -40
  88. data/ext/carray_class.c +53 -63
  89. data/ext/carray_config.h +28 -0
  90. data/ext/carray_conversion.c +350 -346
  91. data/ext/carray_copy.c +156 -268
  92. data/ext/carray_core.c +1341 -198
  93. data/ext/carray_count.c +312 -0
  94. data/ext/carray_data_type.c +43 -19
  95. data/ext/carray_element.c +585 -213
  96. data/ext/carray_factorize.c +2542 -0
  97. data/ext/carray_generate.c +230 -559
  98. data/ext/carray_histogram.c +490 -0
  99. data/ext/carray_hold.c +228 -0
  100. data/ext/carray_index_classifier.c +1035 -0
  101. data/ext/carray_index_classifier.h +27 -0
  102. data/ext/carray_internal.h +120 -0
  103. data/ext/carray_kernels_bincmp.c +4445 -0
  104. data/ext/carray_kernels_binop.c +10979 -0
  105. data/ext/carray_kernels_init.c +36 -0
  106. data/ext/carray_kernels_map.c +3466 -0
  107. data/ext/carray_kernels_moncmp.c +2096 -0
  108. data/ext/carray_kernels_monop.c +18312 -0
  109. data/ext/carray_kernels_reduce_aggregate.c +25836 -0
  110. data/ext/carray_kernels_reduce_boolean.c +329 -0
  111. data/ext/carray_kernels_reduce_cumulative.c +14592 -0
  112. data/ext/carray_kernels_reduce_extreme.c +16947 -0
  113. data/ext/carray_kernels_reduce_variance.c +3909 -0
  114. data/ext/carray_kernels_scan.c +3692 -0
  115. data/ext/carray_kernels_search.c +32137 -0
  116. data/ext/carray_kernels_sort.c +10625 -0
  117. data/ext/carray_kernels_triop.c +1391 -0
  118. data/ext/carray_lazy.c +567 -0
  119. data/ext/carray_loop.c +88 -200
  120. data/ext/carray_mask.c +848 -154
  121. data/ext/carray_math_kernel.h +120 -0
  122. data/ext/carray_mathfunc.c +10 -241
  123. data/ext/carray_median_percentile.c +1257 -0
  124. data/ext/carray_memory_view.c +1625 -0
  125. data/ext/carray_operator.c +1526 -318
  126. data/ext/carray_order.c +664 -1394
  127. data/ext/carray_partition.c +416 -0
  128. data/ext/carray_random.c +518 -0
  129. data/ext/carray_scatter.c +357 -0
  130. data/ext/carray_slab.c +1219 -0
  131. data/ext/carray_slab.h +84 -0
  132. data/ext/carray_sort.c +829 -0
  133. data/ext/carray_sort_kernel.c +620 -0
  134. data/ext/carray_struct.c +695 -0
  135. data/ext/carray_test.c +343 -229
  136. data/ext/carray_undef.c +34 -17
  137. data/ext/carray_utils.c +175 -74
  138. data/ext/extconf.rb +216 -55
  139. data/ext/mk_call_cfunc.rb +480 -0
  140. data/ext/mkkernel.rb +8842 -0
  141. data/ext/ruby_carray.c +202 -101
  142. data/ext/version.h +5 -15
  143. data/ext/version.rb +5 -13
  144. data/lib/carray/arrow_tensor.rb +401 -0
  145. data/lib/carray/attribute.rb +166 -0
  146. data/lib/carray/autoload_carray.rb +220 -0
  147. data/lib/carray/autoload_method_extension.rb +44 -0
  148. data/lib/carray/axis_group.rb +711 -0
  149. data/lib/carray/basics.rb +481 -0
  150. data/lib/carray/bincount_nd.rb +358 -0
  151. data/lib/carray/block_iterator.rb +604 -0
  152. data/lib/carray/boolean_reduce.rb +109 -0
  153. data/lib/carray/categorical.rb +561 -0
  154. data/lib/carray/categorical_iterator.rb +1062 -0
  155. data/lib/carray/complex.rb +150 -0
  156. data/lib/carray/conditional.rb +216 -0
  157. data/lib/carray/const_string.rb +228 -0
  158. data/lib/carray/construct.rb +139 -328
  159. data/lib/carray/core_extensions.rb +240 -0
  160. data/lib/carray/data_type_extension.rb +233 -0
  161. data/lib/carray/fixlen_string.rb +95 -0
  162. data/lib/carray/frame/concat.rb +132 -0
  163. data/lib/carray/frame/convert.rb +95 -0
  164. data/lib/carray/frame/csv_parser.rb +211 -0
  165. data/lib/carray/frame/frame.rb +649 -0
  166. data/lib/carray/frame/group.rb +186 -0
  167. data/lib/carray/frame/io.rb +164 -0
  168. data/lib/carray/frame/join.rb +248 -0
  169. data/lib/carray/frame/records.rb +99 -0
  170. data/lib/carray/frame/sort.rb +113 -0
  171. data/lib/carray/frame/verbs.rb +299 -0
  172. data/lib/carray/frame.rb +16 -0
  173. data/lib/carray/histogram.rb +512 -0
  174. data/lib/carray/inspect.rb +37 -20
  175. data/lib/carray/iterator.rb +57 -349
  176. data/lib/carray/lazy.rb +889 -0
  177. data/lib/carray/mask_gap_fill.rb +200 -0
  178. data/lib/carray/math.rb +78 -342
  179. data/lib/carray/meld_reduce.rb +289 -0
  180. data/lib/carray/methods/align_addr.rb +116 -0
  181. data/lib/carray/methods/bin.rb +128 -0
  182. data/lib/carray/methods/bincount.rb +87 -0
  183. data/lib/carray/methods/bit_string.rb +92 -0
  184. data/lib/carray/methods/broadcast.rb +63 -0
  185. data/lib/carray/methods/choose.rb +39 -0
  186. data/lib/carray/methods/composition.rb +280 -0
  187. data/lib/carray/methods/gather_nd.rb +206 -0
  188. data/lib/carray/methods/index.rb +39 -0
  189. data/lib/carray/methods/insert_block.rb +99 -0
  190. data/lib/carray/methods/is_in.rb +141 -0
  191. data/lib/carray/methods/join.rb +90 -0
  192. data/lib/carray/methods/locate_addr.rb +47 -0
  193. data/lib/carray/methods/mask_duplicates.rb +41 -0
  194. data/lib/carray/methods/meshgrid.rb +91 -0
  195. data/lib/carray/methods/mode.rb +126 -0
  196. data/lib/carray/methods/nunique.rb +46 -0
  197. data/lib/carray/methods/resize.rb +56 -0
  198. data/lib/carray/methods/snap.rb +156 -0
  199. data/lib/carray/methods/string_format.rb +57 -0
  200. data/lib/carray/methods/unique.rb +47 -0
  201. data/lib/carray/methods/value_counts.rb +71 -0
  202. data/lib/carray/mkmf.rb +124 -101
  203. data/lib/carray/runtime.rb +108 -0
  204. data/lib/carray/serialize.rb +478 -167
  205. data/lib/carray/slab_iterator.rb +292 -0
  206. data/lib/carray/stack.rb +291 -0
  207. data/lib/carray/string.rb +56 -180
  208. data/lib/carray/string_operation_extension.rb +289 -0
  209. data/lib/carray/struct.rb +335 -323
  210. data/lib/carray/struct_builder.rb +697 -0
  211. data/lib/carray/table.rb +41 -2
  212. data/lib/carray/time.rb +2255 -38
  213. data/lib/carray/window_iterator.rb +655 -0
  214. data/lib/carray.rb +55 -57
  215. metadata +163 -130
  216. data/Rakefile +0 -51
  217. data/TODO.md +0 -18
  218. data/ext/ca_iter_block.c +0 -257
  219. data/ext/ca_iter_dimension.c +0 -299
  220. data/ext/ca_iter_window.c +0 -214
  221. data/ext/ca_obj_mapping.c +0 -644
  222. data/ext/carray_iterator.c +0 -641
  223. data/ext/carray_math.rb +0 -850
  224. data/ext/carray_numeric.c +0 -259
  225. data/ext/carray_sort_addr.c +0 -254
  226. data/ext/carray_stat.c +0 -2100
  227. data/ext/carray_stat_proc.rb +0 -1999
  228. data/ext/mkmath.rb +0 -741
  229. data/ext/ruby_ccomplex.c +0 -509
  230. data/ext/ruby_float_func.c +0 -86
  231. data/lib/carray/array.rb +0 -8
  232. data/lib/carray/autoload/autoload_base.rb +0 -19
  233. data/lib/carray/autoload/autoload_gem_cairo.rb +0 -9
  234. data/lib/carray/autoload/autoload_gem_ffi.rb +0 -9
  235. data/lib/carray/autoload/autoload_gem_gnuplot.rb +0 -2
  236. data/lib/carray/autoload/autoload_gem_io_csv.rb +0 -14
  237. data/lib/carray/autoload/autoload_gem_io_pg.rb +0 -6
  238. data/lib/carray/autoload/autoload_gem_io_sqlite3.rb +0 -12
  239. data/lib/carray/autoload/autoload_gem_narray.rb +0 -10
  240. data/lib/carray/autoload/autoload_gem_numo_narray.rb +0 -15
  241. data/lib/carray/autoload/autoload_gem_opencv.rb +0 -16
  242. data/lib/carray/autoload/autoload_gem_random.rb +0 -8
  243. data/lib/carray/autoload/autoload_gem_rmagick.rb +0 -23
  244. data/lib/carray/autoload/autoload_gem_zimg.rb +0 -3
  245. data/lib/carray/autoload/autoload_io_imagemagick.rb +0 -6
  246. data/lib/carray/autoload/autoload_math_histogram.rb +0 -5
  247. data/lib/carray/autoload/autoload_math_recurrence.rb +0 -6
  248. data/lib/carray/autoload/autoload_object_iterator.rb +0 -1
  249. data/lib/carray/autoload/autoload_object_link.rb +0 -1
  250. data/lib/carray/autoload/autoload_object_pack.rb +0 -2
  251. data/lib/carray/autoload.rb +0 -141
  252. data/lib/carray/basic.rb +0 -191
  253. data/lib/carray/broadcast.rb +0 -101
  254. data/lib/carray/compose.rb +0 -315
  255. data/lib/carray/convert.rb +0 -115
  256. data/lib/carray/info.rb +0 -110
  257. data/lib/carray/io/imagemagick.rb +0 -235
  258. data/lib/carray/mask.rb +0 -102
  259. data/lib/carray/math/histogram.rb +0 -177
  260. data/lib/carray/math/recurrence.rb +0 -93
  261. data/lib/carray/object/ca_obj_iterator.rb +0 -50
  262. data/lib/carray/object/ca_obj_link.rb +0 -50
  263. data/lib/carray/object/ca_obj_pack.rb +0 -99
  264. data/lib/carray/obsolete.rb +0 -256
  265. data/lib/carray/ordering.rb +0 -181
  266. data/lib/carray/testing.rb +0 -51
  267. data/lib/carray/transform.rb +0 -109
  268. data/mailmap +0 -1
  269. data/misc/Methods.ja.md +0 -182
  270. data/misc/NOTE +0 -51
  271. data/spec/Classes/CABitfield_spec.rb +0 -58
  272. data/spec/Classes/CABlockIterator_spec.rb +0 -114
  273. data/spec/Classes/CABlock_spec.rb +0 -205
  274. data/spec/Classes/CAField_spec.rb +0 -39
  275. data/spec/Classes/CAGrid_spec.rb +0 -75
  276. data/spec/Classes/CAMap_spec.rb +0 -0
  277. data/spec/Classes/CAMapping_spec.rb +0 -105
  278. data/spec/Classes/CAObject_attribute_spec.rb +0 -33
  279. data/spec/Classes/CAObject_spec.rb +0 -33
  280. data/spec/Classes/CARefer_spec.rb +0 -93
  281. data/spec/Classes/CARepeat_spec.rb +0 -65
  282. data/spec/Classes/CASelect_spec.rb +0 -22
  283. data/spec/Classes/CAShift_spec.rb +0 -16
  284. data/spec/Classes/CAStruct_spec.rb +0 -71
  285. data/spec/Classes/CATranspose_spec.rb +0 -60
  286. data/spec/Classes/CAUnboudRepeat_spec.rb +0 -102
  287. data/spec/Classes/CAWindow_spec.rb +0 -54
  288. data/spec/Classes/CAWrap_spec.rb +0 -8
  289. data/spec/Classes/CArray_spec.rb +0 -184
  290. data/spec/Classes/CScalar_spec.rb +0 -55
  291. data/spec/Features/feature_130_spec.rb +0 -19
  292. data/spec/Features/feature_attributes_spec.rb +0 -280
  293. data/spec/Features/feature_boolean_spec.rb +0 -98
  294. data/spec/Features/feature_broadcast.rb +0 -116
  295. data/spec/Features/feature_cast_function.rb +0 -19
  296. data/spec/Features/feature_cast_spec.rb +0 -33
  297. data/spec/Features/feature_class_spec.rb +0 -84
  298. data/spec/Features/feature_complex_spec.rb +0 -42
  299. data/spec/Features/feature_composite_spec.rb +0 -124
  300. data/spec/Features/feature_convert_spec.rb +0 -46
  301. data/spec/Features/feature_copy_spec.rb +0 -123
  302. data/spec/Features/feature_creation_spec.rb +0 -84
  303. data/spec/Features/feature_element_spec.rb +0 -144
  304. data/spec/Features/feature_extream_spec.rb +0 -54
  305. data/spec/Features/feature_generate_spec.rb +0 -74
  306. data/spec/Features/feature_index_spec.rb +0 -69
  307. data/spec/Features/feature_mask_spec.rb +0 -580
  308. data/spec/Features/feature_math_spec.rb +0 -97
  309. data/spec/Features/feature_order_spec.rb +0 -146
  310. data/spec/Features/feature_ref_store_spec.rb +0 -209
  311. data/spec/Features/feature_serialization_spec.rb +0 -125
  312. data/spec/Features/feature_stat_spec.rb +0 -397
  313. data/spec/Features/feature_virtual_spec.rb +0 -48
  314. data/spec/Features/method_eq_spec.rb +0 -81
  315. data/spec/Features/method_is_nan_spec.rb +0 -12
  316. data/spec/Features/method_map_spec.rb +0 -54
  317. data/spec/Features/method_max_with.rb +0 -20
  318. data/spec/Features/method_min_with.rb +0 -19
  319. data/spec/Features/method_ne_spec.rb +0 -18
  320. data/spec/Features/method_project_spec.rb +0 -188
  321. data/spec/Features/method_ref_spec.rb +0 -27
  322. data/spec/Features/method_round_spec.rb +0 -11
  323. data/spec/Features/method_s_linspace_spec.rb +0 -48
  324. data/spec/Features/method_s_span_spec.rb +0 -14
  325. data/spec/Features/method_seq_spec.rb +0 -47
  326. data/spec/Features/method_sort_with.rb +0 -43
  327. data/spec/Features/method_sorted_with.rb +0 -29
  328. data/spec/Features/method_span_spec.rb +0 -42
  329. data/spec/Features/method_wrap_readonly_spec.rb +0 -43
  330. data/spec/UnitTest/test_CAVirtual.rb +0 -214
  331. data/spec/spec_all.rb +0 -10
  332. data/utils/ca_ase.rb +0 -21
  333. data/utils/ca_methods.rb +0 -15
  334. data/utils/cast_checker.rb +0 -30
  335. data/utils/convert_test.rb +0 -73
  336. data/utils/extract_yard.rb +0 -22
  337. data/utils/guess_shape.rb +0 -76
  338. data/utils/monkey_patch_methods.rb +0 -62
  339. data/utils/remove_resource_fork.sh +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7f462cc0db93ae6cbe718b64ba1761c4f1aab048835566be238d1f958328c92
4
- data.tar.gz: 46289071d0a636d9025de050abeecd1e57223b28dc54bf1acef0e578df3365ce
3
+ metadata.gz: 7deb551fcc14866b90ad75e9d74ce716922de103148507bcb8b53c039b9afa48
4
+ data.tar.gz: d8efa03d7f0852a15223329545c5ad3bb0abfcb0c48191978b1e0e6755d50f6b
5
5
  SHA512:
6
- metadata.gz: f36a13c5ae4a15f264577301683bf03fbc8367f017da1ec39831fe9d8b7161ec0f2721a16909a6d166ca6c784f8062a352f9b1b9f4b4e8135071de27c112579b
7
- data.tar.gz: 9cc760bcdb5c9108c7c341b9dd98e12330cf8931cd8ef28d09e603cab984959b287ee9d9e0dc0cb5673e1ad53bd9343ea0e2cf88647ebb81b6b9b557214e9914
6
+ metadata.gz: d1b4817095544fa7fae956207a3356f3300afab2b3e6b25b2c646e8c52b6db9a3ce9553131bb80ba5899f8d393de9dfd9f8136f1a8224402a372076f74556e89
7
+ data.tar.gz: 859f3082f6c44a5f340fbf5ddd057e52f2fcacbadf5c5452c117b15faf683c9f915dc1f47ee59ba2fa37fa416fbf050b4747fbb1934971a472e74861c3b32ec4
data/.yardopts CHANGED
@@ -5,28 +5,8 @@
5
5
  --exclude lib/carray/autoload.rb
6
6
  --exclude 'lib/carray/autoload/'
7
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
-
8
+ --files CHANGELOG.md,NEWS.md
9
+ lib/carray.rb
10
+ lib/carray/**/*.rb
11
+ yard-stubs/**/*.rb
12
+ ext/carray_operator.c
data/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ Releases from 3.0.0 onward are recorded here. For the pre-3.0 history
4
+ (1.4.x through 2.0.1) see [NEWS.md](NEWS.md).
5
+
6
+ ## 3.0.0 — 2026-08-25
7
+
8
+ First public release. Earlier versions existed on RubyGems, but the library
9
+ was developed for the author's own use; 3.0 is where it is packaged,
10
+ documented and tested as something other people can pick up. It is not
11
+ source-compatible with 2.0.1.
12
+
13
+ See [README.md](README.md) for what the library does, and [docs/](docs/)
14
+ and [guides/](guides/) for the reference and the guides.
15
+
16
+ **Requires Ruby 3.0 or later** (3.1 for the MemoryView-backed paths).
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020 Hiroki Motoyoshi.
1
+ Copyright (c) 2005-2026 himotoyoshi.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/NEWS.md CHANGED
@@ -1,6 +1,9 @@
1
1
  ChangeLog of Ruby/CArray
2
2
  ========================
3
3
 
4
+ Releases from 3.0.0 onward are in [CHANGELOG.md](CHANGELOG.md).
5
+ What follows is the history up to 2.0.1.
6
+
4
7
  1.6.0 -> 2.0.0
5
8
  --------------
6
9
 
data/README.md CHANGED
@@ -1,56 +1,140 @@
1
- Ruby/CArray
2
- ===========
1
+ # Ruby/CArray
3
2
 
4
3
  Ruby/CArray is an extension library for the multi-dimensional array class.
5
4
 
6
- Features
7
- --------
5
+ ## Features
6
+
7
+ * Multidimensional arrays holding values of a single, uniform data type
8
+ * Indexing and slicing in many ways — by position, range, boolean mask, or
9
+ index/address arrays
10
+ * Element-wise arithmetic, mathematical and transcendental functions
11
+ * Reduction and statistics computed over the whole array or along any axis
12
+ * Built-in per-element mask on every array to represent missing values, properly
13
+ accounted for in reductions and statistics
14
+ * A rich family of views onto the original data — for indexing, reshaping, and
15
+ reinterpreting elements — without copying
16
+ * Views compose into chains of any depth, and writing through them reaches all the
17
+ way back to the source data
18
+ * Explicit broadcasting: operating on arrays of different shapes by stretching
19
+ size-1 axes to match, without ever adding axes implicitly
20
+ * Fast reductions built on compiler auto-vectorization
21
+ * Kernel-style iteration from Ruby: drive a Ruby block over each sub-array spanning
22
+ chosen axes
23
+ * Faces: a mechanism for building extended data types on top of CArray (time,
24
+ categorical and variable-length string columns are such types)
25
+ * Easily define record types that bind several data together as one element
26
+ * User-defined array classes, written in Ruby, that share the full CArray interface
27
+ so your own type behaves like a CArray everywhere
28
+ * A DataFrame (`CAFrame`) whose columns are plain CArrays — it adds names and row
29
+ operations (select, filter, sort, join, group-by, CSV I/O) and hands a column
30
+ back as the array itself, so masks, views and Faces keep working on it
31
+ * Writing per-axis methods and functions in C extensions with ease — a single
32
+ kernel runs across every view type, with no per-view branching to write yourself
33
+ * MemoryView protocol support — interoperate with other numerical libraries as both
34
+ producer and consumer
35
+
36
+ ## Install
37
+
38
+ ```
39
+ gem install carray
40
+ ```
41
+
42
+ Or add it to your `Gemfile`:
43
+
44
+ ```ruby
45
+ gem "carray"
46
+ ```
47
+
48
+ Requires Ruby 3.0 or later.
49
+
50
+ On a multi-core machine, parallel `make` cuts install time noticeably:
51
+
52
+ ```
53
+ MAKEFLAGS="-j$(nproc)" gem install carray # Linux
54
+ MAKEFLAGS="-j$(sysctl -n hw.ncpu)" gem install carray # macOS
55
+ ```
56
+
57
+ ## Quick example
58
+
59
+ ```ruby
60
+ require "carray"
61
+
62
+ # --- create a 2x3 array ---
63
+ a = CArray.float64(2, 3) { |i, j| i * 3 + j }
64
+ # => [ [ 0, 1, 2 ],
65
+ # [ 3, 4, 5 ] ]
66
+
67
+ # --- reductions over the whole array or along an axis ---
68
+ a.sum # => 15.0 over the whole array
69
+ a.sum(axis: 0) # => [ 3, 5, 7 ] sum down each column
70
+ a.sum(axis: 1) # => [ 3, 12 ] sum across each row
71
+
72
+ # --- element-wise operations and functions ---
73
+ a + 1
74
+ # => [ [ 1, 2, 3 ],
75
+ # [ 4, 5, 6 ] ]
76
+
77
+ a.exp
78
+ # => [ [ 1.000, 2.718, 7.389 ],
79
+ # [ 20.086, 54.598, 148.413 ] ]
80
+
81
+ # --- select by condition ---
82
+ a[(a % 2).eq(0)] # => [ 0, 2, 4 ] the even elements
83
+
84
+ # --- views share storage with the original ---
85
+ a.reshape(3, 2)
86
+ # => [ [ 0, 1 ],
87
+ # [ 2, 3 ],
88
+ # [ 4, 5 ] ]
89
+
90
+ a.transpose
91
+ # => [ [ 0, 3 ],
92
+ # [ 1, 4 ],
93
+ # [ 2, 5 ] ]
94
+
95
+ a[0, nil] # => [ 0, 1, 2 ] the first row
96
+ a[nil, 0] # => [ 0, 3 ] the first column
97
+
98
+ a[nil, 1..2] # a block view of the last two columns
99
+ # => [ [ 1, 2 ],
100
+ # [ 4, 5 ] ]
101
+
102
+ # --- writing through a view updates the original ---
103
+ a[0, nil] = -1
104
+ a
105
+ # => [ [ -1, -1, -1 ],
106
+ # [ 3, 4, 5 ] ]
107
+
108
+ # --- missing values ---
109
+ b = CArray.float64(2, 3) { |i, j| i * 3 + j }
110
+ b[0, 1] = UNDEF # mark some missing values
111
+ b[1, 2] = UNDEF
112
+ b
113
+ # => [ [ 0, _, 2 ],
114
+ # [ 3, 4, _ ] ]
115
+
116
+ b.sum # => 9 missing values are ignored
117
+ b.sum(axis: 0) # => [ 3, 4, 2 ] (column sums)
118
+ b.sum(axis: 1) # => [ 2, 7 ] (row sums)
8
119
 
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
- * Special iterators (dimension, block, window, categorical)
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).
120
+ # the mask is not NaN: dropping it to NaN lets IEEE rules take over instead
121
+ b.strip_mask(Float::NAN).sum(axis: 0)
122
+ # => [ 3, NaN, NaN ] NaN propagates rather than being ignored
123
+ ```
19
124
 
20
- Requirements
21
- ------------
125
+ ## Documentation
22
126
 
23
- * Ruby 2.4.0 or later
24
- * C compiler
25
- + IEEE754 floating point number
26
- + C99 complex number
127
+ * [What is Ruby/CArray](docs/WhatIsCArray.md)
27
128
 
28
- What is Ruby/CArray
29
- ------------------
129
+ ## Credits
30
130
 
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.
131
+ Up to version 2.0, CArray was authored by himotoyoshi.
32
132
 
33
- #### Multi-dimensional uniform array ####
133
+ CArray 3.0 was designed and reviewed by a human developer; the implementation was
134
+ produced in collaboration with AI coding tools.
34
135
 
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
- -------
136
+ ## License
55
137
 
56
138
  MIT (after version 1.5.0)
139
+
140
+ Copyright (C) 2005-2026 himotoyoshi
data/carray.gemspec CHANGED
@@ -1,19 +1,8 @@
1
- Gem::Specification::new do |s|
2
-
3
- version = "2.0.1"
4
-
5
- files = Dir.glob("**/*") + [".yardopts"] -
6
- [
7
- Dir.glob("carray-*.gem"),
8
- Dir.glob("ext/**/{Makefile,mkmf.log}"),
9
- Dir.glob("**/*.{o,so,bundle}"),
10
- Dir.glob("**/*~"),
11
- Dir.glob("doc/**/*"),
12
- Dir.glob("test/**/*"),
13
- ].flatten
14
-
15
- s.platform = Gem::Platform::RUBY
1
+ Gem::Specification.new do |s|
16
2
  s.name = "carray"
3
+ s.version = "3.0.0"
4
+ s.authors = ["himotoyoshi"]
5
+ s.email = ["himotoyoshi@users.noreply.github.com"]
17
6
  s.summary = "Multi-dimesional array class for Ruby"
18
7
  s.description = <<-HERE
19
8
  Ruby/CArray is an extension library for the multi-dimensional numerical array
@@ -22,13 +11,22 @@ Gem::Specification::new do |s|
22
11
  memory block and treats them collectively to ensure efficient performance.
23
12
  Therefore, Ruby/CArray is suitable for numerical computation and data analysis.
24
13
  HERE
25
- s.version = version
26
- s.author = "Hiroki Motoyoshi"
27
- s.email = ""
28
- s.license = 'MIT'
29
- s.homepage = 'https://github.com/himotoyoshi/carray'
30
- s.files = files
31
- s.extensions = [ "ext/extconf.rb" ]
32
- s.required_ruby_version = ">= 2.4.0"
14
+ s.homepage = "https://github.com/himotoyoshi/carray"
15
+ s.license = "MIT"
16
+ s.platform = Gem::Platform::RUBY
17
+ s.required_ruby_version = ">= 3.0"
18
+ s.files = [
19
+ *Dir.glob("lib/**/*.rb"),
20
+ *(Dir.glob("ext/*.c") - %w[ext/carray_kernels.c ext/carray_cast_func.c ext/carray_math.c]),
21
+ *Dir.glob("ext/*.h"),
22
+ *Dir.glob("ext/*.rb"),
23
+ "LICENSE",
24
+ "README.md",
25
+ "NEWS.md",
26
+ "CHANGELOG.md",
27
+ ".yardopts",
28
+ "carray.gemspec",
29
+ ].select { |f| File.file?(f) }
30
+ s.extensions = ["ext/extconf.rb"]
31
+ s.require_paths = ["lib", "ext"]
33
32
  end
34
-
@@ -0,0 +1,91 @@
1
+ /* ---------------------------------------------------------------------------
2
+
3
+ CArray pool framework primitives. Collapses the per-class
4
+ `dim` / `strides` / per-view-tail metadata allocations into a
5
+ single `_pool` buffer, owned by the CArray struct and freed in
6
+ one xfree. Reduces the number of xmalloc / xfree pairs per
7
+ CArray lifecycle and keeps the metadata cache-adjacent.
8
+
9
+ Primary motivation: CABlock and CAWindow view creation. Those
10
+ two carry the most per-instance metadata (dim + strides + per-
11
+ axis tail), so consolidating their allocations into one pool
12
+ buffer roughly doubles clone throughput. Other view types and
13
+ entities adopted the same primitives for uniform alloc/free
14
+ discipline; the perf gain on those is modest.
15
+
16
+ Internal C API (no Ruby surface, no Init function). Three
17
+ entry points:
18
+
19
+ ca_array_alloc struct + pool in one allocation; used by
20
+ the C `*_new` constructors that build a
21
+ CArray from C without a Ruby wrapper.
22
+ ca_array_pool_alloc pool only; used by `*_initialize_copy`
23
+ where TypedData_Make_Struct has already
24
+ allocated the C struct.
25
+ ca_array_free frees both struct and pool; dispatched
26
+ from per-class free callbacks.
27
+
28
+ Per obj_type, two function-pointer hooks are registered into
29
+ `ca_func[obj_type]`: `pool_bytes(ndim)` computes the pool size,
30
+ and `pool_init(ca, ndim)` wires the struct's `dim` / `strides` /
31
+ tail pointers into the freshly allocated pool. See the per-view
32
+ Init_* setup for examples.
33
+
34
+ Mixed dispatch: an obj_type that has not yet registered the pool
35
+ hooks falls through to its legacy per-field ALLOC_N path
36
+ (`ca->_pool == NULL`); existing CArrays from such classes continue
37
+ to free correctly because `ca_array_free` is a no-op when
38
+ `_pool` is NULL. This kept the migration incremental and
39
+ remains safe in mixed object-graph scenarios.
40
+
41
+ See devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md for the design.
42
+
43
+ ---------------------------------------------------------------------------- */
44
+
45
+ #include "carray.h"
46
+ #include <string.h>
47
+
48
+ /* Allocate struct + pool in one shot, then run pool_init.
49
+ *
50
+ * Called by per-class C `*_new` constructors. */
51
+ void *
52
+ ca_array_alloc (int8_t obj_type, int8_t ndim)
53
+ {
54
+ ca_operation_function_t *func = &ca_func[obj_type];
55
+ CArray *ca = xmalloc(func->struct_size);
56
+ memset(ca, 0, func->struct_size);
57
+ ca_array_pool_alloc(ca, obj_type, ndim);
58
+ return ca;
59
+ }
60
+
61
+ /* Allocate just the _pool buffer and run pool_init. The C struct
62
+ * itself is assumed already allocated (e.g. by TypedData_Make_Struct
63
+ * via `*_s_allocate`).
64
+ *
65
+ * Called by per-class `*_initialize_copy` and by ca_array_alloc above. */
66
+ void
67
+ ca_array_pool_alloc (void *ap, int8_t obj_type, int8_t ndim)
68
+ {
69
+ CArray *ca = (CArray *) ap;
70
+ ca_operation_function_t *func = &ca_func[obj_type];
71
+ ca->ndim = ndim;
72
+ ca->_pool = xmalloc(func->pool_bytes(ndim));
73
+ func->pool_init(ca, ndim);
74
+ }
75
+
76
+ /* Free struct + pool in one shot. Safe when `ca->_pool == NULL`
77
+ * (the pool xfree is skipped, the struct xfree always runs); this
78
+ * lets the per-class free callback dispatch here uniformly whether
79
+ * or not its obj_type has migrated to pool registration.
80
+ *
81
+ * Called by per-class free_* callbacks (= `func->free_object`). */
82
+ void
83
+ ca_array_free (void *ap)
84
+ {
85
+ CArray *ca = (CArray *) ap;
86
+ if (ca->_pool) {
87
+ xfree(ca->_pool);
88
+ ca->_pool = NULL;
89
+ }
90
+ xfree(ca);
91
+ }
@@ -0,0 +1,186 @@
1
+ /* ---------------------------------------------------------------------------
2
+
3
+ ca_axis_descriptor.h
4
+
5
+ Per-axis descriptor framework (D1 + D2 + D3) — shared C-level vocabulary
6
+ that lets CSA, CAGrid, CASelectAxis, CAWindow, CAShift, and future
7
+ per-axis-mixed views describe each axis the same way so a common
8
+ attach dispatch engine (D3, ca_axis_dispatch.c) can drive them
9
+ uniformly.
10
+
11
+ See devel/PROPOSAL_AXIS_DESCRIPTOR_FRAMEWORK.md for the design.
12
+
13
+ Status: TWO-TIER FREEZE CONTRACT (3.0 onward), the same split
14
+ ca_kernel_iterator.h declares, for the same reason: this header is
15
+ installed and reachable from `#include "carray.h"`, so what it declares
16
+ is visible to downstream gems whether or not they were meant to use it.
17
+
18
+ FROZEN (additions only; renaming or re-laying-out is a 3.x break):
19
+ - ca_axis_kind_t and the layout of ca_axis_desc_t
20
+
21
+ Not because view authors were invited to build descriptors, but
22
+ because ca_iter_state -- whose slab-delivery fields ARE frozen
23
+ author contract -- embeds ca_axis_desc_t descs[CA_RANK_MAX] by
24
+ value. The type is already part of that struct's layout, so it
25
+ cannot move or shrink without breaking kernels that were promised
26
+ stability. It is frozen by consequence, not by invitation.
27
+
28
+ INTERNAL (free to change across 3.x; no downstream contract):
29
+ - every function below: ca_axis_dispatch_gather / _attach /
30
+ _scatter / _fill_value / _fill_value_via_parent, and the
31
+ ca_*_describe_axes producers
32
+
33
+ An external obj_type cannot participate in this engine anyway:
34
+ ca_iter_register_source_kind accepts CA_ITER_SRC_ATTACH only and
35
+ raises on CA_ITER_SRC_DESCRIPTOR, precisely because the engine
36
+ looks describe_axes up in its own table and an external type has no
37
+ way to supply one. A contract nobody outside can invoke is a
38
+ contract not worth keeping, so these stay free to move.
39
+
40
+ In-tree consumers (ca_obj_grid.c, ca_obj_select.c, ca_obj_select_axis.c,
41
+ ca_obj_window.c, ca_iter_substrate.h, ca_kernel_iterator.c) pick this up
42
+ transitively from carray.h without an explicit include.
43
+
44
+ --------------------------------------------------------------------------- */
45
+
46
+ #ifndef CA_AXIS_DESCRIPTOR_H
47
+ #define CA_AXIS_DESCRIPTOR_H 1
48
+
49
+ /* Depends on int8_t / uint8_t / ca_size_t typedefs from carray.h.
50
+ When this header is included from carray.h mid-file, those typedefs
51
+ are already in scope by the time we reach the include site. */
52
+
53
+ /* ---- D1: per-axis descriptor types ----------------------------------------
54
+
55
+ STRIDE = linear stride axis: parent index = start + i*step,
56
+ i in [0, count). Subsumes nil / Integer / Range index args.
57
+ INDEX = integer index axis: parent index = indices[i],
58
+ i in [0, count). Subsumes integer-array (CAGrid)
59
+ and boolean-mask-after-snapshot (CASelectAxis) axes.
60
+ SHIFT = bound-aware stride axis (CAWindow/CAShift, Tier 2.B):
61
+ parent index = start + i*step normalised by `policy`
62
+ (CA_BOUNDS_FILL / PERIODIC / REFLECT / NEAREST / ...)
63
+ against `size0` (= parent dim along this axis). When
64
+ normalisation fails (still out of range, e.g. FILL
65
+ policy), the engine writes `bound_fill` to the gather
66
+ buffer (or skips the parent write on scatter). */
67
+ typedef enum {
68
+ CA_AXIS_KIND_STRIDE = 0,
69
+ CA_AXIS_KIND_INDEX = 1,
70
+ CA_AXIS_KIND_SHIFT = 2
71
+ } ca_axis_kind_t;
72
+
73
+ typedef struct {
74
+ ca_axis_kind_t kind;
75
+ ca_size_t count; /* output size contributed by this axis */
76
+ /* STRIDE / SHIFT fields (unused / undefined when kind == INDEX) */
77
+ ca_size_t start;
78
+ ca_size_t step;
79
+ /* INDEX-only field (unused / NULL when kind != INDEX).
80
+ Ownership: borrowed from the producer view; lifetime tied to
81
+ the view that produced the descriptor array. Consumer (D3
82
+ dispatch) must not free or mutate. */
83
+ ca_size_t *indices;
84
+ /* SHIFT-only fields (unused / undefined when kind != SHIFT) */
85
+ ca_size_t size0; /* parent dim along this axis (bounds check) */
86
+ uint8_t policy; /* CA_BOUNDS_FILL / PERIODIC / REFLECT / ... */
87
+ } ca_axis_desc_t;
88
+
89
+ /* ---- D2: producer interface ----------------------------------------------
90
+
91
+ Both implementations write ndim entries into `out` (caller-allocated)
92
+ and `out_parent_dims` (caller-allocated, sized CA_RANK_MAX). See
93
+ devel/PROPOSAL_AXIS_DESCRIPTOR_FRAMEWORK.md §5 Framework Phase 1 and
94
+ devel/PROPOSAL_FLAT_INDEX_VIEWS.md §2.3 for rationale.
95
+
96
+ `out_parent_dims[k]` is the **effective** parent dim along descriptor
97
+ axis k — for CSA / CAGrid this is just `parent->dim[k]`, but for
98
+ flat-index views (CASelect / CAMapping, Tier 2.A.3+) it is
99
+ `{parent->elements}` (a single-axis flat view of parent). This
100
+ decouples descriptor.ndim from parent.ndim so the engine can drive
101
+ views whose iteration axes don't match the parent's physical shape.
102
+
103
+ Pointer arguments are typed `void *` here to avoid pulling the
104
+ private CASelectAxis / CAGrid struct definitions (which live in
105
+ their respective .c files) into this header. Each implementation
106
+ casts to its concrete type inside the .c file. */
107
+ void ca_select_axis_describe_axes (void *ca, ca_axis_desc_t *out,
108
+ ca_size_t *out_parent_dims);
109
+ void ca_grid_describe_axes (void *ca, ca_axis_desc_t *out,
110
+ ca_size_t *out_parent_dims);
111
+
112
+ /* ---- D3: common attach engine --------------------------------------------
113
+
114
+ Drives gather from `parent` into an output buffer driven by the
115
+ per-axis descriptor array. Caller must have parent attached before
116
+ invoking.
117
+
118
+ `parent_axis_dims[ndim]` carries the effective parent dim per
119
+ descriptor axis (see producer interface above). The engine never
120
+ reads `parent->dim` directly — it only reads `parent->ptr` for
121
+ data access — which is what allows flat-index views to lie about
122
+ parent's apparent shape (Tier 2.A, PROPOSAL_FLAT_INDEX_VIEWS.md).
123
+
124
+ `bound_fill` is the bytes-wide value written into gather output
125
+ cells whose SHIFT axes resolve to an out-of-bounds parent index
126
+ (Tier 2.B, PROPOSAL_BOUND_AWARE_VIEWS.md). Pass NULL when no
127
+ SHIFT axis is present (CSA / CAGrid / CASelect / CAMapping); the
128
+ engine ignores it. On scatter, the engine simply skips parent
129
+ writes for OOB cells regardless of bound_fill.
130
+
131
+ _gather — caller provides out_buf (must be sized total_elements*bytes)
132
+ _attach — wrapper that mallocs the buffer; caller xfrees
133
+
134
+ Returns a 1-byte placeholder when total_elements == 0 (the
135
+ _attach variant); _gather becomes a no-op in that case.
136
+
137
+ Forward-declare struct _CArray so these declarations can sit in a
138
+ stand-alone header without dragging in the full CArray definition. */
139
+ struct _CArray;
140
+ void ca_axis_dispatch_gather (struct _CArray *parent,
141
+ const ca_size_t *parent_axis_dims,
142
+ ca_axis_desc_t *axes,
143
+ int8_t ndim,
144
+ ca_size_t bytes,
145
+ ca_size_t total_elements,
146
+ const void *bound_fill,
147
+ char *out_buf);
148
+ char *ca_axis_dispatch_attach (struct _CArray *parent,
149
+ const ca_size_t *parent_axis_dims,
150
+ ca_axis_desc_t *axes,
151
+ int8_t ndim,
152
+ ca_size_t bytes,
153
+ ca_size_t total_elements,
154
+ const void *bound_fill);
155
+ void ca_axis_dispatch_scatter (struct _CArray *parent,
156
+ const ca_size_t *parent_axis_dims,
157
+ ca_axis_desc_t *axes,
158
+ int8_t ndim,
159
+ ca_size_t bytes,
160
+ ca_size_t total_elements,
161
+ const char *in_buf);
162
+ /* Broadcast scatter: write the single value `val` (bytes wide) into
163
+ every selected parent cell. See D6 of the framework piece.
164
+ (SHIFT axis OOB cells are skipped — fill semantics aren't
165
+ meaningful for broadcast-write since the destination value already
166
+ IS the broadcast value.) */
167
+ void ca_axis_dispatch_fill_value (struct _CArray *parent,
168
+ const ca_size_t *parent_axis_dims,
169
+ ca_axis_desc_t *axes,
170
+ int8_t ndim,
171
+ ca_size_t bytes,
172
+ ca_size_t total_elements,
173
+ const void *val);
174
+
175
+ /* As above, but each slab is handed to the parent as a region of its own via
176
+ ca_fill_stride, so a parent that has to be materialised to be addressed is
177
+ never gathered and written back whole to set the cells this view selected. */
178
+ void ca_axis_dispatch_fill_value_via_parent (struct _CArray *parent,
179
+ const ca_size_t *parent_axis_dims,
180
+ ca_axis_desc_t *axes,
181
+ int8_t ndim,
182
+ ca_size_t bytes,
183
+ ca_size_t total_elements,
184
+ const void *val);
185
+
186
+ #endif /* CA_AXIS_DESCRIPTOR_H */