1pub type faiss_idx_t = i64;
4pub type idx_t = faiss_idx_t;
5#[repr(C)]
6#[derive(Debug, Copy, Clone)]
7pub struct FaissRangeSearchResult_H {
8 _unused: [u8; 0],
9}
10pub type FaissRangeSearchResult = FaissRangeSearchResult_H;
11#[repr(C)]
12#[derive(Debug, Copy, Clone)]
13pub struct FaissIDSelector_H {
14 _unused: [u8; 0],
15}
16pub type FaissIDSelector = FaissIDSelector_H;
17#[repr(u32)]
18#[doc = " Some algorithms support both an inner product version and a L2 search\n version."]
19#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
20pub enum FaissMetricType {
21 #[doc = "< maximum inner product search"]
22 METRIC_INNER_PRODUCT = 0,
23 #[doc = "< squared L2 search"]
24 METRIC_L2 = 1,
25 #[doc = "< L1 (aka cityblock)"]
26 METRIC_L1 = 2,
27 #[doc = "< infinity distance"]
28 METRIC_Linf = 3,
29 #[doc = "< L_p distance, p is given by metric_arg"]
30 METRIC_Lp = 4,
31 #[doc = " some additional metrics defined in scipy.spatial.distance"]
32 METRIC_Canberra = 20,
33 #[doc = " some additional metrics defined in scipy.spatial.distance"]
34 METRIC_BrayCurtis = 21,
35 #[doc = " some additional metrics defined in scipy.spatial.distance"]
36 METRIC_JensenShannon = 22,
37}
38#[repr(C)]
39#[derive(Debug, Copy, Clone)]
40pub struct FaissSearchParameters_H {
41 _unused: [u8; 0],
42}
43pub type FaissSearchParameters = FaissSearchParameters_H;
44extern "C" {
45 pub fn faiss_SearchParameters_free(obj: *mut FaissSearchParameters);
46}
47extern "C" {
48 pub fn faiss_SearchParameters_new(
49 p_sp: *mut *mut FaissSearchParameters,
50 sel: *mut FaissIDSelector,
51 ) -> ::std::os::raw::c_int;
52}
53#[repr(C)]
54#[derive(Debug, Copy, Clone)]
55pub struct FaissIndex_H {
56 _unused: [u8; 0],
57}
58pub type FaissIndex = FaissIndex_H;
59extern "C" {
60 pub fn faiss_Index_free(obj: *mut FaissIndex);
61}
62extern "C" {
63 pub fn faiss_Index_d(arg1: *const FaissIndex) -> ::std::os::raw::c_int;
64}
65extern "C" {
66 pub fn faiss_Index_is_trained(arg1: *const FaissIndex) -> ::std::os::raw::c_int;
67}
68extern "C" {
69 pub fn faiss_Index_ntotal(arg1: *const FaissIndex) -> idx_t;
70}
71extern "C" {
72 pub fn faiss_Index_metric_type(arg1: *const FaissIndex) -> FaissMetricType;
73}
74extern "C" {
75 pub fn faiss_Index_verbose(arg1: *const FaissIndex) -> ::std::os::raw::c_int;
76}
77extern "C" {
78 pub fn faiss_Index_set_verbose(arg1: *mut FaissIndex, arg2: ::std::os::raw::c_int);
79}
80extern "C" {
81 #[doc = " Perform training on a representative set of vectors\n\n @param index opaque pointer to index object\n @param n nb of training vectors\n @param x training vectors, size n * d"]
82 pub fn faiss_Index_train(
83 index: *mut FaissIndex,
84 n: idx_t,
85 x: *const f32,
86 ) -> ::std::os::raw::c_int;
87}
88extern "C" {
89 #[doc = " Add n vectors of dimension d to the index.\n\n Vectors are implicitly assigned labels ntotal .. ntotal + n - 1\n This function slices the input vectors in chunks smaller than\n blocksize_add and calls add_core.\n @param index opaque pointer to index object\n @param x input matrix, size n * d"]
90 pub fn faiss_Index_add(
91 index: *mut FaissIndex,
92 n: idx_t,
93 x: *const f32,
94 ) -> ::std::os::raw::c_int;
95}
96extern "C" {
97 #[doc = " Same as add, but stores xids instead of sequential ids.\n\n The default implementation fails with an assertion, as it is\n not supported by all indexes.\n\n @param index opaque pointer to index object\n @param xids if non-null, ids to store for the vectors (size n)"]
98 pub fn faiss_Index_add_with_ids(
99 index: *mut FaissIndex,
100 n: idx_t,
101 x: *const f32,
102 xids: *const idx_t,
103 ) -> ::std::os::raw::c_int;
104}
105extern "C" {
106 #[doc = " query n vectors of dimension d to the index.\n\n return at most k vectors. If there are not enough results for a\n query, the result array is padded with -1s.\n\n @param index opaque pointer to index object\n @param x input vectors to search, size n * d\n @param labels output labels of the NNs, size n*k\n @param distances output pairwise distances, size n*k"]
107 pub fn faiss_Index_search(
108 index: *const FaissIndex,
109 n: idx_t,
110 x: *const f32,
111 k: idx_t,
112 distances: *mut f32,
113 labels: *mut idx_t,
114 ) -> ::std::os::raw::c_int;
115}
116extern "C" {
117 #[doc = " query n vectors of dimension d with seach parameters to the index.\n\n return at most k vectors. If there are not enough results for a query,\n the result is padded with -1s.\n\n @param index opaque pointer to index object\n @param x input vectors to search, size n * d\n @param params input params to modify how search is done\n @param labels output labels of the NNs, size n*k\n @param distances output pairwise distances, size n*k"]
118 pub fn faiss_Index_search_with_params(
119 index: *const FaissIndex,
120 n: idx_t,
121 x: *const f32,
122 k: idx_t,
123 params: *const FaissSearchParameters,
124 distances: *mut f32,
125 labels: *mut idx_t,
126 ) -> ::std::os::raw::c_int;
127}
128extern "C" {
129 #[doc = " query n vectors of dimension d to the index.\n\n return all vectors with distance < radius. Note that many\n indexes do not implement the range_search (only the k-NN search\n is mandatory).\n\n @param index opaque pointer to index object\n @param x input vectors to search, size n * d\n @param radius search radius\n @param result result table"]
130 pub fn faiss_Index_range_search(
131 index: *const FaissIndex,
132 n: idx_t,
133 x: *const f32,
134 radius: f32,
135 result: *mut FaissRangeSearchResult,
136 ) -> ::std::os::raw::c_int;
137}
138extern "C" {
139 #[doc = " return the indexes of the k vectors closest to the query x.\n\n This function is identical as search but only return labels of neighbors.\n @param index opaque pointer to index object\n @param x input vectors to search, size n * d\n @param labels output labels of the NNs, size n*k"]
140 pub fn faiss_Index_assign(
141 index: *mut FaissIndex,
142 n: idx_t,
143 x: *const f32,
144 labels: *mut idx_t,
145 k: idx_t,
146 ) -> ::std::os::raw::c_int;
147}
148extern "C" {
149 #[doc = " removes all elements from the database.\n @param index opaque pointer to index object"]
150 pub fn faiss_Index_reset(index: *mut FaissIndex) -> ::std::os::raw::c_int;
151}
152extern "C" {
153 #[doc = " removes IDs from the index. Not supported by all indexes\n @param index opaque pointer to index object\n @param nremove output for the number of IDs removed"]
154 pub fn faiss_Index_remove_ids(
155 index: *mut FaissIndex,
156 sel: *const FaissIDSelector,
157 n_removed: *mut usize,
158 ) -> ::std::os::raw::c_int;
159}
160extern "C" {
161 #[doc = " Reconstruct a stored vector (or an approximation if lossy coding)\n\n this function may not be defined for some indexes\n @param index opaque pointer to index object\n @param key id of the vector to reconstruct\n @param recons reconstructed vector (size d)"]
162 pub fn faiss_Index_reconstruct(
163 index: *const FaissIndex,
164 key: idx_t,
165 recons: *mut f32,
166 ) -> ::std::os::raw::c_int;
167}
168extern "C" {
169 #[doc = " Reconstruct vectors i0 to i0 + ni - 1\n\n this function may not be defined for some indexes\n @param index opaque pointer to index object\n @param recons reconstructed vector (size ni * d)"]
170 pub fn faiss_Index_reconstruct_n(
171 index: *const FaissIndex,
172 i0: idx_t,
173 ni: idx_t,
174 recons: *mut f32,
175 ) -> ::std::os::raw::c_int;
176}
177extern "C" {
178 #[doc = " Computes a residual vector after indexing encoding.\n\n The residual vector is the difference between a vector and the\n reconstruction that can be decoded from its representation in\n the index. The residual can be used for multiple-stage indexing\n methods, like IndexIVF's methods.\n\n @param index opaque pointer to index object\n @param x input vector, size d\n @param residual output residual vector, size d\n @param key encoded index, as returned by search and assign"]
179 pub fn faiss_Index_compute_residual(
180 index: *const FaissIndex,
181 x: *const f32,
182 residual: *mut f32,
183 key: idx_t,
184 ) -> ::std::os::raw::c_int;
185}
186extern "C" {
187 #[doc = " Computes a residual vector after indexing encoding.\n\n The residual vector is the difference between a vector and the\n reconstruction that can be decoded from its representation in\n the index. The residual can be used for multiple-stage indexing\n methods, like IndexIVF's methods.\n\n @param index opaque pointer to index object\n @param n number of vectors\n @param x input vector, size (n x d)\n @param residuals output residual vectors, size (n x d)\n @param keys encoded index, as returned by search and assign"]
188 pub fn faiss_Index_compute_residual_n(
189 index: *const FaissIndex,
190 n: idx_t,
191 x: *const f32,
192 residuals: *mut f32,
193 keys: *const idx_t,
194 ) -> ::std::os::raw::c_int;
195}
196extern "C" {
197 #[doc = " The size of the produced codes in bytes.\n\n @param index opaque pointer to index object\n @param size the returned size in bytes"]
198 pub fn faiss_Index_sa_code_size(
199 index: *const FaissIndex,
200 size: *mut usize,
201 ) -> ::std::os::raw::c_int;
202}
203extern "C" {
204 #[doc = " encode a set of vectors\n\n @param index opaque pointer to index object\n @param n number of vectors\n @param x input vectors, size n * d\n @param bytes output encoded vectors, size n * sa_code_size()"]
205 pub fn faiss_Index_sa_encode(
206 index: *const FaissIndex,
207 n: idx_t,
208 x: *const f32,
209 bytes: *mut u8,
210 ) -> ::std::os::raw::c_int;
211}
212extern "C" {
213 #[doc = " decode a set of vectors\n\n @param index opaque pointer to index object\n @param n number of vectors\n @param bytes input encoded vectors, size n * sa_code_size()\n @param x output vectors, size n * d"]
214 pub fn faiss_Index_sa_decode(
215 index: *const FaissIndex,
216 n: idx_t,
217 bytes: *const u8,
218 x: *mut f32,
219 ) -> ::std::os::raw::c_int;
220}
221#[repr(C)]
222#[derive(Debug, Copy, Clone)]
223pub struct FaissParameterRange_H {
224 _unused: [u8; 0],
225}
226pub type FaissParameterRange = FaissParameterRange_H;
227extern "C" {
228 pub fn faiss_ParameterRange_name(
229 arg1: *const FaissParameterRange,
230 ) -> *const ::std::os::raw::c_char;
231}
232extern "C" {
233 #[doc = " Getter for the values in the range. The output values are invalidated\n upon any other modification of the range."]
234 pub fn faiss_ParameterRange_values(
235 arg1: *mut FaissParameterRange,
236 arg2: *mut *mut f64,
237 arg3: *mut usize,
238 );
239}
240#[repr(C)]
241#[derive(Debug, Copy, Clone)]
242pub struct FaissParameterSpace_H {
243 _unused: [u8; 0],
244}
245pub type FaissParameterSpace = FaissParameterSpace_H;
246extern "C" {
247 pub fn faiss_ParameterSpace_free(obj: *mut FaissParameterSpace);
248}
249extern "C" {
250 #[doc = " Parameter space default constructor"]
251 pub fn faiss_ParameterSpace_new(space: *mut *mut FaissParameterSpace) -> ::std::os::raw::c_int;
252}
253extern "C" {
254 #[doc = " nb of combinations, = product of values sizes"]
255 pub fn faiss_ParameterSpace_n_combinations(arg1: *const FaissParameterSpace) -> usize;
256}
257extern "C" {
258 #[doc = " get string representation of the combination\n by writing it to the given character buffer.\n A buffer size of 1000 ensures that the full name is collected."]
259 pub fn faiss_ParameterSpace_combination_name(
260 arg1: *const FaissParameterSpace,
261 arg2: usize,
262 arg3: *mut ::std::os::raw::c_char,
263 arg4: usize,
264 ) -> ::std::os::raw::c_int;
265}
266extern "C" {
267 #[doc = " set a combination of parameters described by a string"]
268 pub fn faiss_ParameterSpace_set_index_parameters(
269 arg1: *const FaissParameterSpace,
270 arg2: *mut FaissIndex,
271 arg3: *const ::std::os::raw::c_char,
272 ) -> ::std::os::raw::c_int;
273}
274extern "C" {
275 #[doc = " set a combination of parameters on an index"]
276 pub fn faiss_ParameterSpace_set_index_parameters_cno(
277 arg1: *const FaissParameterSpace,
278 arg2: *mut FaissIndex,
279 arg3: usize,
280 ) -> ::std::os::raw::c_int;
281}
282extern "C" {
283 #[doc = " set one of the parameters"]
284 pub fn faiss_ParameterSpace_set_index_parameter(
285 arg1: *const FaissParameterSpace,
286 arg2: *mut FaissIndex,
287 arg3: *const ::std::os::raw::c_char,
288 arg4: f64,
289 ) -> ::std::os::raw::c_int;
290}
291extern "C" {
292 #[doc = " print a description on stdout"]
293 pub fn faiss_ParameterSpace_display(arg1: *const FaissParameterSpace);
294}
295extern "C" {
296 #[doc = " add a new parameter (or return it if it exists)"]
297 pub fn faiss_ParameterSpace_add_range(
298 arg1: *mut FaissParameterSpace,
299 arg2: *const ::std::os::raw::c_char,
300 arg3: *mut *mut FaissParameterRange,
301 ) -> ::std::os::raw::c_int;
302}
303#[doc = " Class for the clustering parameters. Can be passed to the\n constructor of the Clustering object."]
304#[repr(C)]
305#[derive(Debug, Copy, Clone)]
306pub struct FaissClusteringParameters {
307 #[doc = "< clustering iterations"]
308 pub niter: ::std::os::raw::c_int,
309 #[doc = "< redo clustering this many times and keep best"]
310 pub nredo: ::std::os::raw::c_int,
311 #[doc = "< (bool)"]
312 pub verbose: ::std::os::raw::c_int,
313 #[doc = "< (bool) do we want normalized centroids?"]
314 pub spherical: ::std::os::raw::c_int,
315 #[doc = "< (bool) round centroids coordinates to integer"]
316 pub int_centroids: ::std::os::raw::c_int,
317 #[doc = "< (bool) update index after each iteration?"]
318 pub update_index: ::std::os::raw::c_int,
319 #[doc = "< (bool) use the centroids provided as input and do\n< not change them during iterations"]
320 pub frozen_centroids: ::std::os::raw::c_int,
321 #[doc = "< otherwise you get a warning"]
322 pub min_points_per_centroid: ::std::os::raw::c_int,
323 #[doc = "< to limit size of dataset"]
324 pub max_points_per_centroid: ::std::os::raw::c_int,
325 #[doc = "< seed for the random number generator"]
326 pub seed: ::std::os::raw::c_int,
327 #[doc = "< how many vectors at a time to decode"]
328 pub decode_block_size: usize,
329}
330extern "C" {
331 #[doc = " Sets the ClusteringParameters object with reasonable defaults"]
332 pub fn faiss_ClusteringParameters_init(params: *mut FaissClusteringParameters);
333}
334#[repr(C)]
335#[derive(Debug, Copy, Clone)]
336pub struct FaissClustering_H {
337 _unused: [u8; 0],
338}
339pub type FaissClustering = FaissClustering_H;
340extern "C" {
341 pub fn faiss_Clustering_niter(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
342}
343extern "C" {
344 pub fn faiss_Clustering_nredo(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
345}
346extern "C" {
347 pub fn faiss_Clustering_verbose(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
348}
349extern "C" {
350 pub fn faiss_Clustering_spherical(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
351}
352extern "C" {
353 pub fn faiss_Clustering_int_centroids(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
354}
355extern "C" {
356 pub fn faiss_Clustering_update_index(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
357}
358extern "C" {
359 pub fn faiss_Clustering_frozen_centroids(arg1: *const FaissClustering)
360 -> ::std::os::raw::c_int;
361}
362extern "C" {
363 pub fn faiss_Clustering_min_points_per_centroid(
364 arg1: *const FaissClustering,
365 ) -> ::std::os::raw::c_int;
366}
367extern "C" {
368 pub fn faiss_Clustering_max_points_per_centroid(
369 arg1: *const FaissClustering,
370 ) -> ::std::os::raw::c_int;
371}
372extern "C" {
373 pub fn faiss_Clustering_seed(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
374}
375extern "C" {
376 pub fn faiss_Clustering_decode_block_size(arg1: *const FaissClustering) -> usize;
377}
378extern "C" {
379 pub fn faiss_Clustering_d(arg1: *const FaissClustering) -> usize;
380}
381extern "C" {
382 pub fn faiss_Clustering_k(arg1: *const FaissClustering) -> usize;
383}
384#[repr(C)]
385#[derive(Debug, Copy, Clone)]
386pub struct FaissClusteringIterationStats_H {
387 _unused: [u8; 0],
388}
389pub type FaissClusteringIterationStats = FaissClusteringIterationStats_H;
390extern "C" {
391 pub fn faiss_ClusteringIterationStats_obj(arg1: *const FaissClusteringIterationStats) -> f32;
392}
393extern "C" {
394 pub fn faiss_ClusteringIterationStats_time(arg1: *const FaissClusteringIterationStats) -> f64;
395}
396extern "C" {
397 pub fn faiss_ClusteringIterationStats_time_search(
398 arg1: *const FaissClusteringIterationStats,
399 ) -> f64;
400}
401extern "C" {
402 pub fn faiss_ClusteringIterationStats_imbalance_factor(
403 arg1: *const FaissClusteringIterationStats,
404 ) -> f64;
405}
406extern "C" {
407 pub fn faiss_ClusteringIterationStats_nsplit(
408 arg1: *const FaissClusteringIterationStats,
409 ) -> ::std::os::raw::c_int;
410}
411extern "C" {
412 #[doc = " getter for centroids (size = k * d)"]
413 pub fn faiss_Clustering_centroids(
414 clustering: *mut FaissClustering,
415 centroids: *mut *mut f32,
416 size: *mut usize,
417 );
418}
419extern "C" {
420 #[doc = " getter for iteration stats"]
421 pub fn faiss_Clustering_iteration_stats(
422 clustering: *mut FaissClustering,
423 iteration_stats: *mut *mut FaissClusteringIterationStats,
424 size: *mut usize,
425 );
426}
427extern "C" {
428 #[doc = " the only mandatory parameters are k and d"]
429 pub fn faiss_Clustering_new(
430 p_clustering: *mut *mut FaissClustering,
431 d: ::std::os::raw::c_int,
432 k: ::std::os::raw::c_int,
433 ) -> ::std::os::raw::c_int;
434}
435extern "C" {
436 pub fn faiss_Clustering_new_with_params(
437 p_clustering: *mut *mut FaissClustering,
438 d: ::std::os::raw::c_int,
439 k: ::std::os::raw::c_int,
440 cp: *const FaissClusteringParameters,
441 ) -> ::std::os::raw::c_int;
442}
443extern "C" {
444 pub fn faiss_Clustering_train(
445 clustering: *mut FaissClustering,
446 n: idx_t,
447 x: *const f32,
448 index: *mut FaissIndex,
449 ) -> ::std::os::raw::c_int;
450}
451extern "C" {
452 pub fn faiss_Clustering_free(clustering: *mut FaissClustering);
453}
454extern "C" {
455 #[doc = " simplified interface\n\n @param d dimension of the data\n @param n nb of training vectors\n @param k nb of output centroids\n @param x training set (size n * d)\n @param centroids output centroids (size k * d)\n @param q_error final quantization error\n @return error code"]
456 pub fn faiss_kmeans_clustering(
457 d: usize,
458 n: usize,
459 k: usize,
460 x: *const f32,
461 centroids: *mut f32,
462 q_error: *mut f32,
463 ) -> ::std::os::raw::c_int;
464}
465#[repr(C)]
466#[derive(Debug, Copy, Clone)]
467pub struct FaissIndexBinary_H {
468 _unused: [u8; 0],
469}
470pub type FaissIndexBinary = FaissIndexBinary_H;
471extern "C" {
472 pub fn faiss_IndexBinary_free(obj: *mut FaissIndexBinary);
473}
474extern "C" {
475 pub fn faiss_IndexBinary_d(arg1: *const FaissIndexBinary) -> ::std::os::raw::c_int;
476}
477extern "C" {
478 pub fn faiss_IndexBinary_is_trained(arg1: *const FaissIndexBinary) -> ::std::os::raw::c_int;
479}
480extern "C" {
481 pub fn faiss_IndexBinary_ntotal(arg1: *const FaissIndexBinary) -> idx_t;
482}
483extern "C" {
484 pub fn faiss_IndexBinary_metric_type(arg1: *const FaissIndexBinary) -> FaissMetricType;
485}
486extern "C" {
487 pub fn faiss_IndexBinary_verbose(arg1: *const FaissIndexBinary) -> ::std::os::raw::c_int;
488}
489extern "C" {
490 pub fn faiss_IndexBinary_set_verbose(arg1: *mut FaissIndexBinary, arg2: ::std::os::raw::c_int);
491}
492extern "C" {
493 #[doc = " Perform training on a representative set of vectors\n\n @param index opaque pointer to index object\n @param n nb of training vectors\n @param x training vectors, size n * d"]
494 pub fn faiss_IndexBinary_train(
495 index: *mut FaissIndexBinary,
496 n: idx_t,
497 x: *const u8,
498 ) -> ::std::os::raw::c_int;
499}
500extern "C" {
501 #[doc = " Add n vectors of dimension d to the index.\n\n Vectors are implicitly assigned labels ntotal .. ntotal + n - 1\n This function slices the input vectors in chunks smaller than\n blocksize_add and calls add_core.\n @param index opaque pointer to index object\n @param x input matrix, size n * d"]
502 pub fn faiss_IndexBinary_add(
503 index: *mut FaissIndexBinary,
504 n: idx_t,
505 x: *const u8,
506 ) -> ::std::os::raw::c_int;
507}
508extern "C" {
509 #[doc = " Same as add, but stores xids instead of sequential ids.\n\n The default implementation fails with an assertion, as it is\n not supported by all indexes.\n\n @param index opaque pointer to index object\n @param xids if non-null, ids to store for the vectors (size n)"]
510 pub fn faiss_IndexBinary_add_with_ids(
511 index: *mut FaissIndexBinary,
512 n: idx_t,
513 x: *const u8,
514 xids: *const idx_t,
515 ) -> ::std::os::raw::c_int;
516}
517extern "C" {
518 #[doc = " query n vectors of dimension d to the index.\n\n return at most k vectors. If there are not enough results for a\n query, the result array is padded with -1s.\n\n @param index opaque pointer to index object\n @param x input vectors to search, size n * d\n @param labels output labels of the NNs, size n*k\n @param distances output pairwise distances, size n*k"]
519 pub fn faiss_IndexBinary_search(
520 index: *const FaissIndexBinary,
521 n: idx_t,
522 x: *const u8,
523 k: idx_t,
524 distances: *mut i32,
525 labels: *mut idx_t,
526 ) -> ::std::os::raw::c_int;
527}
528extern "C" {
529 #[doc = " query n vectors of dimension d to the index.\n\n return all vectors with distance < radius. Note that many\n indexes do not implement the range_search (only the k-NN search\n is mandatory).\n\n @param index opaque pointer to index object\n @param x input vectors to search, size n * d\n @param radius search radius\n @param result result table"]
530 pub fn faiss_IndexBinary_range_search(
531 index: *const FaissIndexBinary,
532 n: idx_t,
533 x: *const u8,
534 radius: ::std::os::raw::c_int,
535 result: *mut FaissRangeSearchResult,
536 ) -> ::std::os::raw::c_int;
537}
538extern "C" {
539 #[doc = " return the indexes of the k vectors closest to the query x.\n\n This function is identical as search but only return labels of neighbors.\n @param index opaque pointer to index object\n @param x input vectors to search, size n * d\n @param labels output labels of the NNs, size n*k"]
540 pub fn faiss_IndexBinary_assign(
541 index: *mut FaissIndexBinary,
542 n: idx_t,
543 x: *const u8,
544 labels: *mut idx_t,
545 k: idx_t,
546 ) -> ::std::os::raw::c_int;
547}
548extern "C" {
549 #[doc = " removes all elements from the database.\n @param index opaque pointer to index object"]
550 pub fn faiss_IndexBinary_reset(index: *mut FaissIndexBinary) -> ::std::os::raw::c_int;
551}
552extern "C" {
553 #[doc = " removes IDs from the index. Not supported by all indexes\n @param index opaque pointer to index object\n @param nremove output for the number of IDs removed"]
554 pub fn faiss_IndexBinary_remove_ids(
555 index: *mut FaissIndexBinary,
556 sel: *const FaissIDSelector,
557 n_removed: *mut usize,
558 ) -> ::std::os::raw::c_int;
559}
560extern "C" {
561 #[doc = " Reconstruct a stored vector (or an approximation if lossy coding)\n\n this function may not be defined for some indexes\n @param index opaque pointer to index object\n @param key id of the vector to reconstruct\n @param recons reconstructed vector (size d)"]
562 pub fn faiss_IndexBinary_reconstruct(
563 index: *const FaissIndexBinary,
564 key: idx_t,
565 recons: *mut u8,
566 ) -> ::std::os::raw::c_int;
567}
568extern "C" {
569 #[doc = " Reconstruct vectors i0 to i0 + ni - 1\n\n this function may not be defined for some indexes\n @param index opaque pointer to index object\n @param recons reconstructed vector (size ni * d)"]
570 pub fn faiss_IndexBinary_reconstruct_n(
571 index: *const FaissIndexBinary,
572 i0: idx_t,
573 ni: idx_t,
574 recons: *mut u8,
575 ) -> ::std::os::raw::c_int;
576}
577pub type FaissIndexFlat = FaissIndex_H;
578extern "C" {
579 #[doc = " Opaque type for IndexFlat"]
580 pub fn faiss_IndexFlat_new(p_index: *mut *mut FaissIndexFlat) -> ::std::os::raw::c_int;
581}
582extern "C" {
583 pub fn faiss_IndexFlat_new_with(
584 p_index: *mut *mut FaissIndexFlat,
585 d: idx_t,
586 metric: FaissMetricType,
587 ) -> ::std::os::raw::c_int;
588}
589extern "C" {
590 #[doc = " get a pointer to the index's internal data (the `xb` field). The outputs\n become invalid after any data addition or removal operation.\n\n @param index opaque pointer to index object\n @param p_xb output, the pointer to the beginning of `xb`.\n @param p_size output, the current size of `sb` in number of float values."]
591 pub fn faiss_IndexFlat_xb(index: *mut FaissIndexFlat, p_xb: *mut *mut f32, p_size: *mut usize);
592}
593extern "C" {
594 pub fn faiss_IndexFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlat;
595}
596extern "C" {
597 pub fn faiss_IndexFlat_free(obj: *mut FaissIndexFlat);
598}
599extern "C" {
600 #[doc = " compute distance with a subset of vectors\n\n @param index opaque pointer to index object\n @param x query vectors, size n * d\n @param labels indices of the vectors that should be compared\n for each query vector, size n * k\n @param distances\n corresponding output distances, size n * k"]
601 pub fn faiss_IndexFlat_compute_distance_subset(
602 index: *mut FaissIndex,
603 n: idx_t,
604 x: *const f32,
605 k: idx_t,
606 distances: *mut f32,
607 labels: *const idx_t,
608 ) -> ::std::os::raw::c_int;
609}
610pub type FaissIndexFlatIP = FaissIndex_H;
611extern "C" {
612 pub fn faiss_IndexFlatIP_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatIP;
613}
614extern "C" {
615 pub fn faiss_IndexFlatIP_free(obj: *mut FaissIndexFlatIP);
616}
617extern "C" {
618 #[doc = " Opaque type for IndexFlatIP"]
619 pub fn faiss_IndexFlatIP_new(p_index: *mut *mut FaissIndexFlatIP) -> ::std::os::raw::c_int;
620}
621extern "C" {
622 pub fn faiss_IndexFlatIP_new_with(
623 p_index: *mut *mut FaissIndexFlatIP,
624 d: idx_t,
625 ) -> ::std::os::raw::c_int;
626}
627pub type FaissIndexFlatL2 = FaissIndex_H;
628extern "C" {
629 pub fn faiss_IndexFlatL2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatL2;
630}
631extern "C" {
632 pub fn faiss_IndexFlatL2_free(obj: *mut FaissIndexFlatL2);
633}
634extern "C" {
635 #[doc = " Opaque type for IndexFlatL2"]
636 pub fn faiss_IndexFlatL2_new(p_index: *mut *mut FaissIndexFlatL2) -> ::std::os::raw::c_int;
637}
638extern "C" {
639 pub fn faiss_IndexFlatL2_new_with(
640 p_index: *mut *mut FaissIndexFlatL2,
641 d: idx_t,
642 ) -> ::std::os::raw::c_int;
643}
644pub type FaissIndexRefineFlat = FaissIndex_H;
645extern "C" {
646 #[doc = " Opaque type for IndexRefineFlat\n\n Index that queries in a base_index (a fast one) and refines the\n results with an exact search, hopefully improving the results."]
647 pub fn faiss_IndexRefineFlat_new(
648 p_index: *mut *mut FaissIndexRefineFlat,
649 base_index: *mut FaissIndex,
650 ) -> ::std::os::raw::c_int;
651}
652extern "C" {
653 pub fn faiss_IndexRefineFlat_free(obj: *mut FaissIndexRefineFlat);
654}
655extern "C" {
656 pub fn faiss_IndexRefineFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexRefineFlat;
657}
658extern "C" {
659 pub fn faiss_IndexRefineFlat_own_fields(
660 arg1: *const FaissIndexRefineFlat,
661 ) -> ::std::os::raw::c_int;
662}
663extern "C" {
664 pub fn faiss_IndexRefineFlat_set_own_fields(
665 arg1: *mut FaissIndexRefineFlat,
666 arg2: ::std::os::raw::c_int,
667 );
668}
669extern "C" {
670 pub fn faiss_IndexRefineFlat_k_factor(arg1: *const FaissIndexRefineFlat) -> f32;
671}
672extern "C" {
673 pub fn faiss_IndexRefineFlat_set_k_factor(arg1: *mut FaissIndexRefineFlat, arg2: f32);
674}
675pub type FaissIndexFlat1D = FaissIndex_H;
676extern "C" {
677 pub fn faiss_IndexFlat1D_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlat1D;
678}
679extern "C" {
680 pub fn faiss_IndexFlat1D_free(obj: *mut FaissIndexFlat1D);
681}
682extern "C" {
683 #[doc = " Opaque type for IndexFlat1D\n\n optimized version for 1D \"vectors\""]
684 pub fn faiss_IndexFlat1D_new(p_index: *mut *mut FaissIndexFlat1D) -> ::std::os::raw::c_int;
685}
686extern "C" {
687 pub fn faiss_IndexFlat1D_new_with(
688 p_index: *mut *mut FaissIndexFlat1D,
689 continuous_update: ::std::os::raw::c_int,
690 ) -> ::std::os::raw::c_int;
691}
692extern "C" {
693 pub fn faiss_IndexFlat1D_update_permutation(
694 index: *mut FaissIndexFlat1D,
695 ) -> ::std::os::raw::c_int;
696}
697pub type FaissIndexIVFFlat = FaissIndex_H;
698extern "C" {
699 pub fn faiss_IndexIVFFlat_free(obj: *mut FaissIndexIVFFlat);
700}
701extern "C" {
702 pub fn faiss_IndexIVFFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIVFFlat;
703}
704extern "C" {
705 pub fn faiss_IndexIVFFlat_nlist(arg1: *const FaissIndexIVFFlat) -> usize;
706}
707extern "C" {
708 pub fn faiss_IndexIVFFlat_nprobe(arg1: *const FaissIndexIVFFlat) -> usize;
709}
710extern "C" {
711 pub fn faiss_IndexIVFFlat_set_nprobe(arg1: *mut FaissIndexIVFFlat, arg2: usize);
712}
713extern "C" {
714 pub fn faiss_IndexIVFFlat_quantizer(arg1: *const FaissIndexIVFFlat) -> *mut FaissIndex;
715}
716extern "C" {
717 pub fn faiss_IndexIVFFlat_quantizer_trains_alone(
718 arg1: *const FaissIndexIVFFlat,
719 ) -> ::std::os::raw::c_char;
720}
721extern "C" {
722 pub fn faiss_IndexIVFFlat_own_fields(arg1: *const FaissIndexIVFFlat) -> ::std::os::raw::c_int;
723}
724extern "C" {
725 pub fn faiss_IndexIVFFlat_set_own_fields(
726 arg1: *mut FaissIndexIVFFlat,
727 arg2: ::std::os::raw::c_int,
728 );
729}
730extern "C" {
731 #[doc = " whether object owns the quantizer"]
732 pub fn faiss_IndexIVFFlat_new(p_index: *mut *mut FaissIndexIVFFlat) -> ::std::os::raw::c_int;
733}
734extern "C" {
735 pub fn faiss_IndexIVFFlat_new_with(
736 p_index: *mut *mut FaissIndexIVFFlat,
737 quantizer: *mut FaissIndex,
738 d: usize,
739 nlist: usize,
740 ) -> ::std::os::raw::c_int;
741}
742extern "C" {
743 pub fn faiss_IndexIVFFlat_new_with_metric(
744 p_index: *mut *mut FaissIndexIVFFlat,
745 quantizer: *mut FaissIndex,
746 d: usize,
747 nlist: usize,
748 metric: FaissMetricType,
749 ) -> ::std::os::raw::c_int;
750}
751extern "C" {
752 pub fn faiss_IndexIVFFlat_add_core(
753 index: *mut FaissIndexIVFFlat,
754 n: idx_t,
755 x: *const f32,
756 xids: *const idx_t,
757 precomputed_idx: *const i64,
758 ) -> ::std::os::raw::c_int;
759}
760extern "C" {
761 #[doc = " Update a subset of vectors.\n\n The index must have a direct_map\n\n @param nv nb of vectors to update\n @param idx vector indices to update, size nv\n @param v vectors of new values, size nv*d"]
762 pub fn faiss_IndexIVFFlat_update_vectors(
763 index: *mut FaissIndexIVFFlat,
764 nv: ::std::os::raw::c_int,
765 idx: *mut idx_t,
766 v: *const f32,
767 ) -> ::std::os::raw::c_int;
768}
769extern "C" {
770 pub fn faiss_RangeSearchResult_nq(arg1: *const FaissRangeSearchResult) -> usize;
771}
772extern "C" {
773 pub fn faiss_RangeSearchResult_new(
774 p_rsr: *mut *mut FaissRangeSearchResult,
775 nq: idx_t,
776 ) -> ::std::os::raw::c_int;
777}
778extern "C" {
779 pub fn faiss_RangeSearchResult_new_with(
780 p_rsr: *mut *mut FaissRangeSearchResult,
781 nq: idx_t,
782 alloc_lims: ::std::os::raw::c_int,
783 ) -> ::std::os::raw::c_int;
784}
785extern "C" {
786 #[doc = " called when lims contains the nb of elements result entries\n for each query"]
787 pub fn faiss_RangeSearchResult_do_allocation(
788 rsr: *mut FaissRangeSearchResult,
789 ) -> ::std::os::raw::c_int;
790}
791extern "C" {
792 pub fn faiss_RangeSearchResult_free(obj: *mut FaissRangeSearchResult);
793}
794extern "C" {
795 pub fn faiss_RangeSearchResult_buffer_size(arg1: *const FaissRangeSearchResult) -> usize;
796}
797extern "C" {
798 #[doc = " getter for lims: size (nq + 1)"]
799 pub fn faiss_RangeSearchResult_lims(rsr: *mut FaissRangeSearchResult, lims: *mut *mut usize);
800}
801extern "C" {
802 #[doc = " getter for labels and respective distances (not sorted):\n result for query i is labels[lims[i]:lims[i+1]]"]
803 pub fn faiss_RangeSearchResult_labels(
804 rsr: *mut FaissRangeSearchResult,
805 labels: *mut *mut idx_t,
806 distances: *mut *mut f32,
807 );
808}
809extern "C" {
810 pub fn faiss_IDSelector_free(obj: *mut FaissIDSelector);
811}
812extern "C" {
813 #[doc = " Encapsulates a set of ids to remove."]
814 pub fn faiss_IDSelector_is_member(
815 sel: *const FaissIDSelector,
816 id: idx_t,
817 ) -> ::std::os::raw::c_int;
818}
819#[repr(C)]
820#[derive(Debug, Copy, Clone)]
821pub struct FaissIDSelectorRange_H {
822 _unused: [u8; 0],
823}
824pub type FaissIDSelectorRange = FaissIDSelectorRange_H;
825extern "C" {
826 pub fn faiss_IDSelectorRange_free(obj: *mut FaissIDSelectorRange);
827}
828extern "C" {
829 pub fn faiss_IDSelectorRange_imin(arg1: *const FaissIDSelectorRange) -> idx_t;
830}
831extern "C" {
832 pub fn faiss_IDSelectorRange_imax(arg1: *const FaissIDSelectorRange) -> idx_t;
833}
834extern "C" {
835 #[doc = " remove ids between [imni, imax)"]
836 pub fn faiss_IDSelectorRange_new(
837 p_sel: *mut *mut FaissIDSelectorRange,
838 imin: idx_t,
839 imax: idx_t,
840 ) -> ::std::os::raw::c_int;
841}
842#[repr(C)]
843#[derive(Debug, Copy, Clone)]
844pub struct FaissIDSelectorBatch_H {
845 _unused: [u8; 0],
846}
847pub type FaissIDSelectorBatch = FaissIDSelectorBatch_H;
848extern "C" {
849 pub fn faiss_IDSelectorBatch_nbits(arg1: *const FaissIDSelectorBatch) -> ::std::os::raw::c_int;
850}
851extern "C" {
852 pub fn faiss_IDSelectorBatch_mask(arg1: *const FaissIDSelectorBatch) -> idx_t;
853}
854extern "C" {
855 #[doc = " Remove ids from a set. Repetitions of ids in the indices set\n passed to the constructor does not hurt performance. The hash\n function used for the bloom filter and GCC's implementation of\n unordered_set are just the least significant bits of the id. This\n works fine for random ids or ids in sequences but will produce many\n hash collisions if lsb's are always the same"]
856 pub fn faiss_IDSelectorBatch_new(
857 p_sel: *mut *mut FaissIDSelectorBatch,
858 n: usize,
859 indices: *const idx_t,
860 ) -> ::std::os::raw::c_int;
861}
862#[repr(C)]
863#[derive(Debug, Copy, Clone)]
864pub struct FaissIDSelectorNot_H {
865 _unused: [u8; 0],
866}
867pub type FaissIDSelectorNot = FaissIDSelectorNot_H;
868extern "C" {
869 pub fn faiss_IDSelectorNot_new(
870 p_sel: *mut *mut FaissIDSelectorNot,
871 sel: *const FaissIDSelector,
872 ) -> ::std::os::raw::c_int;
873}
874#[repr(C)]
875#[derive(Debug, Copy, Clone)]
876pub struct FaissIDSelectorAnd_H {
877 _unused: [u8; 0],
878}
879pub type FaissIDSelectorAnd = FaissIDSelectorAnd_H;
880extern "C" {
881 pub fn faiss_IDSelectorAnd_new(
882 p_sel: *mut *mut FaissIDSelectorAnd,
883 lhs_sel: *const FaissIDSelector,
884 rhs_sel: *const FaissIDSelector,
885 ) -> ::std::os::raw::c_int;
886}
887#[repr(C)]
888#[derive(Debug, Copy, Clone)]
889pub struct FaissIDSelectorOr_H {
890 _unused: [u8; 0],
891}
892pub type FaissIDSelectorOr = FaissIDSelectorOr_H;
893extern "C" {
894 pub fn faiss_IDSelectorOr_new(
895 p_sel: *mut *mut FaissIDSelectorOr,
896 lhs_sel: *const FaissIDSelector,
897 rhs_sel: *const FaissIDSelector,
898 ) -> ::std::os::raw::c_int;
899}
900#[repr(C)]
901#[derive(Debug, Copy, Clone)]
902pub struct FaissIDSelectorXOr_H {
903 _unused: [u8; 0],
904}
905pub type FaissIDSelectorXOr = FaissIDSelectorXOr_H;
906extern "C" {
907 pub fn faiss_IDSelectorXOr_new(
908 p_sel: *mut *mut FaissIDSelectorXOr,
909 lhs_sel: *const FaissIDSelector,
910 rhs_sel: *const FaissIDSelector,
911 ) -> ::std::os::raw::c_int;
912}
913#[repr(C)]
914#[derive(Debug, Copy, Clone)]
915pub struct FaissBufferList_H {
916 _unused: [u8; 0],
917}
918pub type FaissBufferList = FaissBufferList_H;
919extern "C" {
920 pub fn faiss_BufferList_free(obj: *mut FaissBufferList);
921}
922extern "C" {
923 pub fn faiss_BufferList_buffer_size(arg1: *const FaissBufferList) -> usize;
924}
925extern "C" {
926 pub fn faiss_BufferList_wp(arg1: *const FaissBufferList) -> usize;
927}
928#[doc = " List of temporary buffers used to store results before they are\n copied to the RangeSearchResult object."]
929#[repr(C)]
930#[derive(Debug, Copy, Clone)]
931pub struct FaissBuffer {
932 pub ids: *mut idx_t,
933 pub dis: *mut f32,
934}
935extern "C" {
936 pub fn faiss_BufferList_append_buffer(bl: *mut FaissBufferList) -> ::std::os::raw::c_int;
937}
938extern "C" {
939 pub fn faiss_BufferList_new(
940 p_bl: *mut *mut FaissBufferList,
941 buffer_size: usize,
942 ) -> ::std::os::raw::c_int;
943}
944extern "C" {
945 pub fn faiss_BufferList_add(
946 bl: *mut FaissBufferList,
947 id: idx_t,
948 dis: f32,
949 ) -> ::std::os::raw::c_int;
950}
951extern "C" {
952 #[doc = " copy elemnts ofs:ofs+n-1 seen as linear data in the buffers to\n tables dest_ids, dest_dis"]
953 pub fn faiss_BufferList_copy_range(
954 bl: *mut FaissBufferList,
955 ofs: usize,
956 n: usize,
957 dest_ids: *mut idx_t,
958 dest_dis: *mut f32,
959 ) -> ::std::os::raw::c_int;
960}
961#[repr(C)]
962#[derive(Debug, Copy, Clone)]
963pub struct FaissRangeSearchPartialResult_H {
964 _unused: [u8; 0],
965}
966pub type FaissRangeSearchPartialResult = FaissRangeSearchPartialResult_H;
967#[repr(C)]
968#[derive(Debug, Copy, Clone)]
969pub struct FaissRangeQueryResult_H {
970 _unused: [u8; 0],
971}
972pub type FaissRangeQueryResult = FaissRangeQueryResult_H;
973extern "C" {
974 pub fn faiss_RangeQueryResult_qno(arg1: *const FaissRangeQueryResult) -> idx_t;
975}
976extern "C" {
977 pub fn faiss_RangeQueryResult_nres(arg1: *const FaissRangeQueryResult) -> usize;
978}
979extern "C" {
980 pub fn faiss_RangeQueryResult_pres(
981 arg1: *const FaissRangeQueryResult,
982 ) -> *mut FaissRangeSearchPartialResult;
983}
984extern "C" {
985 #[doc = " result structure for a single query"]
986 pub fn faiss_RangeQueryResult_add(
987 qr: *mut FaissRangeQueryResult,
988 dis: f32,
989 id: idx_t,
990 ) -> ::std::os::raw::c_int;
991}
992extern "C" {
993 pub fn faiss_RangeSearchPartialResult_res(
994 arg1: *const FaissRangeSearchPartialResult,
995 ) -> *mut FaissRangeSearchResult;
996}
997extern "C" {
998 pub fn faiss_RangeSearchPartialResult_new(
999 p_res: *mut *mut FaissRangeSearchPartialResult,
1000 res_in: *mut FaissRangeSearchResult,
1001 ) -> ::std::os::raw::c_int;
1002}
1003extern "C" {
1004 pub fn faiss_RangeSearchPartialResult_finalize(
1005 res: *mut FaissRangeSearchPartialResult,
1006 ) -> ::std::os::raw::c_int;
1007}
1008extern "C" {
1009 #[doc = " called by range_search before do_allocation"]
1010 pub fn faiss_RangeSearchPartialResult_set_lims(
1011 res: *mut FaissRangeSearchPartialResult,
1012 ) -> ::std::os::raw::c_int;
1013}
1014extern "C" {
1015 pub fn faiss_RangeSearchPartialResult_new_result(
1016 res: *mut FaissRangeSearchPartialResult,
1017 qno: idx_t,
1018 qr: *mut *mut FaissRangeQueryResult,
1019 ) -> ::std::os::raw::c_int;
1020}
1021#[repr(C)]
1022#[derive(Debug, Copy, Clone)]
1023pub struct FaissDistanceComputer_H {
1024 _unused: [u8; 0],
1025}
1026pub type FaissDistanceComputer = FaissDistanceComputer_H;
1027extern "C" {
1028 #[doc = " called before computing distances"]
1029 pub fn faiss_DistanceComputer_set_query(
1030 dc: *mut FaissDistanceComputer,
1031 x: *const f32,
1032 ) -> ::std::os::raw::c_int;
1033}
1034extern "C" {
1035 #[doc = " Compute distance of vector i to current query.\n This function corresponds to the function call operator:\n DistanceComputer::operator()"]
1036 pub fn faiss_DistanceComputer_vector_to_query_dis(
1037 dc: *mut FaissDistanceComputer,
1038 i: idx_t,
1039 qd: *mut f32,
1040 ) -> ::std::os::raw::c_int;
1041}
1042extern "C" {
1043 #[doc = " compute distance between two stored vectors"]
1044 pub fn faiss_DistanceComputer_symmetric_dis(
1045 dc: *mut FaissDistanceComputer,
1046 i: idx_t,
1047 j: idx_t,
1048 vd: *mut f32,
1049 ) -> ::std::os::raw::c_int;
1050}
1051extern "C" {
1052 pub fn faiss_DistanceComputer_free(obj: *mut FaissDistanceComputer);
1053}
1054pub type FaissSearchParametersIVF = FaissSearchParameters_H;
1055extern "C" {
1056 pub fn faiss_SearchParametersIVF_free(obj: *mut FaissSearchParametersIVF);
1057}
1058extern "C" {
1059 pub fn faiss_SearchParametersIVF_cast(
1060 arg1: *mut FaissSearchParameters,
1061 ) -> *mut FaissSearchParametersIVF;
1062}
1063extern "C" {
1064 pub fn faiss_SearchParametersIVF_new(
1065 p_sp: *mut *mut FaissSearchParametersIVF,
1066 ) -> ::std::os::raw::c_int;
1067}
1068extern "C" {
1069 pub fn faiss_SearchParametersIVF_new_with(
1070 p_sp: *mut *mut FaissSearchParametersIVF,
1071 sel: *mut FaissIDSelector,
1072 nprobe: usize,
1073 max_codes: usize,
1074 ) -> ::std::os::raw::c_int;
1075}
1076extern "C" {
1077 pub fn faiss_SearchParametersIVF_sel(
1078 arg1: *const FaissSearchParametersIVF,
1079 ) -> *const FaissIDSelector;
1080}
1081extern "C" {
1082 pub fn faiss_SearchParametersIVF_nprobe(arg1: *const FaissSearchParametersIVF) -> usize;
1083}
1084extern "C" {
1085 pub fn faiss_SearchParametersIVF_set_nprobe(arg1: *mut FaissSearchParametersIVF, arg2: usize);
1086}
1087extern "C" {
1088 pub fn faiss_SearchParametersIVF_max_codes(arg1: *const FaissSearchParametersIVF) -> usize;
1089}
1090extern "C" {
1091 pub fn faiss_SearchParametersIVF_set_max_codes(
1092 arg1: *mut FaissSearchParametersIVF,
1093 arg2: usize,
1094 );
1095}
1096pub type FaissIndexIVF = FaissIndex_H;
1097extern "C" {
1098 pub fn faiss_IndexIVF_free(obj: *mut FaissIndexIVF);
1099}
1100extern "C" {
1101 pub fn faiss_IndexIVF_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIVF;
1102}
1103extern "C" {
1104 pub fn faiss_IndexIVF_nlist(arg1: *const FaissIndexIVF) -> usize;
1105}
1106extern "C" {
1107 pub fn faiss_IndexIVF_nprobe(arg1: *const FaissIndexIVF) -> usize;
1108}
1109extern "C" {
1110 pub fn faiss_IndexIVF_set_nprobe(arg1: *mut FaissIndexIVF, arg2: usize);
1111}
1112extern "C" {
1113 pub fn faiss_IndexIVF_quantizer(arg1: *const FaissIndexIVF) -> *mut FaissIndex;
1114}
1115extern "C" {
1116 pub fn faiss_IndexIVF_quantizer_trains_alone(
1117 arg1: *const FaissIndexIVF,
1118 ) -> ::std::os::raw::c_char;
1119}
1120extern "C" {
1121 pub fn faiss_IndexIVF_own_fields(arg1: *const FaissIndexIVF) -> ::std::os::raw::c_int;
1122}
1123extern "C" {
1124 pub fn faiss_IndexIVF_set_own_fields(arg1: *mut FaissIndexIVF, arg2: ::std::os::raw::c_int);
1125}
1126extern "C" {
1127 #[doc = " moves the entries from another dataset to self. On output,\n other is empty. add_id is added to all moved ids (for\n sequential ids, this would be this->ntotal"]
1128 pub fn faiss_IndexIVF_merge_from(
1129 index: *mut FaissIndexIVF,
1130 other: *mut FaissIndexIVF,
1131 add_id: idx_t,
1132 ) -> ::std::os::raw::c_int;
1133}
1134extern "C" {
1135 #[doc = " copy a subset of the entries index to the other index\n\n if subset_type == 0: copies ids in [a1, a2)\n if subset_type == 1: copies ids if id % a1 == a2\n if subset_type == 2: copies inverted lists such that a1\n elements are left before and a2 elements are after"]
1136 pub fn faiss_IndexIVF_copy_subset_to(
1137 index: *const FaissIndexIVF,
1138 other: *mut FaissIndexIVF,
1139 subset_type: ::std::os::raw::c_int,
1140 a1: idx_t,
1141 a2: idx_t,
1142 ) -> ::std::os::raw::c_int;
1143}
1144extern "C" {
1145 #[doc = " search a set of vectors, that are pre-quantized by the IVF\n quantizer. Fill in the corresponding heaps with the query\n results. search() calls this.\n\n @param n nb of vectors to query\n @param x query vectors, size nx * d\n @param assign coarse quantization indices, size nx * nprobe\n @param centroid_dis\n distances to coarse centroids, size nx * nprobe\n @param distance\n output distances, size n * k\n @param labels output labels, size n * k\n @param store_pairs store inv list index + inv list offset\n instead in upper/lower 32 bit of result,\n instead of ids (used for reranking)."]
1146 pub fn faiss_IndexIVF_search_preassigned(
1147 index: *const FaissIndexIVF,
1148 n: idx_t,
1149 x: *const f32,
1150 k: idx_t,
1151 assign: *const idx_t,
1152 centroid_dis: *const f32,
1153 distances: *mut f32,
1154 labels: *mut idx_t,
1155 store_pairs: ::std::os::raw::c_int,
1156 ) -> ::std::os::raw::c_int;
1157}
1158extern "C" {
1159 pub fn faiss_IndexIVF_get_list_size(index: *const FaissIndexIVF, list_no: usize) -> usize;
1160}
1161extern "C" {
1162 #[doc = " initialize a direct map\n\n @param new_maintain_direct_map if true, create a direct map,\n else clear it"]
1163 pub fn faiss_IndexIVF_make_direct_map(
1164 index: *mut FaissIndexIVF,
1165 new_maintain_direct_map: ::std::os::raw::c_int,
1166 ) -> ::std::os::raw::c_int;
1167}
1168extern "C" {
1169 #[doc = " Check the inverted lists' imbalance factor.\n\n 1= perfectly balanced, >1: imbalanced"]
1170 pub fn faiss_IndexIVF_imbalance_factor(index: *const FaissIndexIVF) -> f64;
1171}
1172extern "C" {
1173 #[doc = " display some stats about the inverted lists of the index"]
1174 pub fn faiss_IndexIVF_print_stats(index: *const FaissIndexIVF);
1175}
1176extern "C" {
1177 #[doc = " Get the IDs in an inverted list. IDs are written to `invlist`, which must be\n large enough\n to accommodate the full list.\n\n @param list_no the list ID\n @param invlist output pointer to a slice of memory, at least as long as the\n list's size\n @see faiss_IndexIVF_get_list_size(size_t)"]
1178 pub fn faiss_IndexIVF_invlists_get_ids(
1179 index: *const FaissIndexIVF,
1180 list_no: usize,
1181 invlist: *mut idx_t,
1182 );
1183}
1184#[repr(C)]
1185#[derive(Debug, Copy, Clone)]
1186pub struct FaissIndexIVFStats {
1187 pub nq: usize,
1188 pub nlist: usize,
1189 pub ndis: usize,
1190 pub nheap_updates: usize,
1191 pub quantization_time: f64,
1192 pub search_time: f64,
1193}
1194extern "C" {
1195 pub fn faiss_IndexIVFStats_reset(stats: *mut FaissIndexIVFStats);
1196}
1197extern "C" {
1198 #[doc = " global var that collects all statists"]
1199 pub fn faiss_get_indexIVF_stats() -> *mut FaissIndexIVFStats;
1200}
1201pub type FaissIndexLSH = FaissIndex_H;
1202extern "C" {
1203 pub fn faiss_IndexLSH_free(obj: *mut FaissIndexLSH);
1204}
1205extern "C" {
1206 pub fn faiss_IndexLSH_cast(arg1: *mut FaissIndex) -> *mut FaissIndexLSH;
1207}
1208extern "C" {
1209 pub fn faiss_IndexLSH_nbits(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
1210}
1211extern "C" {
1212 pub fn faiss_IndexLSH_code_size(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
1213}
1214extern "C" {
1215 pub fn faiss_IndexLSH_rotate_data(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
1216}
1217extern "C" {
1218 pub fn faiss_IndexLSH_train_thresholds(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
1219}
1220extern "C" {
1221 #[doc = " The sign of each vector component is put in a binary signature"]
1222 pub fn faiss_IndexLSH_new(
1223 p_index: *mut *mut FaissIndexLSH,
1224 d: idx_t,
1225 nbits: ::std::os::raw::c_int,
1226 ) -> ::std::os::raw::c_int;
1227}
1228extern "C" {
1229 pub fn faiss_IndexLSH_new_with_options(
1230 p_index: *mut *mut FaissIndexLSH,
1231 d: idx_t,
1232 nbits: ::std::os::raw::c_int,
1233 rotate_data: ::std::os::raw::c_int,
1234 train_thresholds: ::std::os::raw::c_int,
1235 ) -> ::std::os::raw::c_int;
1236}
1237#[repr(C)]
1238#[derive(Debug, Copy, Clone)]
1239pub struct FaissVectorTransform_H {
1240 _unused: [u8; 0],
1241}
1242pub type FaissVectorTransform = FaissVectorTransform_H;
1243extern "C" {
1244 pub fn faiss_VectorTransform_free(obj: *mut FaissVectorTransform);
1245}
1246extern "C" {
1247 pub fn faiss_VectorTransform_is_trained(
1248 arg1: *const FaissVectorTransform,
1249 ) -> ::std::os::raw::c_int;
1250}
1251extern "C" {
1252 pub fn faiss_VectorTransform_d_in(arg1: *const FaissVectorTransform) -> ::std::os::raw::c_int;
1253}
1254extern "C" {
1255 pub fn faiss_VectorTransform_d_out(arg1: *const FaissVectorTransform) -> ::std::os::raw::c_int;
1256}
1257extern "C" {
1258 #[doc = " Perform training on a representative set of vectors\n\n @param vt opaque pointer to VectorTransform object\n @param n nb of training vectors\n @param x training vectors, size n * d"]
1259 pub fn faiss_VectorTransform_train(
1260 vt: *mut FaissVectorTransform,
1261 n: idx_t,
1262 x: *const f32,
1263 ) -> ::std::os::raw::c_int;
1264}
1265extern "C" {
1266 #[doc = " apply the random rotation, return new allocated matrix\n @param x size n * d_in\n @return size n * d_out"]
1267 pub fn faiss_VectorTransform_apply(
1268 vt: *const FaissVectorTransform,
1269 n: idx_t,
1270 x: *const f32,
1271 ) -> *mut f32;
1272}
1273extern "C" {
1274 #[doc = " apply transformation and result is pre-allocated\n @param x size n * d_in\n @param xt size n * d_out"]
1275 pub fn faiss_VectorTransform_apply_noalloc(
1276 vt: *const FaissVectorTransform,
1277 n: idx_t,
1278 x: *const f32,
1279 xt: *mut f32,
1280 );
1281}
1282extern "C" {
1283 #[doc = " reverse transformation. May not be implemented or may return\n approximate result"]
1284 pub fn faiss_VectorTransform_reverse_transform(
1285 vt: *const FaissVectorTransform,
1286 n: idx_t,
1287 xt: *const f32,
1288 x: *mut f32,
1289 );
1290}
1291pub type FaissLinearTransform = FaissVectorTransform_H;
1292extern "C" {
1293 pub fn faiss_LinearTransform_free(obj: *mut FaissLinearTransform);
1294}
1295extern "C" {
1296 #[doc = " compute x = A^T * (x - b)\n is reverse transform if A has orthonormal lines"]
1297 pub fn faiss_LinearTransform_transform_transpose(
1298 vt: *const FaissLinearTransform,
1299 n: idx_t,
1300 y: *const f32,
1301 x: *mut f32,
1302 );
1303}
1304extern "C" {
1305 #[doc = " compute A^T * A to set the is_orthonormal flag"]
1306 pub fn faiss_LinearTransform_set_is_orthonormal(vt: *mut FaissLinearTransform);
1307}
1308extern "C" {
1309 pub fn faiss_LinearTransform_have_bias(
1310 arg1: *const FaissLinearTransform,
1311 ) -> ::std::os::raw::c_int;
1312}
1313extern "C" {
1314 pub fn faiss_LinearTransform_is_orthonormal(
1315 arg1: *const FaissLinearTransform,
1316 ) -> ::std::os::raw::c_int;
1317}
1318pub type FaissRandomRotationMatrix = FaissVectorTransform_H;
1319extern "C" {
1320 pub fn faiss_RandomRotationMatrix_free(obj: *mut FaissRandomRotationMatrix);
1321}
1322extern "C" {
1323 #[doc = " Getter for is_orthonormal"]
1324 pub fn faiss_RandomRotationMatrix_new_with(
1325 p_vt: *mut *mut FaissRandomRotationMatrix,
1326 d_in: ::std::os::raw::c_int,
1327 d_out: ::std::os::raw::c_int,
1328 ) -> ::std::os::raw::c_int;
1329}
1330pub type FaissPCAMatrix = FaissVectorTransform_H;
1331extern "C" {
1332 pub fn faiss_PCAMatrix_free(obj: *mut FaissPCAMatrix);
1333}
1334extern "C" {
1335 pub fn faiss_PCAMatrix_new_with(
1336 p_vt: *mut *mut FaissPCAMatrix,
1337 d_in: ::std::os::raw::c_int,
1338 d_out: ::std::os::raw::c_int,
1339 eigen_power: f32,
1340 random_rotation: ::std::os::raw::c_int,
1341 ) -> ::std::os::raw::c_int;
1342}
1343extern "C" {
1344 pub fn faiss_PCAMatrix_eigen_power(arg1: *const FaissPCAMatrix) -> f32;
1345}
1346extern "C" {
1347 pub fn faiss_PCAMatrix_random_rotation(arg1: *const FaissPCAMatrix) -> ::std::os::raw::c_int;
1348}
1349pub type FaissITQMatrix = FaissVectorTransform_H;
1350extern "C" {
1351 pub fn faiss_ITQMatrix_free(obj: *mut FaissITQMatrix);
1352}
1353extern "C" {
1354 #[doc = " Getter for random_rotation"]
1355 pub fn faiss_ITQMatrix_new_with(
1356 p_vt: *mut *mut FaissITQMatrix,
1357 d: ::std::os::raw::c_int,
1358 ) -> ::std::os::raw::c_int;
1359}
1360pub type FaissITQTransform = FaissVectorTransform_H;
1361extern "C" {
1362 pub fn faiss_ITQTransform_free(obj: *mut FaissITQTransform);
1363}
1364extern "C" {
1365 pub fn faiss_ITQTransform_new_with(
1366 p_vt: *mut *mut FaissITQTransform,
1367 d_in: ::std::os::raw::c_int,
1368 d_out: ::std::os::raw::c_int,
1369 do_pca: ::std::os::raw::c_int,
1370 ) -> ::std::os::raw::c_int;
1371}
1372extern "C" {
1373 pub fn faiss_ITQTransform_do_pca(arg1: *const FaissITQTransform) -> ::std::os::raw::c_int;
1374}
1375pub type FaissOPQMatrix = FaissVectorTransform_H;
1376extern "C" {
1377 pub fn faiss_OPQMatrix_free(obj: *mut FaissOPQMatrix);
1378}
1379extern "C" {
1380 #[doc = " Getter for do_pca"]
1381 pub fn faiss_OPQMatrix_new_with(
1382 p_vt: *mut *mut FaissOPQMatrix,
1383 d: ::std::os::raw::c_int,
1384 M: ::std::os::raw::c_int,
1385 d2: ::std::os::raw::c_int,
1386 ) -> ::std::os::raw::c_int;
1387}
1388extern "C" {
1389 pub fn faiss_OPQMatrix_verbose(arg1: *const FaissOPQMatrix) -> ::std::os::raw::c_int;
1390}
1391extern "C" {
1392 pub fn faiss_OPQMatrix_set_verbose(arg1: *mut FaissOPQMatrix, arg2: ::std::os::raw::c_int);
1393}
1394extern "C" {
1395 pub fn faiss_OPQMatrix_niter(arg1: *const FaissOPQMatrix) -> ::std::os::raw::c_int;
1396}
1397extern "C" {
1398 pub fn faiss_OPQMatrix_set_niter(arg1: *mut FaissOPQMatrix, arg2: ::std::os::raw::c_int);
1399}
1400extern "C" {
1401 pub fn faiss_OPQMatrix_niter_pq(arg1: *const FaissOPQMatrix) -> ::std::os::raw::c_int;
1402}
1403extern "C" {
1404 pub fn faiss_OPQMatrix_set_niter_pq(arg1: *mut FaissOPQMatrix, arg2: ::std::os::raw::c_int);
1405}
1406pub type FaissRemapDimensionsTransform = FaissVectorTransform_H;
1407extern "C" {
1408 pub fn faiss_RemapDimensionsTransform_free(obj: *mut FaissRemapDimensionsTransform);
1409}
1410extern "C" {
1411 pub fn faiss_RemapDimensionsTransform_new_with(
1412 p_vt: *mut *mut FaissRemapDimensionsTransform,
1413 d_in: ::std::os::raw::c_int,
1414 d_out: ::std::os::raw::c_int,
1415 uniform: ::std::os::raw::c_int,
1416 ) -> ::std::os::raw::c_int;
1417}
1418pub type FaissNormalizationTransform = FaissVectorTransform_H;
1419extern "C" {
1420 pub fn faiss_NormalizationTransform_free(obj: *mut FaissNormalizationTransform);
1421}
1422extern "C" {
1423 pub fn faiss_NormalizationTransform_new_with(
1424 p_vt: *mut *mut FaissNormalizationTransform,
1425 d: ::std::os::raw::c_int,
1426 norm: f32,
1427 ) -> ::std::os::raw::c_int;
1428}
1429extern "C" {
1430 pub fn faiss_NormalizationTransform_norm(arg1: *const FaissNormalizationTransform) -> f32;
1431}
1432pub type FaissCenteringTransform = FaissVectorTransform_H;
1433extern "C" {
1434 pub fn faiss_CenteringTransform_free(obj: *mut FaissCenteringTransform);
1435}
1436extern "C" {
1437 pub fn faiss_CenteringTransform_new_with(
1438 p_vt: *mut *mut FaissCenteringTransform,
1439 d: ::std::os::raw::c_int,
1440 ) -> ::std::os::raw::c_int;
1441}
1442pub type FaissIndexPreTransform = FaissIndex_H;
1443extern "C" {
1444 pub fn faiss_IndexPreTransform_free(obj: *mut FaissIndexPreTransform);
1445}
1446extern "C" {
1447 pub fn faiss_IndexPreTransform_cast(arg1: *mut FaissIndex) -> *mut FaissIndexPreTransform;
1448}
1449extern "C" {
1450 pub fn faiss_IndexPreTransform_index(arg1: *const FaissIndexPreTransform) -> *mut FaissIndex;
1451}
1452extern "C" {
1453 pub fn faiss_IndexPreTransform_own_fields(
1454 arg1: *const FaissIndexPreTransform,
1455 ) -> ::std::os::raw::c_int;
1456}
1457extern "C" {
1458 pub fn faiss_IndexPreTransform_set_own_fields(
1459 arg1: *mut FaissIndexPreTransform,
1460 arg2: ::std::os::raw::c_int,
1461 );
1462}
1463extern "C" {
1464 #[doc = " Index that applies a LinearTransform transform on vectors before\n handing them over to a sub-index"]
1465 pub fn faiss_IndexPreTransform_new(
1466 p_index: *mut *mut FaissIndexPreTransform,
1467 ) -> ::std::os::raw::c_int;
1468}
1469extern "C" {
1470 pub fn faiss_IndexPreTransform_new_with(
1471 p_index: *mut *mut FaissIndexPreTransform,
1472 index: *mut FaissIndex,
1473 ) -> ::std::os::raw::c_int;
1474}
1475extern "C" {
1476 pub fn faiss_IndexPreTransform_new_with_transform(
1477 p_index: *mut *mut FaissIndexPreTransform,
1478 ltrans: *mut FaissVectorTransform,
1479 index: *mut FaissIndex,
1480 ) -> ::std::os::raw::c_int;
1481}
1482extern "C" {
1483 pub fn faiss_IndexPreTransform_prepend_transform(
1484 index: *mut FaissIndexPreTransform,
1485 ltrans: *mut FaissVectorTransform,
1486 ) -> ::std::os::raw::c_int;
1487}
1488pub type FaissIndexReplicas = FaissIndex_H;
1489extern "C" {
1490 pub fn faiss_IndexReplicas_free(obj: *mut FaissIndexReplicas);
1491}
1492extern "C" {
1493 pub fn faiss_IndexReplicas_own_fields(arg1: *const FaissIndexReplicas)
1494 -> ::std::os::raw::c_int;
1495}
1496extern "C" {
1497 pub fn faiss_IndexReplicas_set_own_fields(
1498 arg1: *mut FaissIndexReplicas,
1499 arg2: ::std::os::raw::c_int,
1500 );
1501}
1502extern "C" {
1503 #[doc = " Index that concatenates the results from several sub-indexes"]
1504 pub fn faiss_IndexReplicas_new(
1505 p_index: *mut *mut FaissIndexReplicas,
1506 d: idx_t,
1507 ) -> ::std::os::raw::c_int;
1508}
1509extern "C" {
1510 pub fn faiss_IndexReplicas_new_with_options(
1511 p_index: *mut *mut FaissIndexReplicas,
1512 d: idx_t,
1513 threaded: ::std::os::raw::c_int,
1514 ) -> ::std::os::raw::c_int;
1515}
1516extern "C" {
1517 pub fn faiss_IndexReplicas_add_replica(
1518 index: *mut FaissIndexReplicas,
1519 replica: *mut FaissIndex,
1520 ) -> ::std::os::raw::c_int;
1521}
1522extern "C" {
1523 pub fn faiss_IndexReplicas_remove_replica(
1524 index: *mut FaissIndexReplicas,
1525 replica: *mut FaissIndex,
1526 ) -> ::std::os::raw::c_int;
1527}
1528extern "C" {
1529 pub fn faiss_IndexReplicas_at(
1530 index: *mut FaissIndexReplicas,
1531 i: ::std::os::raw::c_int,
1532 ) -> *mut FaissIndex;
1533}
1534#[repr(u32)]
1535#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1536pub enum FaissQuantizerType {
1537 #[doc = "< 8 bits per component"]
1538 QT_8bit = 0,
1539 #[doc = "< 4 bits per component"]
1540 QT_4bit = 1,
1541 #[doc = "< same, shared range for all dimensions"]
1542 QT_8bit_uniform = 2,
1543 QT_4bit_uniform = 3,
1544 QT_fp16 = 4,
1545 #[doc = "< fast indexing of uint8s"]
1546 QT_8bit_direct = 5,
1547 #[doc = "< 6 bits per component"]
1548 QT_6bit = 6,
1549}
1550pub type FaissIndexScalarQuantizer = FaissIndex_H;
1551extern "C" {
1552 #[doc = " Opaque type for IndexScalarQuantizer"]
1553 pub fn faiss_IndexScalarQuantizer_new(
1554 p_index: *mut *mut FaissIndexScalarQuantizer,
1555 ) -> ::std::os::raw::c_int;
1556}
1557extern "C" {
1558 pub fn faiss_IndexScalarQuantizer_new_with(
1559 p_index: *mut *mut FaissIndexScalarQuantizer,
1560 d: idx_t,
1561 qt: FaissQuantizerType,
1562 metric: FaissMetricType,
1563 ) -> ::std::os::raw::c_int;
1564}
1565extern "C" {
1566 pub fn faiss_IndexScalarQuantizer_cast(arg1: *mut FaissIndex)
1567 -> *mut FaissIndexScalarQuantizer;
1568}
1569extern "C" {
1570 pub fn faiss_IndexScalarQuantizer_free(obj: *mut FaissIndexScalarQuantizer);
1571}
1572pub type FaissIndexIVFScalarQuantizer = FaissIndex_H;
1573extern "C" {
1574 pub fn faiss_IndexIVFScalarQuantizer_cast(
1575 arg1: *mut FaissIndex,
1576 ) -> *mut FaissIndexIVFScalarQuantizer;
1577}
1578extern "C" {
1579 pub fn faiss_IndexIVFScalarQuantizer_free(obj: *mut FaissIndexIVFScalarQuantizer);
1580}
1581extern "C" {
1582 #[doc = " Opaque type for IndexIVFScalarQuantizer"]
1583 pub fn faiss_IndexIVFScalarQuantizer_new(
1584 p_index: *mut *mut FaissIndexIVFScalarQuantizer,
1585 ) -> ::std::os::raw::c_int;
1586}
1587extern "C" {
1588 pub fn faiss_IndexIVFScalarQuantizer_new_with(
1589 p_index: *mut *mut FaissIndexIVFScalarQuantizer,
1590 quantizer: *mut FaissIndex,
1591 d: idx_t,
1592 nlist: usize,
1593 qt: FaissQuantizerType,
1594 ) -> ::std::os::raw::c_int;
1595}
1596extern "C" {
1597 pub fn faiss_IndexIVFScalarQuantizer_new_with_metric(
1598 p_index: *mut *mut FaissIndexIVFScalarQuantizer,
1599 quantizer: *mut FaissIndex,
1600 d: usize,
1601 nlist: usize,
1602 qt: FaissQuantizerType,
1603 metric: FaissMetricType,
1604 encode_residual: ::std::os::raw::c_int,
1605 ) -> ::std::os::raw::c_int;
1606}
1607extern "C" {
1608 pub fn faiss_IndexIVFScalarQuantizer_nlist(arg1: *const FaissIndexIVFScalarQuantizer) -> usize;
1609}
1610extern "C" {
1611 pub fn faiss_IndexIVFScalarQuantizer_nprobe(arg1: *const FaissIndexIVFScalarQuantizer)
1612 -> usize;
1613}
1614extern "C" {
1615 pub fn faiss_IndexIVFScalarQuantizer_set_nprobe(
1616 arg1: *mut FaissIndexIVFScalarQuantizer,
1617 arg2: usize,
1618 );
1619}
1620extern "C" {
1621 pub fn faiss_IndexIVFScalarQuantizer_quantizer(
1622 arg1: *const FaissIndexIVFScalarQuantizer,
1623 ) -> *mut FaissIndex;
1624}
1625extern "C" {
1626 pub fn faiss_IndexIVFScalarQuantizer_own_fields(
1627 arg1: *const FaissIndexIVFScalarQuantizer,
1628 ) -> ::std::os::raw::c_int;
1629}
1630extern "C" {
1631 pub fn faiss_IndexIVFScalarQuantizer_set_own_fields(
1632 arg1: *mut FaissIndexIVFScalarQuantizer,
1633 arg2: ::std::os::raw::c_int,
1634 );
1635}
1636extern "C" {
1637 #[doc = " whether object owns the quantizer"]
1638 pub fn faiss_IndexIVFScalarQuantizer_add_core(
1639 index: *mut FaissIndexIVFScalarQuantizer,
1640 n: idx_t,
1641 x: *const f32,
1642 xids: *const idx_t,
1643 precomputed_idx: *const idx_t,
1644 ) -> ::std::os::raw::c_int;
1645}
1646extern "C" {
1647 pub fn faiss_IndexIVFScalarQuantizer_train_residual(
1648 index: *mut FaissIndexIVFScalarQuantizer,
1649 n: idx_t,
1650 x: *const f32,
1651 ) -> ::std::os::raw::c_int;
1652}
1653pub type FaissIndexShards = FaissIndex_H;
1654extern "C" {
1655 pub fn faiss_IndexShards_free(obj: *mut FaissIndexShards);
1656}
1657extern "C" {
1658 pub fn faiss_IndexShards_own_fields(arg1: *const FaissIndexShards) -> ::std::os::raw::c_int;
1659}
1660extern "C" {
1661 pub fn faiss_IndexShards_set_own_fields(
1662 arg1: *mut FaissIndexShards,
1663 arg2: ::std::os::raw::c_int,
1664 );
1665}
1666extern "C" {
1667 pub fn faiss_IndexShards_successive_ids(arg1: *const FaissIndexShards)
1668 -> ::std::os::raw::c_int;
1669}
1670extern "C" {
1671 pub fn faiss_IndexShards_set_successive_ids(
1672 arg1: *mut FaissIndexShards,
1673 arg2: ::std::os::raw::c_int,
1674 );
1675}
1676extern "C" {
1677 #[doc = " Index that concatenates the results from several sub-indexes"]
1678 pub fn faiss_IndexShards_new(
1679 p_index: *mut *mut FaissIndexShards,
1680 d: idx_t,
1681 ) -> ::std::os::raw::c_int;
1682}
1683extern "C" {
1684 pub fn faiss_IndexShards_new_with_options(
1685 p_index: *mut *mut FaissIndexShards,
1686 d: idx_t,
1687 threaded: ::std::os::raw::c_int,
1688 successive_ids: ::std::os::raw::c_int,
1689 ) -> ::std::os::raw::c_int;
1690}
1691extern "C" {
1692 pub fn faiss_IndexShards_add_shard(
1693 index: *mut FaissIndexShards,
1694 shard: *mut FaissIndex,
1695 ) -> ::std::os::raw::c_int;
1696}
1697extern "C" {
1698 pub fn faiss_IndexShards_remove_shard(
1699 index: *mut FaissIndexShards,
1700 shard: *mut FaissIndex,
1701 ) -> ::std::os::raw::c_int;
1702}
1703extern "C" {
1704 pub fn faiss_IndexShards_at(
1705 index: *mut FaissIndexShards,
1706 i: ::std::os::raw::c_int,
1707 ) -> *mut FaissIndex;
1708}
1709pub type FaissIndexIDMap = FaissIndex_H;
1710extern "C" {
1711 pub fn faiss_IndexIDMap_own_fields(arg1: *const FaissIndexIDMap) -> ::std::os::raw::c_int;
1712}
1713extern "C" {
1714 pub fn faiss_IndexIDMap_set_own_fields(arg1: *mut FaissIndexIDMap, arg2: ::std::os::raw::c_int);
1715}
1716extern "C" {
1717 #[doc = " Index that translates search results to ids"]
1718 pub fn faiss_IndexIDMap_new(
1719 p_index: *mut *mut FaissIndexIDMap,
1720 index: *mut FaissIndex,
1721 ) -> ::std::os::raw::c_int;
1722}
1723extern "C" {
1724 pub fn faiss_IndexIDMap_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap;
1725}
1726extern "C" {
1727 #[doc = " get a pointer to the index map's internal ID vector (the `id_map` field).\n The outputs of this function become invalid after any operation that can\n modify the index.\n\n @param index opaque pointer to index object\n @param p_id_map output, the pointer to the beginning of `id_map`.\n @param p_size output, the current length of `id_map`."]
1728 pub fn faiss_IndexIDMap_id_map(
1729 index: *mut FaissIndexIDMap,
1730 p_id_map: *mut *mut idx_t,
1731 p_size: *mut usize,
1732 );
1733}
1734extern "C" {
1735 #[doc = " get a pointer to the sub-index (the `index` field).\n The outputs of this function become invalid after any operation that can\n modify the index.\n\n @param index opaque pointer to index object"]
1736 pub fn faiss_IndexIDMap_sub_index(index: *mut FaissIndexIDMap) -> *mut FaissIndex;
1737}
1738pub type FaissIndexIDMap2 = FaissIndex_H;
1739extern "C" {
1740 pub fn faiss_IndexIDMap2_own_fields(arg1: *const FaissIndexIDMap2) -> ::std::os::raw::c_int;
1741}
1742extern "C" {
1743 pub fn faiss_IndexIDMap2_set_own_fields(
1744 arg1: *mut FaissIndexIDMap2,
1745 arg2: ::std::os::raw::c_int,
1746 );
1747}
1748extern "C" {
1749 #[doc = " same as IndexIDMap but also provides an efficient reconstruction\nimplementation via a 2-way index"]
1750 pub fn faiss_IndexIDMap2_new(
1751 p_index: *mut *mut FaissIndexIDMap2,
1752 index: *mut FaissIndex,
1753 ) -> ::std::os::raw::c_int;
1754}
1755extern "C" {
1756 #[doc = " make the rev_map from scratch"]
1757 pub fn faiss_IndexIDMap2_construct_rev_map(
1758 index: *mut FaissIndexIDMap2,
1759 ) -> ::std::os::raw::c_int;
1760}
1761extern "C" {
1762 pub fn faiss_IndexIDMap2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap2;
1763}
1764extern "C" {
1765 #[doc = " get a pointer to the index map's internal ID vector (the `id_map` field).\n The outputs of this function become invalid after any operation that can\n modify the index.\n\n @param index opaque pointer to index object\n @param p_id_map output, the pointer to the beginning of `id_map`.\n @param p_size output, the current length of `id_map`."]
1766 pub fn faiss_IndexIDMap2_id_map(
1767 index: *mut FaissIndexIDMap2,
1768 p_id_map: *mut *mut idx_t,
1769 p_size: *mut usize,
1770 );
1771}
1772extern "C" {
1773 #[doc = " get a pointer to the sub-index (the `index` field).\n The outputs of this function become invalid after any operation that can\n modify the index.\n\n @param index opaque pointer to index object"]
1774 pub fn faiss_IndexIDMap2_sub_index(index: *mut FaissIndexIDMap2) -> *mut FaissIndex;
1775}
1776pub type FILE = [u64; 27usize];
1777extern "C" {
1778 #[doc = " Clone an index. This is equivalent to `faiss::clone_index`"]
1779 pub fn faiss_clone_index(
1780 arg1: *const FaissIndex,
1781 p_out: *mut *mut FaissIndex,
1782 ) -> ::std::os::raw::c_int;
1783}
1784#[repr(i32)]
1785#[doc = " An error code which depends on the exception thrown from the previous\n operation. See `faiss_get_last_error` to retrieve the error message."]
1786#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1787pub enum FaissErrorCode {
1788 #[doc = " No error"]
1789 OK = 0,
1790 #[doc = " Any exception other than Faiss or standard C++ library exceptions"]
1791 UNKNOWN_EXCEPT = -1,
1792 #[doc = " Faiss library exception"]
1793 FAISS_EXCEPT = -2,
1794 #[doc = " Standard C++ library exception"]
1795 STD_EXCEPT = -4,
1796}
1797extern "C" {
1798 #[doc = " Get the error message of the last failed operation performed by Faiss.\n The given pointer is only invalid until another Faiss function is\n called."]
1799 pub fn faiss_get_last_error() -> *const ::std::os::raw::c_char;
1800}
1801extern "C" {
1802 #[doc = " Build and index with the sequence of processing steps described in\n the string."]
1803 pub fn faiss_index_factory(
1804 p_index: *mut *mut FaissIndex,
1805 d: ::std::os::raw::c_int,
1806 description: *const ::std::os::raw::c_char,
1807 metric: FaissMetricType,
1808 ) -> ::std::os::raw::c_int;
1809}
1810extern "C" {
1811 #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index` when a file descriptor is\n provided."]
1812 pub fn faiss_write_index(idx: *const FaissIndex, f: *mut FILE) -> ::std::os::raw::c_int;
1813}
1814extern "C" {
1815 #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index` when a file path is provided."]
1816 pub fn faiss_write_index_fname(
1817 idx: *const FaissIndex,
1818 fname: *const ::std::os::raw::c_char,
1819 ) -> ::std::os::raw::c_int;
1820}
1821extern "C" {
1822 #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index` when a file descriptor is given."]
1823 pub fn faiss_read_index(
1824 f: *mut FILE,
1825 io_flags: ::std::os::raw::c_int,
1826 p_out: *mut *mut FaissIndex,
1827 ) -> ::std::os::raw::c_int;
1828}
1829extern "C" {
1830 #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index` when a file path is given."]
1831 pub fn faiss_read_index_fname(
1832 fname: *const ::std::os::raw::c_char,
1833 io_flags: ::std::os::raw::c_int,
1834 p_out: *mut *mut FaissIndex,
1835 ) -> ::std::os::raw::c_int;
1836}
1837extern "C" {
1838 #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index_binary` when a file descriptor is\n provided."]
1839 pub fn faiss_write_index_binary(
1840 idx: *const FaissIndexBinary,
1841 f: *mut FILE,
1842 ) -> ::std::os::raw::c_int;
1843}
1844extern "C" {
1845 #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index_binary` when a file path is\n provided."]
1846 pub fn faiss_write_index_binary_fname(
1847 idx: *const FaissIndexBinary,
1848 fname: *const ::std::os::raw::c_char,
1849 ) -> ::std::os::raw::c_int;
1850}
1851extern "C" {
1852 #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index_binary` when a file descriptor is\n given."]
1853 pub fn faiss_read_index_binary(
1854 f: *mut FILE,
1855 io_flags: ::std::os::raw::c_int,
1856 p_out: *mut *mut FaissIndexBinary,
1857 ) -> ::std::os::raw::c_int;
1858}
1859extern "C" {
1860 #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index_binary` when a file path is given."]
1861 pub fn faiss_read_index_binary_fname(
1862 fname: *const ::std::os::raw::c_char,
1863 io_flags: ::std::os::raw::c_int,
1864 p_out: *mut *mut FaissIndexBinary,
1865 ) -> ::std::os::raw::c_int;
1866}
1867extern "C" {
1868 #[doc = " Compute pairwise distances between sets of vectors"]
1869 pub fn faiss_pairwise_L2sqr(
1870 d: i64,
1871 nq: i64,
1872 xq: *const f32,
1873 nb: i64,
1874 xb: *const f32,
1875 dis: *mut f32,
1876 ldq: i64,
1877 ldb: i64,
1878 ldd: i64,
1879 );
1880}
1881extern "C" {
1882 #[doc = " Compute pairwise distances between sets of vectors\n arguments from \"faiss_pairwise_L2sqr\"\n ldq equal -1 by default\n ldb equal -1 by default\n ldd equal -1 by default"]
1883 pub fn faiss_pairwise_L2sqr_with_defaults(
1884 d: i64,
1885 nq: i64,
1886 xq: *const f32,
1887 nb: i64,
1888 xb: *const f32,
1889 dis: *mut f32,
1890 );
1891}
1892extern "C" {
1893 #[doc = " compute the inner product between nx vectors x and one y"]
1894 pub fn faiss_fvec_inner_products_ny(
1895 ip: *mut f32,
1896 x: *const f32,
1897 y: *const f32,
1898 d: usize,
1899 ny: usize,
1900 );
1901}
1902extern "C" {
1903 #[doc = " compute ny square L2 distance between x and a set of contiguous y vectors"]
1904 pub fn faiss_fvec_L2sqr_ny(dis: *mut f32, x: *const f32, y: *const f32, d: usize, ny: usize);
1905}
1906extern "C" {
1907 #[doc = " squared norm of a vector"]
1908 pub fn faiss_fvec_norm_L2sqr(x: *const f32, d: usize) -> f32;
1909}
1910extern "C" {
1911 #[doc = " compute the L2 norms for a set of vectors"]
1912 pub fn faiss_fvec_norms_L2(norms: *mut f32, x: *const f32, d: usize, nx: usize);
1913}
1914extern "C" {
1915 #[doc = " same as fvec_norms_L2, but computes squared norms"]
1916 pub fn faiss_fvec_norms_L2sqr(norms: *mut f32, x: *const f32, d: usize, nx: usize);
1917}
1918extern "C" {
1919 #[doc = " L2-renormalize a set of vector. Nothing done if the vector is 0-normed"]
1920 pub fn faiss_fvec_renorm_L2(d: usize, nx: usize, x: *mut f32);
1921}
1922extern "C" {
1923 #[doc = " Setter of threshold value on nx above which we switch to BLAS to compute\n distances"]
1924 pub fn faiss_set_distance_compute_blas_threshold(value: ::std::os::raw::c_int);
1925}
1926extern "C" {
1927 #[doc = " Getter of threshold value on nx above which we switch to BLAS to compute\n distances"]
1928 pub fn faiss_get_distance_compute_blas_threshold() -> ::std::os::raw::c_int;
1929}
1930extern "C" {
1931 #[doc = " Setter of block sizes value for BLAS distance computations"]
1932 pub fn faiss_set_distance_compute_blas_query_bs(value: ::std::os::raw::c_int);
1933}
1934extern "C" {
1935 #[doc = " Getter of block sizes value for BLAS distance computations"]
1936 pub fn faiss_get_distance_compute_blas_query_bs() -> ::std::os::raw::c_int;
1937}
1938extern "C" {
1939 #[doc = " Setter of block sizes value for BLAS distance computations"]
1940 pub fn faiss_set_distance_compute_blas_database_bs(value: ::std::os::raw::c_int);
1941}
1942extern "C" {
1943 #[doc = " Getter of block sizes value for BLAS distance computations"]
1944 pub fn faiss_get_distance_compute_blas_database_bs() -> ::std::os::raw::c_int;
1945}
1946extern "C" {
1947 #[doc = " Setter of number of results we switch to a reservoir to collect results\n rather than a heap"]
1948 pub fn faiss_set_distance_compute_min_k_reservoir(value: ::std::os::raw::c_int);
1949}
1950extern "C" {
1951 #[doc = " Getter of number of results we switch to a reservoir to collect results\n rather than a heap"]
1952 pub fn faiss_get_distance_compute_min_k_reservoir() -> ::std::os::raw::c_int;
1953}