Data Storage
Compressed Storage Format for Sparse Vectors
Only non-zero elements in a sparse matrix are stored. Suppose sparse matrix a has nz non-zero elements: a(k1), a(k2), ..., a(knz)
Two arrays are used to store the information about matrix a:
x(1)=a(k1), x(2)=a(k2), ..., x(nz)=a(knz)
indx(1)=k1, indx(2)=k2, ..., indx(nz)=knz
The compressed storage format is memory-saving and time-efficient.
Full-Storage Format for Vectors
All elements in a sparse matrix are stored.
Sparse Matrix Storage Format
The compressed sparse row (CSR) format is specified by four arrays: value, column, pointerB, and pointerE,
as described in Table 1.
Parameter |
Description |
|---|---|
value |
|
column |
|
pointerB |
|
pointerE |
|
Matrix A
can be represented in CSR format as in Table 2.
Matrix |
Indexing Method |
CSR Format |
|---|---|---|
|
One-based indexing |
value = [2, -3, 7, 1, -6, 8, -4, 5, 9] column = [1, 2, 4, 3, 4, 1, 3, 4, 1] pointerB = [1, 4, 6, 9] pointerE = [4, 6, 9, 10] |
Zero-based indexing |
value = [2, -3, 7, 1, -6, 8, -4, 5, 9] column = [0, 1, 3, 2, 3, 0, 2, 3, 0] pointerB = [0, 3, 5, 8] pointerE = [3, 5, 8, 9] |
The compressed sparse column (CSC) format is specified by four arrays: value, column, pointerB, and pointerE,
as described in Table 3.
Parameter |
Description |
|---|---|
value |
|
column |
|
pointerB |
|
pointerE |
|
Matrix A
can be represented in CSC format as in Table 4.
Matrix |
Indexing Method |
CSC Format |
|---|---|---|
|
One-based indexing |
value = [2, 8, 9, -3, 1, -4, 7, -6, 5] column = [1, 3, 4, 1, 2, 3, 1, 2, 3] pointerB = [1, 4, 5, 7] pointerE = [4, 5, 7, 10] |
Zero-based indexing |
value = [2, 8, 9, -3, 1, -4, 7, -6, 5] column = [0, 2, 3, 0, 1, 2, 0, 1, 2] pointerB = [0, 3, 4, 6] pointerE = [3, 4, 6, 9] |

