add method
Add v under key id. Requires train to have been called.
Implementation
void add(Object? id, Vector v) {
if (!_trained) {
throw StateError('IvfFlatIndex.add: call train() first');
}
if (v.dim != dim) {
throw StateError(
'IvfFlatIndex.add: vector dim ${v.dim} != index dim $dim',
);
}
// Assign — need a Float32List for centroid math; wrap v.values.
final cell = _quantizer.assign(v.values, 0);
_pushToCell(cell, v, id);
_n++;
}