Skip to content

Commit 86a07ed

Browse files
committed
Add spec for contiguous COO arrays (sparse level with rank > 1).
1 parent 5daae31 commit 86a07ed

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spec/latest/index.bs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,29 @@ whose non-implicit elements are themselves arrays specified by `level`. For
371371
example, a sparse level of rank 1 represents a collection of sparse vectors of
372372
subarrays.
373373

374+
If the `coniguous` key `true`, it indicates that all pointer arrays
375+
form a single, contiguous 2-dimensional array. For the back-ends that
376+
do not support storing 2-dimensional arrays, a single 1-dimensional flat array
377+
may be used instead. The default value of `contiguous` is `false`.
378+
374379
Assume that this level represents `n`-dimensional subarrays and the root array
375380
is `N`-dimensional. The sparse level implies the following binary arrays are
376381
present:
377382

378383
: pointers_to_(N - n)
379384
:: Array of size `number_of_positions + 1` whose 1st element is equal to `0` and whose `p + 1`th element is equal to the sum of `pointers_to_(N - n)[p]` and the number of explicitly represented slices in the `p`th position.
380385

386+
In addition, the following binary arrays are present if `contiguous` is `false`:
387+
381388
: indices_(N - n), ..., indices(N - n + r - 1)
382389
:: There are `r` such arrays. When `A[i_0, ..., i_(r - 1), :, ..., :]` is explicitly represented by the subarray in position `q`, `indices_(N-n+s)[q] = i_s`. The arrays must be ordered such that the tuples `(indices_(N-n)[q], ..., indices_(N-n+r-1)[q])` are unique and appear in lexicographic order for all `q` in each range `pointers_to_(N-n)[p] <= q < pointers_to_(N-n)[p + 1]`. This array must contain no other elements.
383390

391+
Or the following binary array is present if `contiguous` is `true`:
392+
393+
: indices_from(N - n)_to(N - n + r - 1)
394+
:: This is a single 2-dimensional array. When `A[i_0, ..., i_(r - 1), :, ..., :]` is explicitly represented by the subarray in position `q`, `indices_from(N - n)_to(N - n + r - 1)[s, q] = i_s`. The arrays must be ordered such that the tuples `(indices_from(N - n)_to(N - n + r - 1)[:, q])` are unique and appear in lexicographic order for all `q` in each range `pointers_to_(N-n)[p] <= q < pointers_to_(N-n)[p + 1]`. This array must contain no other elements.
395+
396+
384397
Special note: If the sparse level is the root level, the `pointers` array should
385398
be omitted, as its first value will be `0` and its last value will be the
386399
length of any of the `indices` arrays in this level.

0 commit comments

Comments
 (0)