flow-linalg
Pure-Rust linear algebra primitives for flow cytometry, built on faer.
Overview
flow-linalg provides the core matrix operations needed for:
Features
- Spillover estimation: Per-control column from median(positive) − median(negative), diagonal-normalized so
S[j][j] = 1. - Spillover inversion: Partial-pivot LU decomposition via
faer. Validates matrix is square and non-singular before inversion. - Compensation application: Per-event matrix-vector multiply, parallelized across output channels with
rayon. Validates event count consistency across input channels - Matrix condition number / complexity metrics
- Hotspot (similarity / mixing-matrix) diagnostics for spectral panels
| Feature Flag | Description |
|---|---|
compensation |
Spillover matrix inversion and per-event compensation |
How it Works
Compensation uses the faer crate's LU for spillover inversion and Rayon-parallel per-channel application when the compensation feature is on.
Condition number metrics use SVD ((κ₂)).
Hotspot matrix helpers operate on cosine-similarity or unit-normalized mixing-matrix Gram forms. No system BLAS is required.
Installation
Or add it directly to your Cargo.toml:
[]
= { = "0.1.3", = ["compensation"] }
API Usage
use ;
use ;
use Result;
use Mat;
use HashMap;
Performance
No published numbers yet. compensation parallelizes across output channels.
Prefer measuring on your panel size rather than just micro-benching.
Tests
License
MIT
Related Crates
- Plotting or gating →
flow-plots,flow-gates - FCS file parsing →
flow-fcs— FCS I/O and optional compensation integration - Spectral unmixing →
flow-tru-ols— Truncated Re-Unmixing OLS - Unmixing via CLI →
tru-ols-cliCLI for Unmix + QC pipeline