nx_vq_train.nx
buildroot/runtime/nx_vq_train.nx
about
nx_vq_train.nx -- Lloyd's algorithm (k-means) VQ codebook training: moonshot rung #2. Given a training set of LPC
reflection vectors, it iteratively (1) assigns each vector to its nearest codebook entry and (2) moves each centroid
to the mean of its assigned vectors -- provably non-increasing distortion. This is the optimal CLASSICAL codebook
that neural RVQ generalises: it lowers the VQ distortion at the SAME bitrate (better coverage), the bridge from raw
VQ to the learned codebook. Composes nx_vq. Caller owns all scratch (no hidden alloc). license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_vq.nx
imported by: nx_rvq_gate.nxnx_vq_train_gate.nx
structs
| none |
consts
| none |
functions
| 9 | func vqt_vec(train: *i64, t: i64, D: i64) -> *i64 { return (train as i64 + t*D*8) as *i64 } |
| 12 | func vqt_iterate(train: *i64, T: i64, cb: *i64, K: i64, D: i64, assign: *i64, sum: *i64, cnt: *i64) -> i64 |
| 34 | func vqt_distortion(train: *i64, T: i64, cb: *i64, K: i64, D: i64) -> i64 |