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