next up previous
Next: Extensions Up: Downloading Matrices Previous: Harwell-Boeing Exchange Format

Coordinate Text File Format

The coordinate text format provides a simple and portable method to exchange sparse matrices. Any language or computer system that understands ASCII text can read this file format with a simple read loop. This makes this data accessible not only to users in the Fortran community, but also developers using C, C++, Pascal, or Basic environments.

In coordinate text file format the first line lists three integers: the number of rows, columns, and nonzeros in the matrix. The nonzero matrix elements are then listed, one per line, by specifying row index i, column index j, and the value a(i,j), in that order. White space is not significant, (i.e. a fixed column format is not used). Experiments show that these coordinate files are approximately 30% larger than corresponding Harwell-Boeing files. Compressed versions typically exhibit similar ratios.

To represent only structure information for a sparse matrix, a single zero can be placed in the a(i,j) position. Although more efficient schemes are available, this allows the same routine to read both types of files. The addition of a single byte to each line of the file is typically of little consequence.

Note that there is no implied order for the matrix elements. This allows one to write simple print routines which traverse the sparse matrix in whatever natural order given by the particular storage scheme. Also note that no annotations are used for storing matrices with special structure, which keeps parsing simple. Symmetric matrices can be represented by only their upper or lower triangular portions, but the file format reveals just that -- the reading program sees only a triangular matrix. (The application is responsible for reinterpreting this.)



Jack Dongarra
Thu May 30 12:55:31 EDT 1996