carray 2.0.1 → 3.0.1

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 (386) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +6 -25
  3. data/CHANGELOG.md +338 -0
  4. data/{NEWS.md → CHANGELOG.v1.md} +3 -0
  5. data/LICENSE +1 -1
  6. data/README.md +120 -36
  7. data/carray.gemspec +32 -30
  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 +1244 -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 +124 -0
  15. data/ext/ca_binop_dispatch.h +152 -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 +239 -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 +4367 -0
  26. data/ext/ca_kernel_iterator.h +2596 -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 +839 -0
  33. data/ext/ca_obj_binop.c +948 -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 +967 -0
  39. data/ext/ca_obj_face.c +750 -0
  40. data/ext/ca_obj_face.h +279 -0
  41. data/ext/ca_obj_fake.c +239 -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 +308 -0
  45. data/ext/ca_obj_grid.c +866 -440
  46. data/ext/ca_obj_meld.c +1039 -0
  47. data/ext/ca_obj_moncmp.c +588 -0
  48. data/ext/ca_obj_monop.c +1123 -0
  49. data/ext/ca_obj_object.c +866 -296
  50. data/ext/ca_obj_record.c +470 -0
  51. data/ext/ca_obj_reduce.c +97 -82
  52. data/ext/ca_obj_refer.c +593 -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 +624 -0
  56. data/ext/ca_obj_select.c +344 -296
  57. data/ext/ca_obj_select_axis.c +1306 -0
  58. data/ext/ca_obj_shift.c +231 -793
  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 +2584 -0
  62. data/ext/ca_obj_string.c +270 -0
  63. data/ext/ca_obj_tile.c +622 -0
  64. data/ext/ca_obj_time.c +548 -0
  65. data/ext/ca_obj_timedelta.c +437 -0
  66. data/ext/ca_obj_transpose.c +62 -516
  67. data/ext/ca_obj_triop.c +785 -0
  68. data/ext/ca_obj_window.c +1202 -565
  69. data/ext/ca_op_byte_swap.c +175 -0
  70. data/ext/ca_op_cmplx64.h +123 -0
  71. data/ext/ca_op_ipower.c +316 -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 +473 -0
  75. data/ext/ca_sweep_engine.h +166 -0
  76. data/ext/ca_transform_common.c +235 -0
  77. data/ext/ca_triop_dispatch.c +55 -0
  78. data/ext/ca_triop_dispatch.h +62 -0
  79. data/ext/carray.h +810 -420
  80. data/ext/carray_access.c +873 -731
  81. data/ext/carray_attribute.c +98 -329
  82. data/ext/carray_bincount.c +255 -0
  83. data/ext/carray_broadcast.c +376 -0
  84. data/ext/carray_build_flags.h +3 -0
  85. data/ext/carray_call_cfunc.c +2897 -874
  86. data/ext/carray_call_cfunc.h +313 -0
  87. data/ext/carray_cast.c +1264 -315
  88. data/ext/carray_cast_func.rb +81 -40
  89. data/ext/carray_class.c +53 -63
  90. data/ext/carray_config.h +28 -0
  91. data/ext/carray_conversion.c +350 -346
  92. data/ext/carray_copy.c +168 -270
  93. data/ext/carray_core.c +1396 -206
  94. data/ext/carray_count.c +312 -0
  95. data/ext/carray_data_type.c +43 -19
  96. data/ext/carray_element.c +585 -213
  97. data/ext/carray_factorize.c +2542 -0
  98. data/ext/carray_generate.c +230 -559
  99. data/ext/carray_histogram.c +490 -0
  100. data/ext/carray_hold.c +228 -0
  101. data/ext/carray_index_classifier.c +1021 -0
  102. data/ext/carray_index_classifier.h +27 -0
  103. data/ext/carray_internal.h +136 -0
  104. data/ext/carray_kernels_bincmp.c +4446 -0
  105. data/ext/carray_kernels_binop.c +11001 -0
  106. data/ext/carray_kernels_init.c +1131 -0
  107. data/ext/carray_kernels_map.c +3467 -0
  108. data/ext/carray_kernels_moncmp.c +2097 -0
  109. data/ext/carray_kernels_monop.c +18313 -0
  110. data/ext/carray_kernels_reduce_aggregate.c +25837 -0
  111. data/ext/carray_kernels_reduce_boolean.c +330 -0
  112. data/ext/carray_kernels_reduce_cumulative.c +14593 -0
  113. data/ext/carray_kernels_reduce_extreme.c +16948 -0
  114. data/ext/carray_kernels_reduce_variance.c +3910 -0
  115. data/ext/carray_kernels_scan.c +3693 -0
  116. data/ext/carray_kernels_search.c +32138 -0
  117. data/ext/carray_kernels_sort.c +10626 -0
  118. data/ext/carray_kernels_triop.c +1392 -0
  119. data/ext/carray_lazy.c +737 -0
  120. data/ext/carray_loop.c +88 -200
  121. data/ext/carray_mask.c +853 -158
  122. data/ext/carray_math_kernel.h +120 -0
  123. data/ext/carray_mathfunc.c +10 -241
  124. data/ext/carray_median_percentile.c +1257 -0
  125. data/ext/carray_memory_view.c +1650 -0
  126. data/ext/carray_operator.c +1525 -320
  127. data/ext/carray_order.c +664 -1394
  128. data/ext/carray_partition.c +416 -0
  129. data/ext/carray_random.c +518 -0
  130. data/ext/carray_scatter.c +357 -0
  131. data/ext/carray_slab.c +1219 -0
  132. data/ext/carray_slab.h +84 -0
  133. data/ext/carray_sort.c +829 -0
  134. data/ext/carray_sort_kernel.c +620 -0
  135. data/ext/carray_struct.c +695 -0
  136. data/ext/carray_test.c +343 -229
  137. data/ext/carray_undef.c +34 -17
  138. data/ext/carray_utils.c +175 -74
  139. data/ext/extconf.rb +234 -55
  140. data/ext/mk_call_cfunc.rb +671 -0
  141. data/ext/mkkernel.rb +9096 -0
  142. data/ext/ruby_carray.c +211 -108
  143. data/ext/version.h +4 -14
  144. data/ext/version.rb +5 -13
  145. data/lib/carray/arrow_tensor.rb +401 -0
  146. data/lib/carray/attribute.rb +166 -0
  147. data/lib/carray/autoload_carray.rb +239 -0
  148. data/lib/carray/autoload_method_extension.rb +45 -0
  149. data/lib/carray/axis_group.rb +711 -0
  150. data/lib/carray/basics.rb +481 -0
  151. data/lib/carray/bincount_nd.rb +358 -0
  152. data/lib/carray/block_iterator.rb +614 -0
  153. data/lib/carray/boolean_reduce.rb +109 -0
  154. data/lib/carray/categorical.rb +561 -0
  155. data/lib/carray/categorical_iterator.rb +1084 -0
  156. data/lib/carray/complex.rb +150 -0
  157. data/lib/carray/conditional.rb +216 -0
  158. data/lib/carray/const_string.rb +228 -0
  159. data/lib/carray/construct.rb +160 -328
  160. data/lib/carray/core_extensions.rb +297 -0
  161. data/lib/carray/data_type_extension.rb +250 -0
  162. data/lib/carray/fixlen_string.rb +95 -0
  163. data/lib/carray/frame/concat.rb +132 -0
  164. data/lib/carray/frame/convert.rb +95 -0
  165. data/lib/carray/frame/csv_parser.rb +211 -0
  166. data/lib/carray/frame/frame.rb +642 -0
  167. data/lib/carray/frame/group.rb +186 -0
  168. data/lib/carray/frame/io.rb +321 -0
  169. data/lib/carray/frame/join.rb +248 -0
  170. data/lib/carray/frame/records.rb +99 -0
  171. data/lib/carray/frame/sort.rb +113 -0
  172. data/lib/carray/frame/verbs.rb +316 -0
  173. data/lib/carray/frame.rb +16 -0
  174. data/lib/carray/fuse_source.rb +123 -0
  175. data/lib/carray/fusion.rb +218 -0
  176. data/lib/carray/histogram.rb +512 -0
  177. data/lib/carray/inspect.rb +37 -26
  178. data/lib/carray/iterator.rb +58 -349
  179. data/lib/carray/lazy.rb +941 -0
  180. data/lib/carray/mask_gap_fill.rb +200 -0
  181. data/lib/carray/math.rb +78 -342
  182. data/lib/carray/meld_reduce.rb +289 -0
  183. data/lib/carray/methods/align_addr.rb +116 -0
  184. data/lib/carray/methods/bin.rb +128 -0
  185. data/lib/carray/methods/bincount.rb +87 -0
  186. data/lib/carray/methods/bit_string.rb +92 -0
  187. data/lib/carray/methods/broadcast.rb +63 -0
  188. data/lib/carray/methods/choose.rb +39 -0
  189. data/lib/carray/methods/composition.rb +280 -0
  190. data/lib/carray/methods/gather_nd.rb +206 -0
  191. data/lib/carray/methods/index.rb +39 -0
  192. data/lib/carray/methods/insert_block.rb +99 -0
  193. data/lib/carray/methods/is_in.rb +141 -0
  194. data/lib/carray/methods/join.rb +90 -0
  195. data/lib/carray/methods/locate_addr.rb +52 -0
  196. data/lib/carray/methods/mask_duplicates.rb +41 -0
  197. data/lib/carray/methods/meshgrid.rb +90 -0
  198. data/lib/carray/methods/mode.rb +126 -0
  199. data/lib/carray/methods/nunique.rb +46 -0
  200. data/lib/carray/methods/resize.rb +56 -0
  201. data/lib/carray/methods/snap.rb +161 -0
  202. data/lib/carray/methods/string_format.rb +57 -0
  203. data/lib/carray/methods/unique.rb +47 -0
  204. data/lib/carray/methods/value_counts.rb +71 -0
  205. data/lib/carray/mkmf.rb +124 -101
  206. data/lib/carray/runtime.rb +89 -0
  207. data/lib/carray/serialize.rb +478 -167
  208. data/lib/carray/slab_iterator.rb +305 -0
  209. data/lib/carray/stack.rb +291 -0
  210. data/lib/carray/string.rb +56 -180
  211. data/lib/carray/string_operation_extension.rb +289 -0
  212. data/lib/carray/struct.rb +335 -323
  213. data/lib/carray/struct_builder.rb +697 -0
  214. data/lib/carray/table.rb +41 -2
  215. data/lib/carray/time.rb +2654 -38
  216. data/lib/carray/window_iterator.rb +927 -0
  217. data/lib/carray.rb +55 -57
  218. data/yard-stubs/ca_obj_array.rb +385 -0
  219. data/yard-stubs/ca_obj_bitarray.rb +38 -0
  220. data/yard-stubs/ca_obj_bitfield.rb +43 -0
  221. data/yard-stubs/ca_obj_block.rb +73 -0
  222. data/yard-stubs/ca_obj_byte_swap.rb +56 -0
  223. data/yard-stubs/ca_obj_fake.rb +31 -0
  224. data/yard-stubs/ca_obj_farray.rb +32 -0
  225. data/yard-stubs/ca_obj_field.rb +45 -0
  226. data/yard-stubs/ca_obj_grid.rb +35 -0
  227. data/yard-stubs/ca_obj_refer.rb +72 -0
  228. data/yard-stubs/ca_obj_roll.rb +45 -0
  229. data/yard-stubs/ca_obj_shift.rb +43 -0
  230. data/yard-stubs/ca_obj_stride.rb +181 -0
  231. data/yard-stubs/ca_obj_tile.rb +29 -0
  232. data/yard-stubs/ca_obj_transpose.rb +40 -0
  233. data/yard-stubs/ca_obj_window.rb +49 -0
  234. data/yard-stubs/carray_access.rb +131 -0
  235. data/yard-stubs/carray_attribute.rb +246 -0
  236. data/yard-stubs/carray_broadcast.rb +37 -0
  237. data/yard-stubs/carray_cast.rb +489 -0
  238. data/yard-stubs/carray_class.rb +65 -0
  239. data/yard-stubs/carray_conversion.rb +76 -0
  240. data/yard-stubs/carray_copy.rb +79 -0
  241. data/yard-stubs/carray_core.rb +114 -0
  242. data/yard-stubs/carray_count.rb +79 -0
  243. data/yard-stubs/carray_element.rb +108 -0
  244. data/yard-stubs/carray_generate.rb +66 -0
  245. data/yard-stubs/carray_lazy.rb +23 -0
  246. data/yard-stubs/carray_loop.rb +140 -0
  247. data/yard-stubs/carray_mask.rb +259 -0
  248. data/yard-stubs/carray_math.rb +132 -0
  249. data/yard-stubs/carray_mathfunc.rb +45 -0
  250. data/yard-stubs/carray_median_percentile.rb +89 -0
  251. data/yard-stubs/carray_memory_view.rb +163 -0
  252. data/yard-stubs/carray_order.rb +312 -0
  253. data/yard-stubs/carray_random.rb +89 -0
  254. data/yard-stubs/carray_scatter.rb +106 -0
  255. data/yard-stubs/carray_slab.rb +57 -0
  256. data/yard-stubs/carray_sort.rb +163 -0
  257. data/yard-stubs/carray_test.rb +85 -0
  258. data/yard-stubs/carray_undef.rb +64 -0
  259. data/yard-stubs/carray_utils.rb +97 -0
  260. data/yard-stubs/ruby_carray.rb +193 -0
  261. metadata +220 -138
  262. data/Rakefile +0 -51
  263. data/TODO.md +0 -18
  264. data/ext/ca_iter_block.c +0 -257
  265. data/ext/ca_iter_dimension.c +0 -299
  266. data/ext/ca_iter_window.c +0 -214
  267. data/ext/ca_obj_mapping.c +0 -644
  268. data/ext/ca_obj_unbound_repeat.c +0 -529
  269. data/ext/carray_iterator.c +0 -641
  270. data/ext/carray_math.rb +0 -850
  271. data/ext/carray_numeric.c +0 -259
  272. data/ext/carray_sort_addr.c +0 -254
  273. data/ext/carray_stat.c +0 -2100
  274. data/ext/carray_stat_proc.rb +0 -1999
  275. data/ext/mkmath.rb +0 -741
  276. data/ext/ruby_ccomplex.c +0 -509
  277. data/ext/ruby_float_func.c +0 -86
  278. data/lib/carray/array.rb +0 -8
  279. data/lib/carray/autoload/autoload_base.rb +0 -19
  280. data/lib/carray/autoload/autoload_gem_cairo.rb +0 -9
  281. data/lib/carray/autoload/autoload_gem_ffi.rb +0 -9
  282. data/lib/carray/autoload/autoload_gem_gnuplot.rb +0 -2
  283. data/lib/carray/autoload/autoload_gem_io_csv.rb +0 -14
  284. data/lib/carray/autoload/autoload_gem_io_pg.rb +0 -6
  285. data/lib/carray/autoload/autoload_gem_io_sqlite3.rb +0 -12
  286. data/lib/carray/autoload/autoload_gem_narray.rb +0 -10
  287. data/lib/carray/autoload/autoload_gem_numo_narray.rb +0 -15
  288. data/lib/carray/autoload/autoload_gem_opencv.rb +0 -16
  289. data/lib/carray/autoload/autoload_gem_random.rb +0 -8
  290. data/lib/carray/autoload/autoload_gem_rmagick.rb +0 -23
  291. data/lib/carray/autoload/autoload_gem_zimg.rb +0 -3
  292. data/lib/carray/autoload/autoload_io_imagemagick.rb +0 -6
  293. data/lib/carray/autoload/autoload_math_histogram.rb +0 -5
  294. data/lib/carray/autoload/autoload_math_recurrence.rb +0 -6
  295. data/lib/carray/autoload/autoload_object_iterator.rb +0 -1
  296. data/lib/carray/autoload/autoload_object_link.rb +0 -1
  297. data/lib/carray/autoload/autoload_object_pack.rb +0 -2
  298. data/lib/carray/autoload.rb +0 -141
  299. data/lib/carray/basic.rb +0 -191
  300. data/lib/carray/broadcast.rb +0 -101
  301. data/lib/carray/compose.rb +0 -315
  302. data/lib/carray/convert.rb +0 -115
  303. data/lib/carray/info.rb +0 -110
  304. data/lib/carray/io/imagemagick.rb +0 -235
  305. data/lib/carray/mask.rb +0 -102
  306. data/lib/carray/math/histogram.rb +0 -177
  307. data/lib/carray/math/recurrence.rb +0 -93
  308. data/lib/carray/object/ca_obj_iterator.rb +0 -50
  309. data/lib/carray/object/ca_obj_link.rb +0 -50
  310. data/lib/carray/object/ca_obj_pack.rb +0 -99
  311. data/lib/carray/obsolete.rb +0 -256
  312. data/lib/carray/ordering.rb +0 -181
  313. data/lib/carray/testing.rb +0 -51
  314. data/lib/carray/transform.rb +0 -109
  315. data/mailmap +0 -1
  316. data/misc/Methods.ja.md +0 -182
  317. data/misc/NOTE +0 -51
  318. data/spec/Classes/CABitfield_spec.rb +0 -58
  319. data/spec/Classes/CABlockIterator_spec.rb +0 -114
  320. data/spec/Classes/CABlock_spec.rb +0 -205
  321. data/spec/Classes/CAField_spec.rb +0 -39
  322. data/spec/Classes/CAGrid_spec.rb +0 -75
  323. data/spec/Classes/CAMap_spec.rb +0 -0
  324. data/spec/Classes/CAMapping_spec.rb +0 -105
  325. data/spec/Classes/CAObject_attribute_spec.rb +0 -33
  326. data/spec/Classes/CAObject_spec.rb +0 -33
  327. data/spec/Classes/CARefer_spec.rb +0 -93
  328. data/spec/Classes/CARepeat_spec.rb +0 -65
  329. data/spec/Classes/CASelect_spec.rb +0 -22
  330. data/spec/Classes/CAShift_spec.rb +0 -16
  331. data/spec/Classes/CAStruct_spec.rb +0 -71
  332. data/spec/Classes/CATranspose_spec.rb +0 -60
  333. data/spec/Classes/CAUnboudRepeat_spec.rb +0 -102
  334. data/spec/Classes/CAWindow_spec.rb +0 -54
  335. data/spec/Classes/CAWrap_spec.rb +0 -8
  336. data/spec/Classes/CArray_spec.rb +0 -184
  337. data/spec/Classes/CScalar_spec.rb +0 -55
  338. data/spec/Features/feature_130_spec.rb +0 -19
  339. data/spec/Features/feature_attributes_spec.rb +0 -280
  340. data/spec/Features/feature_boolean_spec.rb +0 -98
  341. data/spec/Features/feature_broadcast.rb +0 -116
  342. data/spec/Features/feature_cast_function.rb +0 -19
  343. data/spec/Features/feature_cast_spec.rb +0 -33
  344. data/spec/Features/feature_class_spec.rb +0 -84
  345. data/spec/Features/feature_complex_spec.rb +0 -42
  346. data/spec/Features/feature_composite_spec.rb +0 -124
  347. data/spec/Features/feature_convert_spec.rb +0 -46
  348. data/spec/Features/feature_copy_spec.rb +0 -123
  349. data/spec/Features/feature_creation_spec.rb +0 -84
  350. data/spec/Features/feature_element_spec.rb +0 -144
  351. data/spec/Features/feature_extream_spec.rb +0 -54
  352. data/spec/Features/feature_generate_spec.rb +0 -74
  353. data/spec/Features/feature_index_spec.rb +0 -69
  354. data/spec/Features/feature_mask_spec.rb +0 -580
  355. data/spec/Features/feature_math_spec.rb +0 -97
  356. data/spec/Features/feature_order_spec.rb +0 -146
  357. data/spec/Features/feature_ref_store_spec.rb +0 -209
  358. data/spec/Features/feature_serialization_spec.rb +0 -125
  359. data/spec/Features/feature_stat_spec.rb +0 -397
  360. data/spec/Features/feature_virtual_spec.rb +0 -48
  361. data/spec/Features/method_eq_spec.rb +0 -81
  362. data/spec/Features/method_is_nan_spec.rb +0 -12
  363. data/spec/Features/method_map_spec.rb +0 -54
  364. data/spec/Features/method_max_with.rb +0 -20
  365. data/spec/Features/method_min_with.rb +0 -19
  366. data/spec/Features/method_ne_spec.rb +0 -18
  367. data/spec/Features/method_project_spec.rb +0 -188
  368. data/spec/Features/method_ref_spec.rb +0 -27
  369. data/spec/Features/method_round_spec.rb +0 -11
  370. data/spec/Features/method_s_linspace_spec.rb +0 -48
  371. data/spec/Features/method_s_span_spec.rb +0 -14
  372. data/spec/Features/method_seq_spec.rb +0 -47
  373. data/spec/Features/method_sort_with.rb +0 -43
  374. data/spec/Features/method_sorted_with.rb +0 -29
  375. data/spec/Features/method_span_spec.rb +0 -42
  376. data/spec/Features/method_wrap_readonly_spec.rb +0 -43
  377. data/spec/UnitTest/test_CAVirtual.rb +0 -214
  378. data/spec/spec_all.rb +0 -10
  379. data/utils/ca_ase.rb +0 -21
  380. data/utils/ca_methods.rb +0 -15
  381. data/utils/cast_checker.rb +0 -30
  382. data/utils/convert_test.rb +0 -73
  383. data/utils/extract_yard.rb +0 -22
  384. data/utils/guess_shape.rb +0 -76
  385. data/utils/monkey_patch_methods.rb +0 -62
  386. data/utils/remove_resource_fork.sh +0 -5
