Bump M up to 24

This commit is contained in:
Dirkjan Ochtman 2021-01-12 13:37:07 +01:00
parent 581b3a17e2
commit 04094ce06f
1 changed files with 8 additions and 2 deletions

View File

@ -617,7 +617,7 @@ impl Node for UpperNode {
}
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Default)]
#[derive(Clone, Copy, Debug)]
struct ZeroNode {
/// The nearest neighbors on this layer
///
@ -625,6 +625,12 @@ struct ZeroNode {
nearest: [PointId; M * 2],
}
impl Default for ZeroNode {
fn default() -> ZeroNode {
ZeroNode { nearest: [PointId::invalid(); M * 2] }
}
}
impl Node for ZeroNode {
fn nearest_mut(&mut self) -> &mut [PointId] {
&mut self.nearest
@ -760,4 +766,4 @@ impl Index<PointId> for [ZeroNode] {
/// The parameter `M` from the paper
///
/// This should become a generic argument to `Hnsw` when possible.
const M: usize = 12;
const M: usize = 24;