HP MLIB User's Guide Vol. 1 7th Ed.
428 HP MLIB User’s Guide
What you need to know to use these subprograms
• 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.
The matrix in Table 4-4 could be represented in MSR format as:
Table 4-8 MSR Format Matrix
DIA- Sparse diagonal. Given a sparse m-by-k matrix A with ndiag nonzero
diagonals, the DIA format stores the nonzero diagonals of A. Two arrays are
required for the DIA representation:
• idiag(*) - Integer array of length ndiag consisting of the corresponding
diagonal offsets idiag(i) of the nonzero diagonal of A stored in the column
val(:, i). Offsets are represented with respect to the main diagonal, that is,
the main diagonal has offset 0, lower triangular diagonals have negative
offsets, and upper triangular diagonals have positive offsets.
• val( lda,*) - Two dimensional lda-by-ndiag scalar array where lda is greater
or equal to min(m, k). Column val( :, i) consists of elements on diagonal
idiag(i) of A including any zero element within the diagonal. Since diagonals
may have fewer elements than to min(m, k):
• a) any diagonal with positive or zero offset d= idiag(i) (the main diagonal
or any upper triangular diagonal) is stored starting from position val( :,
i);
• b) if m is greater or equal to k, any diagonal with negative offset d=
idiag(i) (any lower triangular diagonal) is stored starting from position
val(-d, i);
• c) if m is less than k, any diagonal with negative offset d= idiag(i) is
stored starting from position val(t, i) where t=1+max(0, k-m-d).
diag= 11 22 33 44
val= 13 15 21 31 35 41 45
indx= 3511515
pntrb= 1346
pntre= 3468