From 33a671205eeaafe93942a6a6cf79115dd7b85e6b Mon Sep 17 00:00:00 2001 From: Min Shao Date: Wed, 4 Dec 2024 11:35:09 -0800 Subject: [PATCH] Correct spelling --- src/optics.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/optics.rs b/src/optics.rs index b6ea209..27bffc3 100644 --- a/src/optics.rs +++ b/src/optics.rs @@ -41,7 +41,7 @@ pub struct Optics { pub metric: M, ordered: Vec, - reacheability: Vec, + reachability: Vec, neighborhoods: Vec>, } @@ -56,7 +56,7 @@ where min_samples: 5, metric: Euclidean::default(), ordered: vec![], - reacheability: vec![], + reachability: vec![], neighborhoods: vec![], } } @@ -74,7 +74,7 @@ where min_samples, metric, ordered: vec![], - reacheability: vec![], + reachability: vec![], neighborhoods: vec![], } } @@ -88,7 +88,7 @@ where let mut clusters: HashMap> = HashMap::new(); for &id in &self.ordered { - if self.reacheability[id].is_normal() && self.reacheability[id] <= eps { + if self.reachability[id].is_normal() && self.reachability[id] <= eps { if clusters.is_empty() { outliers.push(id); } else { @@ -130,7 +130,7 @@ where }; let mut visited = vec![false; input.nrows()]; self.ordered = Vec::with_capacity(input.nrows()); - self.reacheability = vec![A::nan(); input.nrows()]; + self.reachability = vec![A::nan(); input.nrows()]; for (idx, n) in self.neighborhoods.iter().enumerate() { if visited[idx] || n.neighbors.len() < self.min_samples { continue; @@ -142,7 +142,7 @@ where &self.metric, &self.neighborhoods, &mut self.ordered, - &mut self.reacheability, + &mut self.reachability, &mut visited, ); } @@ -158,7 +158,7 @@ fn process( metric: &M, neighborhoods: &[Neighborhood], ordered: &mut Vec, - reacheability: &mut [A], + reachability: &mut [A], visited: &mut [bool], ) where A: FloatCore, @@ -183,7 +183,7 @@ fn process( visited, metric, &mut seeds, - reacheability, + reachability, ); while let Some(s) = seeds.pop() { if visited[s] { @@ -202,7 +202,7 @@ fn process( visited, metric, &mut seeds, - reacheability, + reachability, ); } } @@ -215,7 +215,7 @@ fn update( visited: &[bool], metric: &M, seeds: &mut Vec, - reacheability: &mut [A], + reachability: &mut [A], ) where A: FloatCore, S: Data, @@ -225,17 +225,17 @@ fn update( if visited[o] { continue; } - let reachdist = reacheability_distance(o, id, input, neighborhood, metric); - if !reacheability[o].is_normal() { - reacheability[o] = reachdist; + let reachdist = reachability_distance(o, id, input, neighborhood, metric); + if !reachability[o].is_normal() { + reachability[o] = reachdist; seeds.push(o); - } else if reacheability[o].lt(&reachdist) { - reacheability[o] = reachdist; + } else if reachability[o].lt(&reachdist) { + reachability[o] = reachdist; } } seeds.sort_unstable_by(|a, b| { - reacheability[*a] - .partial_cmp(&reacheability[*b]) + reachability[*a] + .partial_cmp(&reachability[*b]) .unwrap() .reverse() }); @@ -278,7 +278,7 @@ where .collect() } -fn reacheability_distance( +fn reachability_distance( o: usize, p: usize, input: &ArrayBase,