data/lib/carray.rb CHANGED
@@ -1,72 +1,70 @@
1
- # ----------------------------------------------------------------------------
2
- #
3
- # lib/carray.rb
4
- #
5
- # This file is part of Ruby/CArray extension library.
6
- #
7
- # Copyright (C) 2005-2025 Hiroki Motoyoshi
8
- #
9
- # ----------------------------------------------------------------------------
1
+ # main
10
2
 
11
- major = RbConfig::CONFIG['MAJOR'].to_i
12
- minor = RbConfig::CONFIG['MINOR'].to_i
13
- teeny = RbConfig::CONFIG['TEENY'].to_i
14
- ruby_version_code = major * 100 + minor * 10 + teeny
3
+ require 'carray_ext'
15
4
 
16
- if ruby_version_code < 190
17
- require 'complex'
5
+ # Top-level CAMath module -- math namespace for CArrays.
6
+ # `CAMath.sin(ca)` works because module functions inherited
7
+ # from Math (via include) accept any object that responds to
8
+ # the corresponding instance method; CArray defines those in
9
+ # C.
10
+ module CAMath
11
+ include Math
18
12
  end
19
13
 
20
- # main
21
-
22
- require 'carray_ext'
23
-
24
- require 'carray/inspect'
25
- require 'carray/basic'
14
+ # carray/inspect is loaded lazily via autoload_carray (#inspect / #source_code
15
+ # stubs). #inspect fires on the first p / pp / irb display or error-message
16
+ # interpolation, so compute programs that never print a CArray skip it.
26
17
  require 'carray/construct'
