Expand description
Flat spatial index with brute-force nearest-neighbour and radius search.
Supports Euclidean, Manhattan, and Cosine distance metrics. Designed as a lightweight, dependency-free baseline that can be swapped for an HNSW implementation when the dataset outgrows brute-force search.
§Optimizations
- Points stored in a flat
Vec<f32>buffer (stride = dimensions) for cache locality and zero per-point heap allocation. - Euclidean kNN uses squared distances for comparison, deferring the
sqrtto only the finalkresults. - Cosine distance computed in a single fused loop (dot, norm_a, norm_b).
Structs§
- Spatial
Index - A flat spatial index that stores points in a contiguous
f32buffer.
Enums§
- Index
Error - Errors returned by
SpatialIndexoperations.