Function nalgebra_sparse::io::save_to_matrix_market_file
source · pub fn save_to_matrix_market_file<T, S, P>(
sparse_matrix: &S,
path: P
) -> Result<(), Error>where
T: MatrixMarketScalar,
S: MatrixMarketExport<T>,
P: AsRef<Path>,
Expand description
Save a sparse matrix to a Matrix Market format file.
The exporter only saves the matrix with the coordinate
and general
matrix market formats.
Errors
See MatrixMarketErrorKind for a list of possible error conditions.
Examples
use nalgebra_sparse::io::{save_to_matrix_market_file,load_coo_from_matrix_market_str};
let str = r#"
%%matrixmarket matrix coordinate integer general
5 4 2
1 1 10
2 3 5
"#;
let matrix = load_coo_from_matrix_market_str::<i32>(&str)?;
save_to_matrix_market_file(&matrix,"path/to/matrix.mtx")?;