Expand description
Functionality for importing and exporting sparse matrices to and from files.
Available only when the io
feature is enabled.
The following formats are currently supported:
Format | Import | Export |
---|---|---|
Matrix market | Yes | Yes |
§Matrix Market format
The Matrix Market format is a simple ASCII-based file format for sparse matrices, and was initially developed for the NIST Matrix Market, a repository of example sparse matrices. In later years it has largely been superseded by the SuiteSparse Matrix Collection (formerly University of Florida Sparse Matrix Collection), which also uses the Matrix Market file format.
We currently offer functionality for importing a Matrix market file to an instance of a CooMatrix through the function load_coo_from_matrix_market_file, as well as functionality for writing various sparse matrices to the matrix market format through save_to_matrix_market_file. It is also possible to load a matrix stored as a string in the matrix market format with the function load_coo_from_matrix_market_str, or similarly write to a string with save_to_matrix_market_str.
Our implementation is based on the format description on the Matrix Market website and the following NIST whitepaper:
Boisvert, Ronald F., Roldan Pozo, and Karin A. Remington.
“The Matrix Market Exchange Formats: Initial Design.” (1996).
Structs§
- Matrix
Market Error - A description of the error that occurred during importing a matrix from a matrix market format data.
Enums§
- Matrix
Market Error Kind - Errors produced by functions that expect well-formed matrix market format data.
Traits§
- Matrix
Market Export - A marker trait for sparse matrix types that can be exported to the matrix market format.
- Matrix
Market Scalar - A marker trait for supported matrix market scalars.
Functions§
- load_
coo_ from_ matrix_ market_ file - Parses a Matrix Market file at the given path as a
CooMatrix
. - load_
coo_ from_ matrix_ market_ str - Parses a Matrix Market file described by the given string as a
CooMatrix
. - save_
to_ matrix_ market - Save a sparse matrix to an std::io::Write instance.
- save_
to_ matrix_ market_ file - Save a sparse matrix to a Matrix Market format file.
- save_
to_ matrix_ market_ str - Save a sparse matrix as a Matrix Market format string.