Batch quantize: quantize all vectors into a contiguous byte array. Returns `dim * N` bytes laid out as `[v0_d0, v0_d1, ..., v1_d0, ...]`.
(&self, vectors: &[&[f32]])
| 105 | /// |
| 106 | /// Returns `dim * N` bytes laid out as `[v0_d0, v0_d1, ..., v1_d0, ...]`. |
| 107 | pub fn quantize_batch(&self, vectors: &[&[f32]]) -> Vec<u8> { |
| 108 | let mut out = Vec::with_capacity(self.dim * vectors.len()); |
| 109 | for v in vectors { |
| 110 | out.extend(self.quantize(v)); |
| 111 | } |
| 112 | out |
| 113 | } |
| 114 | |
| 115 | /// Dequantize INT8 back to FP32 (lossy reconstruction). |
| 116 | pub fn dequantize(&self, quantized: &[u8]) -> Vec<f32> { |