msm_to_hb, a MATLAB code which accepts a Matlab sparse matrix and writes it to a file in the Harwell Boeing (HB) Sparse Matrix File Format, the original version being by Xiaoye Li.

The original version has been modified. In particular, an effort was made to allow the input of complex matrices.


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


msm_to_hb is available in a MATLAB version.

Related Data and Programs:

hb_io, a MATLAB code which reads and writes sparse linear systems stored in the Harwell-Boeing Sparse Matrix format.

hb_to_msm, a MATLAB code which converts a Harwell Boeing sparse matrix to MATLAB sparse matrix format.

mm_to_hb, a MATLAB code which reads the sparse matrix information from an MM Matrix Market file and writes a corresponding HB Harwell Boeing file.

mm_to_msm, a MATLAB code which reads a Matrix Market file defining a sparse matrix, and creates a corresponding MATLAB sparse matrix data structure.


msm_to_mm, a MATLAB code which writes a MATLAB sparse matrix to a Matrix Market (MM) file;

plasma_matrix, a MATLAB code which demonstrates how a large sparse MATLAB matrix can be written to or read from a Harwell-Boeing sparse matrix file.

st_to_hb, a MATLAB code which converts a sparse matrix file from ST format to Harwell Boeing (HB) format;

test_mat, a MATLAB code which defines test matrices with known inverses, determinants, eigenvalues and so on.


Original verson by Xiaoye Li, University of California at Berkeley.
This modified version by John Burkardt.


  1. Iain Duff, Roger Grimes, John Lewis,
    User's Guide for the Harwell-Boeing Sparse Matrix Collection,
    October 1992.

Source Code:

Last revised on 31 December 2019.