-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f38c00
commit bb7f3c4
Showing
11 changed files
with
1,297 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# sstree | ||
# rindex | ||
Rindex: reverse nearest neighbor search index for high-dimensional clustered datasets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod node; | ||
mod sphere; | ||
pub mod sstree; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use super::sphere::Sphere; | ||
|
||
pub struct InsertionEntry<const D: usize> { | ||
pub idx: usize, | ||
pub sphere: Sphere<D>, | ||
pub parent_height: usize, | ||
} | ||
|
||
pub struct Node<const D: usize> { | ||
pub idx: usize, | ||
pub height: usize, | ||
pub sphere: Sphere<D>, | ||
pub parent: usize, | ||
pub children: Vec<usize>, | ||
pub variance: [f64; D], | ||
pub bound: f64, | ||
} | ||
|
||
impl<const D: usize> Node<D> { | ||
pub fn new(idx: usize, height: usize, sphere: Sphere<D>, parent: usize) -> Node<D> { | ||
Node { | ||
idx, | ||
height, | ||
sphere, | ||
parent, | ||
children: Vec::new(), | ||
variance: [f64::INFINITY; D], | ||
bound: f64::INFINITY, | ||
} | ||
} | ||
|
||
pub fn is_leaf(&self) -> bool { | ||
self.height == 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::distance::euclidean; | ||
|
||
#[derive(Clone, Copy)] | ||
pub struct Sphere<const D: usize> { | ||
pub center: [f64; D], | ||
pub radius: f64, | ||
} | ||
|
||
impl<const D: usize> Sphere<D> { | ||
pub fn new(center: [f64; D], radius: f64) -> Sphere<D> { | ||
Sphere { center, radius } | ||
} | ||
|
||
pub fn min_distance(&self, other: &[f64; D]) -> f64 { | ||
(euclidean(&self.center, other) - self.radius).max(0.) | ||
} | ||
} |
Oops, something went wrong.