MCPcopy Create free account
hub / github.com/SingleRust/SingleRust / convert_to_array_f64_csr

Function convert_to_array_f64_csr

src/shared/mod.rs:348–359  ·  view source on GitHub ↗
(
    csr: &CsrMatrix<T>,
    shape: Shape,
)

Source from the content-addressed store, hash-verified

346}
347
348fn convert_to_array_f64_csr<T: NumericOps>(
349 csr: &CsrMatrix<T>,
350 shape: Shape,
351) -> anyhow::Result<Array2<f64>> {
352 let mut dense = Array2::<f64>::zeros((shape[0], shape[1]));
353 for (row, vec) in csr.row_iter().enumerate() {
354 for (&col, val) in vec.col_indices().iter().zip(csr.values()) {
355 dense[[row, col]] = NumCast::from(*val).unwrap();
356 }
357 }
358 Ok(dense)
359}
360
361fn convert_to_array_f64_csr_selected<T: NumericOps>(
362 csr: &CsrMatrix<T>,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected