mirror of
https://github.com/andreytkachenko/kdtree-rust.git
synced 2024-11-25 02:46:22 +04:00
Reformatted files, changed package name, added description
This commit is contained in:
parent
4ea61ebfbc
commit
9f03f67c1d
11
Cargo.toml
11
Cargo.toml
@ -1,7 +1,8 @@
|
||||
[package]
|
||||
name = "kdtree_rust"
|
||||
name = "fux_kdtree"
|
||||
version = "0.1.0"
|
||||
authors = ["Aleksander Fular <ntszar@gmail.com>"]
|
||||
authors = ["fulara <ntszar@gmail.com>"]
|
||||
description = "K-dimensional tree implemented in Rust for fast NN querying."
|
||||
|
||||
[lib]
|
||||
name = "kdtree"
|
||||
@ -12,9 +13,7 @@ bench = false
|
||||
name = "bench"
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
rand = "*"
|
||||
bencher = "*"
|
||||
|
||||
[dev-dependencies]
|
||||
quickcheck = "0.3"
|
||||
rand = "*"
|
||||
bencher = "*"
|
@ -10,6 +10,7 @@ pub fn squared_euclidean(a : &[f64], b: &[f64]) -> f64 {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn squared_euclidean_test_1d() {
|
||||
let a = [2.];
|
||||
|
@ -9,7 +9,7 @@ mod bounds;
|
||||
use self::bounds::*;
|
||||
use self::distance::*;
|
||||
|
||||
pub trait KdtreePointTrait {
|
||||
pub trait KdtreePointTrait: Copy {
|
||||
fn dims(&self) -> &[f64];
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ pub struct Kdtree<T> {
|
||||
nodes: Vec<KdtreeNode<T>>,
|
||||
}
|
||||
|
||||
impl<T: KdtreePointTrait + Copy> Kdtree<T> {
|
||||
impl<T: KdtreePointTrait> Kdtree<T> {
|
||||
pub fn new(mut points: &mut [T]) -> Kdtree<T> {
|
||||
if points.len() == 0 {
|
||||
panic!("empty vector point not allowed");
|
||||
|
@ -1,6 +1,7 @@
|
||||
#[cfg(test)]
|
||||
pub mod tests_utils {
|
||||
use super::super::*;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct Point3WithId {
|
||||
dims: [f64; 3],
|
||||
|
@ -2,6 +2,7 @@
|
||||
#[macro_use]
|
||||
extern crate quickcheck;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate rand;
|
||||
|
||||
pub mod kdtree;
|
Loading…
Reference in New Issue
Block a user