Skip to content

Commit 604cd26

Browse files
author
Willow Ahrens
committed
tweaking to incorporate recent changes
1 parent da6526a commit 604cd26

1 file changed

Lines changed: 34 additions & 40 deletions

File tree

spec/latest/index.bs

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,14 @@ The level descriptors are dictionaries defined as follows:
272272

273273
#### Element #### {#element_level}
274274

275-
If the level is an element level, it represents zero or more scalars.
276-
If `values_type` is not `iso`, it implies
277-
that the following binary arrays are present in the tensor:
275+
If the level key is "element", the level represents zero or more scalars.
278276

279277
: values
280278
:: Array of size `number_of_positions` whose `p`th element holds the value of the scalar at position `p`.
281279

282280
#### Dense #### {#dense_level}
283281

284-
If the level is a dense level, the `subformat` key must be present. The `rank`
282+
If the level key is "dense", the `subformat` key must be present. The `rank`
285283
key must be present, and set to an integer `r` greater than or equal to 1. The
286284
dense level represents zero or more r-dimensional dense arrays whose elements
287285
are themselves arrays specified by `subformat`. For example, a dense level
@@ -301,7 +299,7 @@ of the sublevel.
301299

302300
#### Sparse #### {#sparse_level}
303301

304-
If the level is an sparse level, the `subformat` key must be present. The
302+
If the level key is "sparse", the `subformat` key must be present. The
305303
`rank` key must be present, and set to an integer `r` greater than or equal to
306304
`1`. The sparse level represents zero or more `r`-dimensional sparse arrays
307305
whose non-implicit elements are themselves arrays specified by `subformat`. For
@@ -322,29 +320,13 @@ Special note: If the sparse level is the root level, the `pointers` array should
322320
be ommitted, as its first value will be `0` and its last value will be the
323321
length of any of the `indices` arrays in this level.
324322

325-
#### ISO #### {#iso_level}
326-
327-
When all values of a sparse array are the same identical value, a special level
328-
is provided to compress the value array to a single value rather than
329-
duplicating the same number unnecessarily. Iso levels represents zero or more
330-
scalars of all the same value. It implies that the following binary arrays are
331-
present in the tensor:
332-
333-
: values
334-
:: Array of size `1` whose element holds the value of all explicit entries in the sparse tensor.
335-
336-
Note: Structure-only matrices (allowed in matrix market format) can be stored
337-
using this level with a value of 1. This adds only a small amount of
338-
overhead while describing essentially the same matrix.
339323

340324
### Equivalent Formats ### {#equivalent_formats}
341325

342326
The following formats are equivalent
343327

344328
#### VEC #### {#vec_format_equiv}
345329

346-
Vector format is equivalent to
347-
348330
```json
349331
{
350332
"format": {
@@ -359,10 +341,6 @@ Vector format is equivalent to
359341

360342
#### CSR #### {#csr_format_equiv}
361343

362-
Compressed-Sparse Row format is equivalent to
363-
364-
Vector format is equivalent to
365-
366344
```json
367345
{
368346
"format": {
@@ -506,23 +484,36 @@ The following strings shall be used to describe data types:
506484
## Value Modifiers ## {#value_modifiers}
507485

508486
When the value array is meant to be reinterpreted before reading, a special bracket syntax is
509-
provided to indicate modifications to the underlying value array.
487+
provided to indicate modifications to the underlying element level. These modifiers can be specified
488+
either in the values_type field or as wrapper levels around the element level.
489+
490+
### Complex Values (complex) ### {#complex_level}
491+
492+
When the values are composed of alternating real and imaginary components of
493+
complex numbers, we use a complex level to signal this modification to the
494+
underlying array.
495+
496+
If the level key is "complex", the `subformat` key must be present. The
497+
complex level represents zero or more complex-valued arrays specified by
498+
`subformat`. The real and imaginary components of the `p`th array are the subarrays at
499+
positions `2p` and `2p+1`.
500+
501+
One can also specify that a type is complex by writing the type as
502+
`complex[<type>]`. For example, a value array of complex `float64` would have a
503+
datatype of `complex[float64]`.
510504

511-
### Sparse Array with Complex Values ### {#complex_arrays}
505+
### All Values the Same (ISO) ### {#iso_level}
512506

513-
When a value array is composed of alternating real and imaginary components of
514-
complex numbers, the type is written as `complex[<type>]`. For example, a value
515-
array of complex `float64` would have a datatype of `complex[float64]` The real
516-
component of the `i`th element in the modified array shall be stored at position
517-
`2i` in the original array, and the imaginary component of the `i`th element in
518-
the modified array shall be at position `2i + 1` in the underlying array.
507+
When all values of a sparse array are the same identical value, a special level
508+
is provided to compress the value array to a single value rather than
509+
duplicating the same number unnecessarily.
519510

520-
### Sparse Array with All Values the Same ### {#iso_arrays}
511+
If the level key is "iso", the `subformat` key must be present. All arrays
512+
represented by the iso level map to the same subarray at position 0. The subarray
513+
is usually a scalar element which is common to all stored indices.
521514

522-
When all values of a sparse array are the same identical value, the type is
523-
written as `iso[<type>]`. This indicates that the array will store only a single
524-
element which is common to all stored indices. All elements in the modified
525-
array shall be stored at position 0 of the underlying array.
515+
One can specify that the value array should be wrapped in an iso level by
516+
writing the value type as `iso[<type>]`.
526517

527518
<div class=example>
528519

@@ -592,15 +583,15 @@ Example of a CSR Matrix whose values are all 7.
592583
"level": "sparse",
593584
"rank": 1,
594585
"subformat": {
595-
"level": "iso",
586+
"level": "element",
596587
}
597588
}
598589
},
599590
"shape": [5, 5],
600591
"data_types": {
601592
"pointers_0": "uint64",
602593
"indices_1": "uint64",
603-
"values": "int8"
594+
"values": "iso[int8]"
604595
}
605596
}
606597
```
@@ -611,6 +602,9 @@ Example of a CSR Matrix whose values are all 7.
611602

612603
</div>
613604

605+
Note: Structure-only matrices (allowed in matrix market format) can be stored
606+
using this technique with a value of 1. This adds only a small amount of
607+
overhead while describing essentially the same matrix.
614608

615609
Binary Containers {#binary_container}
616610
=====================================

0 commit comments

Comments
 (0)