What you need to know to use these subprograms

Point entry formats

COO - Coordinate. Given a sparse matrix A with nnz nonzero entries, the COO format stores the entries of the matrix along with their corresponding row and column indices. Three arrays are required for the COO representation:

val(*) - Scalar array of length nnz containing the matrix entries.

indx(*) - Integer array of length nnz containing row indices such that indx(i) corresponds to the row index of val(i).

jndx(*) - Integer array of length nnz containing column indices such that jndx(i) corresponds to the column index of val(i).

Consider, for example, the 4 x 5 matrix:

Table 4-3

4 x 5 Matrix

 

 

 

 

 

11

0

13

0

15

 

21

22

0

0

0

 

31

0

33

0

35

 

41

0

0

44

45

This matrix could be represented in COO format as:

Table 4-4 COO Format Matrix

val=

11

13

15

21

22

31

33

35

41

44

45

indx=

1

1

1

2

2

3

3

3

4

4

4

jndx=

1

3

5

1

2

1

3

5

1

4

5

CSC - Compressed sparse column. Given a sparse m-by-kmatrix A with nnz nonzero entries, the CSC format stores each column of A as a sparse vector. Four arrays are required for the CSC representation:

val(*) - Scalar array of length max( nnz, pntre(k)-1 ) containing the nonzero matrix entries.

indx(*) - Integer array of length max( nnz, pntre(k)-1 ) containing row indices such that indx(i) corresponds to the row index of val(i).

pntrb(*) - Integer array of length k such that pntrb(j) points to location in val( ) of the first nonzero element in column j.

pntre(*) - Integer array of length k such that pntre(j) -1points to location in val( ) of the last nonzero element in column j.

Note that the above representation only requires each column of A to be stored in a contiguous portion of val( ). If matrix A is stored in the first nnz entries of

Chapter 4 Sparse BLAS Operations 425