Skip to main content

normalize

Function normalize 

Source
pub fn normalize(m: &mut CountMatrix, params: &NormalizeParams)
Expand description

Normalize each cell to target_sum (or the median of totals) then optionally apply ln(1+x). Mirrors scanpy: a zero-count cell’s scaling factor collapses to 1, leaving its (empty) row untouched, and the sparsity pattern is exact because log1p(0) = 0. A NaN count flows through untouched — its cell’s scale is NaN (never mistaken for the zero case, since NaN != 0), so the affected values normalize to NaN just as scanpy propagates them.