SPARSE_CR
Sparse Compressed Row Matrix File Format


SPARSE_CR, the "sparse compressed row format", is a simple data structure for storing sparse matrices.

The sparse compressed row data structure involves:

The associated SPARSE_CR file format to store this information uses 3 separate files, containing the column, row, and entry information separately. The value of N can be inferred from the maximum value to occur in the column file. The value of M can be inferred from the length of the row file (minus 1), and the value of NZ_NUM from the length of the column or entry files.

Related Data and Programs:

DLAP is a set of sparse matrix data structures and file formats associated with the DLAP linear algebra package.

DSP is a sparse matrix data structure and file format that stores the row, column and value of every entry, and uses 1-based indexing.

HB is the Harwell-Boeing sparse matrix data structure and file format; one variant of the data structure format, the unsymmetric assembled matrix format, is equivalent to the sparse compressed column data structure.

LINPLUS is a library of linear algebra routines, which includes routines for the DCC format, which is the sparse compressed column format. LINPLUS is available in a C++ version, and a FORTRAN90 version, and a MATLAB version.

SPARSE is MATLAB's sparse matrix data structure, which is equivalent to the sparse compressed column data format.

SPARSE_CC is the sparse compressed column format for sparse matrices, in which the column information is compressed.

ST is a sparse matrix data structure and file format that stores the row, column and value of every entry, and uses 0-based indexing.

Example:

The 4 by 6 matrix

        11   0   0  14   0  16
         0  22   0   0  25  26
         0   0  33  34   0  36
        41   0  43  44   0  46
      
could be stored as the following SPARSE_CR files: (Here we are using 1-based indices)

ROW:

        1
        4
        7
       10
       14
      

COL:

        1  (row 1 begins on line 1)
        4
        6
        2  (row 2 begins on line 4)
        5
        6
        3  (row 3 begins on line 7)
        4
        6
        1  (row 4 begins on line 10)
        3
        4
        6
        *  (row 5 would begin on line 14)
      

ENTRY:

        11.0  (row 1 begins on line 1)
        14.0
        16.0
        22.0  (row 2 begins on line 4)
        25.0
        26.0
        33.0  (row 3 begins on line 7)
        34.0
        36.0
        41.0  (row 4 begins on line 10)
        43.0
        44.0
        46.0
        *     (row 5 would begin on line 14)
      

SPARSE_CR File Characteristics:

Reference:

  1. Timothy Davis,
    Direct Methods for Sparse Linear Systems,
    SIAM, 2006,
    ISBN: 0898716136,
    LC: QA188.D386.

Sample SPARSE_CR Files:

X01 is a simple example for which M=N=5 and NZ_NUM=12.

X02 is related to a finite difference approximation (-1,2-1) of the second derivative at a set of 20 equally spaced points in 1D. Thus M=N=20 and NZ_NUM=58.

X03 is related to a finite difference approximation (-1,-1,4,-1,-1) of the second derivative at a 5 by 5 grid of equally spaced points in 2D. Thus M=N=25 and NZ_NUM=105.

You can go up one level to the DATA page.


Last revised on 17 July 2007.