pub fn array2_to_csc_with_tolerance<T: Scalar + Clone + Field>(
arr: &Array2<T>,
tolerance: Option<<T as Scalar>::Real>,
) -> CscMatrix<T>Expand description
Converts a dense Array2 to CSC (Compressed Sparse Column) format, with an explicit, opt-in tolerance for approximate sparsification.
§Arguments
arr- Dense 2D arraytolerance-Noneselects exact-zero sparsification (seearray2_to_csc).Some(tol)explicitly opts into dropping any entry withabs(value) <= tol; this must be a deliberate, user-supplied choice, never a silent default, because it changes the numerical content of the matrix.
NaN entries are always retained (stored explicitly) regardless of
tolerance, since a NaN is technically non-zero and silently
discarding it would be data corruption.
§Returns
CSC matrix containing the retained entries