crs


crs, a data directory which contains examples of the Compressed Row Storage (CRS) sparse matrix file format.

The CRS data structure involves:

The associated CRS 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.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Related Data and Programs:

DLAP, a data directory which contains examples of DLAP files, a sparse matrix file format used by the DLAP package;

DSP, a data directory which contains examples of DSP files, a sparse matrix file format, storing just (I,J,A(I,J)), and using one-based indexing.

HB, a data directory which contains examples of Harwell Boeing (HB) files, a sparse matrix file format;

LINPLUS, a C++ library which carries out simple manipulations of matrices in a variety of formats, including matrices stored in symmetric, banded, and sparse formats.

CC, a data directory which contains examples of Compressed Column (CC) files, a three-file format for sparse matrices;

ST, a data directory which contains examples of ST files, the Sparse Triplet format, a sparse matrix file format, storing just (I,J,A(I,J)), and using zero-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 CRS 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)
      

CRS File Characteristics:

Reference:

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

Sample 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.


Last revised on 14 February 2020.