Expand description
Training-free ordinal & sign quantization for vector retrieval.
ordvec is a training-free ordinal/sign retrieval
substrate, developed within the
turbovec project (MIT, by
Ryan Codrai) and factored out here as a standalone crate. It carries
no system dependencies — no BLAS, no ndarray, no faer — and needs
no training, rotation, or codebook. Norms are analytical.
Four substrate families, all data-oblivious:
Rankstores full-precision rank vectors (u16per coordinate,2 * dimbytes per document).RankQuantbuckets each rank into1 << bitsequal-width bins and packsbitsbits per coordinate (dim * bits / 8bytes per document).Bitmapstores a top-bucket bitmap per document (one bit per coordinate) and scores viapopcount(Q AND D).SignBitmapstores a sign bitmap per document (one bit per coordinate, set when the coordinate is positive) for sign-cosine candidate generation.
use ordvec::{Rank, RankQuant};
let mut idx = RankQuant::new(1024, 2);
let docs: Vec<f32> = vec![0.0; 1024 * 10_000];
idx.add(&docs);
let queries: Vec<f32> = vec![0.0; 1024 * 4];
let res = idx.search_asymmetric(&queries, 10);
assert_eq!(res.k, 10);Re-exports§
pub use rank::Rank;pub use sign_bitmap::SignBitmap;
Modules§
- rank
- Rank math primitives and the
Rankindex type. Rank-cosine math primitives and the full-precisionRankindex. - rank_io
- Read/write ordinal/sign index files.
- sign_
bitmap - Sign-cosine bitmap retrieval substrate.
Structs§
- Bitmap
- Top-bucket bitmap index for constant-composition coarse scoring.
- Rank
Quant B-bit RankQuant index.- Search
Results - Top-k search results, laid out as
nqcontiguous blocks ofk.
Type Aliases§
- Bitmap
Index Deprecated - Rank
Index Deprecated - Rank
Quant Index Deprecated - Sign
Bitmap Index Deprecated