Sparse Triplet Matrix File Format

ST is a data directory which contains examples of the "sparse triplet format", a simple data structure and a file format for storing sparse matrices.

The sparse triplet data structure simply records, for each nonzero entry of the matrix, the row, column and value. Thus, the information in the data structure might be

Row and column indices are 0-based.

The sparse triplet file format is an ASCII file of NZ_NUM lines, with each line corresponding to a nonzero entry of the matrix, and containing the row index, column index and value of that entry, separated by spaces.


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:

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.

MGMRES, a C++ library which applies the restarted GMRES algorithm to solve a sparse linear system, by Lili Ju.

ST_IO, a C library which reads and writes sparse linear systems stored in the Sparse Triplet (ST) format.

ST_TO_CC, a C library which converts sparse matrix data from Sparse Triplet (ST) format to Compressed Column (CC) format.

ST_TO_HB, a FORTRAN90 program which converts a sparse matrix file from Sparse Triplet (ST) format to Harwell Boeing (HB) format;

ST_TO_MM, a MATLAB program which converts a sparse matrix file from Sparse Triplet (ST) format to Matrix Market (MM) format;

ST_TO_MSM, a MATLAB program which reads a Sparse Triplet (ST) file and creates a corresponding MATLAB Sparse Matrix (MSM).


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 an ST file which reads:
        0  0  11.0
        0  3  14.0
        0  5  16.0
        1  1  22.0
        1  3  25.0
        1  5  26.0
        2  2  33.0
        2  3  34.0
        2  5  36.0
        3  0  41.0
        3  2  43.0
        3  3  44.0
        3  5  46.0

ST File Characteristics:


  1. Timothy Davis,
    Direct Methods for Sparse Linear Systems,
    SIAM, 2006.

Sample Files:

You can go up one level to the DATA page.

Last revised on 20 July 2014.