pub fn quantize_normalized(v: &[f32]) -> Vec<i8>Expand description
Quantizes a vector of f32 values into 8-bit integers.
This function assumes the vector is meant to be normalized. It computes the L₂‐norm and (if needed) normalizes the vector so that its entries are in approximately [-1, 1]. Then, each value is scaled by 127 and rounded into an i8.
Note that the returned dot products (via quantized_dot_product) will not be in the
same range as full‑precision ones—but the ranking (ordering) will be similar.