Function deserialize_sparse_matrix

Source
pub fn deserialize_sparse_matrix<P, A>(
    path: P,
    format: SerializationFormat,
) -> Result<SparseMatrixCOO<A>>
where P: AsRef<Path>, A: for<'de> Deserialize<'de>,
Expand description

Deserialize a sparse matrix from a file

§Arguments

  • path - Path to the input file
  • format - Serialization format

§Returns

  • Result<SparseMatrixCOO<A>> - Deserialized sparse matrix or error

§Examples

use scirs2_io::serialize::{deserialize_sparse_matrix, SerializationFormat};

// Deserialize sparse matrix
let sparse = deserialize_sparse_matrix::<_, f64>("sparse.json", SerializationFormat::JSON).unwrap();
println!("Sparse matrix: {}x{} with {} non-zero elements", sparse.rows, sparse.cols, sparse.nnz());