@@ -305,7 +305,7 @@ and tensors. For example, a dense vector of sparse vectors is equivalent to the
305305CSR matrix format, and a sparse vector of sparse vectors is equivalent to the
306306hypersparse DCSR matrix format.
307307
308- When defining a custom format, the outermost `subformat ` key is defined as the
308+ When defining a custom format, the outermost `level ` key is defined as the
309309root level descriptor (a level which will only hold one array). If a level holds
310310many different arrays, we refer to the `p`th array as the array in position `p`.
311311
@@ -316,24 +316,25 @@ to represent is `A` and the tensor described by the format descriptor is `B`,
316316then `A[i_1, ..., i_n] = B[i_(transpose[1] ), ..., i_(transpose[n] )]`. `transpose` must
317317be a permutation.
318318
319- If the format key is a dictionary, the `level` key must be present and shall
320- describe the storage format of the level used to represent the sparse array.
319+ If the `custom` key is present, it holds a dictionary for custom formats. The
320+ root level is stored under the `level` key. Each level mush have a `level_desc`
321+ attribute which describe the storage format of the level.
321322
322323The level descriptors are dictionaries defined as follows:
323324
324325#### Element #### {#element_level}
325326
326- If the level key is "element", the level represents zero or more scalars.
327+ If the level descriptor is "element", the level represents zero or more scalars.
327328
328329: values
329330:: Array of size `number_of_positions` whose `p`th element holds the value of the scalar at position `p`.
330331
331332#### Dense #### {#dense_level}
332333
333- If the level key is "dense", the `subformat ` key must be present. The `rank`
334+ If the level descriptor is "dense", the `level ` key must be present. The `rank`
334335key must be present, and set to an integer `r` greater than or equal to 1. The
335336dense level represents zero or more r-dimensional dense arrays whose elements
336- are themselves arrays specified by `subformat `. For example, a dense level
337+ are themselves arrays specified by `level `. For example, a dense level
337338of
338339rank 2 represents a collection of dense matrices of subarrays.
339340
@@ -350,10 +351,10 @@ of the sublevel.
350351
351352#### Sparse #### {#sparse_level}
352353
353- If the level key is "sparse", the `subformat ` key must be present. The
354+ If the level descriptor is "sparse", the `level ` key must be present. The
354355`rank` key must be present, and set to an integer `r` greater than or equal to
355356`1`. The sparse level represents zero or more `r`-dimensional sparse arrays
356- whose non-implicit elements are themselves arrays specified by `subformat `. For
357+ whose non-implicit elements are themselves arrays specified by `level `. For
357358example, a sparse level of rank 1 represents a collection of sparse vectors of
358359subarrays.
359360
@@ -374,17 +375,17 @@ length of any of the `indices` arrays in this level.
374375
375376### Equivalent Formats ### {#equivalent_formats}
376377
377- The following formats are equivalent
378+ The following formats are equivalent. Parsers which support custom formats should also write `format` aliases when appropriate.
378379
379380#### DVEC #### {#dvec_format_equiv}
380381
381382```json
382- "format ": {
383- "subformat ": {
384- "level ": "dense",
383+ "custom ": {
384+ "level ": {
385+ "level_desc ": "dense",
385386 "rank": 1,
386- "subformat ": {
387- "level ": "element",
387+ "level ": {
388+ "level_desc ": "element",
388389 }
389390 }
390391}
@@ -393,15 +394,15 @@ The following formats are equivalent
393394#### DMATR #### {#dmatr_format_equiv}
394395
395396```json
396- "format ": {
397- "subformat ": {
398- "level ": "dense",
397+ "custom ": {
398+ "level ": {
399+ "level_desc ": "dense",
399400 "rank": 1,
400- "subformat ": {
401- "level ": "dense",
401+ "level ": {
402+ "level_desc ": "dense",
402403 "rank": 1,
403- "subformat ": {
404- "level ": "element",
404+ "level ": {
405+ "level_desc ": "element",
405406 }
406407 }
407408 }
@@ -411,16 +412,16 @@ The following formats are equivalent
411412#### DMATC #### {#dmatr_format_equiv}
412413
413414```json
414- "format ": {
415+ "custom ": {
415416 "transpose": [1, 0] ,
416- "subformat ": {
417- "level ": "dense",
417+ "level ": {
418+ "level_desc ": "dense",
418419 "rank": 1,
419- "subformat ": {
420- "level ": "dense",
420+ "level ": {
421+ "level_desc ": "dense",
421422 "rank": 1,
422- "subformat ": {
423- "level ": "element",
423+ "level ": {
424+ "level_desc ": "element",
424425 }
425426 }
426427 }
@@ -430,12 +431,12 @@ The following formats are equivalent
430431#### CVEC #### {#cvec_format_equiv}
431432
432433```json
433- "format ": {
434- "subformat ": {
435- "level ": "sparse",
434+ "custom ": {
435+ "level ": {
436+ "level_desc ": "sparse",
436437 "rank": 1,
437- "subformat ": {
438- "level ": "element",
438+ "level ": {
439+ "level_desc ": "element",
439440 }
440441 }
441442}
@@ -444,15 +445,15 @@ The following formats are equivalent
444445#### CSR #### {#csr_format_equiv}
445446
446447```json
447- "format ": {
448- "subformat ": {
449- "level ": "dense",
448+ "custom ": {
449+ "level ": {
450+ "level_desc ": "dense",
450451 "rank": 1,
451- "subformat ": {
452- "level ": "sparse",
452+ "level ": {
453+ "level_desc ": "sparse",
453454 "rank": 1,
454- "subformat ": {
455- "level ": "element",
455+ "level ": {
456+ "level_desc ": "element",
456457 }
457458 }
458459 }
@@ -462,16 +463,16 @@ The following formats are equivalent
462463#### CSC #### {#csc_format_equiv}
463464
464465```json
465- "format ": {
466+ "custom ": {
466467 "transpose": [1, 0] ,
467- "subformat ": {
468- "level ": "dense",
468+ "level ": {
469+ "level_desc ": "dense",
469470 "rank": 1,
470- "subformat ": {
471- "level ": "sparse",
471+ "level ": {
472+ "level_desc ": "sparse",
472473 "rank": 1,
473- "subformat ": {
474- "level ": "element",
474+ "level ": {
475+ "level_desc ": "element",
475476 }
476477 }
477478 }
@@ -481,15 +482,15 @@ The following formats are equivalent
481482#### DCSR #### {#dcsr_format_equiv}
482483
483484```json
484- "format ": {
485- "subformat ": {
486- "level ": "sparse",
485+ "custom ": {
486+ "level ": {
487+ "level_desc ": "sparse",
487488 "rank": 1,
488- "subformat ": {
489- "level ": "sparse",
489+ "level ": {
490+ "level_desc ": "sparse",
490491 "rank": 1,
491- "subformat ": {
492- "level ": "element",
492+ "level ": {
493+ "level_desc ": "element",
493494 }
494495 }
495496 }
@@ -499,16 +500,16 @@ The following formats are equivalent
499500#### DCSC #### {#dcsc_format_equiv}
500501
501502```json
502- "format ": {
503+ "custom ": {
503504 "transpose": [1, 0] ,
504- "subformat ": {
505- "level ": "sparse",
505+ "level ": {
506+ "level_desc ": "sparse",
506507 "rank": 1,
507- "subformat ": {
508- "level ": "sparse",
508+ "level ": {
509+ "level_desc ": "sparse",
509510 "rank": 1,
510- "subformat ": {
511- "level ": "element",
511+ "level ": {
512+ "level_desc ": "element",
512513 }
513514 }
514515 }
@@ -518,12 +519,12 @@ The following formats are equivalent
518519#### COOR #### {#coor_format_equiv}
519520
520521```json
521- "format ": {
522- "subformat ": {
523- "level ": "sparse",
522+ "custom ": {
523+ "level ": {
524+ "level_desc ": "sparse",
524525 "rank": 2,
525- "subformat ": {
526- "level ": "element",
526+ "level ": {
527+ "level_desc ": "element",
527528 }
528529 }
529530}
@@ -534,13 +535,13 @@ The following formats are equivalent
534535Column-wise Coordinate format
535536
536537```json
537- "format ": {
538+ "custom ": {
538539 "transpose": [1, 0] ,
539- "subformat ": {
540- "level ": "sparse",
540+ "level ": {
541+ "level_desc ": "sparse",
541542 "rank": 2,
542- "subformat ": {
543- "level ": "element",
543+ "level ": {
544+ "level_desc ": "element",
544545 }
545546 }
546547}
0 commit comments