A Concise Sparse Matrix Package in C

CSPARSE is a C library which implements a number of direct methods for sparse linear systems, by Timothy Davis.

The algorithms contained in CSPARSE have been chosen with five goals in mind:

  1. they must embody much of the theory behind sparse matrix algorithms,
  2. they must be either asymptotically optimal in their run time and memory usage or be fast in practice,
  3. they must be concise so as to be easily understood and short enough to print in the book,
  4. they must cover a wide spectrum of matrix operations,
  5. they must be accurate and robust.
The focus is on direct methods; iterative methods and solvers for eigenvalue problems are beyond the scope of this package.


CSPARSE is available in a C version.

Related Data and Programs:

CC, a data directory which contains examples of the Compressed Column (CC) sparse matrix file format;

CG_RC, a C library which implements the conjugate gradient method for solving a positive definite sparse linear system A*x=b, using reverse communication.

CR, a data directory which contains examples of the Compressed Row (CR) sparse matrix file format;

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

MM_IO, a FORTRAN90 library which reads and writes sparse linear systems stored in the Matrix Market format.

SPARSEKIT, a FORTRAN90 library which carries out sparse matrix operations, by Yousef Saad.

SPARSEPAK, a FORTRAN90 library which forms an obsolete version of the Waterloo Sparse Matrix Package.

ST, a data directory which contains examples and an explanation of the Sparse Triplet file format for sparse matrices.

SUPERLU, C programs which illustrate how to use the SUPERLU library, which applies a fast direct solution method to solve sparse linear systems, by James Demmel, John Gilbert, and Xiaoye Li.


Timothy Davis


CSPARSE: a Concise Sparse matrix package.
Copyright (c) 2006, Timothy A. Davis.

CSPARSE is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

CSPARSE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this Module; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


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

Source Code:

Examples and Tests:

csparse_demo1 reads an ST matrix from a file and performs basis matrix operations.

csparse_demo2 reads an ST matrix from a file and solves a linear system.

csparse_demo3 reads an ST matrix from a file, solves a linear system, and performs an update/downdate.

List of Routines:

You can go up one level to the C source codes.

Last revised on 10 March 2006.