Skip to content


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation

HeRC Matrix Tools (HeRCM)

Update 2017-11-21

This project is no longer active. I will accept bug reports and may fix them, but no new features will be added in the forseeable future.


HeRC Matrix Tools is a collection of open source sparse and symmetric matrix tools, originally created for the University of South Carolina HeRC research group.

HeRC Matrix Tools encompasses a number of tools and libraries to make working with symmetric matrices easier, enumerated below.


Some special purpose documentation is kept in doc-extra in markdown format. All other documentation is generated by Doxygen. Doxygen output is not tracked in git, but compiled copies of said documentation are included with project releases.

Documentation may be built manually with doxygen Doxyfile in the TLD of the project.

NOTE: documentation for C components of the project are not listed in the "class browser" - you must use the "Files" tab, then select the file you wish to view documentation for.



Python 3.X

  • read/write access to the file formats:
  • mtx
  • bxf
  • valcol
  • mat
  • matrix operations
  • conversion of matrix to/from scipy.sparse and numpy dense matrix formats
  • append (COO) element
  • retrieve (COO) element by index
  • retrieve indicies which match a COO element
  • remove COO element by index
  • retrieve matrix values by (row, col) coordinate pair
  • modify matrix values by (row, col) coordinate pair
  • remove elements from the matrix whose value is zero
  • replace matrix contents with a scipy.sparse matrix
  • check if any elements are stored in the upper/lower triangle of the matrix
  • check if the matrix is symmetric
  • convert the matrix to symmetric/asymmetric
  • sort matrix elements to row-major
  • transpose the matrix
  • HercExplorer interface
  • wrappers for all of the above
  • paint values by (row, col) pair, in a rectangle pattern, or a diagonal pattern
  • retrieve values by (row, col) pair, in a rectangular region, by row, or by col
  • display graphical (via matplotlib) and pseudo-graphical overviews of the matrix
  • modify matrix dimensions


  • read matrices stored in BXF format


  • store symmetric and asymmetric matrices in COO format
  • store comments about matrix in REMARKS field


Python 3.X

  • read/write support for harwell-boeing format
  • read/write support for serialized python objects
  • matrix computation operations (eg. computing matrix eigenvector)


  • read matricies stored in valcol format
  • read+write support for BXF and valcol
  • matrix transpose operation
  • COO-to-CSR and CSR-to-COO operations
  • sort matrix elements to row major


  • error checking

Major Libraries & their Purposes

Herc Explorer

Wraps most libraries and functionalities provided by the hercm project within a command line interface. Includes the ability to read and write matrices in a variety of formats, preview or plot matrices, and perform a variety of operations on them.



Aggregate IO library for hercm python code, wraps code to read and write matrices in all formats support by hercm python code.



C BXF library. Currently supports read only access to BXF matrix files in C.



Provides read/write access to bxf format files.



Provides read/write access to valcol format files.



Provides a feature rich class type for sparse matrices, and includes scipy/numpy interoperability.



Provides user-interface centric utilities pertaining to sparse matrices, generally used almost exclusively by MatrixExplorer, but is provided as a separate library to facilitate automation by other scripts and programs.