carray 3.0.7 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/CHANGELOG.md +7 -1940
  4. data/README.md +38 -32
  5. data/carray.gemspec +16 -4
  6. data/docs/changelogs/CHANGELOG-3.0.md +2464 -0
  7. data/ext/ca_array_pool.c +4 -5
  8. data/ext/ca_axis_descriptor.h +45 -30
  9. data/ext/ca_axis_dispatch.c +7 -4
  10. data/ext/ca_axis_group.c +6 -9
  11. data/ext/ca_bincmp_dispatch.h +16 -38
  12. data/ext/ca_binop_dispatch.c +27 -0
  13. data/ext/ca_binop_dispatch.h +22 -47
  14. data/ext/ca_categorical_iterator.c +36 -34
  15. data/ext/ca_compare.c +0 -1
  16. data/ext/ca_compare.h +8 -1
  17. data/ext/ca_composite_dispatch.h +6 -0
  18. data/ext/ca_for_buffer.h +6 -1
  19. data/ext/ca_group_iter.c +17 -18
  20. data/ext/ca_iter_state_fields.h +196 -0
  21. data/ext/ca_iter_substrate.h +84 -103
  22. data/ext/ca_kernel_iterator.c +125 -89
  23. data/ext/ca_kernel_iterator.h +229 -1506
  24. data/ext/ca_kernel_iterator_internal.h +1167 -0
  25. data/ext/ca_moncmp_dispatch.h +17 -24
  26. data/ext/ca_monop_dispatch.h +25 -74
  27. data/ext/ca_obj_array.c +90 -163
  28. data/ext/ca_obj_bincmp.c +47 -46
  29. data/ext/ca_obj_binop.c +38 -38
  30. data/ext/ca_obj_bitarray.c +5 -17
  31. data/ext/ca_obj_bitfield.c +15 -30
  32. data/ext/ca_obj_block.c +11 -12
  33. data/ext/ca_obj_byte_swap.c +32 -30
  34. data/ext/ca_obj_const_string.c +57 -62
  35. data/ext/ca_obj_face.c +99 -91
  36. data/ext/ca_obj_face.h +32 -170
  37. data/ext/ca_obj_fake.c +15 -21
  38. data/ext/ca_obj_farray.c +7 -9
  39. data/ext/ca_obj_field.c +17 -13
  40. data/ext/ca_obj_fixlen_string.c +8 -19
  41. data/ext/ca_obj_grid.c +137 -106
  42. data/ext/ca_obj_meld.c +23 -21
  43. data/ext/ca_obj_moncmp.c +10 -21
  44. data/ext/ca_obj_monop.c +24 -35
  45. data/ext/ca_obj_object.c +51 -37
  46. data/ext/ca_obj_record.c +74 -22
  47. data/ext/ca_obj_reduce.c +8 -10
  48. data/ext/ca_obj_refer.c +42 -29
  49. data/ext/ca_obj_remap.c +11 -29
  50. data/ext/ca_obj_repeat.c +41 -23
  51. data/ext/ca_obj_roll.c +18 -24
  52. data/ext/ca_obj_select.c +10 -22
  53. data/ext/ca_obj_select_axis.c +27 -36
  54. data/ext/ca_obj_shift.c +22 -42
  55. data/ext/ca_obj_source.c +1 -5
  56. data/ext/ca_obj_stack.c +28 -24
  57. data/ext/ca_obj_stride.c +53 -54
  58. data/ext/ca_obj_string.c +6 -18
  59. data/ext/ca_obj_tile.c +12 -12
  60. data/ext/ca_obj_time.c +12 -23
  61. data/ext/ca_obj_timedelta.c +12 -23
  62. data/ext/ca_obj_transpose.c +8 -10
  63. data/ext/ca_obj_triop.c +35 -39
  64. data/ext/ca_obj_window.c +67 -86
  65. data/ext/ca_op_cmplx64.h +4 -0
  66. data/ext/ca_op_ipower.c +34 -12
  67. data/ext/ca_op_powi.h +4 -0
  68. data/ext/ca_pow5_table.h +2 -1
  69. data/ext/ca_rng_normal.h +4 -0
  70. data/ext/ca_rng_xoshiro256pp.h +3 -0
  71. data/ext/ca_sort_kernels.h +20 -26
  72. data/ext/ca_sweep_engine.c +2 -3
  73. data/ext/ca_sweep_engine.h +17 -9
  74. data/ext/ca_transform_common.c +3 -8
  75. data/ext/ca_triop_dispatch.h +20 -32
  76. data/ext/caframe_csv_reader.c +11 -11
  77. data/ext/carray.h +300 -1011
  78. data/ext/carray_access.c +234 -180
  79. data/ext/carray_address_basis.c +33 -38
  80. data/ext/carray_attribute.c +81 -104
  81. data/ext/carray_bincount.c +12 -14
  82. data/ext/carray_broadcast.c +30 -26
  83. data/ext/carray_call_cfunc.c +169 -277
  84. data/ext/carray_call_cfunc.h +36 -28
  85. data/ext/carray_cast.c +912 -346
  86. data/ext/carray_cast_func.rb +31 -3
  87. data/ext/carray_class.c +6 -11
  88. data/ext/carray_conversion.c +43 -38
  89. data/ext/carray_copy.c +28 -26
  90. data/ext/carray_core.c +217 -126
  91. data/ext/carray_count.c +27 -15
  92. data/ext/carray_element.c +40 -25
  93. data/ext/carray_factorize.c +53 -52
  94. data/ext/carray_generate.c +26 -19
  95. data/ext/carray_histogram.c +8 -10
  96. data/ext/carray_hold.c +7 -9
  97. data/ext/carray_index_classifier.c +123 -228
  98. data/ext/carray_index_classifier.h +11 -10
  99. data/ext/carray_integer_total.c +523 -0
  100. data/ext/carray_internal.h +1274 -160
  101. data/ext/carray_key_windows.c +3 -3
  102. data/ext/carray_lazy.c +21 -36
  103. data/ext/carray_loop.c +19 -22
  104. data/ext/carray_mask.c +123 -145
  105. data/ext/carray_math_kernel.h +23 -47
  106. data/ext/carray_mathfunc.c +10 -3
  107. data/ext/carray_median_percentile.c +95 -94
  108. data/ext/carray_memory_view.c +42 -47
  109. data/ext/carray_operator.c +423 -122
  110. data/ext/carray_order.c +121 -85
  111. data/ext/carray_partition.c +13 -15
  112. data/ext/carray_random.c +47 -41
  113. data/ext/carray_round.c +9 -4
  114. data/ext/carray_scatter.c +54 -40
  115. data/ext/carray_segment.c +41 -45
  116. data/ext/carray_slab.c +64 -47
  117. data/ext/carray_slab.h +44 -33
  118. data/ext/carray_sort.c +32 -29
  119. data/ext/carray_sort_kernel.c +12 -10
  120. data/ext/carray_struct.c +38 -43
  121. data/ext/carray_test.c +47 -43
  122. data/ext/carray_time_text.c +24 -31
  123. data/ext/carray_undef.c +50 -7
  124. data/ext/carray_utils.c +258 -94
  125. data/ext/extconf.rb +24 -17
  126. data/ext/mk_call_cfunc.rb +19 -20
  127. data/ext/mk_pow5_table.rb +2 -1
  128. data/ext/mkkernel.rb +782 -461
  129. data/ext/ruby_carray.c +47 -42
  130. data/ext/version.h +7 -5
  131. data/lib/carray/attribute.rb +19 -18
  132. data/lib/carray/autoload_carray.rb +20 -15
  133. data/lib/carray/autoload_method_extension.rb +64 -57
  134. data/lib/carray/axis_group.rb +264 -180
  135. data/lib/carray/basics.rb +272 -48
  136. data/lib/carray/bincount_nd.rb +33 -16
  137. data/lib/carray/block_iterator.rb +123 -102
  138. data/lib/carray/boolean_reduce.rb +7 -4
  139. data/lib/carray/categorical.rb +63 -51
  140. data/lib/carray/categorical_iterator.rb +89 -67
  141. data/lib/carray/complex.rb +61 -41
  142. data/lib/carray/conditional.rb +49 -22
  143. data/lib/carray/const_string.rb +54 -62
  144. data/lib/carray/core_extensions.rb +1 -1
  145. data/lib/carray/distance_limit.rb +7 -5
  146. data/lib/carray/factories.rb +269 -0
  147. data/lib/carray/fixlen_string.rb +25 -24
  148. data/lib/carray/frame/column_verbs.rb +20 -8
  149. data/lib/carray/frame/concat.rb +3 -3
  150. data/lib/carray/frame/convert.rb +2 -1
  151. data/lib/carray/frame/csv_parser.rb +7 -1
  152. data/lib/carray/frame/frame.rb +35 -25
  153. data/lib/carray/frame/group.rb +183 -150
  154. data/lib/carray/frame/io.rb +26 -7
  155. data/lib/carray/frame/join.rb +37 -12
  156. data/lib/carray/frame/records.rb +1 -1
  157. data/lib/carray/frame/reshape.rb +3 -3
  158. data/lib/carray/frame/sort.rb +10 -8
  159. data/lib/carray/frame/verbs.rb +148 -118
  160. data/lib/carray/frame/windows.rb +232 -21
  161. data/lib/carray/frame.rb +1 -2
  162. data/lib/carray/fuse_source.rb +24 -21
  163. data/lib/carray/fusion.rb +30 -30
  164. data/lib/carray/histogram.rb +35 -16
  165. data/lib/carray/inspect.rb +7 -7
  166. data/lib/carray/iterator.rb +97 -24
  167. data/lib/carray/key_windows.rb +83 -57
  168. data/lib/carray/lazy.rb +196 -94
  169. data/lib/carray/limits.rb +80 -0
  170. data/lib/carray/mask_gap_fill.rb +21 -16
  171. data/lib/carray/math.rb +87 -50
  172. data/lib/carray/meld_reduce.rb +30 -8
  173. data/lib/carray/methods/align_addr.rb +29 -17
  174. data/lib/carray/methods/bin.rb +5 -1
  175. data/lib/carray/methods/bincount.rb +4 -2
  176. data/lib/carray/methods/bit_string.rb +19 -31
  177. data/lib/carray/methods/broadcast.rb +8 -3
  178. data/lib/carray/methods/choose.rb +5 -5
  179. data/lib/carray/methods/composition.rb +72 -71
  180. data/lib/carray/methods/{index.rb → coordinate.rb} +13 -13
  181. data/lib/carray/methods/discovery_along.rb +3 -3
  182. data/lib/carray/methods/gather_nd.rb +106 -106
  183. data/lib/carray/methods/insert_block.rb +2 -2
  184. data/lib/carray/methods/is_between.rb +6 -4
  185. data/lib/carray/methods/is_in.rb +165 -145
  186. data/lib/carray/methods/join.rb +2 -1
  187. data/lib/carray/methods/lag.rb +6 -2
  188. data/lib/carray/methods/locate_addr.rb +150 -138
  189. data/lib/carray/methods/mask_duplicates.rb +1 -1
  190. data/lib/carray/methods/meshgrid.rb +28 -16
  191. data/lib/carray/methods/mode.rb +67 -67
  192. data/lib/carray/methods/nunique.rb +9 -7
  193. data/lib/carray/methods/repeat.rb +12 -12
  194. data/lib/carray/methods/resize.rb +1 -1
  195. data/lib/carray/methods/snap.rb +24 -20
  196. data/lib/carray/methods/string_format.rb +2 -2
  197. data/lib/carray/methods/unique.rb +4 -2
  198. data/lib/carray/methods/value_counts.rb +1 -1
  199. data/lib/carray/mkmf.rb +25 -28
  200. data/lib/carray/percentile_arguments.rb +82 -0
  201. data/lib/carray/record_order.rb +18 -17
  202. data/lib/carray/rng.rb +1 -0
  203. data/lib/carray/runtime.rb +190 -22
  204. data/lib/carray/segment_iterator.rb +251 -129
  205. data/lib/carray/serialize.rb +618 -571
  206. data/lib/carray/slab_iterator.rb +114 -114
  207. data/lib/carray/stack.rb +11 -12
  208. data/lib/carray/string.rb +16 -22
  209. data/lib/carray/string_operation_extension.rb +76 -52
  210. data/lib/carray/struct.rb +122 -164
  211. data/lib/carray/struct_builder.rb +243 -72
  212. data/lib/carray/time.rb +496 -342
  213. data/lib/carray/window_iterator.rb +191 -150
  214. data/lib/carray.rb +6 -11
  215. data/yard-stubs/ca_obj_array.rb +20 -135
  216. data/yard-stubs/ca_obj_bitarray.rb +1 -8
  217. data/yard-stubs/ca_obj_bitfield.rb +4 -3
  218. data/yard-stubs/ca_obj_byte_swap.rb +21 -7
  219. data/yard-stubs/ca_obj_fake.rb +3 -1
  220. data/yard-stubs/ca_obj_farray.rb +1 -1
  221. data/yard-stubs/ca_obj_field.rb +8 -6
  222. data/yard-stubs/ca_obj_refer.rb +7 -5
  223. data/yard-stubs/ca_obj_roll.rb +7 -6
  224. data/yard-stubs/ca_obj_shift.rb +2 -3
  225. data/yard-stubs/ca_obj_stride.rb +5 -7
  226. data/yard-stubs/ca_obj_tile.rb +1 -1
  227. data/yard-stubs/ca_obj_time.rb +43 -0
  228. data/yard-stubs/ca_obj_transpose.rb +1 -1
  229. data/yard-stubs/ca_obj_window.rb +26 -15
  230. data/yard-stubs/carray_access.rb +51 -4
  231. data/yard-stubs/carray_attribute.rb +26 -38
  232. data/yard-stubs/carray_cast.rb +118 -165
  233. data/yard-stubs/carray_class.rb +3 -4
  234. data/yard-stubs/carray_conversion.rb +6 -7
  235. data/yard-stubs/carray_copy.rb +2 -1
  236. data/yard-stubs/carray_count.rb +5 -3
  237. data/yard-stubs/carray_element.rb +4 -3
  238. data/yard-stubs/carray_limits.rb +100 -0
  239. data/yard-stubs/carray_loop.rb +0 -20
  240. data/yard-stubs/carray_mask.rb +59 -41
  241. data/yard-stubs/carray_math.rb +157 -100
  242. data/yard-stubs/carray_mathfunc.rb +415 -3
  243. data/yard-stubs/carray_median_percentile.rb +29 -11
  244. data/yard-stubs/carray_memory_view.rb +2 -2
  245. data/yard-stubs/carray_order.rb +67 -34
  246. data/yard-stubs/carray_random.rb +6 -6
  247. data/yard-stubs/carray_reduce.rb +353 -0
  248. data/yard-stubs/carray_rng.rb +92 -0
  249. data/yard-stubs/carray_scatter.rb +10 -2
  250. data/yard-stubs/carray_slab.rb +7 -4
  251. data/yard-stubs/carray_sort.rb +7 -6
  252. data/yard-stubs/carray_undef.rb +44 -5
  253. data/yard-stubs/ruby_carray.rb +75 -40
  254. metadata +62 -24
  255. data/CHANGELOG.v1.md +0 -126
  256. data/ext/carray_build_flags.h +0 -3
  257. data/ext/carray_config.h +0 -28
  258. data/ext/carray_data_type.c +0 -90
  259. data/ext/carray_kernels_bincmp.c +0 -6457
  260. data/ext/carray_kernels_binop.c +0 -31534
  261. data/ext/carray_kernels_init.c +0 -1734
  262. data/ext/carray_kernels_moncmp.c +0 -2104
  263. data/ext/carray_kernels_monop.c +0 -25337
  264. data/ext/carray_kernels_reduce_aggregate.c +0 -27545
  265. data/ext/carray_kernels_reduce_boolean.c +0 -1924
  266. data/ext/carray_kernels_reduce_cumulative.c +0 -11646
  267. data/ext/carray_kernels_reduce_extreme.c +0 -21631
  268. data/ext/carray_kernels_reduce_variance.c +0 -5981
  269. data/ext/carray_kernels_scan.c +0 -4302
  270. data/ext/carray_kernels_search.c +0 -37776
  271. data/ext/carray_kernels_sort.c +0 -10814
  272. data/ext/carray_kernels_triop.c +0 -1864
  273. data/lib/carray/construct.rb +0 -360
  274. data/lib/carray/data_type_extension.rb +0 -262
  275. data/lib/carray/data_type_limits.rb +0 -91
data/CHANGELOG.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Changelog
2
2
 
3
- Releases from 3.0.0 onward are recorded here. There is no separate NEWS
3
+ The changes in each release, newest first. There is no separate NEWS
4
4
  file: this is where to look for what changed between the version you have
