# fastbaps-core

Fast Bayesian hierarchical clustering of bacterial population structure — the
pure-Rust core of [fastbaps-py](https://github.com/thanhleviet/fastbaps-py).

This crate has no Python dependency. It implements the numerical kernels that
operate directly on sparse SNP count data:

- `likelihood` — the Dirichlet-multinomial marginal log-likelihood kernel
- `lgamma_table` — a quantized lgamma lookup table for the inner loop
- `logspace` — numerically stable `log_sum_exp` / `log_subtract`
- `calc_ddk` — bottom-up `dk` and cluster-size passes over a merge tree
- `tree_llk` — full-tree marginal-likelihood and `rk` pass
- `bhc` — Rayon-parallel Bayesian hierarchical clustering of partitions
- `summarise_clusters` — cut a merge tree at an `rk` threshold into labels

## Status

The public API operates on flat slices and `ndarray`/`sprs` types
(`&[u8]`, `&[usize]`, `&Array2<f64>`, `&[(i32, i32)]`). It is the engine behind
the `fastbaps` Python package; the Python bindings live in the companion
`fastbaps-py` crate.

## License

Licensed under either of MIT or Apache-2.0 at your option.
