legume_numeric/lib.rs
1//! Numeric / ML foundation for the legume ecosystem.
2//!
3//! Modules:
4//! - [`fast_math`]: fast, approximate `f32` `ln` and `ln Γ`, and `ln Γ` increments
5//! - [`leiden`] — vendored CWTS/10x Leiden port (see `NOTICE`)
6//! - [`matrix`] — matrix IO, KNN, layout, stats (ex `matrix-util`)
7//! - `param` — parametric helpers (ex `matrix-param`)
8//! - `candle` — candle training helpers (ex `candle-util`; feature `candle`)
9//! - `mcmc` — MCMC engine: elliptical slice sampler, chain runner, diagnostics (feature `mcmc`)
10//!
11//! Features: `matrix` and `param` work on nalgebra `DMatrix` alone.
12//! `tensor` (default) adds candle `Tensor` support to the matrix code:
13//! conversions, tensor IO, sampling and fused ops. `ndarray` (default) adds
14//! ndarray `Array2` support: IO, sampling, `ndarray_stat`, `ndarray_gamma`
15//! and kNN from ndarray views. `candle` builds on `tensor`. `metal` and
16//! `cuda` also run matrix code on the GPU (`Umap::fit_on`). A crate
17//! that only needs `DMatrix` sets `default-features = false` with `matrix`
18//! (or `param`) and links neither candle nor ndarray; with no features the
19//! crate is `leiden` and `fast_math` alone.
20
21pub mod fast_math;
22pub mod leiden;
23
24/// candle-core, for crates that use `Tensor` through the `tensor` feature
25/// without a direct dependency on candle.
26#[cfg(feature = "tensor")]
27pub use candle_core;
28
29#[cfg(feature = "matrix")]
30pub mod matrix;
31
32#[cfg(feature = "param")]
33pub mod param;
34
35#[cfg(feature = "candle")]
36pub mod candle;
37
38#[cfg(feature = "mcmc")]
39pub mod mcmc;