petal-neighbors

Crates.iopetal-neighbors
lib.rspetal-neighbors
version0.11.0
sourcesrc
created_at2019-11-21 03:01:35.843754
updated_at2024-08-08 00:40:42.104354
descriptionNearest neighbor search algorithms including a ball tree and a vantage point tree.
homepagehttps://github.com/petabi/petal-neighbors
repositoryhttps://github.com/petabi/petal-neighbors
max_upload_size
id183117
size59,697
(minshao)

documentation

https://docs.rs/petal-neighbors

README

petal-neighbors

Nearest neighbor search algorithms including a ball tree and a vantage point tree.

crates.io Documentation Coverage Status

Examples

The following example shows how to find two nearest neighbors in a ball tree.

use ndarray::{array, aview1};
use petal_neighbors::BallTree;

let points = array![[1., 1.], [1., 2.], [9., 9.]];
let tree = BallTree::euclidean(points).unwrap();
let (indices, distances) = tree.query(&aview1(&[3., 3.]), 2);
assert_eq!(indices, &[1, 0]);  // points[1] is the nearest, points[0] the next.

License

Copyright 2019-2024 Petabi, Inc.

Licensed under Apache License, Version 2.0 (the "License"); you may not use this crate except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See LICENSE for the specific language governing permissions and limitations under the License.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Commit count: 103

cargo fmt