carray 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/CHANGELOG.md +325 -3
- data/{NEWS.md → CHANGELOG.v1.md} +1 -1
- data/README.md +32 -32
- data/carray.gemspec +12 -8
- data/ext/ca_axis_group.c +55 -19
- data/ext/ca_binop_dispatch.c +5 -6
- data/ext/ca_binop_dispatch.h +0 -7
- data/ext/ca_categorical_iterator.c +13 -13
- data/ext/ca_for_each_element.h +6 -8
- data/ext/ca_group_iter.c +1 -1
- data/ext/ca_kernel_iterator.c +69 -23
- data/ext/ca_kernel_iterator.h +3 -10
- data/ext/ca_obj_bincmp.c +57 -27
- data/ext/ca_obj_binop.c +86 -30
- data/ext/ca_obj_const_string.c +3 -1
- data/ext/ca_obj_face.c +80 -0
- data/ext/ca_obj_face.h +33 -1
- data/ext/ca_obj_fake.c +11 -0
- data/ext/ca_obj_fixlen_string.c +3 -1
- data/ext/ca_obj_grid.c +11 -3
- data/ext/ca_obj_meld.c +13 -8
- data/ext/ca_obj_moncmp.c +33 -14
- data/ext/ca_obj_monop.c +19 -7
- data/ext/ca_obj_object.c +99 -4
- data/ext/ca_obj_record.c +3 -1
- data/ext/ca_obj_refer.c +30 -6
- data/ext/ca_obj_roll.c +13 -5
- data/ext/ca_obj_select_axis.c +16 -6
- data/ext/ca_obj_shift.c +3 -3
- data/ext/ca_obj_stride.c +106 -23
- data/ext/ca_obj_string.c +3 -1
- data/ext/ca_obj_tile.c +13 -5
- data/ext/ca_obj_time.c +3 -1
- data/ext/ca_obj_timedelta.c +3 -1
- data/ext/ca_obj_transpose.c +1 -1
- data/ext/ca_obj_triop.c +62 -23
- data/ext/ca_obj_window.c +86 -17
- data/ext/ca_op_cmplx64.h +123 -0
- data/ext/ca_op_ipower.c +0 -3
- data/ext/ca_sort_kernels.h +5 -5
- data/ext/ca_sweep_engine.c +78 -35
- data/ext/ca_sweep_engine.h +13 -4
- data/ext/ca_transform_common.c +7 -0
- data/ext/carray.h +127 -130
- data/ext/carray_access.c +56 -34
- data/ext/carray_bincount.c +8 -8
- data/ext/carray_broadcast.c +99 -6
- data/ext/carray_build_flags.h +3 -0
- data/ext/carray_call_cfunc.c +1491 -0
- data/ext/carray_call_cfunc.h +153 -0
- data/ext/carray_cast.c +69 -31
- data/ext/carray_conversion.c +22 -22
- data/ext/carray_copy.c +12 -2
- data/ext/carray_core.c +57 -10
- data/ext/carray_count.c +1 -1
- data/ext/carray_element.c +7 -7
- data/ext/carray_factorize.c +28 -28
- data/ext/carray_hold.c +1 -1
- data/ext/carray_index_classifier.c +7 -21
- data/ext/carray_internal.h +19 -3
- data/ext/carray_kernels_bincmp.c +1 -0
- data/ext/carray_kernels_binop.c +320 -298
- data/ext/carray_kernels_init.c +1095 -0
- data/ext/carray_kernels_map.c +1 -0
- data/ext/carray_kernels_moncmp.c +1 -0
- data/ext/carray_kernels_monop.c +412 -411
- data/ext/carray_kernels_reduce_aggregate.c +88 -87
- data/ext/carray_kernels_reduce_boolean.c +1 -0
- data/ext/carray_kernels_reduce_cumulative.c +54 -53
- data/ext/carray_kernels_reduce_extreme.c +51 -50
- data/ext/carray_kernels_reduce_variance.c +1 -0
- data/ext/carray_kernels_scan.c +1 -0
- data/ext/carray_kernels_search.c +93 -92
- data/ext/carray_kernels_sort.c +1 -0
- data/ext/carray_kernels_triop.c +1 -0
- data/ext/carray_lazy.c +175 -5
- data/ext/carray_mask.c +6 -5
- data/ext/carray_median_percentile.c +1 -1
- data/ext/carray_memory_view.c +46 -21
- data/ext/carray_operator.c +46 -49
- data/ext/carray_partition.c +4 -4
- data/ext/carray_random.c +7 -7
- data/ext/carray_scatter.c +1 -1
- data/ext/carray_sort.c +3 -3
- data/ext/carray_sort_kernel.c +10 -10
- data/ext/carray_test.c +1 -1
- data/ext/extconf.rb +18 -0
- data/ext/mk_call_cfunc.rb +243 -52
- data/ext/mkkernel.rb +354 -100
- data/ext/ruby_carray.c +18 -16
- data/ext/version.h +4 -4
- data/lib/carray/autoload_carray.rb +19 -0
- data/lib/carray/autoload_method_extension.rb +2 -1
- data/lib/carray/axis_group.rb +7 -7
- data/lib/carray/basics.rb +59 -59
- data/lib/carray/bincount_nd.rb +12 -12
- data/lib/carray/block_iterator.rb +24 -14
- data/lib/carray/categorical.rb +4 -4
- data/lib/carray/categorical_iterator.rb +98 -76
- data/lib/carray/conditional.rb +14 -14
- data/lib/carray/construct.rb +21 -0
- data/lib/carray/core_extensions.rb +62 -5
- data/lib/carray/data_type_extension.rb +18 -1
- data/lib/carray/frame/concat.rb +3 -3
- data/lib/carray/frame/convert.rb +1 -1
- data/lib/carray/frame/frame.rb +4 -11
- data/lib/carray/frame/io.rb +159 -2
- data/lib/carray/frame/sort.rb +1 -1
- data/lib/carray/frame/verbs.rb +18 -1
- data/lib/carray/fuse_source.rb +123 -0
- data/lib/carray/fusion.rb +218 -0
- data/lib/carray/histogram.rb +16 -16
- data/lib/carray/inspect.rb +1 -7
- data/lib/carray/iterator.rb +4 -3
- data/lib/carray/lazy.rb +125 -73
- data/lib/carray/meld_reduce.rb +2 -2
- data/lib/carray/methods/align_addr.rb +1 -1
- data/lib/carray/methods/composition.rb +1 -1
- data/lib/carray/methods/is_in.rb +12 -12
- data/lib/carray/methods/locate_addr.rb +6 -1
- data/lib/carray/methods/mask_duplicates.rb +1 -1
- data/lib/carray/methods/meshgrid.rb +4 -5
- data/lib/carray/methods/mode.rb +2 -2
- data/lib/carray/methods/nunique.rb +1 -1
- data/lib/carray/methods/snap.rb +7 -2
- data/lib/carray/methods/unique.rb +3 -3
- data/lib/carray/methods/value_counts.rb +2 -2
- data/lib/carray/runtime.rb +0 -19
- data/lib/carray/slab_iterator.rb +20 -7
- data/lib/carray/string_operation_extension.rb +5 -5
- data/lib/carray/time.rb +890 -491
- data/lib/carray/window_iterator.rb +285 -13
- data/lib/carray.rb +5 -5
- data/yard-stubs/ca_obj_array.rb +385 -0
- data/yard-stubs/ca_obj_bitarray.rb +38 -0
- data/yard-stubs/ca_obj_bitfield.rb +43 -0
- data/yard-stubs/ca_obj_block.rb +73 -0
- data/yard-stubs/ca_obj_byte_swap.rb +56 -0
- data/yard-stubs/ca_obj_fake.rb +31 -0
- data/yard-stubs/ca_obj_farray.rb +32 -0
- data/yard-stubs/ca_obj_field.rb +45 -0
- data/yard-stubs/ca_obj_grid.rb +35 -0
- data/yard-stubs/ca_obj_refer.rb +72 -0
- data/yard-stubs/ca_obj_roll.rb +45 -0
- data/yard-stubs/ca_obj_shift.rb +43 -0
- data/yard-stubs/ca_obj_stride.rb +181 -0
- data/yard-stubs/ca_obj_tile.rb +29 -0
- data/yard-stubs/ca_obj_transpose.rb +40 -0
- data/yard-stubs/ca_obj_window.rb +49 -0
- data/yard-stubs/carray_access.rb +131 -0
- data/yard-stubs/carray_attribute.rb +246 -0
- data/yard-stubs/carray_broadcast.rb +37 -0
- data/yard-stubs/carray_cast.rb +489 -0
- data/yard-stubs/carray_class.rb +65 -0
- data/yard-stubs/carray_conversion.rb +76 -0
- data/yard-stubs/carray_copy.rb +79 -0
- data/yard-stubs/carray_core.rb +114 -0
- data/yard-stubs/carray_count.rb +79 -0
- data/yard-stubs/carray_element.rb +108 -0
- data/yard-stubs/carray_generate.rb +66 -0
- data/yard-stubs/carray_lazy.rb +23 -0
- data/yard-stubs/carray_loop.rb +140 -0
- data/yard-stubs/carray_mask.rb +259 -0
- data/yard-stubs/carray_math.rb +132 -0
- data/yard-stubs/carray_mathfunc.rb +45 -0
- data/yard-stubs/carray_median_percentile.rb +89 -0
- data/yard-stubs/carray_memory_view.rb +163 -0
- data/yard-stubs/carray_order.rb +312 -0
- data/yard-stubs/carray_random.rb +89 -0
- data/yard-stubs/carray_scatter.rb +106 -0
- data/yard-stubs/carray_slab.rb +57 -0
- data/yard-stubs/carray_sort.rb +163 -0
- data/yard-stubs/carray_test.rb +85 -0
- data/yard-stubs/carray_undef.rb +64 -0
- data/yard-stubs/carray_utils.rb +97 -0
- data/yard-stubs/ruby_carray.rb +193 -0
- metadata +59 -10
- data/ext/ca_obj_unbound_repeat.c +0 -496
data/ext/carray.h
CHANGED
|
@@ -206,7 +206,7 @@ typedef int8_t boolean8_t;
|
|
|
206
206
|
#define CA_FLAG_MULTI_PARENTS 32
|
|
207
207
|
#define CA_FLAG_CYCLE_CHECK 64
|
|
208
208
|
#define CA_FLAG_IS_FACE 128
|
|
209
|
-
/* Face opt-in ordering/search flags
|
|
209
|
+
/* Face opt-in ordering/search flags.
|
|
210
210
|
A Face declares that its numeric storage may be descended to for kernel
|
|
211
211
|
dispatch. The two flags are on independent axes -- do not conflate:
|
|
212
212
|
ORDERABLE_STORAGE: storage native order == surface <=> order (self-scope).
|
|
@@ -224,6 +224,14 @@ typedef int8_t boolean8_t;
|
|
|
224
224
|
search / count / value-hash entries. Whether COMPARABLE holds is likewise
|
|
225
225
|
not a question of being numeric but of carrying a unit -- CATimedelta is
|
|
226
226
|
int64 on both sides and still sets ORDERABLE only. */
|
|
227
|
+
/* CALazyMarker. A marker layers "read this as the leaf of a lazy chain"
|
|
228
|
+
over storage that is identical to its parent's — the same premise as
|
|
229
|
+
CA_FLAG_IS_FACE — so the two are asked about together wherever a
|
|
230
|
+
storage-identical wrapper has to be seen through. Kept as its own bit
|
|
231
|
+
rather than folded into CA_FLAG_IS_FACE: ca_is_face is read in ~100
|
|
232
|
+
places that mean the Face mechanism specifically. */
|
|
233
|
+
#define CA_FLAG_IS_LAZY_MARKER 1024
|
|
234
|
+
|
|
227
235
|
#define CA_FLAG_FACE_ORDERABLE_STORAGE 256
|
|
228
236
|
#define CA_FLAG_FACE_COMPARABLE_STORAGE 512
|
|
229
237
|
/* NOTE: `flags` is int32_t, so there is plenty of bit space left. */
|
|
@@ -247,7 +255,6 @@ enum {
|
|
|
247
255
|
CA_OBJ_SELECT,
|
|
248
256
|
CA_OBJ_OBJECT,
|
|
249
257
|
CA_OBJ_REPEAT,
|
|
250
|
-
CA_OBJ_UNBOUND_REPEAT,
|
|
251
258
|
};
|
|
252
259
|
|
|
253
260
|
enum {
|
|
@@ -311,12 +318,13 @@ enum {
|
|
|
311
318
|
preamble stays focused on basic types + struct definitions. */
|
|
312
319
|
#include "ca_axis_descriptor.h"
|
|
313
320
|
|
|
314
|
-
/* xfer protocol direction flags
|
|
321
|
+
/* xfer protocol direction flags. The protocol is walked through in
|
|
322
|
+
guides/devel/04_attach_lifecycle.md. */
|
|
315
323
|
#define CA_XFER_GET 0 /* target -> data (gather) */
|
|
316
324
|
#define CA_XFER_PUT 1 /* data -> target (scatter) */
|
|
317
325
|
|
|
318
|
-
/* compose-fold state threaded through ca_stride_compose_to_root
|
|
319
|
-
|
|
326
|
+
/* compose-fold state threaded through ca_stride_compose_to_root.
|
|
327
|
+
strides / base / counts are expressed
|
|
320
328
|
in the *current parent*'s byte space; ndim is invariant through the walk.
|
|
321
329
|
counts[] is the leaf's per-dim extent (== leaf->dim), used by
|
|
322
330
|
ca_stride_compose_through's bounds check and by sometimes-fold
|
|
@@ -339,20 +347,20 @@ typedef struct {
|
|
|
339
347
|
void (*detach) (void *ap);
|
|
340
348
|
void (*fill_data) (void *ap, void *data);
|
|
341
349
|
void (*create_mask) (void *ap);
|
|
342
|
-
/* xfer protocol
|
|
350
|
+
/* xfer protocol. Added at struct end so existing
|
|
343
351
|
positional initializers leave it NULL automatically. dir = CA_XFER_GET /
|
|
344
352
|
CA_XFER_PUT. */
|
|
345
353
|
void (*xfer_index) (void *ap, ca_size_t *idx, void *data, int dir);
|
|
346
354
|
void (*xfer_addrs) (void *ap, ca_size_t n, ca_size_t *addrs,
|
|
347
355
|
void *data, int dir);
|
|
348
|
-
/* fold_stride
|
|
356
|
+
/* fold_stride: one compose-fold hop
|
|
349
357
|
for sometimes-fold participants (CAWindow now; CAGrid/CSA/CATile later).
|
|
350
358
|
Compose *f into next_parent's byte space and return 1, or decline
|
|
351
359
|
(leave *f / *next_parent untouched) and return 0 -> this view is the
|
|
352
360
|
fold boundary. CAStride family leaves this NULL (handled open-inline
|
|
353
361
|
by ca_stride_compose_to_root). */
|
|
354
362
|
int (*fold_stride) (void *ap, ca_fold_t *f, void **next_parent);
|
|
355
|
-
/* xfer_stride
|
|
363
|
+
/* xfer_stride: deliver a region of
|
|
356
364
|
counts[k] cells per axis to/from a caller buffer. Local materialise of
|
|
357
365
|
the requested region only (never the whole view).
|
|
358
366
|
|
|
@@ -365,21 +373,20 @@ typedef struct {
|
|
|
365
373
|
with strides[]. dir = CA_XFER_GET / CA_XFER_PUT. */
|
|
366
374
|
void (*xfer_stride) (void *ap, ca_size_t *starts, ca_size_t *counts,
|
|
367
375
|
ca_size_t *strides, void *data, int dir);
|
|
368
|
-
/* xfer_all
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
copy_data / sync_data become thin forwarders (removed in step 5).
|
|
376
|
+
/* xfer_all: whole-view transfer, the direction-unified replacement of
|
|
377
|
+
copy_data / sync_data. Holds the view's optimal whole-domain delivery
|
|
378
|
+
(compose-fold, partial materialise, etc.).
|
|
372
379
|
dir = CA_XFER_GET (gather: view -> data) / CA_XFER_PUT (scatter). */
|
|
373
380
|
void (*xfer_all) (void *ap, void *data, int dir);
|
|
374
|
-
/* Pool framework (
|
|
381
|
+
/* Pool framework (guides/devel/03_memory_management.md). Optional;
|
|
375
382
|
unfilled slots leave the obj_type on the legacy ALLOC_N path. When
|
|
376
383
|
populated, framework primitives in ca_array_pool.c manage a single
|
|
377
384
|
contiguous `_pool` buffer that holds dim/strides/<subclass tail>. */
|
|
378
385
|
size_t struct_size; /* sizeof(<concrete struct>) */
|
|
379
386
|
size_t (*pool_bytes) (int8_t ndim); /* required if struct_size != 0 */
|
|
380
387
|
void (*pool_init) (void *ap, int8_t ndim); /* required if struct_size != 0 */
|
|
381
|
-
/* fill_addrs / fill_stride
|
|
382
|
-
|
|
388
|
+
/* fill_addrs / fill_stride: write one value into part of the view.
|
|
389
|
+
fill_data carries no
|
|
383
390
|
region and so can only say "fill everything I cover"; without a region the
|
|
384
391
|
only way left to fill part of a view was to borrow a pointer, which
|
|
385
392
|
materialises a non-foldable root and writes it all back. `ptr` is a
|
|
@@ -413,7 +420,7 @@ void ca_array_func_xfer_all (void *ap, void *data, int dir);
|
|
|
413
420
|
void ca_array_func_fill_data (void *ap, void *val);
|
|
414
421
|
void ca_array_func_create_mask (void *ap);
|
|
415
422
|
|
|
416
|
-
/* Pool framework primitives (
|
|
423
|
+
/* Pool framework primitives (guides/devel/03_memory_management.md).
|
|
417
424
|
- ca_array_alloc: xmalloc(struct_size) + ca_array_pool_alloc().
|
|
418
425
|
For the C construction path (= replaces
|
|
419
426
|
TypedData_Make_Struct + per-field ALLOC_N).
|
|
@@ -449,8 +456,7 @@ struct _CArray {
|
|
|
449
456
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
450
457
|
Reserved for framework use; ext authors must not read,
|
|
451
458
|
write, or xfree this field directly. See
|
|
452
|
-
ext/ca_array_pool.c
|
|
453
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
459
|
+
ext/ca_array_pool.c. */
|
|
454
460
|
}; /* 28 + 4*ndim (bytes) */
|
|
455
461
|
|
|
456
462
|
typedef CArray CAWrap;
|
|
@@ -468,8 +474,7 @@ typedef struct {
|
|
|
468
474
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
469
475
|
Reserved for framework use; ext authors must not read,
|
|
470
476
|
write, or xfree this field directly. See
|
|
471
|
-
ext/ca_array_pool.c
|
|
472
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
477
|
+
ext/ca_array_pool.c. */
|
|
473
478
|
ca_size_t _dim;
|
|
474
479
|
} CScalar; /* 32 (bytes) */
|
|
475
480
|
|
|
@@ -486,8 +491,7 @@ typedef struct {
|
|
|
486
491
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
487
492
|
Reserved for framework use; ext authors must not read,
|
|
488
493
|
write, or xfree this field directly. See
|
|
489
|
-
ext/ca_array_pool.c
|
|
490
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
494
|
+
ext/ca_array_pool.c. */
|
|
491
495
|
CArray *parent;
|
|
492
496
|
uint32_t attach;
|
|
493
497
|
uint8_t nosync;
|
|
@@ -516,8 +520,7 @@ typedef struct {
|
|
|
516
520
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
517
521
|
Reserved for framework use; ext authors must not read,
|
|
518
522
|
write, or xfree this field directly. See
|
|
519
|
-
ext/ca_array_pool.c
|
|
520
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
523
|
+
ext/ca_array_pool.c. */
|
|
521
524
|
CArray *parent;
|
|
522
525
|
uint32_t attach;
|
|
523
526
|
uint8_t nosync;
|
|
@@ -551,8 +554,7 @@ typedef struct {
|
|
|
551
554
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
552
555
|
Reserved for framework use; ext authors must not read,
|
|
553
556
|
write, or xfree this field directly. See
|
|
554
|
-
ext/ca_array_pool.c
|
|
555
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
557
|
+
ext/ca_array_pool.c. */
|
|
556
558
|
CArray *parent;
|
|
557
559
|
uint32_t attach;
|
|
558
560
|
uint8_t nosync;
|
|
@@ -580,8 +582,7 @@ typedef struct {
|
|
|
580
582
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
581
583
|
Reserved for framework use; ext authors must not read,
|
|
582
584
|
write, or xfree this field directly. See
|
|
583
|
-
ext/ca_array_pool.c
|
|
584
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
585
|
+
ext/ca_array_pool.c. */
|
|
585
586
|
CArray *parent;
|
|
586
587
|
uint32_t attach;
|
|
587
588
|
uint8_t nosync;
|
|
@@ -603,14 +604,13 @@ typedef struct {
|
|
|
603
604
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
604
605
|
Reserved for framework use; ext authors must not read,
|
|
605
606
|
write, or xfree this field directly. See
|
|
606
|
-
ext/ca_array_pool.c
|
|
607
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
607
|
+
ext/ca_array_pool.c. */
|
|
608
608
|
CArray *parent;
|
|
609
609
|
uint32_t attach;
|
|
610
610
|
uint8_t nosync;
|
|
611
611
|
/* ---------- */
|
|
612
|
-
uint8_t *bounds; /* [ndim] per-axis policy (
|
|
613
|
-
|
|
612
|
+
uint8_t *bounds; /* [ndim] per-axis policy (a scalar uint8_t
|
|
613
|
+
before). Allows
|
|
614
614
|
CAShift (per-axis roll[]) to be expressed as
|
|
615
615
|
a CAWindow specialisation. */
|
|
616
616
|
ca_size_t *start;
|
|
@@ -620,8 +620,7 @@ typedef struct {
|
|
|
620
620
|
/* COMPOSITE_FAMILY Phase 1 (E.2): embed descriptor model. Computed by
|
|
621
621
|
ca_compute_embed_descriptor at setup time, immutable for view lifetime.
|
|
622
622
|
Used by attach/sync (E.3-E.4) to skip per-element bound checks via
|
|
623
|
-
"1 alias + 1 fill" decomposition.
|
|
624
|
-
See devel/PROPOSAL_COMPOSITE_FAMILY.md §4.1. */
|
|
623
|
+
"1 alias + 1 fill" decomposition. */
|
|
625
624
|
ca_size_t *embed_parent_start; /* [ndim] parent-side alias rectangle start */
|
|
626
625
|
ca_size_t *embed_count; /* [ndim] alias rectangle size per axis */
|
|
627
626
|
ca_size_t *embed_output_offset; /* [ndim] output-side alias rectangle start */
|
|
@@ -640,13 +639,12 @@ typedef struct {
|
|
|
640
639
|
must be contig in parent storage. */
|
|
641
640
|
} CAWindow; /* 56 + 16*(ndim) + 1*(bytes) + 1*ndim + 24*ndim (bytes) */
|
|
642
641
|
|
|
643
|
-
/*
|
|
644
|
-
of CAWindow. CAShift construction maps (shift[], roll[], fill,
|
|
642
|
+
/* CAShift is a pure typedef of CAWindow. CAShift construction maps (shift[], roll[], fill,
|
|
645
643
|
fill_mask) onto CAWindow's (start = -shift, count = parent->dim,
|
|
646
644
|
bounds = roll ? PERIODIC : (fill_mask ? MASK : FILL), fill). The
|
|
647
645
|
two views share the operation table (ca_window_func); only obj_type
|
|
648
646
|
differs (CA_OBJ_SHIFT vs CA_OBJ_WINDOW) to preserve user-facing class
|
|
649
|
-
distinction.
|
|
647
|
+
distinction. */
|
|
650
648
|
typedef CAWindow CAShift;
|
|
651
649
|
|
|
652
650
|
/* COMPOSITE_FAMILY Phase 2 (T.3, 2026-05-26): CATile = N-region
|
|
@@ -655,9 +653,8 @@ typedef CAWindow CAShift;
|
|
|
655
653
|
is a full-parent alias at output offset
|
|
656
654
|
(i_0 * parent.dim[0], i_1 * parent.dim[1], ...). Attach iterates
|
|
657
655
|
total_tiles regions, calling ca_composite_region_gather for each.
|
|
658
|
-
See devel/PROPOSAL_CATILE.md §1.2 / §1.3.
|
|
659
656
|
|
|
660
|
-
CARoll = typedef CATile (same pattern as the
|
|
657
|
+
CARoll = typedef CATile (same pattern as the
|
|
661
658
|
CAShift = CAWindow precedent); constructor parameters differ but the
|
|
662
659
|
C struct layout is shared, and the attach/sync routine is identical
|
|
663
660
|
(= dispatch the region list in order). */
|
|
@@ -674,8 +671,7 @@ typedef struct {
|
|
|
674
671
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
675
672
|
Reserved for framework use; ext authors must not read,
|
|
676
673
|
write, or xfree this field directly. See
|
|
677
|
-
ext/ca_array_pool.c
|
|
678
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
674
|
+
ext/ca_array_pool.c. */
|
|
679
675
|
CArray *parent;
|
|
680
676
|
uint32_t attach;
|
|
681
677
|
uint8_t nosync;
|
|
@@ -689,10 +685,8 @@ typedef CATile CARoll; /* T.4 will land CARoll-specific constructor +
|
|
|
689
685
|
obj_type CA_OBJ_ROLL. Until then CARoll path
|
|
690
686
|
is just CATile (= typedef body identical). */
|
|
691
687
|
|
|
692
|
-
/* CAStack
|
|
693
|
-
stack view of K uniform-shape parents. shape = (K, *parent_shape),
|
|
688
|
+
/* CAStack: outer-axis-only stack view of K uniform-shape parents. shape = (K, *parent_shape),
|
|
694
689
|
axis 0 maps to parent index, axes 1..ndim-1 are per-parent contig.
|
|
695
|
-
See devel/MEMO_CASTACK_DESIGN.md for design rationale.
|
|
696
690
|
- parents stored as Ruby Array @parents on the wrapper object (= GC
|
|
697
691
|
anchor); C-side tail `parents[]` is alias pointer array.
|
|
698
692
|
- CAView.parent points to parents[0] (= legacy compat for paths that
|
|
@@ -711,8 +705,7 @@ typedef struct {
|
|
|
711
705
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
712
706
|
Reserved for framework use; ext authors must not read,
|
|
713
707
|
write, or xfree this field directly. See
|
|
714
|
-
ext/ca_array_pool.c
|
|
715
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
708
|
+
ext/ca_array_pool.c. */
|
|
716
709
|
CArray *parent; /* = parents[0] (legacy CAView field) */
|
|
717
710
|
uint32_t attach;
|
|
718
711
|
uint8_t nosync;
|
|
@@ -733,8 +726,7 @@ typedef struct {
|
|
|
733
726
|
All other axes must match across parents (uniform check at constructor).
|
|
734
727
|
|
|
735
728
|
v0.1 stub: external-axis (meld_axis == 0) structural xfer_stride path only.
|
|
736
|
-
Other paths raise NotImplementedError
|
|
737
|
-
in devel/MEMO_CAMELD_SEGMENT_MAJOR_ENGINE.md §4. */
|
|
729
|
+
Other paths raise NotImplementedError. */
|
|
738
730
|
typedef struct {
|
|
739
731
|
int16_t obj_type;
|
|
740
732
|
int8_t data_type;
|
|
@@ -785,8 +777,7 @@ typedef struct {
|
|
|
785
777
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
786
778
|
Reserved for framework use; ext authors must not read,
|
|
787
779
|
write, or xfree this field directly. See
|
|
788
|
-
ext/ca_array_pool.c
|
|
789
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
780
|
+
ext/ca_array_pool.c. */
|
|
790
781
|
CArray *parent;
|
|
791
782
|
uint32_t attach;
|
|
792
783
|
uint8_t nosync;
|
|
@@ -813,8 +804,7 @@ typedef struct {
|
|
|
813
804
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
814
805
|
Reserved for framework use; ext authors must not read,
|
|
815
806
|
write, or xfree this field directly. See
|
|
816
|
-
ext/ca_array_pool.c
|
|
817
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
807
|
+
ext/ca_array_pool.c. */
|
|
818
808
|
/* -------------*/
|
|
819
809
|
VALUE array;
|
|
820
810
|
} CAObjectMask;
|
|
@@ -823,35 +813,6 @@ typedef struct {
|
|
|
823
813
|
The "repeat" axes are encoded as strides[k] == 0. */
|
|
824
814
|
typedef CAStride CARepeat;
|
|
825
815
|
|
|
826
|
-
/* CAUnboundRepeat (Phase U.1: CAStride prefix + rep_dim tail).
|
|
827
|
-
`rep_dim[i] == 0` marks an unbound (`*`) axis (size 1, stride 0);
|
|
828
|
-
`rep_dim[i] != 0` marks a sized axis inheriting parent's stride.
|
|
829
|
-
`ndim` replaces the former `rep_ndim` field (they are equal). */
|
|
830
|
-
typedef struct {
|
|
831
|
-
int16_t obj_type;
|
|
832
|
-
int8_t data_type;
|
|
833
|
-
int8_t ndim;
|
|
834
|
-
int32_t flags;
|
|
835
|
-
ca_size_t bytes;
|
|
836
|
-
ca_size_t elements;
|
|
837
|
-
ca_size_t *dim;
|
|
838
|
-
char *ptr;
|
|
839
|
-
CArray *mask;
|
|
840
|
-
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
841
|
-
Reserved for framework use; ext authors must not read,
|
|
842
|
-
write, or xfree this field directly. See
|
|
843
|
-
ext/ca_array_pool.c and
|
|
844
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
845
|
-
CArray *parent;
|
|
846
|
-
uint32_t attach;
|
|
847
|
-
uint8_t nosync;
|
|
848
|
-
/* --- CAStride prefix continues --- */
|
|
849
|
-
ca_size_t *strides;
|
|
850
|
-
ca_size_t base_offset;
|
|
851
|
-
/* --- CAUnboundRepeat tail --- */
|
|
852
|
-
ca_size_t *rep_dim;
|
|
853
|
-
} CAUnboundRepeat;
|
|
854
|
-
|
|
855
816
|
/*
|
|
856
817
|
CAReduce is an internal class
|
|
857
818
|
used only in ca_obj_refer.c.
|
|
@@ -870,8 +831,7 @@ typedef struct {
|
|
|
870
831
|
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path).
|
|
871
832
|
Reserved for framework use; ext authors must not read,
|
|
872
833
|
write, or xfree this field directly. See
|
|
873
|
-
ext/ca_array_pool.c
|
|
874
|
-
devel/PROPOSAL_CARRAY_POOL_STANDARDIZATION.md. */
|
|
834
|
+
ext/ca_array_pool.c. */
|
|
875
835
|
CArray *parent;
|
|
876
836
|
uint32_t attach;
|
|
877
837
|
uint8_t nosync;
|
|
@@ -882,9 +842,8 @@ typedef struct {
|
|
|
882
842
|
|
|
883
843
|
/* -------------------------------------------------------------------- */
|
|
884
844
|
|
|
885
|
-
/* CAIterator is a form-only Ruby base (see ext/carray_iterator.c); the
|
|
886
|
-
|
|
887
|
-
samples/caiterator/iterator.c. */
|
|
845
|
+
/* CAIterator is a form-only Ruby base (see ext/carray_iterator.c); the 2.0 C
|
|
846
|
+
struct (a kernel_at_addr dispatch slot) was retired in 3.0. */
|
|
888
847
|
|
|
889
848
|
/* -------------------------------------------------------------------- */
|
|
890
849
|
|
|
@@ -896,10 +855,8 @@ extern const int ca_cast_table[CA_NTYPE][CA_NTYPE];
|
|
|
896
855
|
extern const int ca_cast_table2[CA_NTYPE][CA_NTYPE];
|
|
897
856
|
|
|
898
857
|
/* data_type promotion reducer — pure function over ca_cast_table. Used by
|
|
899
|
-
CArray.result_type and
|
|
900
|
-
the
|
|
901
|
-
devel/AUDIT_DTYPE_PROMOTION.md for the audit that confirmed single
|
|
902
|
-
source. */
|
|
858
|
+
CArray.result_type and by the lazy view layer. See ext/carray_cast.c
|
|
859
|
+
for the definition; this is the single source of the promotion rule. */
|
|
903
860
|
int8_t ca_promote_type (int8_t a, int8_t b);
|
|
904
861
|
|
|
905
862
|
/* Infer a data_type code from a Ruby *value* (literal Numeric, true/false,
|
|
@@ -918,8 +875,7 @@ int8_t ca_mv_probe_data_type (VALUE obj);
|
|
|
918
875
|
/* Symbol cache for data_type code → Symbol lookup. Initialized in
|
|
919
876
|
Init_carray_class. Indexed by data_type code (0 = CA_FIXLEN ...
|
|
920
877
|
CA_NTYPE-1 = CA_OBJECT). Use rb_ca_data_type_to_sym for the public
|
|
921
|
-
conversion entry point (it validates the code first).
|
|
922
|
-
PROPOSAL_DTYPE_SYMBOL_FLIP rev3 Q5=(Y). */
|
|
878
|
+
conversion entry point (it validates the code first). */
|
|
923
879
|
extern ID ca_data_type_sym[CA_NTYPE];
|
|
924
880
|
VALUE rb_ca_data_type_to_sym (int8_t data_type);
|
|
925
881
|
|
|
@@ -932,9 +888,13 @@ extern int ca_obj_num;
|
|
|
932
888
|
|
|
933
889
|
#define CAVIEW(x) ((CAView *)(x))
|
|
934
890
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
891
|
+
/* CAREFUL: `flag` is parenthesised. Without it, ca_test_flag(ca, A | B)
|
|
892
|
+
expands to `ca->flags & A | B`, and since & binds tighter than | the
|
|
893
|
+
test is true for every array. ca_unset_flag had the mirror hazard
|
|
894
|
+
through ~. */
|
|
895
|
+
#define ca_set_flag(ca, flag) ( (ca)->flags |= (flag) )
|
|
896
|
+
#define ca_unset_flag(ca, flag) ( (ca)->flags &= ~(flag) )
|
|
897
|
+
#define ca_test_flag(ca, flag) (( (ca)->flags & (flag) ) ? 1 : 0)
|
|
938
898
|
|
|
939
899
|
/* -------------------------------------------------------------------- */
|
|
940
900
|
|
|
@@ -993,7 +953,6 @@ extern VALUE rb_cCAStrideMask;
|
|
|
993
953
|
extern VALUE rb_cCASelect;
|
|
994
954
|
extern VALUE rb_cCAObject;
|
|
995
955
|
extern VALUE rb_cCARepeat;
|
|
996
|
-
extern VALUE rb_cCAUnboundRepeat;
|
|
997
956
|
extern VALUE rb_cCAIterator;
|
|
998
957
|
|
|
999
958
|
extern VALUE rb_cCArrayMask;
|
|
@@ -1003,7 +962,6 @@ extern VALUE rb_cCAFieldMask;
|
|
|
1003
962
|
extern VALUE rb_cCASelectMask;
|
|
1004
963
|
extern VALUE rb_cCAObjectMask;
|
|
1005
964
|
extern VALUE rb_cCARepeatMask;
|
|
1006
|
-
extern VALUE rb_cCAUnboundRepeatMask;
|
|
1007
965
|
|
|
1008
966
|
extern VALUE rb_mCA;
|
|
1009
967
|
extern VALUE rb_mCAMath;
|
|
@@ -1098,18 +1056,34 @@ extern VALUE rb_cCArrayObject;
|
|
|
1098
1056
|
|
|
1099
1057
|
#ifdef HAVE_COMPLEX_H
|
|
1100
1058
|
|
|
1059
|
+
/* CMPLX(re, im) builds a complex from its two parts without going through
|
|
1060
|
+
"re + I * im". That expression evaluates I * im first, so an im of +0.0
|
|
1061
|
+
yields (0.0 + 0.0i) and adding it to a re of -0.0 gives +0.0: the sign of
|
|
1062
|
+
a negative zero real part is lost. The sign matters -- branch cuts are
|
|
1063
|
+
selected by the sign of a zero (log(-1+0i) = +pi*i, log(-1-0i) = -pi*i).
|
|
1064
|
+
CMPLX is C11; provide it when the toolchain predates that. */
|
|
1065
|
+
#ifndef CMPLX
|
|
1066
|
+
# if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)))
|
|
1067
|
+
# define CMPLX(re, im) __builtin_complex((double)(re), (double)(im))
|
|
1068
|
+
# else
|
|
1069
|
+
# define CMPLX(re, im) \
|
|
1070
|
+
(((union { double _parts[2]; double complex _value; }) \
|
|
1071
|
+
{ { (double)(re), (double)(im) } })._value)
|
|
1072
|
+
# endif
|
|
1073
|
+
#endif
|
|
1074
|
+
|
|
1101
1075
|
static inline double complex
|
|
1102
1076
|
rb_carray_num2cmplx (VALUE num)
|
|
1103
1077
|
{
|
|
1104
1078
|
if ( RB_TYPE_P(num, T_COMPLEX) ) {
|
|
1105
|
-
return NUM2DBL(rb_complex_real(num))
|
|
1079
|
+
return CMPLX(NUM2DBL(rb_complex_real(num)), NUM2DBL(rb_complex_imag(num)));
|
|
1106
1080
|
}
|
|
1107
1081
|
if ( RB_FLOAT_TYPE_P(num) || RB_INTEGER_TYPE_P(num) ) {
|
|
1108
1082
|
return (double complex) NUM2DBL(num);
|
|
1109
1083
|
}
|
|
1110
1084
|
if ( rb_respond_to(num, rb_intern("to_c")) ) {
|
|
1111
1085
|
VALUE c = rb_funcall(num, rb_intern("to_c"), 0);
|
|
1112
|
-
return NUM2DBL(rb_complex_real(c))
|
|
1086
|
+
return CMPLX(NUM2DBL(rb_complex_real(c)), NUM2DBL(rb_complex_imag(c)));
|
|
1113
1087
|
}
|
|
1114
1088
|
if ( rb_respond_to(num, rb_intern("to_f")) ) {
|
|
1115
1089
|
return (double complex) NUM2DBL(rb_funcall(num, rb_intern("to_f"), 0));
|
|
@@ -1176,7 +1150,6 @@ enum {
|
|
|
1176
1150
|
CA_REG_GRID,
|
|
1177
1151
|
CA_REG_MAPPING,
|
|
1178
1152
|
CA_REG_METHOD_CALL,
|
|
1179
|
-
CA_REG_UNBOUND_REPEAT,
|
|
1180
1153
|
CA_REG_MEMBER,
|
|
1181
1154
|
CA_REG_ATTRIBUTE,
|
|
1182
1155
|
}; /* CA_REGION_TYPE */
|
|
@@ -1218,7 +1191,7 @@ typedef struct {
|
|
|
1218
1191
|
/* The element-wise kernel typedefs (ca_monop_func_t / ca_binop_func_t /
|
|
1219
1192
|
ca_triop_func_t / ca_moncmp_func_t / ca_bincmp_func_t), the rb_ca_call_*
|
|
1220
1193
|
drivers, ca_math_call, and the per-data_type dispatch tables now live in
|
|
1221
|
-
carray_math_kernel.h
|
|
1194
|
+
carray_math_kernel.h, which this header
|
|
1222
1195
|
includes at the bottom (umbrella). Declarations only moved — definitions
|
|
1223
1196
|
and ABI are unchanged. */
|
|
1224
1197
|
|
|
@@ -1261,7 +1234,7 @@ CArray *carray_new_adopt (int8_t data_type,
|
|
|
1261
1234
|
VALUE rb_carray_new_adopt (int8_t data_type,
|
|
1262
1235
|
int8_t ndim, ca_size_t *dim, ca_size_t bytes, char *ptr);
|
|
1263
1236
|
|
|
1264
|
-
/*
|
|
1237
|
+
/* Capstone helper: allocate
|
|
1265
1238
|
a reduction-output CArray for kernel_iterator authors. Computes
|
|
1266
1239
|
output shape = self.dim with slab axes removed (ascending order),
|
|
1267
1240
|
collapses to shape [1] when fully reduced. See
|
|
@@ -1273,7 +1246,7 @@ VALUE rb_ca_new_reduced (VALUE self, int8_t *slab_axes,
|
|
|
1273
1246
|
VALUE rb_ca_new_reduced_bytes (VALUE self, int8_t *slab_axes, int8_t naxes,
|
|
1274
1247
|
int32_t data_type, ca_size_t bytes, int keep_axis);
|
|
1275
1248
|
|
|
1276
|
-
/*
|
|
1249
|
+
/* Capstone helper: parse
|
|
1277
1250
|
variadic axis argv into validated int8_t array. Accepts Integer
|
|
1278
1251
|
args or a single Array arg, normalises negative axes (Python-style),
|
|
1279
1252
|
range / duplicate / overflow checks all raise ArgumentError.
|
|
@@ -1347,7 +1320,7 @@ int ca_stride_compose_through (CAStride *leaf, CAStride *parent,
|
|
|
1347
1320
|
|
|
1348
1321
|
/* --- ca_obj_grid.c --- */
|
|
1349
1322
|
|
|
1350
|
-
/*
|
|
1323
|
+
/* rb_ca_grid_new signature
|
|
1351
1324
|
changed to take a per-axis cag_axis_t proto array (private to
|
|
1352
1325
|
ca_obj_grid.c). No external callers exist so the declaration is
|
|
1353
1326
|
removed from the public header. */
|
|
@@ -1371,19 +1344,12 @@ VALUE rb_ca_fake_type (VALUE self, VALUE rtype, VALUE rbytes);
|
|
|
1371
1344
|
|
|
1372
1345
|
VALUE rb_ca_repeat (int argc, VALUE *argv, VALUE self);
|
|
1373
1346
|
|
|
1374
|
-
/* --- ca_obj_unbound_repeat.c --- */
|
|
1375
|
-
|
|
1376
|
-
VALUE rb_ca_ubrep_shave (VALUE self, VALUE other);
|
|
1377
|
-
VALUE rb_ca_rewrap_unbound_repeat (VALUE src, VALUE out);
|
|
1378
|
-
|
|
1379
1347
|
/* --- carray_broadcast.c --- */
|
|
1380
1348
|
|
|
1381
1349
|
VALUE ca_broadcast_view (VALUE src, int8_t ndim, ca_size_t *target_dim);
|
|
1382
1350
|
void ca_broadcast_pair (volatile VALUE *self, volatile VALUE *other);
|
|
1383
|
-
VALUE ca_ubrep_bind_with (VALUE self, VALUE other);
|
|
1384
1351
|
|
|
1385
|
-
/* --- ca_iter_dimension retired
|
|
1386
|
-
reference impl at samples/caiterator/dimension.c --- */
|
|
1352
|
+
/* --- ca_iter_dimension retired: CADimensionIterator -> CASlabIterator --- */
|
|
1387
1353
|
|
|
1388
1354
|
/* -------------------------------------------------------------------- */
|
|
1389
1355
|
|
|
@@ -1436,10 +1402,26 @@ int ca_is_entity (const void *ap);
|
|
|
1436
1402
|
#endif
|
|
1437
1403
|
|
|
1438
1404
|
int ca_is_view (void *ap);
|
|
1405
|
+
|
|
1406
|
+
/* True iff ca is a member of the CAStride family -- the views whose
|
|
1407
|
+
addressing is a linear stride expression over a single parent, and
|
|
1408
|
+
which ca_stride_compose_to_root therefore folds into
|
|
1409
|
+
root->ptr + base + sum(idx[k] * strides[k]). Currently CAStride,
|
|
1410
|
+
CARefer, CABlock, CARepeat, CATranspose, CAFarray and CAField, plus
|
|
1411
|
+
the mask array of each. Membership is decided by the operation table
|
|
1412
|
+
an obj_type was installed with, so an externally installed view that
|
|
1413
|
+
shares the table is recognised too. Passing a non-member to
|
|
1414
|
+
ca_stride_compose_to_root reads the struct past its end, so guard the
|
|
1415
|
+
call with this. (Defined in ca_obj_stride.c, out of line: it indexes
|
|
1416
|
+
ca_func[], and a function keeps that stride out of separately built
|
|
1417
|
+
callers.) */
|
|
1418
|
+
int ca_is_stride_family (const void *ap);
|
|
1419
|
+
|
|
1439
1420
|
int ca_is_readonly (void *ap);
|
|
1440
1421
|
int ca_is_value_array (void *ap);
|
|
1441
1422
|
int ca_is_mask_array (void *ap);
|
|
1442
1423
|
#define ca_is_face(ca) ( ca_test_flag((ca), CA_FLAG_IS_FACE) )
|
|
1424
|
+
#define ca_is_lazy_marker(ca) ( ca_test_flag((ca), CA_FLAG_IS_LAZY_MARKER) )
|
|
1443
1425
|
|
|
1444
1426
|
#define ca_is_attached(ca) ( (ca)->ptr != NULL )
|
|
1445
1427
|
#define ca_is_empty(ca) ( (ca)->elements == 0 )
|
|
@@ -1454,13 +1436,11 @@ int ca_is_mask_array (void *ap);
|
|
|
1454
1436
|
attached), CAWrap, CScalar, and CAStride-family views whose composed
|
|
1455
1437
|
strides are row-major contiguous (alias-attach path). Used by
|
|
1456
1438
|
kernel_iterator's L1 alias decision (ca_iter_can_alias level 1) and
|
|
1457
|
-
by
|
|
1458
|
-
|
|
1459
|
-
the structural property (= aliasable without materialise) rather
|
|
1460
|
-
than the perf characteristic. */
|
|
1439
|
+
by overlay-view dispatch. The name says the structural property
|
|
1440
|
+
(= aliasable without materialise), not the perf characteristic. */
|
|
1461
1441
|
int ca_attach_is_alias (void *ap);
|
|
1462
1442
|
|
|
1463
|
-
/*
|
|
1443
|
+
/* OR operand masks into
|
|
1464
1444
|
ca_out->mask without ca_attach on operand masks (= gathers via
|
|
1465
1445
|
ca_xfer_all into arena scratch then byte OR-folds). ca_out must be
|
|
1466
1446
|
a freshly templated entity. For bang variant where ca_out IS one of
|
|
@@ -1533,10 +1513,10 @@ void ca_store_index (void *ap, ca_size_t *idx, void *ptr);
|
|
|
1533
1513
|
void ca_store_addr (void *ap, ca_size_t addr, void *ptr);
|
|
1534
1514
|
void ca_xfer_index (void *ap, ca_size_t *idx, void *data, int dir);
|
|
1535
1515
|
void ca_xfer_addrs (void *ap, ca_size_t n, ca_size_t *addrs, void *data, int dir);
|
|
1536
|
-
/*
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1516
|
+
/* Shared predicate: detect if addrs[] is a sequential run
|
|
1517
|
+
(addrs[i] == addrs[0]+i for all i). Used by ca_xfer_addrs_dispatch and
|
|
1518
|
+
by view xfer_addrs slots for whole-view / sub-region run detection ->
|
|
1519
|
+
opportunistic engine dispatch. */
|
|
1540
1520
|
int ca_xfer_addrs_is_sequential_run (ca_size_t n, ca_size_t *addrs,
|
|
1541
1521
|
ca_size_t *base_out);
|
|
1542
1522
|
/* Y.1.e: resolve cand through identity CAStride compose-fold to find an
|
|
@@ -1546,6 +1526,25 @@ int ca_xfer_addrs_is_sequential_run (ca_size_t n, ca_size_t *addrs,
|
|
|
1546
1526
|
parent->ptr gate through view CAStride layers (= chain pattern). */
|
|
1547
1527
|
CArray *ca_resolve_attached_root_via_identity (CArray *cand);
|
|
1548
1528
|
|
|
1529
|
+
/* Shared gate for the xfer_stride slots' structural fast paths.
|
|
1530
|
+
|
|
1531
|
+
An xfer_stride request is given over the view's linear ADDRESSES (see the
|
|
1532
|
+
slot comment above), so request axis k need not be view axis k: a caller
|
|
1533
|
+
is free to hand over a transposed region -- counts/strides in one order,
|
|
1534
|
+
the packed destination buffer in another -- and a degenerate axis makes
|
|
1535
|
+
that indistinguishable from an axis-aligned request by divisibility alone
|
|
1536
|
+
(an (n, 1) view has the same native step on both axes). A structural path
|
|
1537
|
+
that composes request axis k onto view axis k must therefore ask first:
|
|
1538
|
+
does request axis k advance view axis k, and stay inside it for the whole
|
|
1539
|
+
traversal? Returns 1 when that holds for every axis (count <= 1 axes move
|
|
1540
|
+
nothing and always pass), 0 when the request is not such a box -- the
|
|
1541
|
+
caller then takes its per-cell fallback, which is address-correct for any
|
|
1542
|
+
request. ndim is the request's rank, which the slots' wiring keeps equal
|
|
1543
|
+
to ca->ndim. */
|
|
1544
|
+
int ca_xfer_stride_request_is_axis_box (void *ap, ca_size_t *starts,
|
|
1545
|
+
ca_size_t *counts,
|
|
1546
|
+
ca_size_t *strides);
|
|
1547
|
+
|
|
1549
1548
|
void ca_xfer_stride (void *ap, ca_size_t *starts, ca_size_t *counts,
|
|
1550
1549
|
ca_size_t *strides, void *data, int dir);
|
|
1551
1550
|
void ca_xfer_all (void *ap, void *data, int dir);
|
|
@@ -1596,7 +1595,7 @@ void ca_fill_stride_whole (void *ap, void *ptr);
|
|
|
1596
1595
|
/* API : mask handling */
|
|
1597
1596
|
|
|
1598
1597
|
extern VALUE CA_UNDEF;
|
|
1599
|
-
extern VALUE
|
|
1598
|
+
extern VALUE CA_UNSPECIFIED;
|
|
1600
1599
|
|
|
1601
1600
|
boolean8_t *ca_mask_ptr (void *ap);
|
|
1602
1601
|
int ca_has_mask (void *ap);
|
|
@@ -1700,8 +1699,8 @@ VALUE rb_ca_wrap_writable (VALUE obj, VALUE vtype);
|
|
|
1700
1699
|
VALUE rb_ca_wrap_readonly (VALUE obj, VALUE vtype);
|
|
1701
1700
|
|
|
1702
1701
|
/* inheritance */
|
|
1703
|
-
/* rb_ca_data_type_inherit / rb_ca_data_type_import were removed in 3.0
|
|
1704
|
-
|
|
1702
|
+
/* rb_ca_data_type_inherit / rb_ca_data_type_import were removed in 3.0.
|
|
1703
|
+
data_class lives on
|
|
1705
1704
|
Face (CARecord) tail; view ctors no longer carry data_class via
|
|
1706
1705
|
@data_class ivar — Face dispatch (CA_FACE_LIFT_IF_FACE) handles it. */
|
|
1707
1706
|
VALUE rb_ca_set_parent (VALUE self, VALUE obj);
|
|
@@ -1748,8 +1747,7 @@ VALUE rb_ca_is_scalar (VALUE self);
|
|
|
1748
1747
|
VALUE rb_obj_is_data_class (VALUE rtype);
|
|
1749
1748
|
VALUE rb_ca_has_data_class (VALUE self);
|
|
1750
1749
|
VALUE rb_ca_data_class (VALUE self);
|
|
1751
|
-
/* rb_ca_set_data_class was removed in 3.0
|
|
1752
|
-
(PROPOSAL_DEPRECATE_LEGACY_DATA_CLASS P.5). The Ruby method
|
|
1750
|
+
/* rb_ca_set_data_class was removed in 3.0. The Ruby method
|
|
1753
1751
|
CArray#data_class= raises ArgumentError with migration message. */
|
|
1754
1752
|
VALUE rb_ca_data_class_decode (VALUE self, VALUE str);
|
|
1755
1753
|
VALUE rb_ca_data_class_encode (VALUE self, VALUE obj);
|
|
@@ -1878,16 +1876,15 @@ void ca_debug ();
|
|
|
1878
1876
|
|
|
1879
1877
|
/* -------------------------------------------------------------------- */
|
|
1880
1878
|
|
|
1881
|
-
/*
|
|
1879
|
+
/* Portable textbook sort kernels.
|
|
1882
1880
|
These are layer ③ true-internal (ca_sort_kernels.h self-describes as
|
|
1883
1881
|
"ext-internal, signatures may change across 3.x"). They are NOT pulled
|
|
1884
|
-
into the carray.h umbrella and NOT installed (
|
|
1885
|
-
H.4.1): the internal consumers (carray_sort_kernel.c / carray_sort.c /
|
|
1882
|
+
into the carray.h umbrella and NOT installed: the internal consumers (carray_sort_kernel.c / carray_sort.c /
|
|
1886
1883
|
carray_partition.c / carray_kernels.c) include ca_sort_kernels.h
|
|
1887
1884
|
directly. */
|
|
1888
1885
|
|
|
1889
1886
|
/* -------------------------------------------------------------------- */
|
|
1890
|
-
/* Public umbrella
|
|
1887
|
+
/* Public umbrella */
|
|
1891
1888
|
/* -------------------------------------------------------------------- */
|
|
1892
1889
|
|
|
1893
1890
|
/* Pull the ext-author / math-backend surface in under the carray.h
|