Skip to main content

nalgebra_sparse/io/
mod.rs

1//! Functionality for importing and exporting sparse matrices to and from files.
2//!
3//! **Available only when the `io` feature is enabled.**
4//!
5//! The following formats are currently supported:
6//!
7//! | Format                                          |  Import    |   Export   |
8//! | ------------------------------------------------|------------|------------|
9//! | [Matrix market](#matrix-market-format)          |  Yes       |    Yes     |
10//!
11//! [Matrix market]: https://math.nist.gov/MatrixMarket/formats.html
12//!
13//! ## Matrix Market format
14//!
15//! The Matrix Market format is a simple ASCII-based file format for sparse matrices, and was initially developed for
16//! the [NIST Matrix Market](https://math.nist.gov/MatrixMarket/), a repository of example sparse matrices.
17//! In later years it has largely been superseded by the
18//! [SuiteSparse Matrix Collection](https://sparse.tamu.edu/) (formerly University of Florida Sparse Matrix Collection),
19//! which also uses the Matrix Market file format.
20//!
21//! We currently offer functionality for importing a Matrix market file to an instance of a
22//! [CooMatrix](crate::CooMatrix) through the function [load_coo_from_matrix_market_file],
23//! as well as functionality for writing various sparse matrices to the matrix market format
24//! through [save_to_matrix_market_file]. It is also possible to load
25//! a matrix stored as a string in the matrix market format with the function
26//! [load_coo_from_matrix_market_str], or similarly write to a string with
27//! [save_to_matrix_market_str].
28//!
29//! Our implementation is based on the [format description](https://math.nist.gov/MatrixMarket/formats.html)
30//! on the Matrix Market website and the
31//! [following NIST whitepaper](https://math.nist.gov/MatrixMarket/reports/MMformat.ps):
32//!
33//! > Boisvert, Ronald F., Roldan Pozo, and Karin A. Remington.<br/>
34//! > "*The Matrix Market Exchange Formats: Initial Design.*" (1996).
35
36pub use self::matrix_market::{
37    MatrixMarketError, MatrixMarketErrorKind, MatrixMarketExport, MatrixMarketScalar,
38    load_coo_from_matrix_market_file, load_coo_from_matrix_market_str, save_to_matrix_market,
39    save_to_matrix_market_file, save_to_matrix_market_str,
40};
41mod matrix_market;