1#![cfg_attr(target_arch = "x86_64", feature(avx512_target_feature))]
2#![cfg_attr(target_arch = "x86_64", feature(stdarch_x86_avx512))]
3
4pub mod brute_force;
5pub mod index;
6pub mod io;
7pub mod ivf;
8pub mod mstg;
9
10#[cfg(feature = "python")]
11pub mod python_bindings;
12
13mod kmeans;
14mod math;
15mod memory;
16mod quantizer;
17mod rotation;
18mod simd;
19
20pub use brute_force::{BruteForceRabitqIndex, BruteForceSearchParams, BruteForceSearchResult};
21pub use index::RabitqIndex;
22pub use ivf::{IvfRabitqIndex, SearchParams, SearchResult};
23pub use quantizer::{QuantizedVector, RabitqConfig};
24pub use rotation::RotatorType;
25
26pub use roaring::RoaringBitmap;
28
29#[cfg(test)]
30mod tests;
31
32#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
34pub enum Metric {
35 L2,
37 InnerProduct,
39}
40
41#[derive(thiserror::Error, Debug)]
43pub enum RabitqError {
44 #[error("dimension mismatch: expected {expected}, got {got}")]
46 DimensionMismatch { expected: usize, got: usize },
47 #[error("invalid configuration: {0}")]
49 InvalidConfig(&'static str),
50 #[error("index is empty; call `train` first")]
52 EmptyIndex,
53 #[error("i/o error while reading or writing an index: {0}")]
55 Io(#[from] std::io::Error),
56 #[error("invalid persisted index: {0}")]
58 InvalidPersistence(&'static str),
59}