1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Serving indexes that the [siann](https://pypi.org/project/siann/) Python package built: load the file
//! `index.save(path)` wrote, and search it on the CPU from Rust, with the same neighbors, in the same order, as
//! the Python package's search on the CPU. Build and calibrate where building is fast (a GPU, through siann's
//! own builder, NVIDIA's cuVS or mlxvs); serve the saved index from a Rust service on any machine.
//!
//! ```no_run
//! let index = siann::Index::load("approx.siann")?;
//! let queries = vec![0.0f32; 10 * index.dim()]; // ten queries, row by row
//! let found = index.search(&queries, 10)?; // each query's 10 nearest
//! println!("{:?} {:?}", &found.ids[..10], &found.scores[..10]);
//! # Ok::<(), siann::Error>(())
//! ```
//!
//! Exact search, the IVF and CAGRA graphs, for L2, cosine, inner product, L1 and L-infinity; each batch takes
//! the path the index measured fastest on the CPU for its size, at the calibrated widths, unless
//! [`Index::search_with`] names one. Scores are each metric's natural value (the distance for L2, L1 and
//! L-infinity; the similarity for cosine and inner product). The same code is the Python package's CPU engine;
//! its other modules are internal.
// allowed only in `blas` (the calls into the platform's BLAS) and `half` (float16 widening)
pub use ;
/// An error, as a message: the bindings raise it as Python's `ValueError`.
pub type Result<T> = Result;
/// A matrix borrowed from the caller, row-major: `data` holds `rows` rows of `cols` values.