Reformatted files, changed package name, added description

This commit is contained in:
Olek 2016-12-29 01:44:18 +01:00
parent 4ea61ebfbc
commit 9f03f67c1d
6 changed files with 42 additions and 40 deletions

View File

@ -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 = "*"

View File

@ -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.];

View File

@ -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");

View File

@ -1,6 +1,7 @@
#[cfg(test)]
pub mod tests_utils {
use super::super::*;
#[derive(Copy, Clone, PartialEq)]
pub struct Point3WithId {
dims: [f64; 3],

View File

@ -2,6 +2,7 @@
#[macro_use]
extern crate quickcheck;
#[cfg(test)]
extern crate rand;
pub mod kdtree;