code wiki / _hdl_build / nx_vec_nsw.nx
nx_vec_nsw.nx
buildroot/runtime/_hdl_build/nx_vec_nsw.nx
about
nx_vec_nsw.nx -- R-VEC-3 of the onsite-search S-class ladder: SOVEREIGN approximate-nearest-neighbor INDEX via
a Navigable Small World proximity graph (LIBRARY). "Illustration of the multi-layered search process of a
Hierarchical Navigable Small World graph" (cited srch_hnsw.raw) -- this builds the SINGLE-LAYER NSW core (the
base HNSW stacks into layers); an ANN search "is allowed to return points whose distance is at most c*d"
(cited srch_ann.raw) for huge speedups over brute force. Reuses R-VEC-0 vr_cos_milli for distance (higher
cosine = nearer). HONEST SCOPE: single-layer NSW + ef-beam greedy search; hierarchical layers = the named
HNSW extension. Sub-linear because search only walks the graph neighborhood, not all N vectors.
exports: vr_nsw_build, vr_nsw_search. license_tier: ORIGINAL
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_vec_kernel.nx
imported by: nx_vec_nsw_gate.nx
structs
| none |
consts
| 12 | const K_MAGIC_2000000: i64 = 2000000 |
functions
| 15 | func nsw_addedge(adj: *i64, deg: *i64, MMAX: i64, a: i64, b: i64) -> i64 called by 1: vr_nsw_build |
| 23 | func vr_nsw_build(V: *i64, N: i64, D: i64, M: i64, MMAX: i64, adj: *i64, deg: *i64) -> i64 |
| 51 | func vr_nsw_search(V: *i64, N: i64, D: i64, query: *i64, entry: i64, ef: i64, MMAX: i64, adj: *i64, deg: *i64, |