pub fn array2_to_csc<T: Scalar + Clone + Field>(arr: &Array2<T>) -> CscMatrix<T>Expand description
Converts a dense Array2 to CSC (Compressed Sparse Column) format using exact-zero sparsification.
An entry is dropped only if it compares exactly equal to zero
(value == 0). This is the mathematically correct default: a value of
1e-300 is not the same as a mathematical zero, so it is always kept,
and the numerical content of the matrix is never silently altered by
this conversion.
NaN entries are never silently dropped: because a NaN never compares
equal to zero (or to anything else), NaN-containing entries are always
treated as non-zero and stored explicitly in the sparse result.
If you instead want tolerance-based (approximate) sparsification - e.g.
to prune round-off noise below some magnitude - use
array2_to_csc_with_tolerance and pass an explicit tolerance. This
crate never applies a silent tolerance-based default.
§Arguments
arr- Dense 2D array
§Returns
CSC matrix containing every entry that is not exactly zero