HP MLIB User's Guide Vol. 1 7th Ed.

Chapter 4 Sparse BLAS Operations 427
What you need to know to use these subprograms
CSR - Compressed sparse row. Given a sparse m-by-k matrix A with nnz
nonzero entries, the CSR format stores each row of A as a sparse vector. Four
arrays are required for the CSR 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 column
indices such that indx(i) corresponds to the column index of val(i).
pntrb(*) - Integer array of length m such that pntrb(j) points to location in
val( ) of the first nonzero element in row j.
pntre(*) - Integer array of length m such that pntre(j)-1 points to location in
val( ) of the last nonzero element in row j.
Note that the above representation only requires each row of A to be stored in a
contiguous portion of val( ). If matrix A is stored in the first nnz entries of val( ),
a single array pntr( ) of length m+1 can be used instead of pntrb( ) and pntre( )
by having pntrb(i) = pntr(i) and pntre(i) = pntr(i+1).
The matrix in Table 4-4 could be represented in CSR format as:
Table 4-7 CSR Format Matrix
Optionally, a single array pntr( ) (instead of pntrb( ) and pntre( )) could be used:
pntr= 146912
MSR - Modified sparse row. The MSR format is a variation of the CSR
format obtained by storing the main diagonal of the matrix in a specific array.
Given a sparse m-by-k matrix A with nnz nonzero entries, the MSR
representation requires five arrays:
diag(*) - Scalar array of length d containing the main diagonal of A, where
d=min(m, k) is the number of elements in the main diagonal.
val(*) - Scalar array of length max(nnz, pntre(k)-1) containing the nonzero
matrix entries that do not belong to the main diagonal.
indx(*) - Integer array of length max(nnz, pntre(k)-1) containing column
indices such that indx(i) corresponds to the column index of val(i).
val= 11 13 15 21 22 31 33 35 41 44 45
indx= 13512135145
pntrb= 1469
pntre= 46812