diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-05-28 16:02:25 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-06-24 10:03:44 -0400 |
commit | 97d64547f40f362120109fd23f647f15241c08d9 (patch) | |
tree | 3b69d764bbf6379bca48516684d85dd175b39578 | |
parent | 360565b36adab5f6c69e3dc09091c940a142527e (diff) | |
download | acap-97d64547f40f362120109fd23f647f15241c08d9.tar.xz |
docs: Add a README
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | README.md | 30 |
2 files changed, 31 insertions, 0 deletions
@@ -4,6 +4,7 @@ version = "0.1.0" authors = ["Tavian Barnes <tavianator@tavianator.com>"] edition = "2018" description = "A principled API for nearest neighbor search in both metric and non-metric spaces" +readme = "README.md" repository = "https://github.com/tavianator/acap" license = "MIT" keywords = ["ann", "knn", "nearest-neighbors"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..2407ebc --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +`acap` +====== + +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/tavianator/knn/blob/master/LICENSE) +[![Build Status](https://travis-ci.com/tavianator/acap.svg?branch=master)](https://travis-ci.com/tavianator/acap) + +As Close As Possible — [nearest neighbor search] in Rust. + +[nearest neighbor search]: https://en.wikipedia.org/wiki/Nearest_neighbor_search + + +Example +------- + +```rust +use acap::euclid::Euclidean; +use acap::vp::VpTree; +use acap::NearestNeighbors; + +let tree = VpTree::balanced(vec![ + Euclidean([3, 4]), + Euclidean([5, 12]), + Euclidean([8, 15]), + Euclidean([7, 24]), +]); + +let nearest = tree.nearest(&[7, 7]).unwrap(); +assert_eq!(nearest.item, &Euclidean([3, 4])); +assert_eq!(nearest.distance, 5); +``` |