Developer Reference for Intel® oneAPI Math Kernel Library for C
Sparse BLAS CSC Matrix Storage Format
The Intel® oneAPI Math Kernel Library (oneMKL) Sparse BLAS compressed sparse column (CSC) format is specified by four arrays:
values
columns
pointerB
pointerE
In addition, each sparse matrix has an associated variable, indexing , which specifies whether the matrix indices are 0-based ( indexing=0 ) or 1-based ( indexing=1 ). The following table describes the arrays in terms of the values, row, and column positions of the non-zero elements in a sparse matrix A :
values
A real or complex array that contains the non-zero elements of A . Values of the non-zero elements of A are mapped into the values array using the column-major layout.
rows
Element i of the integer array rows is the number of the row in A that contains the i -th value in the values array.
pointerB
Element j of this integer array gives the index of the element in the values and rows arrays that is the first non-zero element in column j of A . Note that the 1-based position of this element in the arrays is equal to pointerB[j]-indexing+1 .
pointerE
An integer array that contains column indices, such that pointerE[j]-1 is the index of the element in the values and rows arrays that is the last non-zero element in column j of A . Note that the 1-based position of this element in the arrays is equal to pointerE[j]-indexing .
The length of the values and columns arrays is equal to the number of non-zero elements in A . The length of the pointerB and pointerE arrays is equal to the number of columns in A .
The CSC format is similar to the CSR format, but the indices are compressed along the columns instead of the rows. Storing a matrix in CSC format and storing the transpose of that same matrix in CSR format will result in identical arrays.
For example, consider matrix B :
It can be represented in the CSC format as:
Storage Arrays for a Matrix in CSC Format
one-based indexing |
||||||||||||||
values |
= |
(1 |
-2 |
-4 |
-1 |
5 |
8 |
4 |
2 |
-3 |
6 |
7 |
4 |
-5) |
rows |
= |
(1 |
2 |
4 |
1 |
2 |
5 |
3 |
4 |
1 |
3 |
4 |
3 |
|
pointerB |
= |
(1 |
4 |
7 |
9 |
|
||||||||
pointerE |
= |
(4 |
7 |
9 |
12 |
|
||||||||
zero-based indexing |
||||||||||||||
values |
= |
(1 |
-2 |
-4 |
-1 |
5 |
8 |
4 |
2 |
-3 |
6 |
7 |
4 |
-5) |
rows |
= |
(0 |
1 |
3 |
0 |
1 |
4 |
2 |
3 |
0 |
2 |
3 |
2 |
|
pointerB |
= |
(0 |
3 |
6 |
8 |
|
||||||||
pointerE |
= |
(3 |
6 |
8 |
11 |
|