Crates.io | vector |
lib.rs | vector |
version | 0.4.1 |
source | src |
created_at | 2024-02-19 13:00:25.728688 |
updated_at | 2024-05-09 16:58:41.935276 |
description | The package provides a vector database allowing for efficient search of nearest neighbors. |
homepage | https://github.com/stainless-steel/vector |
repository | https://github.com/stainless-steel/vector |
max_upload_size | |
id | 1145193 |
size | 14,576 |
The package provides a vector database allowing for efficient search of nearest neighbors.
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]);
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.