Bump M up to 32
This commit is contained in:
parent
58bb0f315a
commit
7690d09fb8
|
@ -5,6 +5,9 @@ license = "MIT OR Apache-2.0"
|
|||
authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"]
|
||||
edition = "2018"
|
||||
|
||||
[features]
|
||||
with-serde = ["serde", "serde-big-array"]
|
||||
|
||||
[dependencies]
|
||||
indicatif = { version = "0.15", optional = true }
|
||||
num_cpus = "1.13"
|
||||
|
@ -13,6 +16,7 @@ parking_lot = "0.11"
|
|||
rand = { version = "0.8", features = ["small_rng"] }
|
||||
rayon = "1.5"
|
||||
serde = { version = "1.0.118", features = ["derive"], optional = true }
|
||||
serde-big-array = { version = "0.3.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
bencher = "0.1.5"
|
||||
|
|
|
@ -675,4 +675,4 @@ pub trait Point: Clone + Sync {
|
|||
/// The parameter `M` from the paper
|
||||
///
|
||||
/// This should become a generic argument to `Hnsw` when possible.
|
||||
const M: usize = 12;
|
||||
const M: usize = 32;
|
||||
|
|
|
@ -7,6 +7,8 @@ use rand::rngs::SmallRng;
|
|||
use rand::Rng;
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "serde-big-array")]
|
||||
use serde_big_array::big_array;
|
||||
|
||||
use crate::{Hnsw, Point, M};
|
||||
|
||||
|
@ -80,7 +82,12 @@ impl<'a> Layer for &'a [UpperNode] {
|
|||
|
||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(crate) struct ZeroNode(pub(crate) [PointId; M * 2]);
|
||||
pub(crate) struct ZeroNode(
|
||||
#[cfg_attr(feature = "serde", serde(with = "BigArray"))] pub(crate) [PointId; M * 2],
|
||||
);
|
||||
|
||||
#[cfg(feature = "serde-big-array")]
|
||||
big_array! { BigArray; }
|
||||
|
||||
impl ZeroNode {
|
||||
pub(crate) fn rewrite(&mut self, mut iter: impl Iterator<Item = PointId>) {
|
||||
|
|
Loading…
Reference in New Issue