Return a dim×dim row-major identity matrix.
(dim: usize)
| 180 | |
| 181 | /// Return a dim×dim row-major identity matrix. |
| 182 | fn identity(dim: usize) -> Vec<f32> { |
| 183 | let mut mat = vec![0.0f32; dim * dim]; |
| 184 | for i in 0..dim { |
| 185 | mat[i * dim + i] = 1.0; |
| 186 | } |
| 187 | mat |
| 188 | } |
| 189 | |
| 190 | /// Dequantize PQ codes into a reconstructed vector in rotated space. |
| 191 | fn dequantize_codes(codes: &[u8], codebooks: &[Vec<Vec<f32>>]) -> Vec<f32> { |