code wiki / _hdl_build / nx_vec_nsw.nx

nx_vec_nsw.nx

buildroot/runtime/_hdl_build/nx_vec_nsw.nx

4272 B88 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic vec
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_vec_kernel.nx nx_vec_nsw.nx nx_vec_nsw_gate.nx

imports: nx_syscalls.nxnx_vec_kernel.nx

imported by: nx_vec_nsw_gate.nx

structs

none

consts

12const K_MAGIC_2000000: i64 = 2000000

functions

15func nsw_addedge(adj: *i64, deg: *i64, MMAX: i64, a: i64, b: i64) -> i64
called by 1: vr_nsw_build
23func vr_nsw_build(V: *i64, N: i64, D: i64, M: i64, MMAX: i64, adj: *i64, deg: *i64) -> i64