Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork30
Fast approximate nearest neighbor searching in Rust, based on HNSW index
License
djc/instant-distance
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Instance Distance is a fast pure-Rust implementation of theHierarchicalNavigable Small Worlds paper by Malkov and Yashunin for findingapproximate nearest neighbors. This implementation powers theInstant Domain Search backend services used for word vector indexing.
Instant Distance is an implementation of a fast approximate nearest neighborsearch algorithm. The algorithm is used to find the closest point(s) to a givenpoint in a set. As one example, it can be used to makesimple translations.
[dependencies]instant-distance ="0.5.0"
use instant_distance::{Builder,Search};fnmain(){let points =vec![Point(255,0,0),Point(0,255,0),Point(0,0,255)];let values =vec!["red","green","blue"];let map =Builder::default().build(points, values);letmut search =Search::default();let cambridge_blue =Point(163,193,173);let closest_point = map.search(&cambridge_blue,&mut search).next().unwrap();println!("{:?}", closest_point.value);}#[derive(Clone,Copy,Debug)]structPoint(isize,isize,isize);impl instant_distance::PointforPoint{fndistance(&self,other:&Self) ->f32{// Euclidean distance metric(((self.0 - other.0).pow(2) +(self.1 - other.1).pow(2) +(self.2 - other.2).pow(2))asf32).sqrt()}}
Rust:
cargo t -p instant-distance --all-features
Python:
make test-python
About
Fast approximate nearest neighbor searching in Rust, based on HNSW index
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.