IvfPqIndex class
IVF cell-probe + PQ residual compression. Requires train(...)
before add(...) (trains coarse quantizer and PQ codebooks in
sequence). Ranks in approximate squared L2 always — the metric
argument to search is accepted for API symmetry but ignored.
Constructors
Properties
- dim → int
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isTrained → bool
-
no setter
- length → int
-
no setter
-
liveIds
→ Iterable<
Object?> -
V50: snapshot of all ids across every cell.
no setter
- m → int
-
final
- nlist → int
-
final
- nprobe ↔ int
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
Object? id, Vector v) → void -
Add
vunder keyid. Assigns to nearest cell, encodes its residual, appends the PQ code. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeId(
Object? id) → bool -
Remove the first entry whose id equals
id. Walks all cells. -
search(
Vector query, int k, {VectorMetric? metric, int? nprobe}) → List< VectorSearchHit> -
Top-
knearest neighbors ofquery. Per-callnprobeoverrides the field. -
toJson(
) → Map< String, Object?> - Serialize coarse centroids + PQ codebooks + every populated cell.
-
toString(
) → String -
A string representation of this object.
inherited
-
train(
List< Vector> samples) → void - Train coarse quantizer + PQ codebooks on residuals.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromJson(
Map< String, Object?> j) → IvfPqIndex - Reconstruct an IvfPqIndex from toJson output.