Skip to content

Commit 7eb231f

Browse files
refinements
1 parent ea267f4 commit 7eb231f

File tree

1 file changed

+39
-14
lines changed

1 file changed

+39
-14
lines changed

include/binsparse/c_bindings/binsparse_matrix.h

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
typedef enum
2828
{
2929
bc_type_none = 0, // no type; values array is NULL (maybe?)
30+
// unsigned types
3031
bc_type_bool = 1, // bool, assume sizeof(bool) == 1, as uint8_t
3132
bc_type_uint8 = 2, // uint8_t
3233
bc_type_uint16 = 3, // uint16_t
3334
bc_type_uint32 = 4, // uint32_t
3435
bc_type_uint64 = 5, // uint64_t
36+
// signed types
3537
bc_type_int8 = 6, // int8_t
3638
bc_type_int16 = 7, // int16_t
3739
bc_type_int32 = 8, // int32_t
@@ -40,6 +42,7 @@ typedef enum
4042
bc_type_fp64 = 11, // double
4143
bc_type_fc32 = 12, // float complex
4244
bc_type_fc64 = 13, // double complex
45+
// user-defined type
4346
bc_type_user = 14, // user-defined type
4447
}
4548
bc_type_code ;
@@ -51,26 +54,29 @@ bc_type_code ;
5154
// Each dimension k of a given n-D matrix can be in one of four formats,
5255
// listed in increasing order of sparsity:
5356
//
54-
// Index some entries present, pointer[k] NULL, index[k] non-NULL
55-
// indices need not be
56-
// in order, nor unique
57+
// pointer[k] index[k] Name and description
58+
// ---------- -------- --------------------
5759
//
58-
// Hyper some entries present, pointer[k] non-NULL, index[k] non-NULL
59-
// indices must be in
60-
// order and unique.
61-
// pointer [k] has size npointer [k]+1
62-
// index [k] has size npointer [k]
60+
// NULL non-NULL "Index": some entries present.
61+
// indices need not be in order, nor unique.
6362
//
64-
// Sparse all entries present, pointer[k] non-NULL, index[k] NULL
65-
// pointer [k] has size of
66-
// dimension [axis_order[k]]+1.
63+
// non-NULL non-NULL "Hyper": some entries present.
64+
// indices must be in order and unique. pointer [k]
65+
// has size npointer [k]+1 and must be monotonically
66+
// non-decreasing. index [k] has size npointer [k]
6767
//
68-
// Full all entries present, pointer[k] NULL, index[k] NULL
68+
// non-NULL NULL "Sparse": all entries present.
69+
// pointer [k] has size dimension [axis_order[k]]+1.
70+
// pointer [k] has size npointer [k]+1 and must be
71+
// monotonically non-decreasing.
72+
//
73+
// NULL NULL "Full": all entries present,
6974

7075
// The matrix format is determined by the presence of pointer [0:rank-1]
71-
// and index [0:rank-1].
76+
// and index [0:rank-1] (NULL or non-NULL). There need not be any format
77+
// enum.
7278

73-
// Common formats
79+
// Common formats:
7480

7581
// rank = 0: a scalar, no arrays present. nvals = 0 or 1
7682

@@ -193,6 +199,25 @@ bc_type_code ;
193199
// index [1] = NULL
194200
// values: size nvals = m * npointer [0], or 1 if iso
195201
//
202+
// Are all 16 formats possible?
203+
// (Full, Sparse, Hyper, Index) x (Full, Sparse, Hyper, Index) ?
204+
// I think the last dimension must be Full or Index, which leads to
205+
// 8 formats: (Full, Sparse, Hyper, Index) x (Full, Index).
206+
// 5 Listed above are:
207+
//
208+
// (Index, Index) COO
209+
// (Sparse, Index) CSR and CSC
210+
// (Hyper, Index) hypersparse by row or col
211+
// (Full, Full) full
212+
// (Hyper, Full) hyper-full
213+
//
214+
// not described aboce:
215+
//
216+
// (Index, Full) can be defined, looks useful. An unorderd
217+
// set of full vectors.
218+
// (Sparse, Full) can be defined but not useful?
219+
// (Full, Index) huh?
220+
//
196221
// bitmap format: held as two full bc_matrices with same dimension and
197222
// axis_order. The first matrix ('bitmap' pattern) is always bool.
198223
// The second full matrix holds the values.

0 commit comments

Comments
 (0)