27
- require 'carray/mask'
28
- require 'carray/compose'
29
- require 'carray/transform'
30
- require 'carray/convert'
31
- require 'carray/testing'
32
- require 'carray/ordering'
33
- require 'carray/broadcast'
18
+ require 'carray/data_type_extension'
19
+ # carray/stack is loaded lazily via autoload_carray (entry-method stubs).
20
+ # CAStack is C-defined so its constant is always present; only the Ruby
21
+ # composition surface (stack/meld/montage/split/append) needs the file.
22
+ require 'carray/runtime' # load-bearing Ruby support the core depends on
23
+ require 'carray/basics' # frequently-used convenience methods kept eager
24
+ require 'carray/conditional' # then_else / replace_where / conditional
25
+ require 'carray/mask_gap_fill' # unmask/strip_mask method: keyword (hold / linear gap-fill)
26
+ require 'carray/attribute' # per-instance metadata Hash (#attribute / #has_attribute?)
27
+ require 'carray/boolean_reduce' # all/any/none skip_masked: keyword (Kleene fold)
28
+ require 'carray/meld_reduce' # CAMeld per-parent reduce fast path (sum/mean/min/max along meld_axis)
29
+ # carray/ordering CIFY (2026-06-21): translated to ext/carray_order.c
34
30
 
