pub struct IvfIndex {
pub vectors: VecStore,
pub original_ids: Vec<u32>,
pub cluster_starts: Vec<u32>,
pub tag_clusters: Vec<Vec<u16>>,
pub dim: usize,
pub n_clusters: usize,
/* private fields */
}Expand description
IVF² index: geometric clusters × per-cluster tag posting lists.
Fields§
§vectors: VecStoreReordered vectors (contiguous per cluster).
original_ids: Vec<u32>Mapping: reordered_id → original_id.
cluster_starts: Vec<u32>Cluster boundaries: cluster c spans [cluster_starts[c]..cluster_starts[c+1]).
tag_clusters: Vec<Vec<u16>>Per-tag list of clusters containing matching vectors.
dim: usizeVector dimensionality.
n_clusters: usizeNumber of clusters.
Implementations§
Source§impl IvfIndex
impl IvfIndex
Sourcepub fn build(
base: &VecStore,
base_meta: &SpMat,
assignments: &[u16],
n: usize,
dim: usize,
n_clusters: usize,
) -> Self
pub fn build( base: &VecStore, base_meta: &SpMat, assignments: &[u16], n: usize, dim: usize, n_clusters: usize, ) -> Self
Build IVF² index from clustered vectors and metadata.
Reorders vectors by cluster, sorts within each cluster by most popular tag (tag-affinity sort), and builds per-cluster tag posting lists.
Sourcepub fn batch_search_mqcb(
&self,
queries: &QueryStore<'_>,
nq: usize,
query_tags: &[Vec<usize>],
query_binary: &[Vec<u64>],
query_top_clusters: &[Vec<usize>],
binary: &BinaryStore,
k: usize,
ef: usize,
n_probe: usize,
binary_rerank: usize,
) -> Vec<Vec<u32>>
pub fn batch_search_mqcb( &self, queries: &QueryStore<'_>, nq: usize, query_tags: &[Vec<usize>], query_binary: &[Vec<u64>], query_top_clusters: &[Vec<usize>], binary: &BinaryStore, k: usize, ef: usize, n_probe: usize, binary_rerank: usize, ) -> Vec<Vec<u32>>
MQCB: processes queries grouped by cluster for L3 cache reuse.
Auto Trait Implementations§
impl Freeze for IvfIndex
impl RefUnwindSafe for IvfIndex
impl Send for IvfIndex
impl Sync for IvfIndex
impl Unpin for IvfIndex
impl UnsafeUnpin for IvfIndex
impl UnwindSafe for IvfIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more