Function nalgebra_sparse::io::load_coo_from_matrix_market_file
source · pub fn load_coo_from_matrix_market_file<T, P: AsRef<Path>>(
path: P
) -> Result<CooMatrix<T>, MatrixMarketError>where
T: MatrixMarketScalar,
Expand description
Parses a Matrix Market file at the given path as a CooMatrix
.
The matrix market format specification does not clarify whether duplicate entries are allowed. Our importer
assumes that this is permitted and produces a CooMatrix
with possibly duplicate entries.
Note: A current restriction of the importer is that you must use a compatible scalar type when importing.
For example, in order to import a matrix stored as integer
in the matrix market format, you must
import it as an integer matrix, otherwise a TypeMismatch error
will be returned. This restriction may be lifted in the future, and is
tracked by issue #1038.
Errors
See MatrixMarketErrorKind for a list of possible error conditions.
Examples
use nalgebra_sparse::io::load_coo_from_matrix_market_file;
// Use e.g. `i32` for integer matrices
let matrix = load_coo_from_matrix_market_file::<i32,_>("path/to/matrix.mtx").unwrap();