35
31
  require 'carray/math'
32
+ # carray/clip_cast CIFY (2026-06-23): translated to ext/carray_cast.c
33
+ require 'carray/complex' # real / imag accessors; MUST precede carray/lazy
34
+ # (lazy aliases real/imag at load time)
35
+ require 'carray/lazy' # the lazy elementwise view layer
36
+ # carray/face.rb was deleted (the Phase 1 skeleton CArray::Face module
37
+ # became dead weight, replaced by C-layer macro deploy +
38
+ # copy_state/storage_to_scalar convention).
39
+ require 'carray/time' # CATime / CATimedelta
40
+ # carray/methods/* (bincount / broadcast / gather_nd+put_nd) are small
41
+ # single-feature method files, loaded lazily via autoload_carray.
36
42
  require 'carray/iterator'
37
- require 'carray/struct'
38
- require 'carray/table'
39
- require 'carray/array'
40
- require 'carray/string'
41
- require 'carray/time'
43
+ # carray/struct is loaded lazily via autoload_carray (constant + entry-method
44
+ # stubs). Nothing in the eager core references CAStruct/CAUnion, so programs
45
+ # that only use numeric arrays never pay its load cost.
46
+ require 'carray/string_operation_extension' # shared StringOperationMixin (must precede the Faces)
47
+ require 'carray/const_string' # CAConstString construction surface
48
+ require 'carray/string' # CAString construction surface
49
+ require 'carray/fixlen_string' # CAFixlenString construction surface
50
+ # CArray.format lives in carray/methods/string_format.rb, autoloaded on first call
42
51
 
