6 releases (3 breaking)
0.4.1 | May 9, 2024 |
---|---|
0.4.0 | May 3, 2024 |
0.3.1 | Mar 10, 2024 |
0.3.0 | Feb 20, 2024 |
0.1.0 | Feb 19, 2024 |
#770 in Math
36 downloads per month
12KB
240 lines
Vector
The package provides a vector database allowing for efficient search of nearest neighbors.
Example
use vector::Index;
let vectors = vec![
[4.0, 2.0],
[5.0, 7.0],
[2.0, 9.0],
[7.0, 8.0],
];
let index = Index::build(&vectors, 1, 1, 42);
let query = [5.0, 5.0];
let (indices, distances): (Vec<_>, Vec<_>) = index
.search(&vectors, &query, 2)
.into_iter()
.unzip();
assert_eq!(indices, &[1, 0]);
Contribution
Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.md.
Dependencies
~7KB