Skip to content

Commit 5d89c42

Browse files
authored
Merge pull request #29 from GraphBLAS/matrix-structure
Add section on matrix structure
2 parents a06f547 + 1c4006b commit 5d89c42

1 file changed

Lines changed: 132 additions & 0 deletions

File tree

spec/latest/index.bs

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,138 @@ Note: Structure-only matrices (allowed in matrix market format) can be stored
369369
using this technique with a value of 1. This adds only a small amount of
370370
overhead while describing essentially the same matrix.
371371

372+
Structure {#key_structure}
373+
--------------------------
374+
The `structure` key, if present, denotes a special matrix structure in which
375+
only one triangle of the matrix is stored and the structure and values in the
376+
other triangle are inferred.
377+
378+
### Pre-Defined Structures ### {#predefined_structure}
379+
380+
The follow pre-defined values can be supplied for the `structure` key to indicate
381+
the structure of the matrix.
382+
383+
#### symmetric_lower #### {#symmetric_lower_structure}
384+
385+
The `symmetric_lower` value indicates that the matrix has a symmetric structure
386+
with only the lower triangle stored. For all matrix entries with row and column
387+
indices `i,j` and value `v`, `i >= j`. If `i != j`, the entry implies the
388+
presence of an entry at row and column index `j,i` with value `v`.
389+
390+
#### symmetric_upper #### {#symmetric_upper_structure}
391+
392+
The `symmetric_upper` value indicates that the matrix has a symmetric structure
393+
with only the upper triangle stored. For all matrix entries with row and column
394+
indices `i,j` and value `v`, `i <= j`. If `i != j`, the entry implies the
395+
presence of an entry at row and column index `j,i` with value `v`.
396+
397+
#### hermitian_lower #### {#hermitian_lower_structure}
398+
399+
The `hermitian_lower` value indicates that the matrix has a Hermitian structure
400+
with only the lower triangle stored. For all matrix entries with row and column
401+
indices `i,j` and value `v`, `i >= j`. If `i != j`, the entry implies the
402+
presence of an entry at row and column index `j,i` with a value equal to the
403+
complex conjugate of `v`. The matrix's value type must be complex.
404+
405+
#### hermitian_upper #### {#hermitian_upper_structure}
406+
407+
The `hermitian_upper` value indicates that the matrix has a Hermitian structure
408+
with only the upper triangle stored. For all matrix entries with row and column
409+
indices `i,j` and value `v`, `i <= j`. If `i != j`, the entry implies the
410+
presence of an entry at row and column index `j,i` with a value equal to the
411+
complex conjugate of `v`. The matrix's value type must be complex.
412+
413+
#### skew_symmetric_lower #### {#skew_symmetric_lower_structure}
414+
415+
The `skew_symmetric_lower` value indicates that the matrix has a skew-symmetric structure
416+
with only the lower triangle stored. For all matrix entries with row and column
417+
indices `i,j` and value `v`, `i >= j`. If `i != j`, the entry implies the
418+
presence of an entry at row and column index `j,i` with value `-v`.
419+
420+
#### skew_symmetric_upper #### {#skew_symmetric_upper_structure}
421+
422+
The `symmetric_upper` value indicates that the matrix has a skew-symmetric structure
423+
with only the upper triangle stored. For all matrix entries with row and column
424+
indices `i,j` and value `v`, `i <= j`. If `i != j`, the entry implies the
425+
presence of an entry at row and column index `j,i` with value `-v`.
426+
427+
<div class=example>
428+
429+
Example of a symmetric CSR matrix.
430+
431+
<table>
432+
<thead>
433+
<tr>
434+
<th> </th>
435+
<th>0</th>
436+
<th>1</th>
437+
<th>2</th>
438+
<th>3</th>
439+
<th>4</th>
440+
</tr>
441+
</thead>
442+
<tbody>
443+
<tr>
444+
<th>0</th>
445+
<td>1</td>
446+
<td>.</td>
447+
<td>.</td>
448+
<td>.</td>
449+
<td>.</td>
450+
</tr>
451+
<tr>
452+
<th>1</th>
453+
<td>2</td>
454+
<td>9</td>
455+
<td>.</td>
456+
<td>.</td>
457+
<td>.</td>
458+
</tr>
459+
<tr>
460+
<th>2</th>
461+
<td>7</td>
462+
<td>.</td>
463+
<td>2</td>
464+
<td>.</td>
465+
<td>.</td>
466+
</tr>
467+
<tr>
468+
<th>3</th>
469+
<td>.</td>
470+
<td>2</td>
471+
<td>.</td>
472+
<td>3</td>
473+
<td>.</td>
474+
</tr>
475+
<tr>
476+
<th>4</th>
477+
<td>.</td>
478+
<td>.</td>
479+
<td>3</td>
480+
<td>.</td>
481+
<td>7</td>
482+
</tr>
483+
</tbody>
484+
</table>
485+
486+
```json
487+
{
488+
"format": "CSR",
489+
"shape": [5, 5],
490+
"structure": "symmetric_lower",
491+
"data_types": {
492+
"pointers_0": "uint64",
493+
"indices_1": "uint64",
494+
"values": "int8"
495+
}
496+
}
497+
```
498+
499+
- `pointers_0` = [0, 1, 3, 5, 7, 9]
500+
- `indices_1` = [0, 0, 1, 0, 2, 1, 3, 2, 4]
501+
- `values` = [1, 2, 9, 7, 2, 2, 3, 3, 7]
502+
503+
</div>
372504

373505
Binary Containers {#binary_container}
374506
=====================================

0 commit comments

Comments
 (0)