HP MLIB User's Guide Vol. 2 7th Ed.
1006 HP MLIB User’s Guide
What you need to know to use these subprograms
Consider, for example, the following matrix:
This matrix could be represented in the format described above by three arrays,
irow, jcol, and mxvalu, as shown in Figure 15-1.
Figure 15-1 Row and Column Index Sparse Matrix Representation
In this example, the matrix entries are listed in order within each column, and
the columns are listed in order, although the representation does not require
that much structure. However, if the entries are required to be ordered by row
and column, even less storage is needed. In addition, symmetry in the matrix
can be used by storing only the entries, for example, on or below the main
diagonal. Other contexts, such as finite element analysis, can make even more
concise representations of the locations of the nonzeros.
This package adopts a particular internal format that allows arbitrary
symmetric matrices to be stored in 2nz+n+1 storage locations, where nz
represents the number of nonzeros in the lower triangle of the matrix. In
essence, the jcol array, which has repeated entries, is replaced by a shorter
array that gives the index of the first nonzero of each column in the mxvalu
array and an indication of the number of elements in each column. These two
pieces of information per matrix column can be represented in a single array
colstr of length n+1 if the convention is adopted that the number of nonzeros in
column j is given by colstr(j+1)−colstr(j) and if colstr(n+1) is set accordingly.
11 0 13 14 0 0
0 22 23 0 25 0
31 32 33 0 35 0
41 0 0 44 45 0
052535455 0
0000066
irow
=
jcol
=
mxvalu
=
134235123514523456
11222333344455556
11 31 41 22 32 52 13 23 33 53 14 44 54 25 35 45 55 66
1