Collect all live FP32 vectors from every segment (growing, building, and sealed) in insertion order. Used to train the collection-level codec-dispatch index.
(&self)
| 13 | /// and sealed) in insertion order. Used to train the collection-level |
| 14 | /// codec-dispatch index. |
| 15 | pub(crate) fn gather_all_vectors_fp32(&self) -> Vec<Vec<f32>> { |
| 16 | let total = self.len(); |
| 17 | let mut out = Vec::with_capacity(total); |
| 18 | |
| 19 | for i in 0..self.growing.len() as u32 { |
| 20 | if let Some(v) = self.growing.get_vector(i) { |
| 21 | out.push(v.to_vec()); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | for seg in &self.building { |
| 26 | for i in 0..seg.flat.len() as u32 { |
| 27 | if let Some(v) = seg.flat.get_vector(i) { |
| 28 | out.push(v.to_vec()); |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | for seg in &self.sealed { |
| 34 | let n = seg.index.len(); |
| 35 | for i in 0..n as u32 { |
| 36 | if !seg.index.is_deleted(i) |
| 37 | && let Some(v) = seg.index.get_vector(i) |
| 38 | { |
| 39 | out.push(v.to_vec()); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | out |
| 45 | } |
| 46 | |
| 47 | /// Build a codec-dispatched index over all current vectors using the |
| 48 | /// requested quantization. Replaces any existing dispatch index for |
no test coverage detected