@@ -56,7 +56,7 @@ outside of the "binsparse" namespace.
5656<div class=example>
5757
5858Example of a JSON descriptor for a compressed-sparse column (CSC) matrix with 10
59- rows and 12 columns, containing float32 values, along with user-defined
59+ rows and 12 columns, containing 20 float32 values, along with user-defined
6060attributes.
6161
6262```json
@@ -65,6 +65,7 @@ attributes.
6565 "version": "0.1",
6666 "format": "CSC",
6767 "shape": [10, 12] ,
68+ "number_of_stored_values": 20,
6869 "data_types": {
6970 "pointers_to_1": "uint64",
7071 "indices_1": "uint64",
@@ -98,6 +99,18 @@ contain the vector's dimension.
9899Note: a matrix has shape [`number_of_rows`, `number_of_columns`] regardless of whether
99100the format orientation is row-wise or column-wise.
100101
102+ Number of Stored Values {#key_number_of_stored_values}
103+ ------------------------------------------------------
104+
105+ The `number_of_stored_values` key must be present and shall define the number
106+ of explicit values that are stored as explicit entries in the sparse tensor
107+ format.
108+
109+ Note: For sparse tensors with all values the same (ISO), `number_of_stored_values`
110+ still refers to the number of explicit entries in the sparse tensor format whose
111+ indices are stored, regardless of the fact that the individual scalar values
112+ themselves are not explicitly stored.
113+
101114Fill {#key_fill}
102115--------------------
103116The `fill` key may be present. If the `fill` key is present, it shall have a
@@ -670,6 +683,7 @@ Example of a CSR Matrix whose values are all 7.
670683 "version": "0.1",
671684 "format": "CSR",
672685 "shape": [5, 5] ,
686+ "number_of_stored_values": 6,
673687 "data_types": {
674688 "pointers_to_1": "uint64",
675689 "indices_1": "uint64",
@@ -807,6 +821,7 @@ Example of a symmetric CSR matrix.
807821 "version": "0.1",
808822 "format": "CSR",
809823 "shape": [5, 5] ,
824+ "number_of_stored_values": 9,
810825 "structure": "symmetric_lower",
811826 "data_types": {
812827 "pointers_to_1": "uint64",
@@ -820,6 +835,13 @@ Example of a symmetric CSR matrix.
820835- `indices_1` = [0, 0, 1, 0, 2, 1, 3, 2, 4]
821836- `values` = [1, 2, 9, 7, 2, 2, 3, 3, 7]
822837
838+ Note: `number_of_stored_values` reflects the number of entries explicitly stored
839+ in the sparse tensor format. This means that for symmetric, Hermittion, and
840+ skew-symmetric matrices, `number_of_stored_values` reflects the number of values
841+ that are stored, not the number of logical values in both matrix triangles.
842+ If the optional attribute `number_of_diagonal_elements` is provided, the
843+ number of logical values in both triangles can be computed in constant time.
844+
823845</div>
824846
825847Attributes {#key_attributes}
0 commit comments