43
- # obsolete methods
52
+ # carray/frame is loaded lazily via autoload_carray (CAFrame / GroupedFrame
53
+ # constants). Nothing in the eager core references the frame, so programs that
54
+ # only use arrays never pay its load cost.
44
55
 
45
- require 'carray/obsolete'
56
+ # opt-in refinements (loaded on first reference to the constant)
46
57
 
47
- # autoload
58
+ class CArray
59
+ autoload :CoreExtensions, 'carray/core_extensions'
60
+ end
48
61
 
49
- unless $CARRAY_NO_AUTOLOAD
50
-
51
- require 'carray/autoload'
52
- require 'carray/autoload/autoload_base'
53
- require 'carray/autoload/autoload_io_imagemagick'
54
- require 'carray/autoload/autoload_math_histogram'
55
- require 'carray/autoload/autoload_math_recurrence'
56
- require 'carray/autoload/autoload_object_iterator'
57
- require 'carray/autoload/autoload_object_link'
58
- require 'carray/autoload/autoload_object_pack'
62
+ # autoload
59
63
 
60
- require 'carray/autoload/autoload_gem_random'
61
- require 'carray/autoload/autoload_gem_gnuplot'
62
- require 'carray/autoload/autoload_gem_narray'
63
- require 'carray/autoload/autoload_gem_numo_narray'
64
- # require 'carray/autoload/autoload_gem_io_csv'
65
- # require 'carray/autoload/autoload_gem_io_sqlite3'
66
- # require 'carray/autoload/autoload_gem_rmagick'
67
- # require 'carray/autoload/autoload_gem_cairo'
68
- # require 'carray/autoload/autoload_gem_opencv'
69
- # require 'carray/autoload/autoload_gem_ffi'
64
+ require 'carray/autoload_method_extension'
70
65
 
71
- undef autoload_method
66
+ class CArray
67
+ extend AutoloadMethodExtension
72
68
  end
