LshIndex class

Sign-projection LSH over dense vectors. See file header for semantics. Codes are packed into (nbits + 7) ~/ 8 bytes each.

Constructors

LshIndex(int dim, {int nbits = 64, int seed = 1234})

Properties

codeSize int
final
dim int
final
hashCode int
The hash code for this object.
no setterinherited
length int
no setter
liveIds Iterable<Object?>
V50: snapshot of ids in insertion order.
no setter
nbits int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(Object? id, Vector v) → void
Add v under key id. Encodes on-the-fly; codes are stored contiguously in _codes.
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. Swap-last, O(N) in the id lookup.
Top-k nearest neighbors of query under Hamming distance. The metric argument is accepted for API symmetry with the other index kinds but ignored — LSH always ranks in Hamming space.
toJson(int seed) Map<String, Object?>
Serialize the built code table. Projectors are regenerated from (seed, nbits, dim) on load — no need to persist them.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromJson(Map<String, Object?> j) LshIndex
Reconstruct an LshIndex from toJson output.