5
- and a newer one. The 1.x history, up to the 2.0.0 release, is in
6
- [CHANGELOG.v1.md](CHANGELOG.v1.md); 2.0.1 went unrecorded.
5
+ and a newer one. Releases from 3.0.0 to 3.1.0 are recorded in
6
+ [docs/changelogs/CHANGELOG-3.0.md](docs/changelogs/CHANGELOG-3.0.md).
7
7
 
8
8
  <!-- Newest first, at both levels: a new release section goes above the
9
9
  ones below it, and a new entry goes directly under its own release
@@ -34,1941 +34,8 @@ and a newer one. The 1.x history, up to the 2.0.0 release, is in
34
34
  neighbour ("as well", "the producer above") or leave unnamed the
35
35
  method, class or keyword it is about. -->
36
36
 
37
- ## 3.0.7
37
+ ## 3.1.0
38
38
 
39
- - New: `CATime` and `CATimedelta` take the word forms of their operators
40
- (`add`, `sub`; on a duration also `mul`, `div`, `neg`). A duration array
41
- divided by one duration gives the ratios as numbers, a number may stand
42
- left of a duration (`2 * d`), a duration element has `-@` and `abs`, and
43
- a duration array has `to_seconds`. A duration's comparisons and stores
44
- take a String such as `"3 days"`.
45
-
46
- - New: `pmax` and `pmin` (with `maximum`, `minimum`, `fmax`, `fmin`) on
47
- `CATimedelta`, `CAFixlenString` and `CAConstString`. `CAConstString`
48
- also has `match`, `bsearch`, `bsearch_addr`, `search_addr`, `min_addr`
49
- and `max_addr`.
50
-
51
- - New: a `CAFixlenString` carries the encoding of its text
52
- (`a.encoding`), and its cells read in that encoding: UTF-8 when the
53
- strings were ASCII, `BINARY` when they disagreed. `to_const_string`
54
- keeps it, so non-ASCII text comes back from `to_fixlen_string`. Two
55
- arrays of different text encodings no longer stack.
56
-
57
- - New: `CAFrame#resample` takes a `CArray` as `by:`, and a windowed
58
- reduction takes a Hash of column name to value as `fill_value:`.
59
- `CACategorical#count` takes the keywords of `CArray#count`, and the
60
- `all` and `any` of a categorical iterator take `axis:`.
61
-
62
- - New: `CArray.from_memory_view` and `wrap_memory_view` take an item of
63
- several members (a record) as raw bytes, a `fixlen` array of the item's
64
- size.
65
-
66
- - Change: a Float is refused as a shape, a size or a count
67
- (`CArray.int32(2.5)`, `blocks(2.5)`, the counts of `repeat`), whole or
68
- not; it was cut down to an Integer. A Float key of `[]` still reads as a
69
- position.
70
-
71
- - Change: a data type name must match whole. `:complex128`, `:float16` or
72
- `:int128` raise `ArgumentError`; they were read as the type whose name
73
- they begin with (`:complex128` gave `cmplx64`). Write `:cmplx128`.
74
- `CArray::Complex64::TypeSymbol` and `CArray::Complex128::TypeSymbol` are
75
- `:cmplx64` and `:cmplx128`.
76
-
77
- - Change: a keyword given with a String key (`a.sum("axis" => 0)`) raises
78
- `ArgumentError`; it was ignored. Write `axis: 0`.
79
-
80
- - Change: storing complex cells into a real array raises; the imaginary
81
- parts were dropped. Convert with `to_type` first.
82
-
83
- - Change: an object or boolean array given where addresses are expected
84
- (`project`, `scatter_add!` and the other `scatter_*!`, `addr2index`)
85
- raises `IndexError`. A boolean array still selects in `[]`.
86
-
87
- - Change: a value a numeric or boolean array cannot hold (`nil`, a String,
88
- a Symbol, another object) is answered alike for every data type: an
89
- operator raises `TypeError`, an ordering (`<`, `pmax` and its kin)
90
- raises `ArgumentError`, and `eq`, `ne`, `count`, `search` and `is_in`
91
- find no cell. `search("2")` on a numeric array used to read the text.
92
- `true` and `false` are 1 and 0, so `count(true)` counts the cells
93
- holding 1. An object array still looks such values up as values.
94
-
95
- - Change: `UNDEF` beside an array in an operation is a masked scalar of the
96
- array's own type, so `CA_INT32([1, 2]) + UNDEF` is an all-masked `int32`
97
- array; integer, boolean and fixlen arrays gave an object array.
98
-
99
- - Change: `to_type` to an integer type gives `UNDEF` for an object Float,
100
- Rational, BigDecimal or Complex the type cannot hold, and keeps the low
101
- bytes of an object Integer wider than 64 bits, as `int64` to `int8` does.
102
- A store and a view still refuse such values.
103
-
104
- - Change: `x ** k` with an Integer `k` from -2 to 4 is computed by at most
105
- two multiplications or divisions (`x ** 2` is `x * x`), and other Integer
106
- exponents through `pow`, for a scalar and an array exponent alike,
107
- eagerly and lazily. Float and complex results can differ from 3.0.6 in
108
- the last bit.
109
-
110
- - Change: a time or a date with a year past four digits is written with
111
- its sign (`"+12345-01-01"`), in `to_s` and in CSV, so it reads back.
112
-
113
- - Change: `join`, `join_asof`, `align`, `CAFrame.concatenate`, `stack` and
114
- `stack_columns` refuse integers that the float type they meet would
115
- round (past 2**53 beside `float64`), in a key or in the pieces of a
116
- column; such integers matched or merged with neighbouring values. Cast
117
- one side to the other's type first.
118
-
119
- - Change: the frames that `GroupedFrame`, the windows and a frame's own
120
- verbs return hold a copy of the index, so a write to the result's index
121
- does not reach the source frame.
122
-
123
- - Change: `CAFrame` refuses, with an `ArgumentError` that names the verb,
124
- a `GroupedFrame#table` or `#filter` without a block, a `lag` step that is
125
- not an Integer, a `columns:` Range that selects no column, a
126
- `fill_value:` Hash naming no column, a row-wise group verb with no column
127
- left to compute, and a splice of a frame without an index into one with
128
- an index.
129
-
130
- - Change: CSV type inference reads a column as text when a float would
131
- round one of its integers, and an object column of Integers past 2**53
132
- beside a Float is not inferred as `float64`.
133
-
134
- - Change: a walk into object cells (`unique`, `hash`, `Marshal.dump`,
135
- computations over the cells) raises past 256 levels of nesting. A cell
136
- holding a lazy expression over the array that holds the cell made these
137
- run without end.
138
-
139
- - Change: a String Face (`CAString`, `CAFixlenString`, `CAConstString`)
140
- refuses an ordering with a value that is not a String, and a Face
141
- refuses a single Ruby object as the operand of an operator the Face does
142
- not define.
143
-
144
- - Change (C extensions and carray-jit): `CArray::AddressBasis.sweep` and
145
- the sweep bridge refuse a `CScalar` output beside an array operand.
146
-
147
- ## 3.0.6
148
-
149
- - New: `CAFrame` answers the column reductions itself, as a frame of one
150
- row (`df.mean`, `df.sum("rain", "temp")`), and the running values down
151
- all its rows (`df.cumsum("rain")`, `order`), as a grouped frame does
152
- down each group. `percentile(p, *names)` and `quantile` (a column per
153
- quartile, `"rain_p0"` ... `"rain_p100"`) are added to the frame, groups
154
- and windows.
155
-
156
- - New: `CAFrame` row picks: `nlargest` / `nsmallest` (also on
157
- `GroupedFrame`), `drop_masked` for the rows with no masked cell,
158
- `GroupedFrame#head` / `#tail` for the first and last rows of each group,
159
- and `filter` given a boolean selector directly (`df.filter(df["n"] > 3)`).
160
-
161
- - New: `CAFrame#transform` computes columns with a block, keeping their
162
- names and the index. `select`, `drop`, `transform` and `describe` pick
163
- columns by a Range of names, a Regexp, a kind (`:float`, `:integer`,
164
- `:complex`, `:timedelta`, ...) or a data type.
165
-
166
- - New: `CAFrame#value_counts` (how many rows hold each value, as a
167
- frame), `#strip_mask` (the masked cells filled, in a new frame), `#to_a`
168
- (the rows as Arrays, masked cells `UNDEF`), `#shape`, `#empty?`, and
169
- `GroupedFrame#each` and `#size`. `CAFrame#==` compares two frames by
170
- their table: names, columns, index and row axis name.
171
-
172
- - New: `CAFrame#lag` and `GroupedFrame#lag` take a distance of the key,
173
- `before: "1 hour"` or `after:`, giving each row the value of the row at
174
- exactly that distance (`UNDEF` where there is none). The key is the
175
- index or the column `on:` names: a time, a duration or a number.
176
-
177
- - New: `join` and `join_asof` take a key named differently on the two
178
- sides, and `view: :full`, which gives every column of the result as a
179
- view, with holes for the unmatched rows, so a write reaches either
180
- frame.
181
-
182
- - New: `df[name] = value` with a single value repeats it on every row.
183
- `fill` takes several columns, an Array of names or a Hash of column =>
184
- value; `rename` takes a block, can exchange two names, and renames the
185
- index under its name. `sort_by_key` and `sort_by` take `descending:`.
186
-
187
- - New: `CAFrame#set_column_attrs` gives columns their names and common
188
- attributes; `CArray#attrs_symkey` and `CAFrame#attrs_symkey` return the
189
- attributes with Symbol keys. `CAFrame#to_csv` takes `precision:`.
190
-
191
- - New: `GroupedFrame#fill(name, :linear)` interpolates within each group.
192
- On a frame, `:linear` reads an index that is not in order as one series
193
- in index order.
194
-
195
- - New: `melt` brings number columns of different types (an `int64` and a
196
- `float64` column) to their common type, still as a view. A mixture no
197
- type holds without changing a value (`int64` beside `uint64`), or one
198
- with text or time, is refused; cast the columns first.
199
-
200
- - New: `wsum` and `wmean` take weights shaped as the reduced axes, matched
201
- in ascending axis order, besides a scalar and weights of the receiver's
202
- shape.
203
-
204
- - New (C extensions and carray-jit): `CArray::AddressBasis.sweep(function,
205
- fsync, arrays, *parts)` runs a chunked element-wise sweep
206
- (`ca_call_cslab_N_r`, arities 1 to 7) from Ruby, handing the slab
207
- pointers to the parts' own String bytes. An `fsync` character other than
208
- `0` or `1` is refused.
209
-
210
- - Change: CArray requires Ruby 3.2 or later, up from 3.0. On an older
211
- Ruby, `gem install carray` does not offer this release; install a
212
- newer Ruby with a version manager such as rbenv or mise, or stay on
213
- 3.0.5.
214
-
215
- - Change: CSV reading and writing are split by what they take.
216
- `CAFrame.read_csv` and `#write_csv` take a path or an IO;
217
- `CAFrame.from_csv` takes CSV text as a String and `#to_csv` returns it.
218
- Code that gave `from_csv` a path or an IO calls `read_csv`, and
219
- `to_csv(path)` becomes `write_csv(path)`. No aliases are kept.
220
-
221
- - Change: `read_csv` and `from_csv` infer the column types by default
222
- (`int64`, `float64`, `boolean`, `time`, otherwise text); `types:` names
223
- some columns and the rest are still inferred. Pass `types: :string` to
224
- read every column as text, as before. A column with a blank but present
225
- value (a quoted `""`) stays text.
226
-
227
- - Change: `CAFrame#set_index`, `#reset_index`, `#cast`, `#promote`,
228
- `#parse_to_time` and `#to_time` return a new frame and leave the
229
- receiver as it is (the two share their columns). Assign the result:
230
- `df = df.set_index("time")`.
231
-
232
- - Change: a `GroupedFrame` reduction given column names returns a frame of
233
- those columns, one row per group, labelled as without names; it
234
- returned the `CArray` (one name) or an `Array` of them. Take the column
235
- (`grp.mean("temp")["temp"]`) or reduce the group iterator
236
- (`grp["temp"].mean`) for the values alone.
237
-
238
- - Change: a `GroupedFrame` or window value on the frame's rows given
239
- several column names (`keep_rows: true`, the running values, `lag`,
240
- `w.mean("a", "b")`) returns a frame of them on the frame's rows and
241
- index, instead of an `Array`. One name still gives the `CArray`.
242
-
243
- - Change: `CAFrame#filter` no longer takes `keep_masked:`, so every row
244
- selection is a view. To keep the rows whose condition is undetermined,
245
- say so in the selector: `df.filter(cond.is_masked)` or
246
- `df.filter(cond.strip_mask(true))`.
247
-
248
- - Change: `df[sel] = ...` refuses a Ruby Array as the row selector, as
249
- `df[]` does; the column indexer would read `[0, 2]` as two rows from
250
- row 0. Write `df[CA_INT64([0, 2])]` for rows 0 and 2.
251
-
252
- - Change: a group key named in a `GroupedFrame` reduction, and the index's
253
- name given to a verb that reads or changes columns (`df[...]`,
254
- `select`, `fill`, `cast`, the reductions), raise and point at `size`
255
- or `df.index`. A key argument (`group_by`, `sort_by_key`, `join(on:)`)
256
- still names the index.
257
-
258
- - Change: an `:inner` or `:right` `join` gives the other frame's columns
259
- as views picked by row, not copies, so a write to them reaches that
260
- frame. Call `copy` on the result to keep it apart.
261
-
262
- - Change: a `CScalar` takes only `s[]` and `s[0]`, reading or writing its
263
- one cell; any other index (`s[3]`, a range, `nil`, an index array)
264
- raises. A view such as `s.refer(s.data_type, [1])` takes the usual
265
- indexes.
266
-
267
- - Change: `CArray.stack` and `CArray.meld` refuse a value array
268
- (`a.value`) or a mask array (`a.mask`) as a part. Pass a copy
269
- (`a.value.copy`), or `a.is_masked` for the mask's values.
270
-
271
- - Change: `CArray#==` finds a NaN equal to a NaN, so an array holding NaN
272
- equals its copy and the array read back from a file. The cell-by-cell
273
- IEEE comparison is `eq`; `eql?` still compares bits.
274
-
275
- - Change: `CARemap#mapper` returns a read-only array; writing it raises.
276
- The index array given to `a[idx]` is not affected.
277
-
278
- - Change: `Marshal.dump` of a `CAWrap` (from `CArray.wrap_memory_view`)
279
- writes its values, and the load gives a plain array owning a copy of
280
- them, as for a view of the wrap; it raised `TypeError`.
281
-
282
- - Change: `as_type` returns a view also when the data type is the
283
- receiver's own, and `CATime#to_unit` / `CATimedelta#to_unit` return a
284
- new array when the unit does not change, so an attribute set on, or a
285
- freeze of, the result does not reach the receiver.
286
-
287
- - Change: `wmean` gives `UNDEF` where the weights sum to zero, on every
288
- path; numeric arrays gave NaN or an infinity. A weight array with one
289
- element is no longer read as a scalar: give a Ruby number or a
290
- `CScalar`.
291
-
292
- - Change: a computation over an object array that comes back into the
293
- array (a cell holding the array, or a view of it) raises, as reading
294
- such a cell does; it recursed until the process died. A lazy
295
- expression over such an array (a cell holding `x + 1` for the array `x`)
296
- raises the same way instead of overflowing the stack or not ending, and
297
- so does `Marshal.dump` of an object view whose cells lead back to its
298
- root.
299
-
300
- - Change (CAObject authors): a `CAObject` without `create_mask` raises
301
- `TypeError` when its `copy_data` writes `UNDEF`, as it does when a
302
- fetcher answers `UNDEF`; the `UNDEF` was dropped and read as a value.
303
-
304
- - Change (C extensions): `ca_install_obj_type` refuses an operation table
305
- without `allocate`, `attach`, `sync` and `detach` slots;
306
- `ca_iter_register_source_kind` refuses carray's own types; and the
307
- kernel iterator's `FIBER_PAIR` forms refuse `CA_KERNEL_WRITE`.
308
-
309
- - Fix: `require "carray"` works on Ruby 4.0; it raised
310
- `Ractor::IsolationError` since 3.0.4.
311
-
312
- - Fix: `CArray.fuse` works on Ruby 3.2 and 3.3. The gem now depends on
313
- prism 1.0 or later, which `gem install` and Bundler bring in on Ruby
314
- 3.2, which ships none, and 3.3, whose own prism is too old; Ruby 3.4
315
- and later already ship it.
316
-
317
- - Fix: a block of a reshape over a strided view
318
- (`a[1..2, 1..3].reshape(3, 2)[0..1, nil]`) read and wrote past the end
319
- of a row, outside the buffer at the edges.
320
-
321
- - Fix: a frozen object array shared between Ractors can be computed over
322
- in several at once; it was refused as cyclic. A cell holding a view of
323
- other cells of the same array is no longer refused.
324
-
325
- - Fix: a record array (`CARecord`) exports through MemoryView from a
326
- Ractor other than the main one; it raised `Ractor::IsolationError`.
327
-
328
- - Fix: `Marshal.dump` of a view no longer writes its whole parent (a
329
- one-cell view of a 100,000-cell array dumped about 400 KB), and an
330
- array's mask marshals as a plain boolean array.
331
-
332
- - Fix: an `each_slab` Enumerator stopped part way with `next` leaves no
333
- array attached once its Fiber is collected.
334
-
335
- - Fix: a window or block iterator reads its source afresh on each call;
336
- after the source changed, a later reduction mixed new sums with old
337
- counts.
338
-
339
- - Fix: a frozen or read-only `CArray.meld` refuses writes through a meld
340
- of it (`CArray.meld(m, m)` wrote into the frozen root).
341
-
342
- - Fix: a write to a `CArray.stack` or `CArray.meld` whose parts share
343
- cells (`CArray.meld(a, a)`) gives those cells the value, or the mask, of
344
- the last part; `add!` could leave an earlier part's result, and a mask
345
- write masked the cells of every part.
346
-
347
- - Fix: a write to a `CArray.stack` or `CArray.meld` that one part refuses
348
- (a value outside a part's data type) writes nothing; the parts before
349
- it were written.
350
-
351
- - Fix: `blocks(...).sort_addr` works when the source holds more than one
352
- tile; it failed with `IndexError`.
353
-
354
- - Fix: `elem_fetch` answers a boolean cell with `true` or `false` when given
355
- an index array over a view, as `[]` does; it answered `0` or `1`.
356
-
357
- - Fix: `CAFrame#fill(:linear)` leaves a row with no coordinate out of the
358
- interpolation; it was filled with 0.
359
-
360
- - Fix: `bin_to` and `histogram1d` put a value next to an edge in the bin
361
- that edge bounds when the edges are nearly but not exactly equally
362
- spaced.
363
-
364
- - Fix: `float ** Integer` takes any exponent that fits 64 bits, eagerly
365
- as lazily, and `x.lazy.pow(k)` answers as `x.pow(k)`. A lazy array
366
- compared with `UNDEF` (`eq`, `ne`) answers as the eager one does.
367
-
368
- - Fix: writing `UNDEF` through a widening `refer` (`r.refer(:float64,
369
- ...)`) no longer masks parent cells outside the written cells, and a
370
- mask written onto a `CAObject` without mask hooks survives the next
371
- read of its values.
372
-
373
- - Fix: a masked cell that is not a String reads as `""` when a `CAString`
374
- wraps a view, as it does over an entity.
375
-
376
- - Fix (CASource authors): a source that leaves its `ptr` NULL at rest no
377
- longer crashes `elem_*`, `dump_binary` to a File or `nlargest` over a
378
- whole axis.
379
-
380
- ## 3.0.5
381
-
382
- - New: `GroupedFrame#aggregate` takes a block instead of a spec. The block
383
- is given the grouping once and returns a Hash of output name => a
384
- CArray with one value per group, built from `g["col"]` iterators and
385
- CArray arithmetic (`g["temp"].max - g["temp"].min`). `grp[array]`
386
- groups any CArray with one entry per row, such as a value computed
387
- from columns or a column with cells masked.
388
-
389
- - New: a `CAFrame` grouped reduction takes a Hash of column name => value
390
- as `fill_value:`, filling only the named columns. A single
391
- `fill_value:` still goes to every column and has to suit each.
392
-
393
- - New: `CArray.meld` brings pieces of different data types to a common
394
- one, as `CArray.stack` does, and takes `data_type:`. `CAFrame.meld` and
395
- a frame splice still refuse a column whose pieces differ in data type;
396
- cast the column first, or use `concatenate`.
397
-
398
- - New: `scatter_replace!` takes an object or fixed-length array, as
399
- `put_nd` and `put_along_axis` do. The accumulating members
400
- (`scatter_add!` and the others) still take numeric arrays only.
401
-
402
- - New: `CAConstString#count` and `CACategorical#count` with no argument
403
- count the cells that are not masked, as `CArray#count` does.
404
-
405
- - New: `CAFixlenString` answers `minmax`, `cummax` and `cummin`, as
406
- `CAString` does.
407
-
408
- - New (C extensions): `carray.h` defines `ca_u_<type>` cell types and
409
- `CA_U(type)`, of the same size and value as the plain types but with no
410
- alignment requirement, for reading cells that need not be aligned (a
411
- refer with a byte offset, a struct member, a wrapped buffer). The slab
412
- macros in `ca_kernel_iterator.h` use them for their pointers.
413
-
414
- - Change: `CACategorical#sort_addr` is renamed `group_addr`, the order of
415
- the cells by category. `sort_addr` on a categorical now raises, as
416
- `sort_index` does, since a categorical has no order of values.
417
-
418
- - Change: a Face's `parent` (of a `CATime`, `CARecord`, ...) is a
419
- read-only view of its storage. Write the storage of a time through
420
- `CATime#ticks`.
421
-
422
- - Change: an operator that cannot bring two data types together raises
423
- `CArray::DataTypeError` instead of `TypeError`. `DataTypeError` is a
424
- `TypeError`, so `rescue TypeError` still catches it.
425
-
426
- - Change: a float cell with no integer of the target type -- an infinity,
427
- or a value out of the type's range -- is now treated the way NaN
428
- already was. `to_type` (`int32`, `as_int64`, ...) masks it to `UNDEF`;
429
- storing it into an integer array raises `RangeError`
430
- (`FloatDomainError` for an infinity). Before, it became whatever the
431
- machine's C conversion gave, which differed between x86 and ARM.
432
- `clip_int64` and the other `clip_<type>` methods saturate a float
433
- source to the type's limits on every machine; integer `linspace` raises
434
- `RangeError` for a span the type cannot hold.
435
-
436
- - Change: a Ruby Array operand of a numeric or boolean array is read as
437
- its cells: `a.eq([1, 5, 3])` compares cell by cell (it compared every
438
- cell with the whole Array), and `a + [1, 2, 3]` adds (it raised).
439
- Nested Arrays give the axes. An object array still takes an Array as
440
- one value.
441
-
442
- - Change: `window`'s `bounds:` is a policy named by a Symbol or String,
443
- matched whole; an Integer and an abbreviation raise. A `fill_value:`
444
- given with a policy that does not use it (`:nearest`, `:strict`, ...)
445
- raises instead of being dropped.
446
-
447
- - Change: a length, count, offset or shift given to a view
448
- (`sliding_windows`, `block_view`, `tile`, `roll`, `shift`, `field`,
449
- `diagonal`) must be an Integer; a Float raises `TypeError` instead of
450
- being truncated. `transpose` reads its axes as the other axis arguments
451
- are read: negative from the end, an Integer only.
452
-
453
- - Change: `drop_axis` on an array whose every axis has size 1 keeps one
454
- axis of size 1, and `reshape` with no axes raises.
455
-
456
- - Change: in an index of one key per axis, an index array of more than
457
- one axis on one axis raises `ArgumentError`; it was read flat. Pass
458
- `idx.flatten` for the old reading.
459
-
460
- - Change: `elem_fetch`, `elem_store` and the other `elem_*` methods read
461
- an index as `[]` reads a key: a Float with no fraction is an index, a
462
- Float with a fraction raises `IndexError`.
463
-
464
- - Change: two string arrays of different kinds (`CAString`,
465
- `CAFixlenString`, `CAConstString`) or of different widths compare by
466
- their strings. A String query longer than a fixed-width cell matches
467
- no cell in `eq`, `count`, `search`, `bsearch` and `is_in`; it was cut
468
- to the cell's width.
469
-
470
- - Change: `str_index` and `rindex` give `UNDEF` for a cell that does not
471
- hold the substring; they raised for the whole array.
472
-
473
- - Change: `bsearch` and `bsearch_addr` answer the first of several equal
474
- cells.
475
-
476
- - Change: `search` and `search_addr` raise `ArgumentError` for a negative
477
- or NaN `eps`, which acted as an exact match.
478
-
479
- - Change: `inherit_mask` and `inherit_mask_replace` raise `ArgumentError`
480
- for a source whose number of cells differs from the receiver's (a
481
- scalar source still applies to every cell).
482
-
483
- - Change: a reduction's `fill_value:` that its result cannot hold raises
484
- even when no cell needs it, and `fill` on an empty array checks its
485
- value as an assignment does.
486
-
487
- - Change: rounding a `:M` or `:Y` `CATime` to a calendar bucket
488
- (`round(unit: :Y)`, `"3 months"`) measures the distance by the instant,
489
- so it agrees with the same dates on `:D`.
490
-
491
- - Change: a `CATime` reduction (`mean`, `median`, ...) sends a tie to the
492
- later tick on both sides of 1970; before 1970 it went to the earlier
493
- one.
494
-
495
- - Change: a duration String added to or subtracted from a `CATime` is
496
- one step of its own resolution, so `"15 minutes"` on a `"10 minutes"`
497
- grid raises, as the same duration as a `CATimedelta` does. It was read
498
- as fifteen one-minute steps and cut to the grid.
499
-
500
- - Change: of `-0.0` and `0.0`, `pmax` gives `0.0` and `pmin` gives
501
- `-0.0`, in either order and on every platform, as `maximum` and
502
- `minimum` do. Which zero `min` and `max` answer is not specified.
503
-
504
- - Change: a one-sided `clip` passes a NaN cell through, as a two-sided
505
- `clip` does.
506
-
507
- - Change: a categorical's `fill_value:` (of `shift`, `window`, `project`)
508
- is a label; a `CAConstString` takes only `UNDEF` as a fill value.
509
-
510
- - Change: a lazy operator with a Face operand (a categorical, a time, a
511
- string array) answers as the eager operator does; it read the Face's
512
- storage. `CAConstString#eq` with another array compares cell by cell.
513
-
514
- - Change: a boolean member of a record (or `field(offset, :boolean)` of a
515
- fixed-length array) raises `RangeError` when read as a byte that is not
516
- 0 or 1, instead of answering differently in each method.
517
-
518
- - Change: unmasking a cell of a `CAString` that holds no String gives an
519
- empty String.
520
-
521
- - Change: `swap_bytes` keeps the attributes, as `refer` and `bitfield`
522
- do. An array with no cells has no say in the attributes a `meld`,
523
- `stack` or `concatenate` keeps.
524
-
525
- - Change: `dim_view` keeps a Face, as `transpose` does.
526
-
527
- - Change: `CArray.string(n)` without a block, and `CArray.string("ab")`,
528
- raise; `fixlen_string` and `to_fixlen_string` raise for `bytes:` below 1.
529
- `project` raises for a keyword argument, `paste` into a frozen array
530
- raises `FrozenError`, and `CArray.result_type` refuses a MemoryView
531
- operand whose format carray cannot read, as the operators do.
532
-
533
- - Change: `CArray.sort_addr` with numeric keys is two to three times as fast, and
534
- `nlargest` / `nsmallest` read each fiber once with a work area of a
535
- few times n.
536
-
537
- - Fix: x86-64 Linux. Inputs that reached an integer division by zero
538
- inside the library stopped the process with SIGFPE there (on ARM they
539
- were refused later or gave a wrong answer): a sum over a view with a
540
- zero-length axis, `wsum` / `wmean` with 1-D weights over a zero-length
541
- axis, a view of a stack of empty arrays, `window` with a step of 0, and
542
- `wrap_readonly(String, CA_FIXLEN)`. Each now answers or raises
543
- `ArgumentError`. The extension builds with GCC 14 without warnings.
544
-
545
- - Fix: big-endian hosts. `bitfield` read 0 and lost writes, a struct's
546
- bit members overwrote each other, and an element-wise operation applied
547
- in place could give a wrong cell.
548
-
549
- - Fix: `save` and `dump` with `endian: :little` or `:big` wrote the other
550
- byte order. `load` reads the marker, so files written so far still load
551
- correctly.
552
-
553
- - Fix: running out of memory inside a kernel left a view attached, lost
554
- the keywords of the call (`a.sum(axis: 1)` returned the total), or
555
- leaked the array being built.
556
-
557
- - Fix: an array with 16 axes (the maximum) given to `bitarray`, `field`,
558
- a narrowing `refer` or a `:_` index wrote past an internal array.
559
-
560
- - Fix: a lazy chain whose step narrows the cells (`a.lazy.abs` of a
561
- complex array) overran the heap; `seq` on an empty object array wrote
562
- past its end.
563
-
564
- - Fix: a CAObject's copy and sync hooks: a view the hook kept of the
565
- array it was lent, or the lent array's mask, pointed at freed memory
566
- after the hook returned.
567
-
568
- - Fix: `CArray.fuse` crashed when several Ractors ran a fuse block for the
569
- first time at once.
570
-
571
- - Fix: a grouped `variancep` / `stddevp` matches `CArray#variancep` to the
572
- last bit.
573
-
574
- - Fix: `count` with an array of values honours `keep_axis:`.
575
-
576
- - Fix: `CARecord.wrap` of a record array wraps its storage, not the
577
- record array.
578
-
579
- - Fix: an unnamed struct's `order_by` survives `save` / `load` and
580
- Marshal.
581
-
582
- - Fix: `CAFrame.from_csv` and `cast(name => :time)` read a leap second
583
- (`23:59:60`) as `CArray.time` does, into the next minute.
584
-
585
- ## 3.0.4
586
-
587
- - New: `CAFrame#verify(rules)` judges every row against named rules (each
588
- a callable that returns a boolean CArray) and returns the verdicts as a
589
- frame, one column per rule; a row whose rule read a masked value is
590
- `UNDEF`, so `count(false)` counts the rows that break it.
591
-
592
- - New: `CAFrame#join` takes `how: :semi` and `:anti` (the left rows that
593
- have, or have no, match), several key columns (`on: ["station",
594
- "date"]`), and the index as a key by the row axis name.
595
- `CAFrame#join_asof` takes the index too, and `by:` columns that must
596
- match exactly before the nearest key is taken.
597
-
598
- - New: a `CAFrame` grouping has more verbs. The short form of `prod`,
599
- `accumulate`, `median`, `variance`, `stddev`, `variancep`, `stddevp`,
600
- `first`, `last`, `nunique`, `count`, `all` and `any`, beside `sum` /
601
- `mean` / `min` / `max`; `filter` (keep the groups a block chooses);
602
- `lag`, `order`, `cumsum` and the other running values, and
603
- `fill(name, :ffill)` / `:bfill`, all kept on the frame's rows; and
604
- `to_frame`. The reductions take column names (`grp.mean("temp")` is a
605
- CArray) and `keep_rows: true`, which gives each row its own group's
606
- result.
607
-
608
- - New: `CAFrame#resample` takes `by:`, columns whose groups are binned
609
- apart: `df.resample("time", "1 day", by: "station").max("temp")`.
610
-
611
- - New: `CArray#windows(on:, before:, after:)` bounds each window by a
612
- width of a key (a time, a duration or a number) instead of a count of
613
- cells, with `by:`, `exclude:`, `interval:` and `at:` (windows placed at
614
- given points, which may overlap). The key need not be sorted, and the
615
- value may have several columns (shape `(N, ...)`). `CAFrame#windows(on:
616
- "time", ...)` does the same for a frame's columns.
617
-
618
- - New: `CArray#lag(n = 1, axis:)` is the value `n` steps earlier along an
619
- axis, `UNDEF` where there is none, so `x - x.lag` starts with `UNDEF`.
620
-
621
- - New: the slab, block, segment, categorical and axis-group iterators
622
- have `lag`, `order` (each cell's rank within its piece) and
623
- `strip_mask(method: :ffill / :bfill)`; each of them works within one
624
- piece and never takes a value from another. Every iterator has `first`,
625
- `last` and `nunique`.
626
-
627
- - New: `CArray#is_between(lo, hi, exclude:)` (or a Range) is true where a
628
- value lies between two bounds; `exclude: :lower`, `:upper` or `:both`
629
- leaves bounds out, and `nil` or an open end leaves a side unbounded.
630
-
631
- - New: `CArray#round(ndigits)` rounds each element to `ndigits` decimal
632
- places (negative for tens, hundreds, ...), as `Float#round` and
633
- `Integer#round` do.
634
-
635
- - New: `CArray#to_frame(*names, axis: -1)` shows an array as a CAFrame
636
- whose columns are views of it, one per position along `axis`.
637
-
638
- - New: `CACategorical#contrast(base:, full:)` gives one int8 column per
639
- category (1 in the cell's category, the base left out unless `full:
640
- true`), and `CAFrame#contrast_columns(name, ...)` puts those columns in
641
- the frame in place of the categorical.
642
-
643
- - New: `CAFrame#is_duplicate(*names, except:)` is true for the rows that
644
- repeat an earlier row in the named columns; `except: :last` or `:none`
645
- chooses which occurrence stays unmarked.
646
-
647
- - New: `CAFrame#append(name, col, before:, after:)` puts the column next
648
- to another one.
649
-
650
- - New: a `CAFrame` carries attributes of the frame as a whole (`attr`,
651
- `set_attr`, `attrs`, ..., and `CAFrame.new(..., attrs:)`), separate from
652
- each column's. A row selection or a change of columns keeps them; a
653
- summary, a join or a reshape does not.
654
-
655
- - New: `CAFrame#to_csv(attrs: [:units, ...])` writes one line per
656
- attribute key below the names, and `CAFrame.from_csv(attrs: [...])`
657
- reads them back as column attributes; in a reading block,
658
- `r.header(:units)` does the same for a line anywhere in the header.
659
-
660
- - New: `CAFrame.from_csv` `columns:` takes a Hash that selects and names
661
- columns, and the names `c0`, `c1`, ... of a file without a header;
662
- `cast` and `from_csv` `types:` take `:categorical`. `CAFrame.new` takes
663
- `types:` and `on_error:`, as `from_records` does.
664
-
665
- - New: `CArray#delete_attr(key)` removes an attribute and returns its
666
- value.
667
-
668
- - New: `CATime#end_of(unit:, origin:)` (the last tick of each time's
669
- bucket), `days_in_month`, `quarter`, and the ISO 8601 week `iso_week`
670
- with its year `iso_year`.
671
-
672
- - New: a time or duration array takes a single value in `+` and `-`
673
- (`t + "3 days"`, `t - t.min`, `t - Time.utc(2024, 1, 1)`), and a month
674
- or year duration moves a time on a day or finer grid as `Date#>>` does
675
- (`2024-01-31 + 1 month` is `2024-02-29`). A bare number is still
676
- refused.
677
-
678
- - New: a time array compares with a value off its grid (`days.eq(
679
- "2024-01-03T05:00")`, `<`, `search_nearest`, `is_in`, ...) in the finer
680
- unit the two share, where it raised `ArgumentError`. An assignment
681
- still raises.
682
-
683
- - New: `CATime#pmax` / `pmin` (and `maximum` / `minimum` / `fmax` /
684
- `fmin`) give the later / earlier time cell by cell.
685
-
686
- - New: CArray can be used in a Ractor other than the main one, `fuse`
687
- included, and a frozen array is shared between Ractors without
688
- copying. See `docs/topics/Ractor.md`.
689
-
690
- - New: C extensions: `CA_FOR_EACH_WHOLE` and `CA_FOR_EACH_WHOLE_MASKED`
691
- hand a kernel the whole array as one contiguous run.
692
-
693
- - Change: `CArray#rank` is removed; use `#ndim`.
694
-
695
- - Change: `CArray::TableMethods` (`column_names=`, `column`, `row`, `rows`
696
- and `select` on a 2-D array) is removed; use `a.to_frame("x", "y")`,
697
- then `df["x"]` for a column or `df.to_records[i]` for a row.
698
-
699
- - Change: `CArray.load_arrow_tensor`, `CArray#save_arrow_tensor` and
700
- `CArray::ArrowTensor`, the experimental Arrow tensor IPC reader and
701
- writer, are removed.
702
-
703
- - Change: methods whose names start and end with `__` that were public
704
- internals are now private, renamed or removed. Call the public method
705
- they served instead.
706
-
707
- - Change: CAFrame takes column names as Strings only. A Symbol name
708
- (`df.drop(:a)`, `join(on: :a)`, `CAFrame.new(axis_name: :row)`) raises
709
- `TypeError`; write `"a"`. Record keys given to `from_records` may still
710
- be Symbols, and `df[:x]` stays the predicate syntax.
711
-
712
- - Change: a masked cell of an integer index array keeps its place:
713
- `x[i]`, the grid forms and `CAFrame` row selection `df[i]` give a
714
- result shaped like `i`, `UNDEF` where `i` is masked, where they dropped
715
- those positions. To drop them as before, index by
716
- `i[i.is_not_masked]`.
717
-
718
- - Change: an index beside a CArray key is read as it is without one: a
719
- range ending before its start reads backwards (`a[i, -1..1]`), and an
720
- Integer key drops its axis (`a[i, 1]` has the shape of `i`; add `:_`
721
- or use `1..1` to keep it).
722
-
723
- - Change: an index with a Float that has a fraction (`a[1.5..3]`, a step
724
- of `0.5`) raises `IndexError`; it was cut to an integer. Convert with
725
- `to_i` or `round` first. A Float that holds an integer, such as a count
726
- from `sum`, is still that position.
727
-
728
- - Change: an index step says the direction, as in Ruby: a step pointing
729
- away from the end reads nothing (`a[(0..4).step(-1)]` read `a[0]`).
730
-
731
- - Change: a boolean selector of more than one axis must have the array's
732
- shape; it picked cells by flat position. Flatten both sides to keep the
733
- old reading.
734
-
735
- - Change: storing an integer a cell cannot hold raises `RangeError`
736
- (`CA_INT8([300])`, `a[0] = 300`, `fill`, `scatter_add!`, a record
737
- member); it wrapped (`300` into int8 was `44`). Storing or reading a
738
- NaN into an integer cell (`ints[] = floats`, `as_type`, `fake`) raises
739
- `FloatDomainError`. To keep C's conversion, use `to_type`, which is
740
- unchanged.
741
-
742
- - Change: `CArray.time` reads an Integer as a count of ticks of `unit:`
743
- (`CArray.time(CA_INT64([0, 10]), unit: :m)` is 00:00 and 00:10); it
744
- read Unix seconds. To read Unix seconds onto another unit, write
745
- `CArray.time(secs).to_unit(:m)`.
746
-
747
- - Change: `CArray.time` without `unit:`, and `CAFrame#parse_to_time` with
748
- a format or `:mixed`, read the values in the finest unit they show
749
- (dates alone `:D`, fractions of a second `:ms` / `:us` / `:ns`); it was
750
- always `:s`. Pass `unit: :s` to keep the old unit.
751
-
752
- - Change: adding a duration that is coarser than a time's unit and not a
753
- whole number of its ticks (`"1 day"` on a `"7 hours"` time) raises, and
754
- so does `CArray#time(origin:)` between two ticks of `unit:`; both were
755
- cut to the grid. Convert the time to a unit both share first.
756
-
757
- - Change: `order(descending: true)` puts NaN last and keeps tied cells in
758
- their original order (`[5, 3, 5, 1, 5]` gives `[0, 3, 1, 4, 2]`, was
759
- `[2, 3, 1, 4, 0]`); with `method: :dense` the largest value is 0 and
760
- the ranks have no gaps. Code that used `(n - 1) - order` for the
761
- descending rank needs that formula written out. `nlargest` no longer
762
- returns NaN or masked cells first, and `nsmallest` / `nlargest` and
763
- their `_index` forms break ties by position.
764
-
765
- - Change: a CAFrame column built from Ruby values is typed by them:
766
- Integers `int64`, numbers `float64`, Strings a text column (`CAString`),
767
- arrays of one shape an N-D column, anything else `:object`; it was
768
- `:object`. This holds for `CAFrame.new("x" => [...])`, `df["x"] = [...]`,
769
- a group's `table` block and a Proc in `aggregate`. Wrap the values in
770
- `CA_OBJECT(...)` to keep an object column. A returned array is read
771
- from the N-D column as `col[i, nil]`.
772
-
773
- - Change: `CAFrame#melt` names each row's source in a text column
774
- (`CAString`); it was an object column.
775
-
776
- - Change: `CAFrame#group_by` on several keys gives a result with no
777
- index: each key is a column, before the reduced columns. Read the keys
778
- with `result["station"]` and so on, where the index held tuples.
779
-
780
- - Change: `CAFrame#data_types`, `describe` and `p df` name a Face column
781
- by its class (`CATime[D]`, `CAString`) where they gave its storage
782
- `data_type` (`:fixlen` for most). Read the storage through the Face's
783
- accessor (`ticks`, `codes`, ...).
784
-
785
- - Change: a CAFrame verb that takes a list of columns refuses a name
786
- given twice (`select("a", "a")`, `group_by("a", "a")`) with
787
- `ArgumentError`. `df["a", "a"]` still gives the column twice.
788
-
789
- - Change: a CAFrame group or window reduction over a column whose type
790
- lacks it raises `CArray::DataTypeError`; it raised `ArgumentError`.
791
-
792
- - Change: a `CAString` holds only Strings: storing `nil`, a number or an
793
- Array into it raises (use `UNDEF` to mask a cell). A selection among
794
- Strings (`then_else`, `choose`, `select`, `conditional`) and a
795
- `CAString`'s String operators give a `CAString`, where they gave an
796
- object array.
797
-
798
- - Change: attributes follow conversions, views and copies but not
799
- reductions: `categorize`, `cast`, `parse_to_time`, `dup`, Marshal and a
800
- Face's views keep them, and `first` / `last` of a grouping no longer
801
- carry them. A joined or concatenated array shows the keys every piece
802
- shows with the same value. An attribute value is stored frozen; change
803
- it by setting it again.
804
-
805
- - Change: an error names the method you called, and the common refusals
806
- open with it ("+: shape mismatch between operands ...", "fill: can not
807
- modify read-only array"). The exception classes are unchanged; code
808
- that matches a message needs the new text.
809
-
810
- - Change: `clip` refuses `UNDEF` or a masked cell as a bound with
811
- `ArgumentError`. To mask the cells out of range, pass `UNDEF` as the
812
- fill (`clip(0, 10, UNDEF)`).
813
-
814
- - Change: `is_in`, `intersection`, `difference` and `union` refuse a
815
- Range; pass an Array (`(1..3).to_a`), or use `is_between` for an
816
- interval.
817
-
818
- - Change: `median`, `percentile` and `quantile` along the only axis of a
819
- 1-D array give a bare value, as `sum` does. `nunique(axis:)` naming
820
- every axis gives an Integer; pass `keep_axis: true` to keep an array.
821
-
822
- - Change: `valid_index?` and `valid_addr?` count a negative index from
823
- the end, as `[]` does. `elem_fetch` on an empty array raises
824
- `IndexError`; it returned `nil`.
825
-
826
- - Change: `seq` / `seq!` on an integer array take a Float or Rational
827
- start or step as `init_val + step*i` cut toward zero
828
- (`int32.seq(0.5, 0.5)` is `[0, 1, 1, 2]`, was `[0, 0, 1, 1]`), and
829
- raise `RangeError` for a start or Integer step the type cannot hold.
830
-
831
- - Change: `random!` on an integer array raises for bounds the type
832
- cannot hold or a Float bound, and clears the mask. `bin`, `bincount`,
833
- `bincount_nd` and the histograms raise for a non-Integer count and for
834
- edges that decrease.
835
-
836
- - Change: MemoryView: `wrap_memory_view` refuses a boolean buffer (any
837
- byte other than 0 or 1 cannot be told apart; use `from_memory_view`,
838
- which reads it as true), and a wrap with a read-only `mask:` is
839
- read-only. `CArray.memory_view_reject_reason` returns `nil` for an
840
- object that is not a CArray.
841
-
842
- - Change: C extensions: fifteen kernel iterator shorthand macros
843
- (`CA_SLAB_REDUCE_F64`, `CA_SLAB_REDUCE_T_PLUS`,
844
- `CA_L2_FOR_EACH_UNMASKED` and others) are removed; write the macro they
845
- stood for (`CA_SLAB_REDUCE_T` with `double`, ...).
846
- `ca_iter_state_next_slab_strided` is removed, and
847
- `ca_iter_state_init_l2` takes `CA_SLAB_AXES` only.
848
-
849
- ## 3.0.3
850
-
851
- - New: `CAFrame.from_csv` reads messy tables: `types: :infer` (numbers,
852
- booleans, year-first dates and times), `types: { default: ... }`,
853
- `missing:` tokens, `on_error:` (`:mask`, `:warn`, `:raise`), `columns:` to
854
- read only some columns, and `header:` / `data:` / `column_names:` by line.
855
- `CAFrame#cast` takes the same map; `parse_to_time(name, :infer)` finds a
856
- column's date format; `describe` and `split_column` are new; `to_csv`
857
- takes `encoding:` and `missing:`.
858
-
859
- - New: `CAFrame` reshapes and resamples: `pivot` / `pivot_grid` / `melt`,
860
- `stack_rows(by:)` / `unstack_rows`, `stack_columns` / `unstack_column`,
861
- `CAFrame.stack` / `unstack` (frames as layers), and `resample(name, unit)`
862
- for time bins. The stacked forms are views. `protect` makes a frame
863
- read-only.
864
-
865
- - New: `CAFrame` group reductions and `aggregate` reduce N-D columns along
866
- the rows (a column `(N, L)` gives `(groups, L)`), take `min_count:` and
867
- `fill_value:`, and pass a reduction its arguments
868
- (`"p90" => ["temp", :percentile, 90.0]`).
869
-
870
- - New: `value.segments(offsets:)` / `segments(lengths:)` iterate over
871
- consecutive runs of cells, with `CArray.segment_offsets` /
872
- `segment_index` to convert between lengths, boundaries and segment
873
- numbers. The scans, `map`, `median` and `percentile` of
874
- `group_by_category` take `axis:`, and a window's `median`, `percentile`
875
- and `quantile` answer under the default `bounds: :skip`.
876
-
877
- - New: `bitfield(range, type)` reads a field as a signed or wider integer;
878
- `set_attrs(hash)`; `order(kind:)`; `tolerance: "10 minutes"` for time keys
879
- in `locate_nearest_addr` and `CAFrame#join_asof`. A `CARecord` answers
880
- `unique`, `value_counts`, `mode`, `is_in`, the set operations,
881
- `categorize`, `count(v)` and `locate_addr`.
882
-
883
- - New: for whoever registers a `CArray.expression_evaluator` (carray-jit):
884
- mixed data types, integer powers, comparisons, `then_else`, `shift`, and
885
- reductions, scans and sorts of an expression now reach the evaluator. An
886
- evaluator that does not know a node declines, and CArray computes the
887
- expression as before.
888
-
889
- - New: for C extensions: `ca_iter_ensure`, `ca_sync_detach`,
890
- `ca_attach_n` / `ca_allocate_n`, `ca_iter_state_init_l2_paired`,
891
- `ca_stride_setup(NULL, ...)` and `ca_check_uninitialized` let an
892
- extension clean up when its code raises.
893
-
894
- - Change: `CAFrame` names its columns "columns": `variable_names` is now
895
- `column_names`, `variables` is `columns` and `nvar` is `ncol`. The old
896
- names are gone.
897
-
898
- - Change: `sort_index`, `rank_index`, `partition_index`, `partition` and
899
- `partition_copy` without `axis:` work on the whole array, as `sort` does;
900
- they worked along axis 0. On an N-D array pass `axis: 0` to keep the old
901
- result.
902
-
903
- - Change: errors a caller can cause no longer raise `RuntimeError`: a bad
904
- shape, step, axis, option or data type raises `ArgumentError`,
905
- `TypeError`, `RangeError` or `CArray::DataTypeError`, and every index out
906
- of range raises `IndexError` (`take_along_axis`, `axis2addr` and
907
- `addr2index` raised others). `CArray::DataTypeError` is now a
908
- `TypeError`. A write to a read-only array still raises `RuntimeError`.
909
- Messages name the method you called and the value you gave. Update a
910
- `rescue` that matched the old class or wording.
911
-
912
- - Change: arguments that were truncated or ignored now raise: an axis,
913
- `min_count:`, `kth` or `n` that is not an Integer; a misspelt keyword; a
914
- keyword a method does not take (`min_count:` to `all` / `any` of an
915
- iterator, as to the core); a Symbol column name in `cast` and `types:`;
916
- `windows` given anything but Ranges (an exclusive range now leaves out
917
- its end); `CA_INT32(0, 2)`; a fixlen array without `bytes:`. A negative
918
- axis counts from the end everywhere. The indexer's method form
919
- (`a[:eq, 0]`) calls public methods only.
920
-
921
- - Change: a Hash passed as a positional argument is an argument, as in
922
- Ruby 3, not keywords: `a.sum({axis: 0})` raises (write `a.sum(axis: 0)`
923
- or `a.sum(**opts)`). An object array of Hashes can now be searched and
924
- counted.
925
-
926
- - Change: values that cannot be held raise instead of being bent: storing
927
- `nil` into a numeric or boolean array, an Integer operand the array's type
928
- cannot hold (`RangeError`; the comparisons answer by value instead), and a
929
- String that is not a decimal number (`"010"` is now 10, and `to_type` gives
930
- `UNDEF`). `CAFrame#cast` to an integer makes `2.5` `UNDEF` instead of 2.
931
- Store `Float::NAN` or `UNDEF` for a missing value.
932
-
933
- - Change: reductions with too few values: `variance` / `stddev` of fewer
934
- than two values is `UNDEF` (pass `fill_value: 0.0` for the old answer),
935
- and `minmax` of nothing is `[UNDEF, UNDEF]`. `fill_value:` is stored into
936
- the result's type with or without `axis:`; `fill_value: UNDEF`,
937
- `strip_mask(UNDEF)` and `unmask(UNDEF)` leave the cells masked.
938
-
939
- - Change: arrays of mixed types meet in a type that holds both: signed with
940
- unsigned integers (`uint8` with `int8` is `int16`, `uint64` with `int64` is
941
- `:object`) and 32-bit or wider integers with `float32` (in `float64`) when
942
- joined or matched. `CArray.result_type` lets a scalar take the arrays'
943
- type, as an operator does (`result_type(float32_array, 0.1)` is
944
- `:float32`). Arithmetic is unchanged.
945
-
946
- - Change: integer and float edge cases no longer depend on the machine or
947
- the argument order: a shift count means what it does to `Integer#<<`,
948
- signed `rcp` / `rcp_mul` round down as `/` does, `to_type` to an integer
949
- makes NaN `UNDEF`, `maximum` / `minimum` of two zeros are `0.0` / `-0.0`,
950
- and `clip` raises when `min` exceeds `max` (a one-sided fill clamps the
951
- other side).
952
-
953
- - Change: `CAFrame#join` matches as SQL joins do: a key on 2 left and 3
954
- right rows gives 6 rows, and a masked key matches nothing and stays as an
955
- unmatched row. When the other frame's key is unique, `:left` gives the
956
- same rows as before.
957
-
958
- - Change: `CAFrame.from_csv`'s reading block takes the reader as its
959
- parameter and its `body` verb is `data`
960
- (`from_csv(path) { |r| r.skip 2; r.header; r.data }`). Text columns come
961
- back as `CAString`. Contents that cannot be read raise
962
- `CAFrame::UnreadableColumn` or `CAFrame::AmbiguousTimeFormat`, which are
963
- not `ArgumentError`.
964
-
965
- - Change: reading time from text is stricter: `parse_to_time` without a
966
- format reads year-first text only (pass a format, or `:mixed` for the old
967
- guess) in the finest unit the text shows; `CArray.time` and strptime
968
- formats refuse trailing text and a time of day they cannot read; a date
969
- the column's unit cannot hold raises `RangeError`. Before, these cells
970
- were guessed, floored or masked.
971
-
972
- - Change: `CAFrame#to_csv` writes a boolean as `1` / `0` and a float32 as
973
- its shortest decimal, refuses a record column, and raises naming the row
974
- and column of a cell it cannot encode. `extract` masks a cell its pattern
975
- does not match, where it gave `""`.
976
-
977
- - Change: `CAFrame`: a frozen frame refuses `[]=`, `set_index`, `cast` and
978
- the other in-place verbs; `at` on a numeric index takes numbers only; the
979
- index of a `group_by` result keeps the key's type (a `CATime` key gives a
980
- `CATime` index); group `sum` / `mean` / `min` / `max` include every column
981
- whose type has the reduction (times and strings among them).
982
-
983
- - Change: `CAStruct` / `CARecord`: records are ordered only by the members
984
- named in `CArray.struct(order_by:)`; without it sorting, `min` / `max` and
985
- comparison raise. An element's `[]` takes a String or a position (a
986
- Symbol raises), a member named like a method (`hash`, `size`) gets no
987
- accessor, a nested member reads as a view (`dup` it for a copy), boolean
988
- and 1-bit members read as `true` / `false`, and `UNDEF` cannot be stored
989
- in a member. Records of another struct are refused.
990
-
991
- - Change: a `CARecord` exported through MemoryView uses Ruby's own format
992
- (`ruby/memory_view.h`) instead of PEP 3118 `T{...}`; the member names are
993
- `CARecord#memory_view_field_names`. A union is no longer exported.
994
-
995
- - Change: a time array compares with, searches for and stores a `String` or
996
- `Date` as well as a `Time`, at the precision the value carries: a value
997
- off the array's grid (09:00 against a day array) raises, where a `Time`
998
- was floored. `union` of two units gives the finer unit. `inspect` shows
999
- the tick and each cell as `to_s` does.
1000
-
1001
- - Change: `==` on a Face (a time, string or categorical array) compares the
1002
- values it holds, and only with a Face of its own class: time arrays of
1003
- different units holding the same instants are `==`, and a `CAString` is
1004
- no longer `==` to an object array of the same strings (compare
1005
- `to_type(:object)` for that).
1006
-
1007
- - Change: Faces (`CATime`, `CATimedelta`, `CACategorical`, string arrays):
1008
- `.lazy` returns the Face and computes eagerly; storing one into a
1009
- non-object plain array raises (convert with `to_type(:object)` or
1010
- `ticks`); `CArray.save`, `dump` and `Marshal.dump` refuse one, and a
1011
- `CAWrap` (save `.parent` or `.copy`); `CArray.stack([face])` returns the
1012
- Face, and mixing Faces raises.
1013
-
1014
- - Change: for whoever writes a Face: the hooks are renamed
1015
- `storage_to_element` / `element_to_storage`, and a stored value goes
1016
- through `element_to_storage` once (it went through twice). A Face written
1017
- in Ruby on `CAObject` over a numeric storage refuses arithmetic, math and
1018
- reductions unless it passes `numeric: true`.
1019
-
1020
- - Change: views: a view of a frozen array is read-only rather than frozen
1021
- (`RuntimeError`, `frozen?` false), so `sort`, selections and lazy
1022
- expressions work on a frozen array. `then_else` and `sort` on a lazy
1023
- expression return a read-only lazy view (call `copy` for a snapshot), and
1024
- `then_else` branches broadcast as operands do. `dup` of a `CAWrap` is a
1025
- plain `CArray`. Attributes survive `copy` and `to_type`.
1026
-
1027
- - Change: a `bitarray` view has no mask and refuses a masked array (use
1028
- `value.bitarray`); `pack_bits` raises on masked cells (pack the mask with
1029
- `validity_bits`). `bitfield` refuses a complex array.
1030
-
1031
- - Change: on an object array, `min`, `max`, `cummin`, `pmin` and the rest
1032
- compare with `<=>`, as `sort` does; a pair that cannot be ordered raises
1033
- `ArgumentError`. `median`, `percentile` and `quantile` answer in the
1034
- elements' own arithmetic (`CA_OBJECT([1, 2]).median` is `3/2`; convert
1035
- with `to_type(:float64)` for a Float). `&`, `|` and `^` with a boolean
1036
- array read its cells as `true` / `false`, eager and lazy.
1037
-
1038
- - Change: smaller behaviour changes: `locate_nearest_addr` (and `join_asof`,
1039
- `snap_to`) with `direction:` matches beyond the reference's ends (limit it
1040
- with `tolerance:`); `map_slab` carries the mask of the block's result; a
1041
- masked cell of a one-axis boolean selector selects nothing; `shift`,
1042
- `roll`, `tile` and `window` on a zero-length axis return an empty view;
1043
- boolean sums in `axis_group` and categorical scans are uint64, as in the
1044
- core; `group_by_category` raises `TypeError` for a non-categorical.
1045
-
1046
- - Change: an operand that exports MemoryView and defines `to_ca` (an Arrow
1047
- array, with a bridge) is taken through `to_ca`, so Arrow nulls arrive as
1048
- masked cells and time columns as `CATime`.
1049
-
1050
- - Change: for C extensions: `CArray::VERSION_CODE` is
1051
- `major*10000 + minor*100 + teeny` (`30003`); the `CA_FOR_EACH_ELEMENT`
1052
- macros, `CA_WITH_BUFFER` and `CA_CHECK_BOUND` are removed (use
1053
- `ca_call_cslab_N_r`, `ca_call_cfunc_N_r` or `rb_ca_call_with_buffer`);
1054
- the `_INOUT` and `_PAIR` fiber macros raise on a shape mismatch; kernels
1055
- are built with `-fwrapv`. Rebuild the extension.
1056
-
1057
- - Change: faster, with the same results: `from_csv` with `types:` (two to
1058
- five times), text to float (eight times), `CAConstString#to_string`,
1059
- reductions over gathered, `shift` and `window` views, a repeated
1060
- `CArray.fuse` block, and selecting from a lazy expression.
1061
-
1062
- - Fix: wrong answers that came without an error. An in-place operation
1063
- reading an argument that shares its memory read cells it had already
1064
- written (`a[1..5].add!(a[0..4])` gave a running sum; `scatter_*!`,
1065
- `inherit_mask` and `mask=` too); `refer` to a wider type on a transposed
1066
- or stepped parent read neighbouring values; views of a stack or meld,
1067
- and a slice of a lazy expression, returned other cells; a Float operand
1068
- of an integer array was truncated (`count(1.5)` found `1`); `mask=` with
1069
- another shape copied cells by count; a masked index read cell 0 in
1070
- `gather_nd`; `stddev` of NaN data was 0.0.
1071
-
1072
- - Fix: wrong answers that came without an error, time and strings: time
1073
- keys of different units matched or not depending on the side in `is_in`,
1074
- `join` and `align`; `locate_nearest_addr` picked a wrong row for a NaN,
1075
- an infinite or a nanosecond key; `unmask(time)`, `resize(fill_value:)`
1076
- and `insert_block` read a `Time` as a count; `CAConstString` comparisons
1077
- compared buffer positions; a `CAString` compared against a time,
1078
- categorical or const string compared their encodings.
1079
-
1080
- - Fix: writes that were lost now reach the array: through a grid, selection
1081
- or `select_axis` over a reshaped transpose, through a stack or meld of
1082
- views, into a nested struct member, into the mask copy of a stack or meld,
1083
- and the masked cells of `c[] = c.flip(0)`.
1084
-
1085
- - Fix: crashes and reads outside an array: a garbage collection during an
1086
- operation on a converted or computed array (`CAObject`, lazy, object
1087
- data); a slab kept after `each_slab`; a `CARecord` after `Marshal.load`;
1088
- shapes and indices whose arithmetic overflows; `refer(:object)` and
1089
- `bitfield` on object data; `scatter_*!` on complex; `MIN / -1` on Linux
1090
- x86; struct members outside the record; fixlen stores of another width;
1091
- reductions in several Ractors.
1092
-
1093
- - Fix: an operation that raises part way (a block, a conversion, a
1094
- division by zero) leaves its arrays usable and frees its memory. Before,
1095
- an array could stay attached, and after 32 such errors every lazy
1096
- expression failed with "all 32 slots in use".
1097
-
1098
- - Fix: iterator reductions answer as the same reduction on an array: every
1099
- one takes `min_count:` and `fill_value:` (`blocks(n).percentile(p,
1100
- min_count: k)` read them as a second percentile), a group's counts apply
1101
- `min_count:` to the right cells, a group's `wmean` no longer takes
1102
- `fill_value:` as a weight, a window of only NaN gives NaN, and object
1103
- weights in `segments` stay exact.
1104
-
1105
- - Fix: `CAFrame` round trips through CSV and records: quotes, separators of
1106
- several characters or spaces, lines of spaces, a duplicated header name,
1107
- complex `Infinity` / `NaN`, months and years, hour 24, a one-column file
1108
- with a blank name; nested arrays, `Complex` and `Rational` in
1109
- `from_records`. `fill`, `to_table` and `filter(keep_masked:)` work with
1110
- N-D and categorical columns; `meld` and `concatenate` take empty frames;
1111
- `group_by` takes a categorical key and treats NaN in a composite key as
1112
- one value.
1113
-
1114
- - Fix: Faces stay Faces: the reductions of `windows` and `blocks`,
1115
- `partition_copy`, `then_else`, `clip`, `mask_eq` and `meld` return the
1116
- Face, and a Face's own state survives `min(axis:)`, `cummax` and
1117
- `partition_copy`. `axis_group` and categorical reductions take boolean,
1118
- complex, object and Face values; a time array's `fill_value:` is a time
1119
- on every path. `CAFrame#fill(:linear)` interpolates any Face that defines
1120
- `linear_fetch`. A categorical refuses `clip` and `minmax` as it refuses
1121
- `min`.
1122
-
1123
- - Fix: types kept through operations: complex arrays work with `unique`,
1124
- `is_in` and the rest of that family; `meld` reductions answer as on a
1125
- copy; fixlen strings of different widths match; `atan2`, `hypot` and
1126
- others keep float32 and integer types; a record member declared with
1127
- `endian:` reads, sorts, saves and loads correctly.
1128
-
1129
- - Fix: NaN and masked cells are treated the same everywhere: NaN is last in
1130
- object sorts and `categorize`, loses `min` / `max`, and is found by
1131
- `CAFrame#at(Float::NAN)`; `min_index` never points at a masked cell or a
1132
- NaN; `min_count:` and `fill_value:` are honoured where they were ignored;
1133
- a lazy expression's mask follows its operands; a selection or `shift`
1134
- follows later mask changes; `invert_mask` works on a selection.
1135
-
1136
- - Fix: MemoryView: a `CAFixlenString` exports as bytes and a frozen fixlen
1137
- array can be exported; `CATime`, `CACategorical` and `CAConstString` are
1138
- refused by `memory_view_available?` with the reason, instead of answering
1139
- `true` and failing.
1140
-
1141
- - Fix: with carray-jit: two expressions that differ only in which operand an
1142
- operation reads no longer share a kernel, and a store whose destination
1143
- overlaps an operand is computed by CArray.
1144
-
1145
- - Fix: for C extensions: a `CA_KERNEL_WRITE` walk over a view that holds a
1146
- cell more than once keeps the cells the kernel wrote; a walk left with
1147
- `break` writes back its slab; writes through a `CAGrid`, `CAWindow` or
1148
- `CAShift` over a view reach the array; the sweep engine and paired walks
1149
- read an argument sharing the output's memory as it was; a view class
1150
- that is not registered with `ca_iter_register_source_kind` is still
1151
- accepted. Rebuild the extension.
1152
-
1153
- ## 3.0.2
1154
-
1155
- - New: `CArray::AddressBasis`, for a C extension whose code addresses cells
1156
- itself rather than being handed them — a kernel generated from an
1157
- expression, which writes its own loop. `open` lends a pointer and one byte
1158
- stride per axis for the length of a block, and closes what it opened even
1159
- when the block raises; `classify` reports how an array would be opened
1160
- without opening it. It is a runtime facility at the `ca_attach` layer, not
1161
- a user API: what it lends is a raw machine address, so it is described in
1162
- the developer's guide rather than in the user documentation.
1163
-
1164
- - New: a `CAString` column can be searched, not only sorted: `bsearch`,
1165
- `bsearch_addr`, `search` and `count(v)` answer where they used to raise
1166
- `ArgumentError`. A cell of one is the Ruby String it shows, so a String query
1167
- compares against it directly, with nothing to reconcile. Sorting, which
1168
- already worked, is unchanged, and so is `CAConstString`, which answers
1169
- `search` / `count(v)` natively and still has no `bsearch`.
1170
-
1171
- - New: `count(v)` counts an object or fixlen array, which used to raise
1172
- `CArray::DataTypeError`. An object array compares by Ruby `==`, so
1173
- `count(1)` and `count(1.0)` agree, and `true` / `false` / `nil` are values to
1174
- count rather than the boolean array's `true` / `false`. A fixlen array
1175
- compares the whole cell by `memcmp`, with a short String query padded out to
1176
- the cell width -- so a 4-byte cell holding `"a\0\0\0"` is counted by
1177
- `count("a")`.
1178
-
1179
- - New: `CArray.empty(data_type, dim, bytes: nil)` allocates without the zero
1180
- fill, for an array whose every cell is written before anything reads it. One
1181
- existing call changes: `CArray.empty(3, [4])` raised `TypeError` in 3.0.1
1182
- and now matches `CArray.new(3, [4])`.
1183
-
1184
- - New: `CAFrame.from_csv` reads an open IO as well as a path, so CSV already
1185
- in memory need not go through a temporary file first. A String argument is
1186
- still always a path, never CSV text.
1187
-
1188
- - New: `inspect_full` renders an array the way `inspect` does but without the
1189
- `...` abbreviation.
1190
-
1191
- - New: `repeat` lays each element of an array down several times --
1192
- `v.repeat(2)`, or `v.repeat([3, 1, 2])` for a count each. It is not `tile`,
1193
- which lays the whole array down again. The result is a view.
1194
-
1195
- - New: `unique`, `nunique` and `mask_duplicates` take `along: k`, comparing
1196
- whole sub-arrays instead of cells -- `z.unique(along: 0)` gives the distinct
1197
- rows of a 2-D array. Giving both `along:` and `axis:` raises.
1198
-
1199
- - New: each numeric data type names its own limits on its class --
1200
- `CArray::Int32::MIN` / `MAX`, and `TINY` / `EPSILON` for float and complex
1201
- types. `MIN` is the bottom of the range, where Ruby's `Float::MIN` is what
1202
- is called `TINY` here.
1203
-
1204
- - New: `CArray::Rng` is a random number generator with its own state, which
1205
- `random!`, `randomn!` and `shuffle!` accept as `rng:` alongside a Ruby
1206
- `Random`. Without `rng:`, or with a Ruby `Random`, nothing changes.
1207
-
1208
- - New: `CArray#factorize` answers `[codes, levels]` in one pass, for a caller
1209
- who wants the codes as storage rather than the `CACategorical` that
1210
- `categorize` builds from the same two.
1211
-
1212
- - New: C extensions only. `CA_FOR_EACH_FIBER_PAIR` and
1213
- `CA_FOR_EACH_FIBER_PAIR_MASKED` yield one contiguous fiber from each of two
1214
- sources at the same position.
1215
-
1216
- - Change: `CArray.meld` (and `CAMeld.new`, and so `CAFrame.meld`) now treats a
1217
- homogeneous list of Faces the way `CArray.stack` does: a Face whose state is
1218
- per-parent is refused, and one that can be carried is kept on the result.
1219
- `CAConstString` and `CAString` now raise `ArgumentError` — weld the storage
1220
- instead, with `.parent`, or use `CArray.concatenate`. `CAFixlenString`,
1221
- `CATime` and `CATimedelta` come back as themselves rather than as the raw
1222
- storage; melding pieces whose Face state differs, such as two `CATime`
1223
- columns in different units, now raises rather than welding the ticks. Lists
1224
- of plain arrays, and a list of one, are unaffected.
1225
-
1226
- - Change: `CAConstString.wrap` now checks the `(start, end)` pairs it is given
1227
- against the buffer, and takes ownership of the offsets entity by marking it
1228
- read-only. A pair outside the buffer raises `ArgumentError` naming the
1229
- element; masked cells are exempt, since their bytes may be anything. Code
1230
- that built a column with well-formed offsets is unaffected, except that the
1231
- entity it passed can no longer be written afterwards — pass `.copy` to keep
1232
- a mutable one. This also means the storage behind an existing column
1233
- (`column.parent[i] = ...`) now raises rather than silently rewriting a column
1234
- that reports itself read-only.
1235
-
1236
- - Change: `all` and `any` on an `axis_group` reduction now require a boolean
1237
- payload, as `CArray#all` / `#any` and the other iterators do. They folded any
1238
- numeric payload, counting a non-zero cell as true, so `data.all` refused and
1239
- `data[g].all(axis: :group)` answered for the same float array. Convert first
1240
- if you meant the old reading: `data.ne(0)[g].all(axis: :group)`.
1241
-
1242
- - Change: the `axis:` reductions on `group_by_category` now read the source
1243
- array when asked, rather than some of them answering from a result kept
1244
- from an earlier call. `sum`, `mean`, `min`, `max` and the counts shared a
1245
- kept result per axis while `prod`, the variance family and `wsum` / `wmean`
1246
- did not, so after a write through the source one iterator could report a
1247
- mean and a variance that no data can produce together. Reading several
1248
- members off one iterator now costs one kernel run each instead of one
1249
- shared run; keep the result if you want the old sharing. The no-axis
1250
- reductions are unchanged: they still work from the copy taken when the
1251
- iterator was built.
1252
-
1253
- - Change: `CAFrame#at(UNDEF)` now raises `ArgumentError` instead of returning a
1254
- row. An index can hold a masked cell -- an `:outer` / `:right` join and
1255
- `align` both produce one -- but a row with no label cannot be identified by
1256
- one, and two undefined labels are not the same label; the key matching behind
1257
- `join` and `align` already treats a masked key as matching nothing. Use
1258
- `df.filter { |f| f.index.is_masked }` for the rows with no label, which also
1259
- handles more than one of them. Asking for a real label whose cell is masked
1260
- still raises `KeyError`, unchanged.
1261
-
1262
- - Change: functions built on the C-extension bridge (`ca_call_cfunc_*`,
1263
- `ca_call_cslab_*`, and `CAMath.spherical_to_xyz` / `xyz_to_spherical`)
1264
- pair two array operands only when their shapes agree, and otherwise
1265
- raise `ArgumentError` naming both shapes. Arrays of the same size but
1266
- different shape, such as (2,3) and (3,2), used to be accepted and read
1267
- in flat order; reshape one of them first. Arrays of different sizes
1268
- raised `RuntimeError` before, so a `rescue` of that class needs
1269
- updating. A scalar still pairs with any array.
1270
-
1271
- - Change: `min`, `max`, `minmax`, `cummin` and `cummax` answer `NaN`, and
1272
- `min_index`, `max_index`, `min_addr` and `max_addr` answer `UNDEF`, when every
1273
- cell a float array contributes is `NaN`. They used to answer `Infinity`,
1274
- `-Infinity`, the interval `[Infinity, -Infinity]` and position `0`. A `NaN`
1275
- still loses to any number, so an array holding at least one number answers as
1276
- before, as does one holding only real infinities. Empty and all-masked still
1277
- answer `UNDEF`, and integer, boolean, fixlen and object arrays are unchanged
1278
- -- an object array already answered `NaN`. To have `NaN` counted as missing
1279
- rather than skipped, call `mask_invalid` first; `min_count:` and `fill_value:`
1280
- act on masked cells and do not reach `NaN` ones.
1281
-
1282
- - Change: the `CAConstString` ordering family takes `axis:` -- and `kind:` /
1283
- `masked_position:` / `keep_axis:` where CArray does -- across `min`, `max`,
1284
- `minmax`, `min_index`, `max_index`, `sort`, `sort_copy`, `sort_addr`,
1285
- `sort_index`, `rank_index`, `order`, `partition_copy` and `partition_index`.
1286
- Three answers move to CArray's: `sort_index` gives per-fiber indices where it
1287
- gave view-flat addresses (ask `sort_addr` for those); `sort` with no `axis:`
1288
- flattens first, where it kept the shape (a 1-D column is unaffected); and
1289
- `min` / `max` on an empty or wholly masked column give UNDEF, not nil.
1290
-
1291
- - Change: `CABlock#count` and `CAWindow#count` are gone. They gave back the
1292
- per-axis number of cells the view exposes -- which is what `shape` answers
1293
- -- and in doing so hid `CArray#count` on the two classes an indexing
1294
- expression lands on most: `a[2...8].count(true)` raised `ArgumentError`,
1295
- and `a[2...8].count` gave a shape rather than a population. Read the
1296
- geometry with `shape`. `size0` / `start` / `step` / `offset`, which say
1297
- where the view sits in its parent, are unchanged.
1298
-
1299
- - Change: `CArray.jit_for`, `CArray.jit_each` and `CArray.jit_map` are no
1300
- longer defined here; they arrive with `require "carray/jit"`. Without it a
1301
- call raises `NoMethodError` where 3.0.1 raised `NotImplementedError`, so
1302
- code that rescued that to fall back asks `CArray.respond_to?(:jit_each)`.
1303
-
1304
- - Change: the Ruby attach surface is gone from released builds:
1305
- `CArray.attach` / `.attach!`, `CArray#attach` / `#attach!`, and
1306
- `#__attach__` / `#__sync__` / `#__detach__`. Write through the array
1307
- directly instead. `CArray#attached?` and the C lifecycle are unchanged.
1308
-
1309
- - Change: `a[1, :_]` returns a view of the axes `:_` asked for instead of
1310
- raising `IndexError`. To keep an axis rather than drop it, index it with
1311
- something that is not a scalar -- `a[[1], :_]`.
1312
-
1313
- - Change: C extensions only. A kernel iterator init the engine refuses now
1314
- raises instead of returning a code the block macros discarded. To handle a
1315
- refusal rather than propagate it, call `ca_iter_state_init_l1` / `_l2`
1316
- directly and read the code.
1317
-
1318
- - Change: `CACategorical.from_codes` now materialises `codes` when it is a
1319
- view rather than an array of its own, so writing through the array the view
1320
- was taken from no longer changes the categorical underneath it. A wrapped
1321
- memory view is an array of its own and is still adopted without a copy, so a
1322
- zero-copy import stays zero-copy. The array you pass is never marked
1323
- read-only beyond what you handed over.
1324
-
1325
- - Change: `CACategorical.from_codes` now checks what it is handed and
1326
- normalises it. It raises `ArgumentError` for duplicate labels, for more
1327
- labels than the codes data type can carry once its top value is reserved as
1328
- the exclusion sentinel, and for an unmasked code outside `0...labels.size`
1329
- that is not the sentinel. A cell that arrives masked also gets the sentinel
1330
- written into its code byte, so the mask and the byte now agree for every
1331
- reader, a byte-reinterpret export included. Codes built by `categorize`
1332
- already satisfy all of this, so nothing changes for a categorical made that
1333
- way.
1334
-
1335
- - Change: `search_nearest` and `search_nearest_addr` work on an object array of
1336
- numbers, and say why when they cannot. They measured only with `#distance`,
1337
- and since `Numeric#distance` became an opt-in refinement -- which a C-level
1338
- call does not see -- that raised `NoMethodError` for an Integer as readily as
1339
- for a String. A number is now measured as `(query - cell).abs`, exactly for
1340
- Rational and BigDecimal; an object defining a real `#distance` still uses it;
1341
- anything else raises `CArray::DataTypeError` naming the query's class, and
1342
- points at `search` / `bsearch` for an exact match. Numeric arrays are
1343
- unaffected.
1344
-
1345
- - Change: `CAFrame.from_csv` reads a missing field as UNDEF in every column,
1346
- not only in one named by `types:`. An unquoted empty field, and a cell a
1347
- short row never reached, used to arrive as a Ruby `nil` sitting in an
1348
- uncast column, so a mask written by `to_csv` did not survive the trip back.
1349
- A quoted empty field (`""`) is still the empty string, which is a value.
1350
- Code that worked around this with `col[:eq, nil] = UNDEF` can drop the line.
1351
-
1352
- - Change: `CArray.time` reads a string array about eight times faster with an
1353
- explicit `format:`, and about three times faster letting it auto-detect --
1354
- so `CAFrame#parse_to_time`, which calls it, speeds up by the same amount.
1355
- Parsed values are unchanged.
1356
-
1357
- - Change: `window` accepts `bounds:` as a Symbol as well as a String, which is
1358
- the spelling `windows` already took. Strings keep working.
1359
-
1360
- - Change: C extensions only. A partial fill of an array backed by a CAObject
1361
- or CASource subclass takes the `fill_block` / `fill_addrs` slots where the
1362
- subclass defines them, instead of one `store_addr` per cell. Which cells are
1363
- written is unchanged, and a subclass defining no fill slot keeps the
1364
- per-cell path.
1365
-
1366
- - Fix: `is_in`, `count(v)`, the set operations, `locate_addr`, `search`,
1367
- `bsearch` and `linear_section` no longer compare a Face operand by its
1368
- storage when that storage is not the value it shows. Passing a
1369
- `CAConstString` (whose cells are byte ranges) to one of these on another
1370
- Face used to answer from the byte ranges: where the two cell widths
1371
- coincided — a `CAConstString` cell is 16 bytes, and so is a
1372
- `CAFixlenString` cell whose column is 16 bytes wide — you got a wrong
1373
- answer with no error, and a set operation could return raw offset bytes as
1374
- its values. Such an operand now raises `ArgumentError`; convert it first,
1375
- with `#to_string` for a string Face, or pass `.parent` on both sides to work
1376
- in storage space. Plain operands, and Faces whose cells are their values
1377
- (`CAString`, `CAFixlenString`), are unaffected, as is the cross-unit
1378
- reconciliation `CATime` does through `to_comparable`.
1379
-
1380
- - Fix: the reductions without `axis:` on `group_by_category` now agree with one
1381
- another about which values they are reducing. `cumsum` and the other scans
1382
- read the array when called while every other member worked from the copy
1383
- taken when the iterator was built, so a write through the source between two
1384
- calls was visible to one and not the other. All of them now answer about the
1385
- values as they were when the iterator was built; build a new iterator to pick
1386
- up a write. The `axis:` reductions read the array when called, unchanged.
1387
-
1388
- - Fix: `CArray.load_from_file` no longer exhausts the stack. It was
1389
- registered for autoload but defined nowhere, so calling it recursed until
1390
- Ruby gave up; it now raises `NoMethodError` like any other method that does
1391
- not exist. Use `CArray.load`, which is unchanged. An autoload registration
1392
- whose library defines no such method now says which method and which
1393
- library, rather than recursing.
1394
-
1395
- - Fix: a `group_by_category` reduction over a read-only Face — a
1396
- `CAConstString` column — no longer fails with an `IndexError` about a buffer
1397
- range. Such a Face cannot be built by writing into it, so `min`, `max` and
1398
- the other value members hand back the surface values (the strings) rather
1399
- than the Face. A writable Face such as `CATime` still answers in its Face.
1400
-
1401
- - Fix: a group iterator from `axis_group` now answers `shape`, `ndim` and
1402
- `dim`, which every other iterator answers and which it returned `nil` for,
1403
- and its `count` takes the two forms the family declares: `count(UNDEF)` for
1404
- masked cells and `count(v)` for cells equal to `v`. Both previously raised
1405
- `ArgumentError` about the number of arguments.
1406
-
1407
- - Fix: a `group_by_category` reduction over values that carry a Face (a
1408
- `CATime` column, say) now answers in that Face, as `CArray`'s own reduction
1409
- does: `min`, `max` and `median` come back as a `CATime` of elements rather
1410
- than failing with an internal message about a zero width. A member the core
1411
- does not define for that Face still refuses, in the core's own words.
1412
-
1413
- - Fix: the band-only classifier shape for a `group_by_category(axis:)`
1414
- reduction is now reachable on a two-dimensional source, where it was
1415
- refused and the refusal listed it among the accepted forms. Where both the
1416
- case A shape and the band-only shape fit, which a square source allows,
1417
- case A is taken, as before. The refusal no longer names `sum` when another
1418
- reduction was the one called.
1419
-
1420
- - Fix: `count(axis:)` and `count_not_masked(axis:)` on `group_by_category`
1421
- now work for a complex, boolean or object payload. They counted cells
1422
- through a numeric-only kernel, which refused those payloads for an answer
1423
- that never depended on the payload. The no-axis form already worked.
1424
-
1425
- - Fix: a `group_by_category` iterator whose classifier does not line up
1426
- cell-for-cell with the value now says so. A no-axis reduction on one raises
1427
- `ArgumentError` naming the mismatch and pointing at the `axis:` form, rather
1428
- than a `NoMethodError` about `nil`; `elements` raises the same instead of
1429
- answering `nil`; and `inspect` says "per-fiber only" instead of printing an
1430
- empty grouping. `accumulate(axis:)`, which failed outright on such an
1431
- iterator, now works.
1432
-
1433
- - Fix: a reduction from `group_by_category` now hands back an array of the
1434
- caller's own. `min`, `max`, `minmax`, `count`, `count_not_masked`,
1435
- `elements`, `min_index` and `max_index` returned the iterator's memo itself,
1436
- so writing into a result changed what that iterator answered from then on,
1437
- and changed it for the other members reading the same memo. `sum` already
1438
- copied. Nothing to change in calling code unless you relied on writing
1439
- through a result.
1440
-
1441
- - Fix: an `axis_group` reduction or scan that raises part-way through no
1442
- longer leaks the working memory it had taken. An object-valued scan
1443
- (`cumsum`, `cummax` and the rest) calls back into Ruby for every cell, so a
1444
- value that will not coerce or a `<=>` that answers `nil` raises from an
1445
- ordinary call and used to leave roughly 36 bytes per source element behind
1446
- each time. Nothing to change in calling code.
1447
-
1448
- - Fix: `CAFrame#set_index` on a frame that already has an index no longer
1449
- discards it. The index being replaced now goes back to being a column, the
1450
- same demotion `reset_index` performs and in the same position, so re-indexing
1451
- keeps every column and `set_index("b")` on a frame indexed by `"a"` is the
1452
- same as `reset_index` followed by `set_index("b")`. Previously the column the
1453
- old index had been made from was gone, with nothing said.
1454
-
1455
- - Fix: `CAFrame#reset_index` now restores the row axis name the frame had
1456
- before `set_index` promoted a column over it, so the two are each other's
1457
- inverse as documented. It used to leave `"row"`, which is user-visible: the
1458
- row axis name is the header of the index's column in `to_csv` and its key in
1459
- a row `Hash`. A frame built with an index, or derived from one, never had an
1460
- earlier name, so `reset_index` still leaves the default there.
1461
-
1462
- - Fix: `min` and `max` on an `axis_group` reduction now answer in the source
1463
- array's data type, as `CArray#min` / `#max` do, instead of float64 -- an
1464
- int64 beyond the float mantissa came back rounded. A boolean array answers
1465
- as its 0/1 numeric storage (`all` / `any` are the boolean-returning twins).
1466
- A group holding nothing but `NaN` now answers `NaN` rather than the
1467
- accumulator's infinity, and `min_addr` / `max_addr` answer UNDEF for it,
1468
- since no cell won.
1469
-
1470
- - Fix: an `axis_group` reduction over a grouping whose group axis has length
1471
- zero now answers each output cell the way a group with no member is answered
1472
- -- `sum` 0, `prod` 1, `count` 0, `all` true, `any` false, and UNDEF for
1473
- `mean`, `min`, `max`, `min_addr`, `max_addr` and the variance family. It
1474
- previously returned an unmasked 0 for all of them, so a mean and a variance
1475
- both read as 0.0. A zero-length band axis, which reduces to no cells at all,
1476
- is unchanged.
1477
-
1478
- - Fix: a per-category `min`, `max`, `min_index`, `max_index`, `median`,
1479
- `percentile` or `quantile` from `group_by_category` now treats `NaN` the way
1480
- `CArray`'s own reduction does: a `NaN` loses every contest, a category
1481
- holding nothing but `NaN` answers `NaN` for an extremum and UNDEF for a
1482
- position, and an order statistic sorts `NaN` last. Before, the answer
1483
- depended on where in the category the `NaN` sat, so the same values in a
1484
- different row order gave different results. Nothing to change in calling
1485
- code.
1486
-
1487
- - Fix: `p` / `inspect` on a `CAFrame` whose only data is its index now shows the
1488
- table. It printed the summary line alone, because it gated on the column set
1489
- while the table itself counts the index as a column.
1490
-
1491
- - Fix: `CAFrame` no longer reports a row count that nothing in the frame backs.
1492
- Splicing a frame that has no columns into another that has neither columns nor
1493
- an index left the target claiming the spliced frame's row count, while its own
1494
- `copy`, `head` and `filter` all answered 0 and it would then accept only
1495
- columns of that length. The count is now read off a column, or off the index
1496
- when there are no columns. Nothing to change in calling code.
1497
-
1498
- - Fix: `CAFrame`'s `df[rows] = UNDEF` now refuses a row outside the frame on a
1499
- frame with no columns, as the read and delete forms already did. It used to
1500
- return quietly, because the bound check came from the column indexer the
1501
- selector was handed to and there was no column to hand it to. Masking a row
1502
- that does exist on such a frame is still a no-op -- there are no data cells,
1503
- and the index is left alone by design.
1504
-
1505
- - Fix: `CAFrame`'s `to_table` (and so `p` / `puts` / `to_s`) now prints a masked
1506
- element inside an N-D cell as `_`, the marker it already used for a masked
1507
- scalar cell, instead of the literal `UNDEF`. Nothing to change in calling
1508
- code.
1509
-
1510
- - Fix: `CAFrame#group_by` with a composite key no longer makes a group of its
1511
- own for rows whose key has a masked component. Such a row now forms no group,
1512
- which is what a single masked key cell already did. Nothing to change in
1513
- calling code unless you relied on the UNDEF-labelled group.
1514
-
1515
- - Fix: two `CAFrame` verbs that change every column now decide before changing
1516
- any, so a column that refuses no longer leaves the frame half-changed in an
1517
- order that depends on how the columns were inserted. `df[sel] = UNDEF` on a
1518
- frame holding a read-only column (a categorical) raises without masking
1519
- anything, and `promote(type)` raises without casting anything when some
1520
- column would narrow. Nothing to change in calling code.
1521
-
1522
- - Fix: `CAFrame.from_records` now reads a `nil` cell back as UNDEF in every
1523
- column, not only in one a numeric cast happens to convert. A string, boolean,
1524
- object or N-D column used to keep the `nil` as a value, so a mask written by
1525
- `to_records` did not survive the trip and a row with no index label came back
1526
- labelled `nil`. Note that the data type is still rebuilt from the values, so
1527
- an integer column returns as `int64` and a boolean column as an object
1528
- column; `cast` afterwards if the exact type matters.
1529
-
1530
- - Fix: a CSV written from a frame with a single column -- or with only an
1531
- index -- now reads back with all of its rows. A masked cell is written as an
1532
- empty field, which for a one-column row is a line with nothing on it, and the
1533
- reader skipped it as a blank line. Blank lines in a file with more than one
1534
- column are still skipped, as a row there always carries a separator. Nothing
1535
- to change in calling code.
1536
-
1537
- - Fix: linear gap-fill on an **integer** array no longer fills the cells
1538
- outside the interpolable span with `0` and drops their mask. It now leaves
1539
- them masked, as it already did for a float array and as the documentation
1540
- says. This covers `unmask(method: :linear)` and `strip_mask(method: :linear)`
1541
- as well as `CAFrame#fill(name, :linear)`, with or without a frame index.
1542
- Nothing to change in calling code.
1543
-
1544
- - Fix: on a frame grouped by a numeric column, `CAFrame`'s `mean`, `sum`, `min`
1545
- and `max` shortcuts now work. They raised `axis_name "..." collides with a
1546
- column of the same name`, because the key column was reduced into the result
1547
- while also being its index; a key only stayed out of the way when its data
1548
- type was one a reduction skips anyway -- a string, boolean, categorical or
1549
- time column. A composite numeric key no longer returns its key columns as
1550
- reduced columns either, so it gives the same column set a composite string
1551
- key gives. `aggregate` and `table` were never affected. Nothing to change in
1552
- calling code.
1553
-
1554
- - Fix: `CAFrame#filter(keep_masked: true)` no longer hands back a frame whose
1555
- index writes through to the original. Its columns were already independent,
1556
- so writing the result's index changed the original while writing its columns
1557
- did not. The result is now materialized throughout -- columns and index --
1558
- whether or not the selector actually carries a masked cell, so the same call
1559
- site no longer switches between sharing and copying depending on the data.
1560
- Code that wants a frame sharing storage with the original should use plain
1561
- `filter`, which is still a view-frame.
1562
-
1563
- - Fix: reductions, scans and order statistics no longer leak memory when
1564
- reading their source raises part way through -- for example
1565
- `cumsum`, `sum` or `median` over a float64 view of an object array
1566
- holding a cell that is not a number. Each call used to leave the
1567
- slab the walk was gathering into behind. Nothing to change in calling
1568
- code.
1569
-
1570
- - Fix: `a[sel]` no longer leaks memory when reading the boolean selector
1571
- raises -- for example `fake(CA_BOOLEAN)` over an int32 array holding a
1572
- 2. Nothing to change in calling code.
1573
-
1574
- - Fix: a view that converts on read -- for example `fake(CA_BOOLEAN)` over
1575
- an int32 array holding a 2 -- now raises every time it is read, where
1576
- the second read used to succeed silently and return values from a
1577
- half-converted buffer. A view stacked or melded over such an array no
1578
- longer leaves its other parents attached when the read raises, and a
1579
- reshape of a lazy view no longer leaks its buffer. Nothing to change in
1580
- calling code.
1581
-
1582
- - Fix: for C extensions, a callback passed to `ca_call_cfunc_*` or
1583
- `ca_call_cslab_*` may now `rb_raise` to refuse a value: the bridge
1584
- detaches and frees what it holds before the exception propagates,
1585
- where it used to leave an output view attached and its scratch memory
1586
- behind. The outputs are left partly written. Nothing to change in
1587
- calling code.
1588
-
1589
- - Fix: when `to_type` on a view raises part way through the cast -- for
1590
- example an int32 value other than 0 or 1 cast to boolean -- the view is
1591
- no longer left holding a stale copy of its parent, which made later
1592
- reads through it return the old values. Nothing to change in calling
1593
- code.
1594
-
1595
- - Fix: `copy` and `strip_mask(fill)` no longer leak the result's memory
1596
- when reading the source raises part way through -- for example a
1597
- float64 view of an object array holding a cell that is not a number.
1598
- Nothing to change in calling code.
1599
-
1600
- - Fix: functions built on the C-extension bridge (`ca_call_cfunc_*`,
1601
- `ca_call_cslab_*`, the `CA_FOR_EACH_ELEMENT` macros, and
1602
- `CAMath.lgamma` and its siblings) no longer leak memory, or leave an
1603
- output view attached, when reading an operand raises part way through
1604
- -- for example a float64 view of an object array holding a cell that is
1605
- not a number. Nothing to change in calling code.
1606
-
1607
- - Fix: `is_in`, `intersection`, `difference` and `union` take an Array or Range
1608
- of Strings against a fixlen array, where every such call raised
1609
- `CArray::DataTypeError` -- `CAFixlenString` included. The set is built at the
1610
- array's cell width, so a short String matches a padded cell the way it does
1611
- everywhere else. A set given as a CArray must still be of that width; when it
1612
- is not, the refusal now says which width was wanted instead of reporting a
1613
- data type mismatch between two fixlen arrays.
1614
-
1615
- - Fix: comparing a fixlen array against a String compares it as a value of
1616
- that array's cell width. The String became an object operand, so `eq` / `ne` /
1617
- `lt` / `gt` / `ge` / `le` and the `[:eq, v]` indexer ran `String#==` per cell
1618
- against the cell's NUL-padded text -- and an array pads a short String on
1619
- write, so `a[i] = "be"` then `a.eq("be")` was false, `a.gt("be")` was true,
1620
- and the scan took 30x longer than the same one in `search`. Two fixlen
1621
- arrays of different widths compare as before, as does a Regexp for `match`.
1622
- `CAFixlenString` was never affected.
1623
-
1624
- - Fix: `percentile` and `median` no longer interpolate between objects that
1625
- have no arithmetic. On a column of Strings `percentile(30)` quietly answered
1626
- `""` and even-length `median` raised `NoMethodError` from inside a funcall;
1627
- both now raise `CArray::DataTypeError` naming `method: :lower` / `:higher` /
1628
- `:nearest`, which pick an element and work. A `p` that lands exactly on an
1629
- element (`percentile(50)` of five) still answers, as does an odd-length
1630
- `median`. Numbers stored as objects -- Integer, Rational, BigDecimal -- are
1631
- unaffected.
1632
-
1633
- - Fix: `sort_copy` takes whatever `sort` takes. It refused everything its own
1634
- fast path could not handle, so an object or boolean array sorted through
1635
- `sort` and raised `CArray::DataTypeError` through `sort_copy`; complex, which
1636
- neither can order, refused differently depending on which one was asked, and
1637
- now refuses alike. Numeric arrays keep the fast path and are unchanged.
1638
-
1639
- - Fix: `CAConstString#sort_addr`, `#sort_index`, `#rank_index`, `#order`,
1640
- `#min_index`, `#max_index`, `#partition_copy` and `#partition_index` read the
1641
- strings. They read the `(start, end)` offsets that hold them, which order by
1642
- how the column was packed, so they gave well-formed wrong answers rather than
1643
- raising: `sort_addr` on an unsorted column gave the identity, and
1644
- `partition_copy` gave NUL bytes. `#minmax` answers instead of raising, and
1645
- sorting a column with masked cells no longer raises.
1646
-
1647
- - Fix: `to_const_string` gives an N-D source back with its shape instead of
1648
- flattened, and `CAConstString#unique` / `#mode` / `#mask_duplicates` /
1649
- `#intersection` / `#difference` / `#union` keep the column's encoding --
1650
- on a column that was not UTF-8 they raised out of the builder's check.
1651
-
1652
- - Fix: `each_with_index` and `map_with_index!` no longer raise
1653
- `SystemStackError` on a long array, and neither do `CArray#format` /
1654
- `CArray.format`, which are built on them. The ceiling was the C stack, so
1655
- where it fell depended on where the code ran: around a million cells on the
1656
- main thread, under a hundred thousand inside a `Thread`.
1657
-
1658
- - Fix: `CArray.concatenate` and `CArray.mosaic` take a zero-length piece --
1659
- an empty slice such as `a[0...0]`, or `CArray.int32(0)` -- instead of
1660
- raising `IndexError`. The piece contributes nothing and the remaining ones
1661
- concatenate as before. `CArray#paste` likewise accepts a source covering no
1662
- cell, and writes nothing.
1663
-
1664
- - Fix: C extensions only. A kernel writing into a view the caller supplied now
1665
- reaches the array; writes were lost, or crashed, for several view kinds
1666
- iterated along an axis whose fiber is not contiguous. Kernels writing into
1667
- an array they allocated themselves were never affected.
1668
-
1669
- - Fix: `CArray#each_slab` yields a read-only slab, and writing through it
1670
- raises rather than reaching the array on one axis and being dropped on
1671
- another. Return values from the block instead, or assign through the array.
1672
-
1673
- ## 3.0.1
1674
-
1675
- - New: `CArray.jit_for`, `CArray.jit_each` and `CArray.jit_map` name a block
1676
- that is compiled rather than run. Compiling needs the carray-jit gem;
1677
- without it they raise `NotImplementedError`. An expression over whole
1678
- arrays wants `CArray.fuse`, which needs no compiler.
1679
-
1680
- - New: every iterator answers `accumulate` beside `sum`; some of them did not.
1681
- It is the same fold kept in the source's own data type, where `sum` answers
1682
- in the type the core promotes to -- a window or tile count over `uint8` cells
1683
- stays one byte wide.
1684
-
1685
- - New: `CArray::CoreExtensions` adds postfix math on `Complex`, so `a[0].tanh`
1686
- reads the way `a.tanh` does. It covers the seventeen functions a complex
1687
- array supports and agrees with the array form exactly, branch cuts and the
1688
- sign of a zero included. Opt in with `using CArray::CoreExtensions`.
1689
-
1690
- - New: `ca_is_stride_family(ca)` in `carray.h`, for a C extension that folds a
1691
- view into `root->ptr + base + sum(idx[k] * strides[k])` itself. True for
1692
- CAStride, CARefer, CABlock, CARepeat, CATranspose, CAFarray and CAField and
1693
- the mask array of each, and for an externally installed view that shares
1694
- their operation table.
1695
-
1696
- - New: `divmod` returns `[quotient, remainder]` element-wise with the quotient
1697
- floored, the pair Ruby's `Integer#divmod` and `Float#divmod` return. The
1698
- quotient keeps the receiver's data type.
1699
-
1700
- - New: two optional CAObject callbacks take a partial fill as a region instead
1701
- of one `store_addr` per cell: `fill_block(starts, counts, steps, val)` for a
1702
- forward per-axis sub-region, `fill_addrs(addrs, val)` otherwise. Defining
1703
- neither keeps the old behaviour. Filling a 1000x1000 region of a 2000x2000
1704
- CAObject: 116 ms to 0.6 ms.
1705
-
1706
- - New: `CAFrame#to_table` renders the frame as an aligned text table, and
1707
- `inspect` / `to_s` sit on it: `p df` summarises the first 8 and last 2 rows,
1708
- `puts df` prints the whole frame. `rows:` caps the printed rows, `precision:`
1709
- rounds float cells for display (default 6), masked cells show as `_`.
1710
-
1711
- - New: `CAFrame#to_time` takes a `CATime::Grid`, positionally or as `unit:`, so
1712
- a netCDF `units` attribute goes in whole. The grid also carries an epoch phase
1713
- the `unit:` / `epoch:` pair cannot -- that pair reads the epoch on the coarse
1714
- grid and loses the time of day. The keyword form is unchanged.
1715
-
1716
- - New: `CATime::Grid` packages the `(unit:, origin:)` pair that `#timesteps`,
1717
- `#snap` and `.from_timesteps` take, so it is built once and passed as one
1718
- value: `t.snap(g, direction: :floor)`, `t.timesteps(g)`, `g.at(k)`. It parses
1719
- and prints the udunits `"<unit> since <instant>"` form, holding a phased
1720
- origin that the keyword pair cannot (`"12 hours since 2017-11-30 09:00"`).
1721
- `CATime#grid` is the grid an array is stored on. Storage is unchanged.
1722
-
1723
- - New: `CATime#snap(grid, direction:)` rounds to a tick grid, the shape
1724
- `CArray#snap` has for numbers. `#floor` / `#ceil` / `#round` are its
1725
- fixed-direction forms; their results and keyword forms are unchanged.
1726
-
1727
- - New: a time element is taken directly as a start or origin literal, so a
1728
- `floor` / `ceil` / `to_unit` answer feeds back into `CArray.time`,
1729
- `time_range`, `time_series`, `CArray#time` and an `origin:`; it used to have
1730
- to go out through `DateTime` and be re-parsed. A `:M` or `:Y` element names
1731
- the first midnight of its granule. What an origin must satisfy is unchanged.
1732
-
1733
- - New: `CArray.time` parses a year-month (`"2019-09"`) and a bare year
1734
- (`"2019"`), so the form a `:M` / `:Y` element prints reads back in. A
1735
- missing finer field names the head of that period.
1736
-
1737
- - Change: `abs`, `abs2` and `arg` on a `cmplx64` array now return `float32`
1738
- instead of `float64` -- the width that type carries its real values in, the
1739
- same one `real` and `imag` already returned. `arg` on a `float32` array
1740
- likewise returns `float32` rather than widening. `cmplx128` and `float64`
1741
- are unchanged, and `arg` on an integer array still gives `float64`. To keep
1742
- the old width, add `.to_type(:float64)`.
1743
-
1744
- - Change: `CArray.fuse` takes the expression rather than the arrays it is
1745
- over -- `CArray.fuse { (a + b) * c }` in place of
1746
- `CArray.fuse(a, b, c) { |x, y, z| (x + y) * z }`. What comes back is the
1747
- expression, so `x = CArray.fuse { ... }` now wants `.to_ca` for an array.
1748
- Where the block's source cannot be read -- an `irb` prompt, inside `eval` --
1749
- write `a.lazy + b.lazy`. `CArray.lazy(*args) { ... }` is gone.
1750
-
1751
- - Change: a lazy expression (`a.lazy + b`, `CArray.fuse`) builds its mask when
1752
- something reads it, rather than when the expression is built. A mask set on
1753
- either operand after the expression was built is now seen; before, only the
1754
- left one was. `root_array` and `ancestors` now stop at a lazy operation
1755
- instead of walking into its left operand. Building a long masked expression
1756
- is also no longer quadratic in the length of the chain.
1757
-
1758
- - Change: the top-level constant `CA_NIL` is now `CArray::UNSPECIFIED`
1759
- (`CA_UNSPECIFIED` in C). It is an internal sentinel for "the caller gave no
1760
- argument", not a value to pass in; `unmask`, `shift(fill_value:)` and
1761
- `window(fill_value:)` behave as before.
1762
-
1763
- - Change: `group_by_category` reductions answer in the data type the core
1764
- reduction promotes the value to, instead of one chosen per reduction. `sum`
1765
- on an integer value now answers in float64 (`accumulate` is the spelling
1766
- that stays in the value's type), and `mean`, `variance` and `median` on an
1767
- object value stay exact. `sum` on a boolean value and `prod` or `mean` on a
1768
- complex one, which raised, now work.
1769
-
1770
- - Change: the `:*` unbound repeat is retired. `a[:*, nil]` raises `IndexError`;
1771
- `CArray#unbound_repeat`, `CAUnboundRepeat` and `insert_axis(repeat: :*)` are
1772
- gone. Use `:_`, which gives the same shape and now stretches on a store as
1773
- well as in an operation. `CArray#broadcast_to` and
1774
- `CArray.meshgrid(sparse: true)` are unaffected.
1775
-
1776
- - Change: a binary operation requires shapes to agree, or to differ only in
1777
- size-1 axes at equal ndim. `(3,2) + (2,3)` and `(3,2) + (6)` raise
1778
- `ArgumentError` where they used to answer in one operand's shape; flatten
1779
- both sides to combine the values in the order they lie. Comparisons, `fma`
1780
- and the lazy forms follow the same rule. Scalars are unaffected, but a
1781
- one-element 1-D array such as `CArray.int32(1)` counts as a shape.
1782
-
1783
- - Change: an assignment requires the shapes to match. `t[] = src` with a
1784
- differently shaped source raises `RuntimeError`; use `src.flatten`. In
1785
- exchange a smaller source is repeated to fit, so `t[] = row[:_, nil, nil]`
1786
- and `t[] = col` (shape `(n,1)`) work where they used to raise. A 1-D side on
1787
- either end still passes, as do shapes differing only in size-1 axes; Ruby
1788
- Arrays and scalars are unchanged.
1789
-
1790
- - Change: `to_ca` on a view derived from a lazy marker returns a new entity
1791
- rather than the view itself -- `a.lazy.shift(1, 0).to_ca`, inside a `fuse`
1792
- block or not. `copy` behaves as before.
1793
-
1794
- - Change: `/` and `%` follow Ruby instead of C. Integer division floors and the
1795
- remainder carries the sign of the divisor; float `%` floors too, float `/` is
1796
- unchanged. For the old behaviour use `fmod`, which now takes integers as well
1797
- as floats.
1798
-
1799
- - Change: `reminder` is removed -- it was IEEE 754 remainder on floats but C `%`
1800
- on integers. Use `fmod` for the truncated remainder. The IEEE form has no
1801
- replacement.
1802
-
1803
- - Change: the result-type override of `CArray#conditional` and
1804
- `CArray.select` is now `data_type:`, spelled the way the rest of the
1805
- library spells it. There is no alias: `dtype:` raises `unknown keyword`.
1806
-
1807
- - Change: a calendar-grid `origin:` given to the bucket-grid methods of a
1808
- `CATime` array -- `timesteps`, `snap`, `floor`, `ceil`, `round`,
1809
- `is_righttime` -- now has to be a month head (the 1st at 00:00); it used to
1810
- drop the day and time silently. A `:Y` tick likewise has to start in
1811
- January. `from_timesteps` already refused an off-grid origin.
1812
-
1813
- - Change: the MemoryView producer emits the format vocabulary
1814
- `ruby/memory_view.h` specifies rather than PEP 3118's, so below 32 bits it
1815
- writes `c` / `C` / `s` / `S` in place of `b` / `B` / `h` / `H`. From 32 bits
1816
- up the two already agreed, and `?`, `Zf` / `Zd`, `T{...}` and `Ns` stay PEP
1817
- 3118, which Ruby has no spelling for. The consumer side already accepted
1818
- both, so views produced by 3.0.0 still import.
1819
-
1820
- - Change: multiplying and dividing a `cmplx64` array (`*`, `/`, `rcp`,
1821
- `rcp_mul`) is computed in double and rounded once, so both are correctly
1822
- rounded; the old route could be off by about 1800 units in the last place.
1823
- A product that overflows a float but not a double no longer comes back NaN.
1824
- Division is 4.2-5.3x faster and multiplication 1.3x slower. `+`, `-` and
1825
- every `cmplx128` operation are unchanged.
1826
-
1827
- - Change: element-wise math on a `float32` or `cmplx64` array is computed at
1828
- that width rather than widened and rounded back, so `sqrt`, `exp`, `log`,
1829
- the trigonometric and hyperbolic families, `atan2`, `hypot`, `abs` and `arg`
1830
- are 1.1-3.5x faster there and can move by a bit or two in the last place.
1831
- Complex `log`, `power`, `exp2` and `exp10` are unchanged, as are the
1832
- rounding, min / max, comparison and variance families and the wider types.
1833
-
1834
- - Change: a rolling `sum`, `mean`, `prod`, `min`, `max`, `all` or `any` --
1835
- `a.windows(-1..1).sum` and the like -- over a window up to five cells wide on
1836
- every axis is 2-5x faster, and 1.3-4x over a masked source; `min_count:` and
1837
- `fill_value:` come along. `min`, `max` and `prod` answer exactly as before;
1838
- `sum` and `mean` may differ in the last bits. A wider window, or any other
1839
- reduction, is unchanged.
1840
-
1841
- - Change: `CATime#to_unit` floors to a coarser grid instead of raising, and
1842
- crosses the calendar / fixed-length boundary (`:M` <-> `:D`) through
1843
- civil-date algebra. `:Y` / `:M` -> `:W` still raises.
1844
-
1845
- - Change: `CATimedelta#to_unit` truncates toward zero instead of raising on a
1846
- coarser target. Crossing the calendar boundary still raises.
1847
-
1848
- - Fix: `nextafter` on a `float32` array returned its own input. The step was
1849
- taken in double, and the next double above a float rounds back to that same
1850
- float. It now steps by one float32 ulp.
1851
-
1852
- - Fix: a lazy expression over an object array (`CArray.object`,
1853
- `CA_OBJECT`) returned wrong values, and crashed when materialised
1854
- repeatedly. Affects `to_ca` and `copy` on a lazy view, an eager operation
1855
- with a lazy operand, and a reduction over one. Other data types were never
1856
- affected.
1857
-
1858
- - Fix: reading a concatenated view (`CArray.concat`, `CAFrame.concat`)
1859
- backwards along the concatenated axis -- `m.reverse` and any other negative
1860
- step -- raised IndexError instead of answering.
1861
-
1862
- - Fix: reading a lazy expression (`a.lazy + b`, `CArray.fuse`) with a step
1863
- other than one -- `expr[[0, 3, 2]]`, `expr.reverse` and the like -- returned
1864
- values the expression cannot produce, because its operands were read from
1865
- the wrong cells. Comparisons carried the same fault, `a.lazy > b` and
1866
- one-operand ones such as `a.lazy.is_nan` alike. Contiguous reads were never
1867
- affected.
1868
-
1869
- - Fix: `a.value + b` raised `can not create mask array for the value array`
1870
- when `b` carried a mask. It now propagates `b`'s mask.
1871
-
1872
- - Fix: a rolling window that does not cover the cell it is centred on --
1873
- `windows(1..2)`, the two cells after this one -- was read as if it started at
1874
- the array's edge, so every answer came out shifted by the range's start, and
1875
- `bounds: :truncate` produced anchors whose window did not fit. `windows(1..2)`
1876
- on `[1..8]` now sums to `[5, 7, 9, 11, 13, 15, 8, 0]`. A window that covers
1877
- its anchor, which is every centred one, is unaffected.
1878
-
1879
- - Fix: storing a `Complex` into a `cmplx64` or `cmplx128` array kept the sign
1880
- of a negative zero real part only when the imaginary part was also negative,
1881
- so `Complex(-0.0, 0.0)` came back as `0.0+0.0i`. The sign of a zero picks the
1882
- side of a branch cut, so a value stored this way could be carried to the
1883
- wrong branch. All four sign combinations now round-trip, through element
1884
- assignment and through `to_type`.
1885
-
1886
- - Fix: `sinh`, `cosh`, `tanh`, `asinh`, `acosh` and `atanh` on a complex array
1887
- gave the hyperbolic function of the real part alone: `cmplx128` and
1888
- `cmplx64` arrays came back with `tanh(Re z)` where `ctanh(z)` was meant,
1889
- wrong in both parts, and `acosh` and `atanh` also returned 0 or infinity
1890
- where the true value is finite. They now agree with C99 `complex.h`. Real
1891
- and object arrays were never affected.
1892
-
1893
- - Fix: a C extension reading a view in column-major order -- axes and steps
1894
- reversed against the view's own -- got wrong values from a view with a
1895
- length-1 axis, such as `v[nil, :_]`, `v.reshape(n, 1)` or a one-column slice:
1896
- the first cell repeated, a read out of bounds, or a hang.
1897
- `carray-linalg-accelerate`'s `solve(a, b)` returned `b[0]` repeated for a
1898
- single-column right-hand side.
1899
-
1900
- - Fix: an operation between two views of an array that computes its values --
1901
- a lazy expression such as `(a.lazy + b)`, or a `CAObject` over a file -- no
1902
- longer reads that source one cell at a time. `+`, `fma` and comparisons on
1903
- such a pair now run at the speed of copying each operand first, so the
1904
- `.copy` that worked around it is no longer needed. Single-operand
1905
- operations, copies, region transfers and reductions were already unaffected.
1906
-
1907
- - Fix: views built inside a `CArray.fuse` block stay part of the expression
1908
- instead of dropping out of it, so a stencil written the natural way is fused.
1909
- `[]`, `shift`, `roll`, `flip`/`reverse`, `transpose`/`T`, `reshape`,
1910
- `flatten`, `window`, `diagonal`, `tile` and `refer` keep the chain;
1911
- `unbound_repeat` and `[:*, ...]` deliberately do not.
1912
-
1913
- - Fix: a window or shift over a view parent no longer copies that parent in
1914
- full on every transfer. `a[nil, nil].shift(1, 0)` and friends now read at
1915
- parity with an entity parent and write several times faster.
1916
-
1917
- - Fix: reductions over a bare `.lazy` marker no longer raise. Per-axis forms
1918
- and anything over a masked array failed, so `a.lazy.sum(axis: 0)` raised
1919
- while `a.lazy.sum` worked.
1920
-
1921
- - Fix: `ca_test_flag` / `ca_set_flag` / `ca_unset_flag` in `carray.h`, which
1922
- only a C extension calls, did not parenthesise their flag argument, so
1923
- testing two flags at once was true for every array.
1924
-
1925
- - Fix: a Face no longer hands back its storage bytes through the type casts.
1926
- `as_type`, `fake` and `CArray.wrap_writable` raise; `CArray.wrap_readonly`
1927
- converts as `to_type` does, which also makes `t.eq(o)` and `o.eq(t)` agree.
1928
- Reach the storage explicitly with `t.parent.fake(...)`. Numeric Faces are
1929
- unaffected.
1930
-
1931
- - Fix: `arange` raised `NoMethodError` in every form; it builds the array now.
1932
- Integer arguments count exactly, so a step dividing the span evenly no longer
1933
- picks up an extra element. A zero step or a wrong argument count raises
1934
- `ArgumentError`.
1935
-
1936
- - Fix: `from_timesteps` on a week grid answered Thursdays. The week grid counts
1937
- from the epoch, which is one, so it cannot hold an ISO Monday head; a week
1938
- bucket now answers on the day grid and round-trips against `floor` cell for
1939
- cell. A day-or-finer array keeps the Monday default, a week-stored array its
1940
- own epoch-anchored ticks.
1941
-
1942
- - Fix: a masked cell decided whether a `CATime` conversion fit. The range
1943
- guards took their extremes with the mask stripped, so `to_unit` raised
1944
- `RangeError` over a wide value that was masked out. They now answer UNDEF
1945
- when there is nothing to bound -- an empty array, or every cell masked.
1946
-
1947
- - Fix: `CATimedelta::Element#/` floored a negative duration, so `-30h / 4`
1948
- answered `-8h` where the array form answered `-7h`. A duration is a
1949
- magnitude, so it shrinks toward zero, matching the array form in all four
1950
- sign combinations.
1951
-
1952
- - Fix: `CArray.time` no longer rolls a field that is out of range over into
1953
- another date. `"2019-02-31"` parsed to 2019-03-03, and `"201909"` -- a valid
1954
- YYMMDD to Ruby, 2020-19-09 -- to 2021-07; both now raise.
1955
-
1956
- - Fix: `CATime#to_unit` and `CATimedelta#to_unit` were wrong between two
1957
- resolutions where neither tick is a whole multiple of the other: converting
1958
- 3 hours to a `"90 minutes"` grid gave 1 unit rather than 2.
1959
-
1960
- - Fix: importing a MemoryView whose mask is published as `C` or `c` no longer
1961
- fails. The check knew only PEP 3118's `B`, `b` and `?`, so a producer that
1962
- spells a byte in Ruby's format vocabulary was refused.
1963
-
1964
- ## 3.0.0
1965
-
1966
- First public release. Earlier versions existed on RubyGems, but the library
1967
- was developed for the author's own use; 3.0 is where it is packaged,
1968
- documented and tested as something other people can pick up. It is not
1969
- source-compatible with 2.0.1.
1970
-
1971
- See [README.md](README.md) for what the library does, and [docs/](docs/)
1972
- and [guides/](guides/) for the reference and the guides.
1973
-
1974
- **Requires Ruby 3.0 or later** (3.1 for the MemoryView-backed paths).
39
+ CArray follows [Semantic Versioning](https://semver.org/) from this
40
+ release on. The changes from 3.0.11 to 3.1.0 are in
41
+ [docs/changelogs/CHANGELOG-3.0.md](docs/changelogs/CHANGELOG-3.0.md).