69
+
70
+ require 'carray/autoload_carray'
@@ -0,0 +1,385 @@
1
+ # DOCUMENTATION ONLY — DO NOT REQUIRE.
2
+ # Stubs for constructor methods defined in ext/ca_obj_array.c.
3
+ # See yard-stubs/README.md and yard-stubs/STYLE.md.
4
+
5
+ class CArray
6
+ # @!group Construction
7
+
8
+ # @overload initialize(data_type, shape)
9
+ # Allocates a CArray of the given `data_type` and `shape`, with
10
+ # storage left uninitialized (caller is expected to fill it).
11
+ # @param data_type [Symbol, Integer, Class, String] element type.
12
+ # @param shape [Array<Integer>] one extent per axis.
13
+ # @return [self]
14
+ # @overload initialize(data_type, shape, bytes:)
15
+ # For `data_type == :fixlen`, sets the per-element byte size.
16
+ # Ignored for numeric types.
17
+ # @param data_type [Symbol]
18
+ # @param shape [Array<Integer>]
19
+ # @param bytes [Integer]
20
+ # @return [self]
21
+ # @overload initialize(data_type, shape) { value }
22
+ # With a 0-arity block, calls the block once and broadcasts its
23
+ # return value into every cell of the new array (scalar-fill fast
24
+ # path). This is the dominant
25
+ # `CArray.<type>(n) { value }` idiom.
26
+ # @yieldreturn [Object] value to broadcast.
27
+ # @return [self]
28
+ # @overload initialize(data_type, shape) { |*idx| ... }
29
+ # With an n-arity block, calls the block once per cell with the
30
+ # multi-dimensional index unpacked (`|i|` for 1-D, `|i, j|` for
31
+ # 2-D, etc.). The block's return value is stored at that cell.
32
+ # @yieldparam idx [Array<Integer>] per-axis indices.
33
+ # @yieldreturn [Object]
34
+ # @return [self]
35
+ #
36
+ # 3.0 breaking: `CArray.new(MyStruct, ...)` no longer accepts a
37
+ # user class as `data_type`. Use `CARecord.new(MyStruct, *shape)`
38
+ # or define `class MyArr < CARecord; data_class MyStruct; end`.
39
+ def initialize(*); end
40
+
41
+ # @overload initialize_copy(other)
42
+ # Implements `dup` / `clone` semantics: copies `other`'s
43
+ # `data_type`, shape, mask, and element data into `self`. Result
44
+ # is an independent entity.
45
+ #
46
+ # Note that for views, `dup`/`clone` produce a new view sharing
47
+ # the parent (Ruby shallow-copy semantics); use {#copy} when an
48
+ # independent owned array is required.
49
+ # @param other [CArray]
50
+ # @return [self]
51
+ # @api private
52
+ def initialize_copy(other); end
53
+
54
+ # @!endgroup
55
+
56
+ class << self
57
+ # @!group Construction (typed shorthands)
58
+ #
59
+ # `CArray.<type>` (no args) returns the typed class
60
+ # (`CArray::Float64`, `CArray::Int32`, ...). `CArray.<type>(*shape)`
61
+ # is a shorthand for `CArray.new(:<type>, shape)`. The shorthands
62
+ # accept the same optional block as `initialize`.
63
+
64
+ # @overload fixlen
65
+ # Returns the typed class `CArray::Fixlen`.
66
+ # @return [Class]
67
+ # @overload fixlen(*shape, bytes:) { ... }
68
+ # Equivalent to `CArray.new(:fixlen, shape, bytes: bytes) { ... }`.
69
+ # The `bytes:` keyword is required for `:fixlen`.
70
+ # @param shape [Array<Integer>]
71
+ # @param bytes [Integer]
72
+ # @return [CArray]
73
+ def fixlen(*shape, bytes: nil); end
74
+
75
+ # @overload boolean
76
+ # Returns the typed class `CArray::Boolean`.
77
+ # @return [Class]
78
+ # @overload boolean(*shape) { ... }
79
+ # Equivalent to `CArray.new(:boolean, shape) { ... }`.
80
+ # @param shape [Array<Integer>]
81
+ # @return [CArray]
82
+ def boolean(*shape); end
83
+
84
+ # @overload int8
85
+ # Returns the typed class `CArray::Int8`.
86
+ # @return [Class]
87
+ # @overload int8(*shape) { ... }
88
+ # Equivalent to `CArray.new(:int8, shape) { ... }`.
89
+ # @return [CArray]
90
+ def int8(*shape); end
91
+
92
+ # @overload uint8
93
+ # Returns the typed class `CArray::UInt8`.
94
+ # @return [Class]
95
+ # @overload uint8(*shape) { ... }
96
+ # Equivalent to `CArray.new(:uint8, shape) { ... }`.
97
+ # @return [CArray]
98
+ def uint8(*shape); end
99
+
100
+ # @overload int16
101
+ # Returns the typed class `CArray::Int16`.
102
+ # @return [Class]
103
+ # @overload int16(*shape) { ... }
104
+ # Equivalent to `CArray.new(:int16, shape) { ... }`.
105
+ # @return [CArray]
106
+ def int16(*shape); end
107
+
108
+ # @overload uint16
109
+ # Returns the typed class `CArray::UInt16`.
110
+ # @return [Class]
111
+ # @overload uint16(*shape) { ... }
112
+ # Equivalent to `CArray.new(:uint16, shape) { ... }`.
113
+ # @return [CArray]
114
+ def uint16(*shape); end
115
+
116
+ # @overload int32
117
+ # Returns the typed class `CArray::Int32`.
118
+ # @return [Class]
119
+ # @overload int32(*shape) { ... }
120
+ # Equivalent to `CArray.new(:int32, shape) { ... }`.
121
+ # @return [CArray]
122
+ def int32(*shape); end
123
+
124
+ # @overload uint32
125
+ # Returns the typed class `CArray::UInt32`.
126
+ # @return [Class]
127
+ # @overload uint32(*shape) { ... }
128
+ # Equivalent to `CArray.new(:uint32, shape) { ... }`.
129
+ # @return [CArray]
130
+ def uint32(*shape); end
131
+
132
+ # @overload int64
133
+ # Returns the typed class `CArray::Int64`.
134
+ # @return [Class]
135
+ # @overload int64(*shape) { ... }
136
+ # Equivalent to `CArray.new(:int64, shape) { ... }`.
137
+ # @return [CArray]
138
+ def int64(*shape); end
139
+
140
+ # @overload uint64
141
+ # Returns the typed class `CArray::UInt64`.
142
+ # @return [Class]
143
+ # @overload uint64(*shape) { ... }
144
+ # Equivalent to `CArray.new(:uint64, shape) { ... }`.
145
+ # @return [CArray]
146
+ def uint64(*shape); end
147
+
148
+ # @overload float32
149
+ # Returns the typed class `CArray::Float32`.
150
+ # @return [Class]
151
+ # @overload float32(*shape) { ... }
152
+ # Equivalent to `CArray.new(:float32, shape) { ... }`.
153
+ # @return [CArray]
154
+ def float32(*shape); end
155
+
156
+ # @overload float64
157
+ # Returns the typed class `CArray::Float64`.
158
+ # @return [Class]
159
+ # @overload float64(*shape) { ... }
160
+ # Equivalent to `CArray.new(:float64, shape) { ... }`.
161
+ # @return [CArray]
162
+ def float64(*shape); end
163
+
164
+ # @overload cmplx64
165
+ # Returns the typed class `CArray::Cmplx64`.
166
+ # @return [Class]
167
+ # @overload cmplx64(*shape) { ... }
168
+ # Equivalent to `CArray.new(:cmplx64, shape) { ... }`.
169
+ # @return [CArray]
170
+ def cmplx64(*shape); end
171
+
172
+ # @overload cmplx128
173
+ # Returns the typed class `CArray::Cmplx128`.
174
+ # @return [Class]
175
+ # @overload cmplx128(*shape) { ... }
176
+ # Equivalent to `CArray.new(:cmplx128, shape) { ... }`.
177
+ # @return [CArray]
178
+ def cmplx128(*shape); end
179
+
180
+ # @overload object
181
+ # Returns the typed class `CArray::Object`.
182
+ # @return [Class]
183
+ # @overload object(*shape) { ... }
184
+ # Equivalent to `CArray.new(:object, shape) { ... }`.
185
+ # @return [CArray]
186
+ def object(*shape); end
187
+
188
+ # @!endgroup
189
+
190
+ # @!group Construction (legacy-name aliases)
191
+
192
+ # @overload byte(*shape)
193
+ # Alias of {.uint8}.
194
+ def byte(*shape); end
195
+
196
+ # @overload short(*shape)
197
+ # Alias of {.int16}.
198
+ def short(*shape); end
199
+
200
+ # @overload int(*shape)
201
+ # Alias of {.int32}.
202
+ def int(*shape); end
203
+
204
+ # @overload float(*shape)
205
+ # Alias of {.float32}.
206
+ def float(*shape); end
207
+
208
+ # @overload double(*shape)
209
+ # Alias of {.float64}.
210
+ def double(*shape); end
211
+
212
+ # @overload complex(*shape)
213
+ # Alias of {.cmplx64}.
214
+ def complex(*shape); end
215
+
216
+ # @overload dcomplex(*shape)
217
+ # Alias of {.cmplx128}.
218
+ def dcomplex(*shape); end
219
+
220
+ # @!endgroup
221
+
222
+ # @!group External memory wrapping
223
+
224
+ # @overload wrap(data_type, shape) { target }
225
+ # Wraps an external memory block as a CAWrap. The block must
226
+ # return a `target` object that defines `wrap_as_carray(obj)`,
227
+ # which receives the freshly allocated CAWrap and is
228
+ # responsible for setting its `ptr` field.
229
+ #
230
+ # Use this when bridging to a memory source that does not
231
+ # expose the MemoryView protocol (otherwise prefer
232
+ # {.wrap_memory_view} / {.from_memory_view}).
233
+ # @param data_type [Symbol]
234
+ # @param shape [Array<Integer>]
235
+ # @yieldreturn [#wrap_as_carray] external buffer holder.
236
+ # @return [CAWrap]
237
+ def wrap(data_type, shape); end
238
+
239
+ # @!endgroup
240
+ end
241
+ end
242
+
243
+ class CScalar
244
+ # @!group Construction
245
+
246
+ # @overload initialize(data_type)
247
+ # Allocates a CScalar (0-D CArray) of the given `data_type`.
248
+ # @param data_type [Symbol, Integer, Class, String]
249
+ # @return [self]
250
+ # @overload initialize(data_type, bytes:)
251
+ # For `data_type == :fixlen`, sets the per-element byte size.
252
+ # @param data_type [Symbol]
253
+ # @param bytes [Integer]
254
+ # @return [self]
255
+ # @overload initialize(data_type) { |scalar| ... }
256
+ # Yields the freshly allocated scalar; the block's return value
257
+ # is stored at the cell unless it is `scalar` itself.
258
+ # @yieldparam scalar [CScalar]
259
+ # @yieldreturn [Object]
260
+ # @return [self]
261
+ def initialize(*); end
262
+
263
+ # @overload initialize_copy(other)
264
+ # Copies `other`'s `data_type` and stored value into `self`.
265
+ # @param other [CScalar]
266
+ # @return [self]
267
+ # @api private
268
+ def initialize_copy(other); end
269
+
270
+ # @!endgroup
271
+
272
+ class << self
273
+ # @!group Construction (typed shorthands)
274
+
275
+ # @overload fixlen(bytes:) { ... }
276
+ # Equivalent to `CScalar.new(:fixlen, bytes: bytes) { ... }`.
277
+ # @param bytes [Integer]
278
+ # @return [CScalar]
279
+ def fixlen(bytes:); end
280
+
281
+ # @overload boolean { ... }
282
+ # Equivalent to `CScalar.new(:boolean) { ... }`.
283
+ # @return [CScalar]
284
+ def boolean; end
285
+
286
+ # @overload int8 { ... }
287
+ # Equivalent to `CScalar.new(:int8) { ... }`.
288
+ # @return [CScalar]
289
+ def int8; end
290
+
291
+ # @overload uint8 { ... }
292
+ # Equivalent to `CScalar.new(:uint8) { ... }`.
293
+ # @return [CScalar]
294
+ def uint8; end
295
+
296
+ # @overload int16 { ... }
297
+ # Equivalent to `CScalar.new(:int16) { ... }`.
298
+ # @return [CScalar]
299
+ def int16; end
300
+
301
+ # @overload uint16 { ... }
302
+ # Equivalent to `CScalar.new(:uint16) { ... }`.
303
+ # @return [CScalar]
304
+ def uint16; end
305
+
306
+ # @overload int32 { ... }
307
+ # Equivalent to `CScalar.new(:int32) { ... }`.
308
+ # @return [CScalar]
309
+ def int32; end
310
+
311
+ # @overload uint32 { ... }
312
+ # Equivalent to `CScalar.new(:uint32) { ... }`.
313
+ # @return [CScalar]
314
+ def uint32; end
315
+
316
+ # @overload int64 { ... }
317
+ # Equivalent to `CScalar.new(:int64) { ... }`.
318
+ # @return [CScalar]
319
+ def int64; end
320
+
321
+ # @overload uint64 { ... }
322
+ # Equivalent to `CScalar.new(:uint64) { ... }`.
323
+ # @return [CScalar]
324
+ def uint64; end
325
+
326
+ # @overload float32 { ... }
327
+ # Equivalent to `CScalar.new(:float32) { ... }`.
328
+ # @return [CScalar]
329
+ def float32; end
330
+
331
+ # @overload float64 { ... }
332
+ # Equivalent to `CScalar.new(:float64) { ... }`.
333
+ # @return [CScalar]
334
+ def float64; end
335
+
336
+ # @overload cmplx64 { ... }
337
+ # Equivalent to `CScalar.new(:cmplx64) { ... }`.
338
+ # @return [CScalar]
339
+ def cmplx64; end
340
+
341
+ # @overload cmplx128 { ... }
342
+ # Equivalent to `CScalar.new(:cmplx128) { ... }`.
343
+ # @return [CScalar]
344
+ def cmplx128; end
345
+
346
+ # @overload object { ... }
347
+ # Equivalent to `CScalar.new(:object) { ... }`.
348
+ # @return [CScalar]
349
+ def object; end
350
+
351
+ # @!endgroup
352
+
353
+ # @!group Construction (legacy-name aliases)
354
+
355
+ # @overload byte
356
+ # Alias of {.uint8}.
357
+ def byte; end
358
+
359
+ # @overload short
360
+ # Alias of {.int16}.
361
+ def short; end
362
+
363
+ # @overload int
364
+ # Alias of {.int32}.
365
+ def int; end
366
+
367
+ # @overload float
368
+ # Alias of {.float32}.
369
+ def float; end
370
+
371
+ # @overload double
372
+ # Alias of {.float64}.
373
+ def double; end
374
+
375
+ # @overload complex
376
+ # Alias of {.cmplx64}.
377
+ def complex; end
378
+
379
+ # @overload dcomplex
380
+ # Alias of {.cmplx128}.
381
+ def dcomplex; end
382
+
383
+ # @!endgroup
384
+ end
385
+ end
@@ -0,0 +1,38 @@
1
+ # DOCUMENTATION ONLY — DO NOT REQUIRE.
2
+ # Stubs for CABitarray and CArray#bitarray defined in ext/ca_obj_bitarray.c.
3
+ # See yard-stubs/README.md and yard-stubs/STYLE.md.
4
+
5
+ # Per-bit expansion view of the parent. Every parent cell is fanned
6
+ # out into `parent.bytes * 8` boolean cells along a trailing bit
7
+ # axis appended after the parent's own axes, so the view's shape is
8
+ # `[*parent.shape, parent.bytes * 8]` and its `data_type` is
9
+ # `:boolean`.
10
+ #
11
+ # On big-endian hosts the bit axis of a non-fixlen parent reflects
12
+ # network byte order (parent bytes are walked in reverse within each
13
+ # element); single-byte parents are linear on either endian.
14
+ class CABitarray < CAView
15
+ end
16
+
17
+ class CArray
18
+ # @!group Views
19
+
20
+ # Returns a {CABitarray} view of `self`, exposing every bit of
21
+ # every parent cell as an individual boolean cell. See
22
+ # {CABitarray} for the axis layout and endian handling.
23
+ #
24
+ # Aliased as `bits`.
25
+ #
26
+ # @overload bitarray
27
+ # @return [CABitarray]
28
+ # @raise [CADataTypeError] when `self.data_type` is a complex or
29
+ # object type (bit-level access is not defined for those).
30
+ def bitarray; end
31
+
32
+ # Alias for {#bitarray}.
33
+ #
34
+ # @return [CABitarray]
35
+ def bits; end
36
+
37
+ # @!endgroup
38
+ end
@@ -0,0 +1,43 @@
1
+ # DOCUMENTATION ONLY — DO NOT REQUIRE.
2
+ # Stubs for CABitfield and CArray#bitfield defined in ext/ca_obj_bitfield.c.
3
+ # See yard-stubs/README.md and yard-stubs/STYLE.md.
4
+
5
+ # Bit-field extraction view: each cell of `self` carries a contiguous
6
+ # bit field of the parent, exposed as an unsigned-integer (or boolean
7
+ # when the field is 1 bit wide) CArray of the same shape. Writes
8
+ # through the view are read-modify-write against the parent — bits
9
+ # outside the field are preserved.
10
+ class CABitfield < CAView
11
+ end
12
+
13
+ class CArray
14
+ # @!group Views
15
+
16
+ # Returns a {CABitfield} view of `self`. Each parent cell is
17
+ # treated as a bag of bits; `range` selects a contiguous slice of
18
+ # those bits, and the resulting view exposes that slice as a cell
19
+ # of the returned array.
20
+ #
21
+ # `range` may be an integer (a single bit — the resulting view has
22
+ # `data_type :boolean`) or a `Range` covering the bit positions.
23
+ # The `data_type` of the view is chosen from the bit width:
24
+ # 1 bit → `:boolean`, 2..8 → `:uint8`, 9..16 → `:uint16`,
25
+ # 17..32 → `:uint32`, 33..64 → `:uint64`.
26
+ #
27
+ # `type` is accepted but currently ignored (the width-derived type
28
+ # is always used).
29
+ #
30
+ # @overload bitfield(range, type = nil)
31
+ # @param range [Integer, Range] bit position (single bit) or bit
32
+ # range within one parent cell.
33
+ # @param type [Symbol, nil] reserved, currently ignored.
34
+ # @return [CABitfield]
35
+ # @raise [IndexError] when `range` extends past the parent's bit
36
+ # width, when the range has a step != 1, or when the bit length
37
+ # is outside `1..64`.
38
+ # @raise [ArgumentError] when the derived bit length exceeds the
39
+ # resolved data type.
40
+ def bitfield(range, type = nil); end
41
+
42
+ # @!endgroup
43
+ end
@@ -0,0 +1,73 @@
1
+ # DOCUMENTATION ONLY — DO NOT REQUIRE.
2
+ # Stubs for CABlock accessors and address helpers defined in
3
+ # ext/ca_obj_block.c. The CABlock class shell lives in
4
+ # yard-stubs/ruby_carray.rb.
5
+ # See yard-stubs/README.md and yard-stubs/STYLE.md.
6
+
7
+ class CABlock
8
+ # @!group Block geometry
9
+
10
+ # @overload size0
11
+ # Returns the parent dimension sizes that the block is carved
12
+ # from (one Integer per axis). Distinct from `shape`, which is
13
+ # the block's own shape (= `count` after step / stride logic).
14
+ # @return [Array<Integer>]
15
+ def size0; end
16
+
17
+ # @overload start
18
+ # Returns the starting index of the block within the parent, per
19
+ # axis.
20
+ # @return [Array<Integer>]
21
+ def start; end
22
+
23
+ # @overload step
24
+ # Returns the per-axis step (stride in parent index units) the
25
+ # block walks the parent with.
26
+ # @return [Array<Integer>]
27
+ def step; end
28
+
29
+ # @overload count
30
+ # Returns the per-axis number of elements the block exposes.
31
+ # Same as `shape`.
32
+ # @return [Array<Integer>]
33
+ def count; end
34
+
35
+ # @overload offset
36
+ # Returns the block's base flat offset into the parent (in
37
+ # element units), set at construction and adjusted as start[]
38
+ # moves.
39
+ # @return [Integer]
40
+ def offset; end
41
+
42
+ # @!endgroup
43
+
44
+ # @!group Address mapping
45
+
46
+ # @overload idx2addr0(*idx)
47
+ # Maps a per-axis view index tuple to the corresponding flat
48
+ # address into the parent (= "addr0"). Useful for projecting a
49
+ # view-local coordinate back onto the parent's buffer.
50
+ # @param idx [Array<Integer>] one Integer per axis;
51
+ # `idx.length == self.ndim` is required.
52
+ # @return [Integer]
53
+ # @raise [ArgumentError] when the number of args does not equal
54
+ # `self.ndim`.
55
+ # @raise [IndexError] when any `idx[k]` is out of range for the
56
+ # block's `shape[k]`.
57
+ def idx2addr0(*idx); end
58
+
59
+ # @overload index2addr0(*idx)
60
+ # Alias of {#idx2addr0}.
61
+ def index2addr0(*idx); end
62
+
63
+ # @overload addr2addr0(addr)
64
+ # Flat-address variant of {#idx2addr0}. Unravels the block-local
65
+ # flat `addr` into a multi-dim index, then maps that to the
66
+ # parent's flat address.
67
+ # @param addr [Integer] block-local flat address
68
+ # (`0...self.elements`).
69
+ # @return [Integer]
70
+ def addr2addr0(addr); end
71
+
72
+ # @!endgroup
73
+ end