Search::select_simple() doesn't need to take a length
This commit is contained in:
parent
50c4ed60bc
commit
c6087de542
|
@ -340,7 +340,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let nearest = search.select_simple(out.len());
|
let nearest = &search.select_simple()[..out.len()];
|
||||||
for (i, candidate) in nearest.iter().enumerate() {
|
for (i, candidate) in nearest.iter().enumerate() {
|
||||||
out[i] = candidate.pid;
|
out[i] = candidate.pid;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ fn insert<P: Point>(
|
||||||
heuristic: &Option<Heuristic>,
|
heuristic: &Option<Heuristic>,
|
||||||
) {
|
) {
|
||||||
let found = match heuristic {
|
let found = match heuristic {
|
||||||
None => search.select_simple(M * 2),
|
None => &search.select_simple()[..M * 2],
|
||||||
Some(heuristic) => search.select_heuristic(&points[new], layer, points, *heuristic),
|
Some(heuristic) => search.select_heuristic(&points[new], layer, points, *heuristic),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -653,8 +653,7 @@ impl Search {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Selection of neighbors for insertion (algorithm 3 from the paper)
|
/// Selection of neighbors for insertion (algorithm 3 from the paper)
|
||||||
fn select_simple(&mut self, num: usize) -> &[Candidate] {
|
fn select_simple(&mut self) -> &[Candidate] {
|
||||||
self.nearest.truncate(num);
|
|
||||||
&self.nearest
|
&self.nearest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue