Expand description
Lloyd-Max optimal scalar quantizer tables for N(0,1), precomputed offline.
Centroids and decision boundaries are computed via Lloyd’s algorithm (2000 iterations, convergence tolerance 1e-12) on the standard normal distribution, then embedded as constants. No runtime training pass.
4-bit: 16 centroids / 15 boundaries. 2-bit: 4 centroids / 3 boundaries.
Constants§
- BOUNDARIES_
4BIT - 4-bit decision boundaries (index i separates centroid i-1 and i).
- CENTROIDS_
4BIT - 4-bit Lloyd-Max centroids for N(0,1).
Functions§
- dequantize_
4bit - Dequantize a 4-bit index back to its centroid value.
- quantize_
4bit - Quantize one N(0,1)-distributed value to a 4-bit index via binary search over the decision boundaries.