MARCA_Models:
The Harwell-Boeing Compact Storage Scheme

William J. Stewart

Billy's Home Page


The Harwell-Boeing Compact Storage Scheme

The Harwell-Boeing format, (aa,ja,ia); is a compact storage mechanism whereby the nz nonzero elements of a matrix are stored contiguously in a one dimensional real*8 array called aa. In this array, the nonzero elements of any row k come before those of row k+1 and after those of row k-1. Nonzero elements within a given row are not necessarily in order. The column position of each nonzero element in aa is stored in the corresponding position of the integer array ja. Finally, row boundaries are determined from values stored in the integer array ia; ia(k) denoted the first position in aa (and ja) at which an element of row k is to be found. Additionally, ia(n+1) = nz.

For matrices generated in the MARCA_Models collection, the nz elements of aa are stored in the real*8 work array, dwork, beginning at position j1. The nz elements of ja and the n+1 elements of ia are both stored in the integer work array, iwork, the first beginning at position k1 and the second at position k2.

Consider, for example, the following matrix of order 4:

       | -2.1   1.7   0.0   0.4 |
       |  0.8  -0.8   0.0   0.0 |
       |  0.6   0.0  -0.6   0.0 |
       |  0.0   0.3   0.2  -0.5 |
One possible way to store this in the Harwell-Boeing compact storage scheme is as follows:
       aa:   1.7  0.4 -2.1 -0.8  0.8  0.6 -0.6  0.2  0.3 -0.5
       ja:    2    4    1    2    1    1    3    3    2    4
       ia:    1    4    6    8   11

The reader may be interested in looking at the subroutine writeToFile, which is the final subroutine in the file generate.f. This subroutine extracts, one at a time, the elements of a matrix generated by the MARCA_Models software, and writes each element's row position, column position and numerical value to a data file.