mirror of
https://github.com/instant-labs/instant-distance.git
synced 2025-02-16 12:52:08 +00:00
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>"]
|
authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
with-serde = ["serde", "serde-big-array"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
indicatif = { version = "0.15", optional = true }
|
indicatif = { version = "0.15", optional = true }
|
||||||
num_cpus = "1.13"
|
num_cpus = "1.13"
|
||||||
@ -13,6 +16,7 @@ parking_lot = "0.11"
|
|||||||
rand = { version = "0.8", features = ["small_rng"] }
|
rand = { version = "0.8", features = ["small_rng"] }
|
||||||
rayon = "1.5"
|
rayon = "1.5"
|
||||||
serde = { version = "1.0.118", features = ["derive"], optional = true }
|
serde = { version = "1.0.118", features = ["derive"], optional = true }
|
||||||
|
serde-big-array = { version = "0.3.1", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bencher = "0.1.5"
|
bencher = "0.1.5"
|
||||||
|
@ -675,4 +675,4 @@ pub trait Point: Clone + Sync {
|
|||||||
/// The parameter `M` from the paper
|
/// The parameter `M` from the paper
|
||||||
///
|
///
|
||||||
/// This should become a generic argument to `Hnsw` when possible.
|
/// 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;
|
use rand::Rng;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
#[cfg(feature = "serde-big-array")]
|
||||||
|
use serde_big_array::big_array;
|
||||||
|
|
||||||
use crate::{Hnsw, Point, M};
|
use crate::{Hnsw, Point, M};
|
||||||
|
|
||||||
@ -80,7 +82,12 @@ impl<'a> Layer for &'a [UpperNode] {
|
|||||||
|
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[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 {
|
impl ZeroNode {
|
||||||
pub(crate) fn rewrite(&mut self, mut iter: impl Iterator<Item = PointId>) {
|
pub(crate) fn rewrite(&mut self, mut iter: impl Iterator<Item = PointId>) {
|
||||||
|
Loading…
Reference in New Issue
Block a user