Skip to main content

Crate flow_pacmap

Crate flow_pacmap 

Source
Expand description

§flow-pacmap

First-party implementation of PaCMAP (Pairwise Controlled Manifold Approximation Projection) from Wang et al. 2021 (JMLR 22, Algorithm 1).

Designed for large-n flow cytometry data:

  • No ndarray version conflicts — pure &[f32] / Vec<[f32;2]> API
  • PCA via faer SVD on the d×d covariance matrix (O(n·d²), no large intermediates)
  • HNSW KNN via usearch (C++ FFI, hardware SIMD, optional f16 quantization)
  • All pair counts use checked_mul; no debug-mode overflow panics
  • Progress reporting via mpsc::Sender<PaCMAPProgress> (per phase + every 10 iters)
  • Cancellation via Arc<AtomicBool>
  • Staged KNN: compute_knnKnnGraph → optional input to fit_transform

Re-exports§

pub use config::Init;
pub use config::OptimizeBackend;
pub use config::PaCMAPConfig;
pub use error::PaCMAPError;
pub use knn::compute_knn;
pub use knn::validate_knn_for_pacmap;

Modules§

adam
Adam optimizer step for the 2-D embedding.
config
Configuration types for a PaCMAP embedding run.
error
Error types for flow-pacmap.
gradient
PaCMAP loss gradient computation (Algorithm 1, Wang et al. 2021).
knn
Re-export and PaCMAP-facing adapters for flow_knn.
pairs
Near, mid-near, and further pair construction from Algorithm 1.
pca
PCA initialisation for PaCMAP.
weights
Three-phase weight schedule from Algorithm 1 of Wang et al. 2021.

Structs§

HnswParams
Quality / memory trade-off for HNSW indices (usearch or ann-search-rs).
KnnGraph
Portable k-nearest-neighbour graph: per-point indices and distances only.
NeighborList
Neighbours of a single query point.
PaCMAPProgress
Progress event emitted during optimization.

Enums§

DistanceMetric
Distance metric for the KNN graph.
KnnMethod
Approximate / exact nearest-neighbour method.
Quantization
Vector quantization for usearch HNSW storage.

Functions§

fit_transform
Embed n × d row-major f32 data into 2 dimensions.
read_knn_graph
Read a KnnGraph previously written by write_knn_graph.
write_knn_graph
Write a KnnGraph to path (creates/overwrites the file).