1#[doc = r" If Bindgen could only determine the size and alignment of a"]
4#[doc = r" type, it is represented like this."]
5#[derive(PartialEq, Copy, Clone, Debug, Hash)]
6#[repr(C)]
7pub struct __BindgenOpaqueArray<T: Copy, const N: usize>(pub [T; N]);
8impl<T: Copy + Default, const N: usize> Default for __BindgenOpaqueArray<T, N> {
9 fn default() -> Self {
10 Self([<T as Default>::default(); N])
11 }
12}
13pub type faiss_idx_t = i64;
14pub type idx_t = faiss_idx_t;
15#[repr(C)]
16#[derive(Debug, Copy, Clone)]
17pub struct FaissRangeSearchResult_H {
18 _unused: [u8; 0],
19}
20pub type FaissRangeSearchResult = FaissRangeSearchResult_H;
21#[repr(C)]
22#[derive(Debug, Copy, Clone)]
23pub struct FaissIDSelector_H {
24 _unused: [u8; 0],
25}
26#[doc = " Encapsulates a set of ids to remove."]
27pub type FaissIDSelector = FaissIDSelector_H;
28#[doc = "< maximum inner product search"]
29pub const FaissMetricType_METRIC_INNER_PRODUCT: FaissMetricType = 0;
30#[doc = "< squared L2 search"]
31pub const FaissMetricType_METRIC_L2: FaissMetricType = 1;
32#[doc = "< L1 (aka cityblock)"]
33pub const FaissMetricType_METRIC_L1: FaissMetricType = 2;
34#[doc = "< infinity distance"]
35pub const FaissMetricType_METRIC_Linf: FaissMetricType = 3;
36#[doc = "< L_p distance, p is given by metric_arg"]
37pub const FaissMetricType_METRIC_Lp: FaissMetricType = 4;
38#[doc = " some additional metrics defined in scipy.spatial.distance"]
39pub const FaissMetricType_METRIC_Canberra: FaissMetricType = 20;
40#[doc = " some additional metrics defined in scipy.spatial.distance"]
41pub const FaissMetricType_METRIC_BrayCurtis: FaissMetricType = 21;
42#[doc = " some additional metrics defined in scipy.spatial.distance"]
43pub const FaissMetricType_METRIC_JensenShannon: FaissMetricType = 22;
44#[doc = " Some algorithms support both an inner product version and a L2 search\n version."]
45pub type FaissMetricType = ::std::os::raw::c_uint;
46#[repr(C)]
47#[derive(Debug, Copy, Clone)]
48pub struct FaissSearchParameters_H {
49 _unused: [u8; 0],
50}
51pub type FaissSearchParameters = FaissSearchParameters_H;
52unsafe extern "C" {
53 pub fn faiss_SearchParameters_free(obj: *mut FaissSearchParameters);
54}
55unsafe extern "C" {
56 pub fn faiss_SearchParameters_new(
57 p_sp: *mut *mut FaissSearchParameters,
58 sel: *mut FaissIDSelector,
59 ) -> ::std::os::raw::c_int;
60}
61#[repr(C)]
62#[derive(Debug, Copy, Clone)]
63pub struct FaissIndex_H {
64 _unused: [u8; 0],
65}
66#[doc = " Opaque type for referencing to an index object"]
67pub type FaissIndex = FaissIndex_H;
68unsafe extern "C" {
69 #[doc = " Opaque type for referencing to an index object"]
70 pub fn faiss_Index_free(obj: *mut FaissIndex);
71}
72unsafe extern "C" {
73 #[doc = " Getter for d"]
74 pub fn faiss_Index_d(arg1: *const FaissIndex) -> ::std::os::raw::c_int;
75}
76unsafe extern "C" {
77 #[doc = " Getter for is_trained"]
78 pub fn faiss_Index_is_trained(arg1: *const FaissIndex) -> ::std::os::raw::c_int;
79}
80unsafe extern "C" {
81 #[doc = " Getter for ntotal"]
82 pub fn faiss_Index_ntotal(arg1: *const FaissIndex) -> idx_t;
83}
84unsafe extern "C" {
85 #[doc = " Getter for metric_type"]
86 pub fn faiss_Index_metric_type(arg1: *const FaissIndex) -> FaissMetricType;
87}
88unsafe extern "C" {
89 #[doc = " Getter for metric_type"]
90 pub fn faiss_Index_verbose(arg1: *const FaissIndex) -> ::std::os::raw::c_int;
91}
92unsafe extern "C" {
93 #[doc = " Getter for metric_type"]
94 pub fn faiss_Index_set_verbose(arg1: *mut FaissIndex, arg2: ::std::os::raw::c_int);
95}
96unsafe extern "C" {
97 #[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"]
98 pub fn faiss_Index_train(
99 index: *mut FaissIndex,
100 n: idx_t,
101 x: *const f32,
102 ) -> ::std::os::raw::c_int;
103}
104unsafe extern "C" {
105 #[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"]
106 pub fn faiss_Index_add(
107 index: *mut FaissIndex,
108 n: idx_t,
109 x: *const f32,
110 ) -> ::std::os::raw::c_int;
111}
112unsafe extern "C" {
113 #[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)"]
114 pub fn faiss_Index_add_with_ids(
115 index: *mut FaissIndex,
116 n: idx_t,
117 x: *const f32,
118 xids: *const idx_t,
119 ) -> ::std::os::raw::c_int;
120}
121unsafe extern "C" {
122 #[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"]
123 pub fn faiss_Index_search(
124 index: *const FaissIndex,
125 n: idx_t,
126 x: *const f32,
127 k: idx_t,
128 distances: *mut f32,
129 labels: *mut idx_t,
130 ) -> ::std::os::raw::c_int;
131}
132unsafe extern "C" {
133 #[doc = " query n vectors of dimension d with search 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"]
134 pub fn faiss_Index_search_with_params(
135 index: *const FaissIndex,
136 n: idx_t,
137 x: *const f32,
138 k: idx_t,
139 params: *const FaissSearchParameters,
140 distances: *mut f32,
141 labels: *mut idx_t,
142 ) -> ::std::os::raw::c_int;
143}
144unsafe extern "C" {
145 #[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"]
146 pub fn faiss_Index_range_search(
147 index: *const FaissIndex,
148 n: idx_t,
149 x: *const f32,
150 radius: f32,
151 result: *mut FaissRangeSearchResult,
152 ) -> ::std::os::raw::c_int;
153}
154unsafe extern "C" {
155 #[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"]
156 pub fn faiss_Index_assign(
157 index: *mut FaissIndex,
158 n: idx_t,
159 x: *const f32,
160 labels: *mut idx_t,
161 k: idx_t,
162 ) -> ::std::os::raw::c_int;
163}
164unsafe extern "C" {
165 #[doc = " removes all elements from the database.\n @param index opaque pointer to index object"]
166 pub fn faiss_Index_reset(index: *mut FaissIndex) -> ::std::os::raw::c_int;
167}
168unsafe extern "C" {
169 #[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"]
170 pub fn faiss_Index_remove_ids(
171 index: *mut FaissIndex,
172 sel: *const FaissIDSelector,
173 n_removed: *mut usize,
174 ) -> ::std::os::raw::c_int;
175}
176unsafe extern "C" {
177 #[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)"]
178 pub fn faiss_Index_reconstruct(
179 index: *const FaissIndex,
180 key: idx_t,
181 recons: *mut f32,
182 ) -> ::std::os::raw::c_int;
183}
184unsafe extern "C" {
185 #[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)"]
186 pub fn faiss_Index_reconstruct_n(
187 index: *const FaissIndex,
188 i0: idx_t,
189 ni: idx_t,
190 recons: *mut f32,
191 ) -> ::std::os::raw::c_int;
192}
193unsafe extern "C" {
194 #[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"]
195 pub fn faiss_Index_compute_residual(
196 index: *const FaissIndex,
197 x: *const f32,
198 residual: *mut f32,
199 key: idx_t,
200 ) -> ::std::os::raw::c_int;
201}
202unsafe extern "C" {
203 #[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"]
204 pub fn faiss_Index_compute_residual_n(
205 index: *const FaissIndex,
206 n: idx_t,
207 x: *const f32,
208 residuals: *mut f32,
209 keys: *const idx_t,
210 ) -> ::std::os::raw::c_int;
211}
212unsafe extern "C" {
213 #[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"]
214 pub fn faiss_Index_sa_code_size(
215 index: *const FaissIndex,
216 size: *mut usize,
217 ) -> ::std::os::raw::c_int;
218}
219unsafe extern "C" {
220 #[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()"]
221 pub fn faiss_Index_sa_encode(
222 index: *const FaissIndex,
223 n: idx_t,
224 x: *const f32,
225 bytes: *mut u8,
226 ) -> ::std::os::raw::c_int;
227}
228unsafe extern "C" {
229 #[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"]
230 pub fn faiss_Index_sa_decode(
231 index: *const FaissIndex,
232 n: idx_t,
233 bytes: *const u8,
234 x: *mut f32,
235 ) -> ::std::os::raw::c_int;
236}
237#[repr(C)]
238#[derive(Debug, Copy, Clone)]
239pub struct FaissParameterRange_H {
240 _unused: [u8; 0],
241}
242#[doc = " possible values of a parameter, sorted from least to most expensive/accurate"]
243pub type FaissParameterRange = FaissParameterRange_H;
244unsafe extern "C" {
245 #[doc = " possible values of a parameter, sorted from least to most expensive/accurate"]
246 pub fn faiss_ParameterRange_name(
247 arg1: *const FaissParameterRange,
248 ) -> *const ::std::os::raw::c_char;
249}
250unsafe extern "C" {
251 #[doc = " Getter for the values in the range. The output values are invalidated\n upon any other modification of the range."]
252 pub fn faiss_ParameterRange_values(
253 arg1: *mut FaissParameterRange,
254 arg2: *mut *mut f64,
255 arg3: *mut usize,
256 );
257}
258#[repr(C)]
259#[derive(Debug, Copy, Clone)]
260pub struct FaissParameterSpace_H {
261 _unused: [u8; 0],
262}
263#[doc = " Uses a-priori knowledge on the Faiss indexes to extract tunable parameters."]
264pub type FaissParameterSpace = FaissParameterSpace_H;
265unsafe extern "C" {
266 #[doc = " Uses a-priori knowledge on the Faiss indexes to extract tunable parameters."]
267 pub fn faiss_ParameterSpace_free(obj: *mut FaissParameterSpace);
268}
269unsafe extern "C" {
270 #[doc = " Parameter space default constructor"]
271 pub fn faiss_ParameterSpace_new(space: *mut *mut FaissParameterSpace) -> ::std::os::raw::c_int;
272}
273unsafe extern "C" {
274 #[doc = " nb of combinations, = product of values sizes"]
275 pub fn faiss_ParameterSpace_n_combinations(arg1: *const FaissParameterSpace) -> usize;
276}
277unsafe extern "C" {
278 #[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."]
279 pub fn faiss_ParameterSpace_combination_name(
280 arg1: *const FaissParameterSpace,
281 arg2: usize,
282 arg3: *mut ::std::os::raw::c_char,
283 arg4: usize,
284 ) -> ::std::os::raw::c_int;
285}
286unsafe extern "C" {
287 #[doc = " set a combination of parameters described by a string"]
288 pub fn faiss_ParameterSpace_set_index_parameters(
289 arg1: *const FaissParameterSpace,
290 arg2: *mut FaissIndex,
291 arg3: *const ::std::os::raw::c_char,
292 ) -> ::std::os::raw::c_int;
293}
294unsafe extern "C" {
295 #[doc = " set a combination of parameters on an index"]
296 pub fn faiss_ParameterSpace_set_index_parameters_cno(
297 arg1: *const FaissParameterSpace,
298 arg2: *mut FaissIndex,
299 arg3: usize,
300 ) -> ::std::os::raw::c_int;
301}
302unsafe extern "C" {
303 #[doc = " set one of the parameters"]
304 pub fn faiss_ParameterSpace_set_index_parameter(
305 arg1: *const FaissParameterSpace,
306 arg2: *mut FaissIndex,
307 arg3: *const ::std::os::raw::c_char,
308 arg4: f64,
309 ) -> ::std::os::raw::c_int;
310}
311unsafe extern "C" {
312 #[doc = " print a description on stdout"]
313 pub fn faiss_ParameterSpace_display(arg1: *const FaissParameterSpace);
314}
315unsafe extern "C" {
316 #[doc = " add a new parameter (or return it if it exists)"]
317 pub fn faiss_ParameterSpace_add_range(
318 arg1: *mut FaissParameterSpace,
319 arg2: *const ::std::os::raw::c_char,
320 arg3: *mut *mut FaissParameterRange,
321 ) -> ::std::os::raw::c_int;
322}
323#[doc = " Class for the clustering parameters. Can be passed to the\n constructor of the Clustering object."]
324#[repr(C)]
325#[derive(Debug, Copy, Clone)]
326pub struct FaissClusteringParameters {
327 #[doc = "< clustering iterations"]
328 pub niter: ::std::os::raw::c_int,
329 #[doc = "< redo clustering this many times and keep best"]
330 pub nredo: ::std::os::raw::c_int,
331 #[doc = "< (bool)"]
332 pub verbose: ::std::os::raw::c_int,
333 #[doc = "< (bool) do we want normalized centroids?"]
334 pub spherical: ::std::os::raw::c_int,
335 #[doc = "< (bool) round centroids coordinates to integer"]
336 pub int_centroids: ::std::os::raw::c_int,
337 #[doc = "< (bool) update index after each iteration?"]
338 pub update_index: ::std::os::raw::c_int,
339 #[doc = "< (bool) use the centroids provided as input and do\n< not change them during iterations"]
340 pub frozen_centroids: ::std::os::raw::c_int,
341 #[doc = "< otherwise you get a warning"]
342 pub min_points_per_centroid: ::std::os::raw::c_int,
343 #[doc = "< to limit size of dataset"]
344 pub max_points_per_centroid: ::std::os::raw::c_int,
345 #[doc = "< seed for the random number generator"]
346 pub seed: ::std::os::raw::c_int,
347 #[doc = "< how many vectors at a time to decode"]
348 pub decode_block_size: usize,
349}
350#[allow(clippy::unnecessary_operation, clippy::identity_op)]
351const _: () = {
352 ["Size of FaissClusteringParameters"]
353 [::std::mem::size_of::<FaissClusteringParameters>() - 48usize];
354 ["Alignment of FaissClusteringParameters"]
355 [::std::mem::align_of::<FaissClusteringParameters>() - 8usize];
356 ["Offset of field: FaissClusteringParameters::niter"]
357 [::std::mem::offset_of!(FaissClusteringParameters, niter) - 0usize];
358 ["Offset of field: FaissClusteringParameters::nredo"]
359 [::std::mem::offset_of!(FaissClusteringParameters, nredo) - 4usize];
360 ["Offset of field: FaissClusteringParameters::verbose"]
361 [::std::mem::offset_of!(FaissClusteringParameters, verbose) - 8usize];
362 ["Offset of field: FaissClusteringParameters::spherical"]
363 [::std::mem::offset_of!(FaissClusteringParameters, spherical) - 12usize];
364 ["Offset of field: FaissClusteringParameters::int_centroids"]
365 [::std::mem::offset_of!(FaissClusteringParameters, int_centroids) - 16usize];
366 ["Offset of field: FaissClusteringParameters::update_index"]
367 [::std::mem::offset_of!(FaissClusteringParameters, update_index) - 20usize];
368 ["Offset of field: FaissClusteringParameters::frozen_centroids"]
369 [::std::mem::offset_of!(FaissClusteringParameters, frozen_centroids) - 24usize];
370 ["Offset of field: FaissClusteringParameters::min_points_per_centroid"]
371 [::std::mem::offset_of!(FaissClusteringParameters, min_points_per_centroid) - 28usize];
372 ["Offset of field: FaissClusteringParameters::max_points_per_centroid"]
373 [::std::mem::offset_of!(FaissClusteringParameters, max_points_per_centroid) - 32usize];
374 ["Offset of field: FaissClusteringParameters::seed"]
375 [::std::mem::offset_of!(FaissClusteringParameters, seed) - 36usize];
376 ["Offset of field: FaissClusteringParameters::decode_block_size"]
377 [::std::mem::offset_of!(FaissClusteringParameters, decode_block_size) - 40usize];
378};
379unsafe extern "C" {
380 #[doc = " Sets the ClusteringParameters object with reasonable defaults"]
381 pub fn faiss_ClusteringParameters_init(params: *mut FaissClusteringParameters);
382}
383#[repr(C)]
384#[derive(Debug, Copy, Clone)]
385pub struct FaissClustering_H {
386 _unused: [u8; 0],
387}
388#[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
389pub type FaissClustering = FaissClustering_H;
390unsafe extern "C" {
391 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
392 pub fn faiss_Clustering_niter(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
393}
394unsafe extern "C" {
395 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
396 pub fn faiss_Clustering_nredo(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
397}
398unsafe extern "C" {
399 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
400 pub fn faiss_Clustering_verbose(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
401}
402unsafe extern "C" {
403 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
404 pub fn faiss_Clustering_spherical(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
405}
406unsafe extern "C" {
407 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
408 pub fn faiss_Clustering_int_centroids(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
409}
410unsafe extern "C" {
411 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
412 pub fn faiss_Clustering_update_index(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
413}
414unsafe extern "C" {
415 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
416 pub fn faiss_Clustering_frozen_centroids(arg1: *const FaissClustering)
417 -> ::std::os::raw::c_int;
418}
419unsafe extern "C" {
420 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
421 pub fn faiss_Clustering_min_points_per_centroid(
422 arg1: *const FaissClustering,
423 ) -> ::std::os::raw::c_int;
424}
425unsafe extern "C" {
426 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
427 pub fn faiss_Clustering_max_points_per_centroid(
428 arg1: *const FaissClustering,
429 ) -> ::std::os::raw::c_int;
430}
431unsafe extern "C" {
432 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
433 pub fn faiss_Clustering_seed(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
434}
435unsafe extern "C" {
436 #[doc = " clustering based on assignment - centroid update iterations\n\n The clustering is based on an Index object that assigns training\n points to the centroids. Therefore, at each iteration the centroids\n are added to the index.\n\n On output, the centroids table is set to the latest version\n of the centroids and they are also added to the index. If the\n centroids table it is not empty on input, it is also used for\n initialization.\n\n To do several clusterings, just call train() several times on\n different training sets, clearing the centroid table in between."]
437 pub fn faiss_Clustering_decode_block_size(arg1: *const FaissClustering) -> usize;
438}
439unsafe extern "C" {
440 #[doc = " getter for d"]
441 pub fn faiss_Clustering_d(arg1: *const FaissClustering) -> usize;
442}
443unsafe extern "C" {
444 #[doc = " getter for k"]
445 pub fn faiss_Clustering_k(arg1: *const FaissClustering) -> usize;
446}
447#[repr(C)]
448#[derive(Debug, Copy, Clone)]
449pub struct FaissClusteringIterationStats_H {
450 _unused: [u8; 0],
451}
452#[doc = " getter for k"]
453pub type FaissClusteringIterationStats = FaissClusteringIterationStats_H;
454unsafe extern "C" {
455 #[doc = " getter for k"]
456 pub fn faiss_ClusteringIterationStats_obj(arg1: *const FaissClusteringIterationStats) -> f32;
457}
458unsafe extern "C" {
459 #[doc = " getter for k"]
460 pub fn faiss_ClusteringIterationStats_time(arg1: *const FaissClusteringIterationStats) -> f64;
461}
462unsafe extern "C" {
463 #[doc = " getter for k"]
464 pub fn faiss_ClusteringIterationStats_time_search(
465 arg1: *const FaissClusteringIterationStats,
466 ) -> f64;
467}
468unsafe extern "C" {
469 #[doc = " getter for k"]
470 pub fn faiss_ClusteringIterationStats_imbalance_factor(
471 arg1: *const FaissClusteringIterationStats,
472 ) -> f64;
473}
474unsafe extern "C" {
475 #[doc = " getter for k"]
476 pub fn faiss_ClusteringIterationStats_nsplit(
477 arg1: *const FaissClusteringIterationStats,
478 ) -> ::std::os::raw::c_int;
479}
480unsafe extern "C" {
481 #[doc = " getter for centroids (size = k * d)"]
482 pub fn faiss_Clustering_centroids(
483 clustering: *mut FaissClustering,
484 centroids: *mut *mut f32,
485 size: *mut usize,
486 );
487}
488unsafe extern "C" {
489 #[doc = " getter for iteration stats"]
490 pub fn faiss_Clustering_iteration_stats(
491 clustering: *mut FaissClustering,
492 iteration_stats: *mut *mut FaissClusteringIterationStats,
493 size: *mut usize,
494 );
495}
496unsafe extern "C" {
497 #[doc = " the only mandatory parameters are k and d"]
498 pub fn faiss_Clustering_new(
499 p_clustering: *mut *mut FaissClustering,
500 d: ::std::os::raw::c_int,
501 k: ::std::os::raw::c_int,
502 ) -> ::std::os::raw::c_int;
503}
504unsafe extern "C" {
505 pub fn faiss_Clustering_new_with_params(
506 p_clustering: *mut *mut FaissClustering,
507 d: ::std::os::raw::c_int,
508 k: ::std::os::raw::c_int,
509 cp: *const FaissClusteringParameters,
510 ) -> ::std::os::raw::c_int;
511}
512unsafe extern "C" {
513 pub fn faiss_Clustering_train(
514 clustering: *mut FaissClustering,
515 n: idx_t,
516 x: *const f32,
517 index: *mut FaissIndex,
518 ) -> ::std::os::raw::c_int;
519}
520unsafe extern "C" {
521 pub fn faiss_Clustering_free(clustering: *mut FaissClustering);
522}
523unsafe extern "C" {
524 #[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"]
525 pub fn faiss_kmeans_clustering(
526 d: usize,
527 n: usize,
528 k: usize,
529 x: *const f32,
530 centroids: *mut f32,
531 q_error: *mut f32,
532 ) -> ::std::os::raw::c_int;
533}
534#[repr(C)]
535#[derive(Debug, Copy, Clone)]
536pub struct FaissIndexBinary_H {
537 _unused: [u8; 0],
538}
539#[doc = " Opaque type for referencing to a binary index object"]
540pub type FaissIndexBinary = FaissIndexBinary_H;
541unsafe extern "C" {
542 #[doc = " Opaque type for referencing to a binary index object"]
543 pub fn faiss_IndexBinary_free(obj: *mut FaissIndexBinary);
544}
545unsafe extern "C" {
546 #[doc = " Getter for d"]
547 pub fn faiss_IndexBinary_d(arg1: *const FaissIndexBinary) -> ::std::os::raw::c_int;
548}
549unsafe extern "C" {
550 #[doc = " Getter for is_trained"]
551 pub fn faiss_IndexBinary_is_trained(arg1: *const FaissIndexBinary) -> ::std::os::raw::c_int;
552}
553unsafe extern "C" {
554 #[doc = " Getter for ntotal"]
555 pub fn faiss_IndexBinary_ntotal(arg1: *const FaissIndexBinary) -> idx_t;
556}
557unsafe extern "C" {
558 #[doc = " Getter for metric_type"]
559 pub fn faiss_IndexBinary_metric_type(arg1: *const FaissIndexBinary) -> FaissMetricType;
560}
561unsafe extern "C" {
562 #[doc = " Getter for metric_type"]
563 pub fn faiss_IndexBinary_verbose(arg1: *const FaissIndexBinary) -> ::std::os::raw::c_int;
564}
565unsafe extern "C" {
566 #[doc = " Getter for metric_type"]
567 pub fn faiss_IndexBinary_set_verbose(arg1: *mut FaissIndexBinary, arg2: ::std::os::raw::c_int);
568}
569unsafe extern "C" {
570 #[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"]
571 pub fn faiss_IndexBinary_train(
572 index: *mut FaissIndexBinary,
573 n: idx_t,
574 x: *const u8,
575 ) -> ::std::os::raw::c_int;
576}
577unsafe extern "C" {
578 #[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"]
579 pub fn faiss_IndexBinary_add(
580 index: *mut FaissIndexBinary,
581 n: idx_t,
582 x: *const u8,
583 ) -> ::std::os::raw::c_int;
584}
585unsafe extern "C" {
586 #[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)"]
587 pub fn faiss_IndexBinary_add_with_ids(
588 index: *mut FaissIndexBinary,
589 n: idx_t,
590 x: *const u8,
591 xids: *const idx_t,
592 ) -> ::std::os::raw::c_int;
593}
594unsafe extern "C" {
595 #[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"]
596 pub fn faiss_IndexBinary_search(
597 index: *const FaissIndexBinary,
598 n: idx_t,
599 x: *const u8,
600 k: idx_t,
601 distances: *mut i32,
602 labels: *mut idx_t,
603 ) -> ::std::os::raw::c_int;
604}
605unsafe extern "C" {
606 #[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"]
607 pub fn faiss_IndexBinary_range_search(
608 index: *const FaissIndexBinary,
609 n: idx_t,
610 x: *const u8,
611 radius: ::std::os::raw::c_int,
612 result: *mut FaissRangeSearchResult,
613 ) -> ::std::os::raw::c_int;
614}
615unsafe extern "C" {
616 #[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"]
617 pub fn faiss_IndexBinary_assign(
618 index: *mut FaissIndexBinary,
619 n: idx_t,
620 x: *const u8,
621 labels: *mut idx_t,
622 k: idx_t,
623 ) -> ::std::os::raw::c_int;
624}
625unsafe extern "C" {
626 #[doc = " removes all elements from the database.\n @param index opaque pointer to index object"]
627 pub fn faiss_IndexBinary_reset(index: *mut FaissIndexBinary) -> ::std::os::raw::c_int;
628}
629unsafe extern "C" {
630 #[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"]
631 pub fn faiss_IndexBinary_remove_ids(
632 index: *mut FaissIndexBinary,
633 sel: *const FaissIDSelector,
634 n_removed: *mut usize,
635 ) -> ::std::os::raw::c_int;
636}
637unsafe extern "C" {
638 #[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)"]
639 pub fn faiss_IndexBinary_reconstruct(
640 index: *const FaissIndexBinary,
641 key: idx_t,
642 recons: *mut u8,
643 ) -> ::std::os::raw::c_int;
644}
645unsafe extern "C" {
646 #[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)"]
647 pub fn faiss_IndexBinary_reconstruct_n(
648 index: *const FaissIndexBinary,
649 i0: idx_t,
650 ni: idx_t,
651 recons: *mut u8,
652 ) -> ::std::os::raw::c_int;
653}
654unsafe extern "C" {
655 pub fn faiss_RangeSearchResult_nq(arg1: *const FaissRangeSearchResult) -> usize;
656}
657unsafe extern "C" {
658 pub fn faiss_RangeSearchResult_new(
659 p_rsr: *mut *mut FaissRangeSearchResult,
660 nq: idx_t,
661 ) -> ::std::os::raw::c_int;
662}
663unsafe extern "C" {
664 pub fn faiss_RangeSearchResult_new_with(
665 p_rsr: *mut *mut FaissRangeSearchResult,
666 nq: idx_t,
667 alloc_lims: ::std::os::raw::c_int,
668 ) -> ::std::os::raw::c_int;
669}
670unsafe extern "C" {
671 #[doc = " called when lims contains the nb of elements result entries\n for each query"]
672 pub fn faiss_RangeSearchResult_do_allocation(
673 rsr: *mut FaissRangeSearchResult,
674 ) -> ::std::os::raw::c_int;
675}
676unsafe extern "C" {
677 pub fn faiss_RangeSearchResult_free(obj: *mut FaissRangeSearchResult);
678}
679unsafe extern "C" {
680 #[doc = " getter for buffer_size"]
681 pub fn faiss_RangeSearchResult_buffer_size(arg1: *const FaissRangeSearchResult) -> usize;
682}
683unsafe extern "C" {
684 #[doc = " getter for lims: size (nq + 1)"]
685 pub fn faiss_RangeSearchResult_lims(rsr: *mut FaissRangeSearchResult, lims: *mut *mut usize);
686}
687unsafe extern "C" {
688 #[doc = " getter for labels and respective distances (not sorted):\n result for query i is labels[lims[i]:lims[i+1]]"]
689 pub fn faiss_RangeSearchResult_labels(
690 rsr: *mut FaissRangeSearchResult,
691 labels: *mut *mut idx_t,
692 distances: *mut *mut f32,
693 );
694}
695unsafe extern "C" {
696 #[doc = " Encapsulates a set of ids to remove."]
697 pub fn faiss_IDSelector_free(obj: *mut FaissIDSelector);
698}
699unsafe extern "C" {
700 #[doc = " Encapsulates a set of ids to remove."]
701 pub fn faiss_IDSelector_is_member(
702 sel: *const FaissIDSelector,
703 id: idx_t,
704 ) -> ::std::os::raw::c_int;
705}
706#[repr(C)]
707#[derive(Debug, Copy, Clone)]
708pub struct FaissIDSelectorRange_H {
709 _unused: [u8; 0],
710}
711#[doc = " remove ids between [imni, imax)"]
712pub type FaissIDSelectorRange = FaissIDSelectorRange_H;
713unsafe extern "C" {
714 #[doc = " remove ids between [imni, imax)"]
715 pub fn faiss_IDSelectorRange_free(obj: *mut FaissIDSelectorRange);
716}
717unsafe extern "C" {
718 #[doc = " remove ids between [imni, imax)"]
719 pub fn faiss_IDSelectorRange_imin(arg1: *const FaissIDSelectorRange) -> idx_t;
720}
721unsafe extern "C" {
722 #[doc = " remove ids between [imni, imax)"]
723 pub fn faiss_IDSelectorRange_imax(arg1: *const FaissIDSelectorRange) -> idx_t;
724}
725unsafe extern "C" {
726 #[doc = " remove ids between [imni, imax)"]
727 pub fn faiss_IDSelectorRange_new(
728 p_sel: *mut *mut FaissIDSelectorRange,
729 imin: idx_t,
730 imax: idx_t,
731 ) -> ::std::os::raw::c_int;
732}
733#[repr(C)]
734#[derive(Debug, Copy, Clone)]
735pub struct FaissIDSelectorBatch_H {
736 _unused: [u8; 0],
737}
738#[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"]
739pub type FaissIDSelectorBatch = FaissIDSelectorBatch_H;
740unsafe extern "C" {
741 #[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"]
742 pub fn faiss_IDSelectorBatch_nbits(arg1: *const FaissIDSelectorBatch) -> ::std::os::raw::c_int;
743}
744unsafe extern "C" {
745 #[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"]
746 pub fn faiss_IDSelectorBatch_mask(arg1: *const FaissIDSelectorBatch) -> idx_t;
747}
748unsafe extern "C" {
749 #[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"]
750 pub fn faiss_IDSelectorBatch_new(
751 p_sel: *mut *mut FaissIDSelectorBatch,
752 n: usize,
753 indices: *const idx_t,
754 ) -> ::std::os::raw::c_int;
755}
756#[repr(C)]
757#[derive(Debug, Copy, Clone)]
758pub struct FaissIDSelectorBitmap_H {
759 _unused: [u8; 0],
760}
761pub type FaissIDSelectorBitmap = FaissIDSelectorBitmap_H;
762unsafe extern "C" {
763 pub fn faiss_IDSelectorBitmap_free(obj: *mut FaissIDSelectorBitmap);
764}
765unsafe extern "C" {
766 pub fn faiss_IDSelectorBitmap_n(arg1: *const FaissIDSelectorBitmap) -> usize;
767}
768unsafe extern "C" {
769 pub fn faiss_IDSelectorBitmap_bitmap(arg1: *const FaissIDSelectorBitmap) -> *const u8;
770}
771unsafe extern "C" {
772 pub fn faiss_IDSelectorBitmap_new(
773 p_sel: *mut *mut FaissIDSelectorBitmap,
774 n: usize,
775 bitmap: *const u8,
776 ) -> ::std::os::raw::c_int;
777}
778#[repr(C)]
779#[derive(Debug, Copy, Clone)]
780pub struct FaissIDSelectorNot_H {
781 _unused: [u8; 0],
782}
783pub type FaissIDSelectorNot = FaissIDSelectorNot_H;
784unsafe extern "C" {
785 pub fn faiss_IDSelectorNot_new(
786 p_sel: *mut *mut FaissIDSelectorNot,
787 sel: *const FaissIDSelector,
788 ) -> ::std::os::raw::c_int;
789}
790#[repr(C)]
791#[derive(Debug, Copy, Clone)]
792pub struct FaissIDSelectorAnd_H {
793 _unused: [u8; 0],
794}
795pub type FaissIDSelectorAnd = FaissIDSelectorAnd_H;
796unsafe extern "C" {
797 pub fn faiss_IDSelectorAnd_new(
798 p_sel: *mut *mut FaissIDSelectorAnd,
799 lhs_sel: *const FaissIDSelector,
800 rhs_sel: *const FaissIDSelector,
801 ) -> ::std::os::raw::c_int;
802}
803#[repr(C)]
804#[derive(Debug, Copy, Clone)]
805pub struct FaissIDSelectorOr_H {
806 _unused: [u8; 0],
807}
808pub type FaissIDSelectorOr = FaissIDSelectorOr_H;
809unsafe extern "C" {
810 pub fn faiss_IDSelectorOr_new(
811 p_sel: *mut *mut FaissIDSelectorOr,
812 lhs_sel: *const FaissIDSelector,
813 rhs_sel: *const FaissIDSelector,
814 ) -> ::std::os::raw::c_int;
815}
816#[repr(C)]
817#[derive(Debug, Copy, Clone)]
818pub struct FaissIDSelectorXOr_H {
819 _unused: [u8; 0],
820}
821pub type FaissIDSelectorXOr = FaissIDSelectorXOr_H;
822unsafe extern "C" {
823 pub fn faiss_IDSelectorXOr_new(
824 p_sel: *mut *mut FaissIDSelectorXOr,
825 lhs_sel: *const FaissIDSelector,
826 rhs_sel: *const FaissIDSelector,
827 ) -> ::std::os::raw::c_int;
828}
829#[repr(C)]
830#[derive(Debug, Copy, Clone)]
831pub struct FaissBufferList_H {
832 _unused: [u8; 0],
833}
834#[doc = " List of temporary buffers used to store results before they are\n copied to the RangeSearchResult object."]
835pub type FaissBufferList = FaissBufferList_H;
836unsafe extern "C" {
837 #[doc = " List of temporary buffers used to store results before they are\n copied to the RangeSearchResult object."]
838 pub fn faiss_BufferList_free(obj: *mut FaissBufferList);
839}
840unsafe extern "C" {
841 #[doc = " List of temporary buffers used to store results before they are\n copied to the RangeSearchResult object."]
842 pub fn faiss_BufferList_buffer_size(arg1: *const FaissBufferList) -> usize;
843}
844unsafe extern "C" {
845 #[doc = " List of temporary buffers used to store results before they are\n copied to the RangeSearchResult object."]
846 pub fn faiss_BufferList_wp(arg1: *const FaissBufferList) -> usize;
847}
848#[doc = " List of temporary buffers used to store results before they are\n copied to the RangeSearchResult object."]
849#[repr(C)]
850#[derive(Debug, Copy, Clone)]
851pub struct FaissBuffer {
852 pub ids: *mut idx_t,
853 pub dis: *mut f32,
854}
855#[allow(clippy::unnecessary_operation, clippy::identity_op)]
856const _: () = {
857 ["Size of FaissBuffer"][::std::mem::size_of::<FaissBuffer>() - 16usize];
858 ["Alignment of FaissBuffer"][::std::mem::align_of::<FaissBuffer>() - 8usize];
859 ["Offset of field: FaissBuffer::ids"][::std::mem::offset_of!(FaissBuffer, ids) - 0usize];
860 ["Offset of field: FaissBuffer::dis"][::std::mem::offset_of!(FaissBuffer, dis) - 8usize];
861};
862unsafe extern "C" {
863 pub fn faiss_BufferList_append_buffer(bl: *mut FaissBufferList) -> ::std::os::raw::c_int;
864}
865unsafe extern "C" {
866 pub fn faiss_BufferList_new(
867 p_bl: *mut *mut FaissBufferList,
868 buffer_size: usize,
869 ) -> ::std::os::raw::c_int;
870}
871unsafe extern "C" {
872 pub fn faiss_BufferList_add(
873 bl: *mut FaissBufferList,
874 id: idx_t,
875 dis: f32,
876 ) -> ::std::os::raw::c_int;
877}
878unsafe extern "C" {
879 #[doc = " copy elemnts ofs:ofs+n-1 seen as linear data in the buffers to\n tables dest_ids, dest_dis"]
880 pub fn faiss_BufferList_copy_range(
881 bl: *mut FaissBufferList,
882 ofs: usize,
883 n: usize,
884 dest_ids: *mut idx_t,
885 dest_dis: *mut f32,
886 ) -> ::std::os::raw::c_int;
887}
888#[repr(C)]
889#[derive(Debug, Copy, Clone)]
890pub struct FaissRangeSearchPartialResult_H {
891 _unused: [u8; 0],
892}
893#[doc = " the entries in the buffers are split per query"]
894pub type FaissRangeSearchPartialResult = FaissRangeSearchPartialResult_H;
895#[repr(C)]
896#[derive(Debug, Copy, Clone)]
897pub struct FaissRangeQueryResult_H {
898 _unused: [u8; 0],
899}
900#[doc = " result structure for a single query"]
901pub type FaissRangeQueryResult = FaissRangeQueryResult_H;
902unsafe extern "C" {
903 #[doc = " result structure for a single query"]
904 pub fn faiss_RangeQueryResult_qno(arg1: *const FaissRangeQueryResult) -> idx_t;
905}
906unsafe extern "C" {
907 #[doc = " result structure for a single query"]
908 pub fn faiss_RangeQueryResult_nres(arg1: *const FaissRangeQueryResult) -> usize;
909}
910unsafe extern "C" {
911 #[doc = " result structure for a single query"]
912 pub fn faiss_RangeQueryResult_pres(
913 arg1: *const FaissRangeQueryResult,
914 ) -> *mut FaissRangeSearchPartialResult;
915}
916unsafe extern "C" {
917 #[doc = " result structure for a single query"]
918 pub fn faiss_RangeQueryResult_add(
919 qr: *mut FaissRangeQueryResult,
920 dis: f32,
921 id: idx_t,
922 ) -> ::std::os::raw::c_int;
923}
924unsafe extern "C" {
925 pub fn faiss_RangeSearchPartialResult_res(
926 arg1: *const FaissRangeSearchPartialResult,
927 ) -> *mut FaissRangeSearchResult;
928}
929unsafe extern "C" {
930 pub fn faiss_RangeSearchPartialResult_new(
931 p_res: *mut *mut FaissRangeSearchPartialResult,
932 res_in: *mut FaissRangeSearchResult,
933 ) -> ::std::os::raw::c_int;
934}
935unsafe extern "C" {
936 pub fn faiss_RangeSearchPartialResult_finalize(
937 res: *mut FaissRangeSearchPartialResult,
938 ) -> ::std::os::raw::c_int;
939}
940unsafe extern "C" {
941 #[doc = " called by range_search before do_allocation"]
942 pub fn faiss_RangeSearchPartialResult_set_lims(
943 res: *mut FaissRangeSearchPartialResult,
944 ) -> ::std::os::raw::c_int;
945}
946unsafe extern "C" {
947 pub fn faiss_RangeSearchPartialResult_new_result(
948 res: *mut FaissRangeSearchPartialResult,
949 qno: idx_t,
950 qr: *mut *mut FaissRangeQueryResult,
951 ) -> ::std::os::raw::c_int;
952}
953#[repr(C)]
954#[derive(Debug, Copy, Clone)]
955pub struct FaissDistanceComputer_H {
956 _unused: [u8; 0],
957}
958pub type FaissDistanceComputer = FaissDistanceComputer_H;
959unsafe extern "C" {
960 #[doc = " called before computing distances"]
961 pub fn faiss_DistanceComputer_set_query(
962 dc: *mut FaissDistanceComputer,
963 x: *const f32,
964 ) -> ::std::os::raw::c_int;
965}
966unsafe extern "C" {
967 #[doc = " Compute distance of vector i to current query.\n This function corresponds to the function call operator:\n DistanceComputer::operator()"]
968 pub fn faiss_DistanceComputer_vector_to_query_dis(
969 dc: *mut FaissDistanceComputer,
970 i: idx_t,
971 qd: *mut f32,
972 ) -> ::std::os::raw::c_int;
973}
974unsafe extern "C" {
975 #[doc = " compute distance between two stored vectors"]
976 pub fn faiss_DistanceComputer_symmetric_dis(
977 dc: *mut FaissDistanceComputer,
978 i: idx_t,
979 j: idx_t,
980 vd: *mut f32,
981 ) -> ::std::os::raw::c_int;
982}
983unsafe extern "C" {
984 pub fn faiss_DistanceComputer_free(obj: *mut FaissDistanceComputer);
985}
986pub type FaissSearchParametersIVF = FaissSearchParameters_H;
987unsafe extern "C" {
988 pub fn faiss_SearchParametersIVF_free(obj: *mut FaissSearchParametersIVF);
989}
990unsafe extern "C" {
991 pub fn faiss_SearchParametersIVF_cast(
992 arg1: *mut FaissSearchParameters,
993 ) -> *mut FaissSearchParametersIVF;
994}
995unsafe extern "C" {
996 pub fn faiss_SearchParametersIVF_new(
997 p_sp: *mut *mut FaissSearchParametersIVF,
998 ) -> ::std::os::raw::c_int;
999}
1000unsafe extern "C" {
1001 pub fn faiss_SearchParametersIVF_new_with(
1002 p_sp: *mut *mut FaissSearchParametersIVF,
1003 sel: *mut FaissIDSelector,
1004 nprobe: usize,
1005 max_codes: usize,
1006 ) -> ::std::os::raw::c_int;
1007}
1008unsafe extern "C" {
1009 pub fn faiss_SearchParametersIVF_sel(
1010 arg1: *const FaissSearchParametersIVF,
1011 ) -> *const FaissIDSelector;
1012}
1013unsafe extern "C" {
1014 pub fn faiss_SearchParametersIVF_nprobe(arg1: *const FaissSearchParametersIVF) -> usize;
1015}
1016unsafe extern "C" {
1017 pub fn faiss_SearchParametersIVF_set_nprobe(arg1: *mut FaissSearchParametersIVF, arg2: usize);
1018}
1019unsafe extern "C" {
1020 pub fn faiss_SearchParametersIVF_max_codes(arg1: *const FaissSearchParametersIVF) -> usize;
1021}
1022unsafe extern "C" {
1023 pub fn faiss_SearchParametersIVF_set_max_codes(
1024 arg1: *mut FaissSearchParametersIVF,
1025 arg2: usize,
1026 );
1027}
1028#[doc = " Index based on a inverted file (IVF)\n\n In the inverted file, the quantizer (an Index instance) provides a\n quantization index for each vector to be added. The quantization\n index maps to a list (aka inverted list or posting list), where the\n id of the vector is then stored.\n\n At search time, the vector to be searched is also quantized, and\n only the list corresponding to the quantization index is\n searched. This speeds up the search by making it\n non-exhaustive. This can be relaxed using multi-probe search: a few\n (nprobe) quantization indices are selected and several inverted\n lists are visited.\n\n Sub-classes implement a post-filtering of the index that refines\n the distance estimation from the query to database vectors."]
1029pub type FaissIndexIVF = FaissIndex_H;
1030unsafe extern "C" {
1031 #[doc = " Index based on a inverted file (IVF)\n\n In the inverted file, the quantizer (an Index instance) provides a\n quantization index for each vector to be added. The quantization\n index maps to a list (aka inverted list or posting list), where the\n id of the vector is then stored.\n\n At search time, the vector to be searched is also quantized, and\n only the list corresponding to the quantization index is\n searched. This speeds up the search by making it\n non-exhaustive. This can be relaxed using multi-probe search: a few\n (nprobe) quantization indices are selected and several inverted\n lists are visited.\n\n Sub-classes implement a post-filtering of the index that refines\n the distance estimation from the query to database vectors."]
1032 pub fn faiss_IndexIVF_free(obj: *mut FaissIndexIVF);
1033}
1034unsafe extern "C" {
1035 #[doc = " Index based on a inverted file (IVF)\n\n In the inverted file, the quantizer (an Index instance) provides a\n quantization index for each vector to be added. The quantization\n index maps to a list (aka inverted list or posting list), where the\n id of the vector is then stored.\n\n At search time, the vector to be searched is also quantized, and\n only the list corresponding to the quantization index is\n searched. This speeds up the search by making it\n non-exhaustive. This can be relaxed using multi-probe search: a few\n (nprobe) quantization indices are selected and several inverted\n lists are visited.\n\n Sub-classes implement a post-filtering of the index that refines\n the distance estimation from the query to database vectors."]
1036 pub fn faiss_IndexIVF_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIVF;
1037}
1038unsafe extern "C" {
1039 #[doc = " number of possible key values"]
1040 pub fn faiss_IndexIVF_nlist(arg1: *const FaissIndexIVF) -> usize;
1041}
1042unsafe extern "C" {
1043 #[doc = " number of probes at query time"]
1044 pub fn faiss_IndexIVF_nprobe(arg1: *const FaissIndexIVF) -> usize;
1045}
1046unsafe extern "C" {
1047 #[doc = " number of probes at query time"]
1048 pub fn faiss_IndexIVF_set_nprobe(arg1: *mut FaissIndexIVF, arg2: usize);
1049}
1050unsafe extern "C" {
1051 #[doc = " quantizer that maps vectors to inverted lists"]
1052 pub fn faiss_IndexIVF_quantizer(arg1: *const FaissIndexIVF) -> *mut FaissIndex;
1053}
1054unsafe extern "C" {
1055 #[doc = " = 0: use the quantizer as index in a kmeans training\n = 1: just pass on the training set to the train() of the quantizer\n = 2: kmeans training on a flat index + add the centroids to the quantizer"]
1056 pub fn faiss_IndexIVF_quantizer_trains_alone(
1057 arg1: *const FaissIndexIVF,
1058 ) -> ::std::os::raw::c_char;
1059}
1060unsafe extern "C" {
1061 #[doc = " whether object owns the quantizer"]
1062 pub fn faiss_IndexIVF_own_fields(arg1: *const FaissIndexIVF) -> ::std::os::raw::c_int;
1063}
1064unsafe extern "C" {
1065 #[doc = " whether object owns the quantizer"]
1066 pub fn faiss_IndexIVF_set_own_fields(arg1: *mut FaissIndexIVF, arg2: ::std::os::raw::c_int);
1067}
1068unsafe extern "C" {
1069 #[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"]
1070 pub fn faiss_IndexIVF_merge_from(
1071 index: *mut FaissIndexIVF,
1072 other: *mut FaissIndexIVF,
1073 add_id: idx_t,
1074 ) -> ::std::os::raw::c_int;
1075}
1076unsafe extern "C" {
1077 #[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"]
1078 pub fn faiss_IndexIVF_copy_subset_to(
1079 index: *const FaissIndexIVF,
1080 other: *mut FaissIndexIVF,
1081 subset_type: ::std::os::raw::c_int,
1082 a1: idx_t,
1083 a2: idx_t,
1084 ) -> ::std::os::raw::c_int;
1085}
1086unsafe extern "C" {
1087 #[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)."]
1088 pub fn faiss_IndexIVF_search_preassigned(
1089 index: *const FaissIndexIVF,
1090 n: idx_t,
1091 x: *const f32,
1092 k: idx_t,
1093 assign: *const idx_t,
1094 centroid_dis: *const f32,
1095 distances: *mut f32,
1096 labels: *mut idx_t,
1097 store_pairs: ::std::os::raw::c_int,
1098 ) -> ::std::os::raw::c_int;
1099}
1100unsafe extern "C" {
1101 pub fn faiss_IndexIVF_get_list_size(index: *const FaissIndexIVF, list_no: usize) -> usize;
1102}
1103unsafe extern "C" {
1104 #[doc = " initialize a direct map\n\n @param new_maintain_direct_map if true, create a direct map,\n else clear it"]
1105 pub fn faiss_IndexIVF_make_direct_map(
1106 index: *mut FaissIndexIVF,
1107 new_maintain_direct_map: ::std::os::raw::c_int,
1108 ) -> ::std::os::raw::c_int;
1109}
1110unsafe extern "C" {
1111 #[doc = " Check the inverted lists' imbalance factor.\n\n 1= perfectly balanced, >1: imbalanced"]
1112 pub fn faiss_IndexIVF_imbalance_factor(index: *const FaissIndexIVF) -> f64;
1113}
1114unsafe extern "C" {
1115 #[doc = " display some stats about the inverted lists of the index"]
1116 pub fn faiss_IndexIVF_print_stats(index: *const FaissIndexIVF);
1117}
1118unsafe extern "C" {
1119 #[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)"]
1120 pub fn faiss_IndexIVF_invlists_get_ids(
1121 index: *const FaissIndexIVF,
1122 list_no: usize,
1123 invlist: *mut idx_t,
1124 );
1125}
1126unsafe extern "C" {
1127 pub fn faiss_IndexIVF_train_encoder(
1128 index: *mut FaissIndexIVF,
1129 n: idx_t,
1130 x: *const f32,
1131 assign: *const idx_t,
1132 ) -> ::std::os::raw::c_int;
1133}
1134#[repr(C)]
1135#[derive(Debug, Copy, Clone)]
1136pub struct FaissIndexIVFStats {
1137 pub nq: usize,
1138 pub nlist: usize,
1139 pub ndis: usize,
1140 pub nheap_updates: usize,
1141 pub quantization_time: f64,
1142 pub search_time: f64,
1143}
1144#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1145const _: () = {
1146 ["Size of FaissIndexIVFStats"][::std::mem::size_of::<FaissIndexIVFStats>() - 48usize];
1147 ["Alignment of FaissIndexIVFStats"][::std::mem::align_of::<FaissIndexIVFStats>() - 8usize];
1148 ["Offset of field: FaissIndexIVFStats::nq"]
1149 [::std::mem::offset_of!(FaissIndexIVFStats, nq) - 0usize];
1150 ["Offset of field: FaissIndexIVFStats::nlist"]
1151 [::std::mem::offset_of!(FaissIndexIVFStats, nlist) - 8usize];
1152 ["Offset of field: FaissIndexIVFStats::ndis"]
1153 [::std::mem::offset_of!(FaissIndexIVFStats, ndis) - 16usize];
1154 ["Offset of field: FaissIndexIVFStats::nheap_updates"]
1155 [::std::mem::offset_of!(FaissIndexIVFStats, nheap_updates) - 24usize];
1156 ["Offset of field: FaissIndexIVFStats::quantization_time"]
1157 [::std::mem::offset_of!(FaissIndexIVFStats, quantization_time) - 32usize];
1158 ["Offset of field: FaissIndexIVFStats::search_time"]
1159 [::std::mem::offset_of!(FaissIndexIVFStats, search_time) - 40usize];
1160};
1161unsafe extern "C" {
1162 pub fn faiss_IndexIVFStats_reset(stats: *mut FaissIndexIVFStats);
1163}
1164unsafe extern "C" {
1165 #[doc = " global var that collects all statists"]
1166 pub fn faiss_get_indexIVF_stats() -> *mut FaissIndexIVFStats;
1167}
1168#[doc = " Index based on a inverted file (IVF)\n\n In the inverted file, the quantizer (an IndexBinary instance) provides a\n quantization index for each vector to be added. The quantization\n index maps to a list (aka inverted list or posting list), where the\n id of the vector is stored.\n\n Otherwise the object is similar to the IndexIVF"]
1169pub type FaissIndexBinaryIVF = FaissIndexBinary_H;
1170unsafe extern "C" {
1171 #[doc = " Index based on a inverted file (IVF)\n\n In the inverted file, the quantizer (an IndexBinary instance) provides a\n quantization index for each vector to be added. The quantization\n index maps to a list (aka inverted list or posting list), where the\n id of the vector is stored.\n\n Otherwise the object is similar to the IndexIVF"]
1172 pub fn faiss_IndexBinaryIVF_free(obj: *mut FaissIndexBinaryIVF);
1173}
1174unsafe extern "C" {
1175 #[doc = " Index based on a inverted file (IVF)\n\n In the inverted file, the quantizer (an IndexBinary instance) provides a\n quantization index for each vector to be added. The quantization\n index maps to a list (aka inverted list or posting list), where the\n id of the vector is stored.\n\n Otherwise the object is similar to the IndexIVF"]
1176 pub fn faiss_IndexBinaryIVF_cast(arg1: *mut FaissIndexBinary) -> *mut FaissIndexBinaryIVF;
1177}
1178unsafe extern "C" {
1179 #[doc = " number of possible key values"]
1180 pub fn faiss_IndexBinaryIVF_nlist(arg1: *const FaissIndexBinaryIVF) -> usize;
1181}
1182unsafe extern "C" {
1183 #[doc = " number of probes at query time"]
1184 pub fn faiss_IndexBinaryIVF_nprobe(arg1: *const FaissIndexBinaryIVF) -> usize;
1185}
1186unsafe extern "C" {
1187 #[doc = " number of probes at query time"]
1188 pub fn faiss_IndexBinaryIVF_set_nprobe(arg1: *mut FaissIndexBinaryIVF, arg2: usize);
1189}
1190unsafe extern "C" {
1191 #[doc = " quantizer that maps vectors to inverted lists"]
1192 pub fn faiss_IndexBinaryIVF_quantizer(
1193 arg1: *const FaissIndexBinaryIVF,
1194 ) -> *mut FaissIndexBinary;
1195}
1196unsafe extern "C" {
1197 #[doc = " whether object owns the quantizer"]
1198 pub fn faiss_IndexBinaryIVF_own_fields(
1199 arg1: *const FaissIndexBinaryIVF,
1200 ) -> ::std::os::raw::c_int;
1201}
1202unsafe extern "C" {
1203 #[doc = " whether object owns the quantizer"]
1204 pub fn faiss_IndexBinaryIVF_set_own_fields(
1205 arg1: *mut FaissIndexBinaryIVF,
1206 arg2: ::std::os::raw::c_int,
1207 );
1208}
1209unsafe extern "C" {
1210 #[doc = " max nb of codes to visit to do a query"]
1211 pub fn faiss_IndexBinaryIVF_max_codes(arg1: *const FaissIndexBinaryIVF) -> usize;
1212}
1213unsafe extern "C" {
1214 #[doc = " max nb of codes to visit to do a query"]
1215 pub fn faiss_IndexBinaryIVF_set_max_codes(arg1: *mut FaissIndexBinaryIVF, arg2: usize);
1216}
1217unsafe extern "C" {
1218 #[doc = " Select between using a heap or counting to select the k smallest values\n when scanning inverted lists."]
1219 pub fn faiss_IndexBinaryIVF_use_heap(arg1: *const FaissIndexBinaryIVF)
1220 -> ::std::os::raw::c_int;
1221}
1222unsafe extern "C" {
1223 #[doc = " Select between using a heap or counting to select the k smallest values\n when scanning inverted lists."]
1224 pub fn faiss_IndexBinaryIVF_set_use_heap(
1225 arg1: *mut FaissIndexBinaryIVF,
1226 arg2: ::std::os::raw::c_int,
1227 );
1228}
1229unsafe extern "C" {
1230 #[doc = " collect computations per batch"]
1231 pub fn faiss_IndexBinaryIVF_per_invlist_search(
1232 arg1: *const FaissIndexBinaryIVF,
1233 ) -> ::std::os::raw::c_int;
1234}
1235unsafe extern "C" {
1236 #[doc = " collect computations per batch"]
1237 pub fn faiss_IndexBinaryIVF_set_per_invlist_search(
1238 arg1: *mut FaissIndexBinaryIVF,
1239 arg2: ::std::os::raw::c_int,
1240 );
1241}
1242unsafe extern "C" {
1243 #[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"]
1244 pub fn faiss_IndexBinaryIVF_merge_from(
1245 index: *mut FaissIndexBinaryIVF,
1246 other: *mut FaissIndexBinaryIVF,
1247 add_id: idx_t,
1248 ) -> ::std::os::raw::c_int;
1249}
1250unsafe extern "C" {
1251 #[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).\n @param params used to override the object's search parameters"]
1252 pub fn faiss_IndexBinaryIVF_search_preassigned(
1253 index: *const FaissIndexBinaryIVF,
1254 n: idx_t,
1255 x: *const u8,
1256 k: idx_t,
1257 cidx: *const idx_t,
1258 cdis: *const i32,
1259 dis: *mut i32,
1260 idx: *mut idx_t,
1261 store_pairs: ::std::os::raw::c_int,
1262 params: *const FaissSearchParametersIVF,
1263 ) -> ::std::os::raw::c_int;
1264}
1265unsafe extern "C" {
1266 pub fn faiss_IndexBinaryIVF_get_list_size(
1267 index: *const FaissIndexBinaryIVF,
1268 list_no: usize,
1269 ) -> usize;
1270}
1271unsafe extern "C" {
1272 #[doc = " initialize a direct map\n\n @param new_maintain_direct_map if true, create a direct map,\n else clear it"]
1273 pub fn faiss_IndexBinaryIVF_make_direct_map(
1274 index: *mut FaissIndexBinaryIVF,
1275 new_maintain_direct_map: ::std::os::raw::c_int,
1276 ) -> ::std::os::raw::c_int;
1277}
1278unsafe extern "C" {
1279 #[doc = " Check the inverted lists' imbalance factor.\n\n 1= perfectly balanced, >1: imbalanced"]
1280 pub fn faiss_IndexBinaryIVF_imbalance_factor(index: *const FaissIndexBinaryIVF) -> f64;
1281}
1282unsafe extern "C" {
1283 #[doc = " display some stats about the inverted lists of the index"]
1284 pub fn faiss_IndexBinaryIVF_print_stats(index: *const FaissIndexBinaryIVF);
1285}
1286#[doc = " Opaque type for IndexFlat"]
1287pub type FaissIndexFlat = FaissIndex_H;
1288unsafe extern "C" {
1289 #[doc = " Opaque type for IndexFlat"]
1290 pub fn faiss_IndexFlat_new(p_index: *mut *mut FaissIndexFlat) -> ::std::os::raw::c_int;
1291}
1292unsafe extern "C" {
1293 pub fn faiss_IndexFlat_new_with(
1294 p_index: *mut *mut FaissIndexFlat,
1295 d: idx_t,
1296 metric: FaissMetricType,
1297 ) -> ::std::os::raw::c_int;
1298}
1299unsafe extern "C" {
1300 #[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."]
1301 pub fn faiss_IndexFlat_xb(index: *mut FaissIndexFlat, p_xb: *mut *mut f32, p_size: *mut usize);
1302}
1303unsafe extern "C" {
1304 #[doc = " attempt a dynamic cast to a flat index, thus checking\n check whether the underlying index type is `IndexFlat`.\n\n @param index opaque pointer to index object\n @return the same pointer if the index is a flat index, NULL otherwise"]
1305 pub fn faiss_IndexFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlat;
1306}
1307unsafe extern "C" {
1308 #[doc = " attempt a dynamic cast to a flat index, thus checking\n check whether the underlying index type is `IndexFlat`.\n\n @param index opaque pointer to index object\n @return the same pointer if the index is a flat index, NULL otherwise"]
1309 pub fn faiss_IndexFlat_free(obj: *mut FaissIndexFlat);
1310}
1311unsafe extern "C" {
1312 #[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"]
1313 pub fn faiss_IndexFlat_compute_distance_subset(
1314 index: *mut FaissIndex,
1315 n: idx_t,
1316 x: *const f32,
1317 k: idx_t,
1318 distances: *mut f32,
1319 labels: *const idx_t,
1320 ) -> ::std::os::raw::c_int;
1321}
1322#[doc = " Opaque type for IndexFlatIP"]
1323pub type FaissIndexFlatIP = FaissIndex_H;
1324unsafe extern "C" {
1325 #[doc = " Opaque type for IndexFlatIP"]
1326 pub fn faiss_IndexFlatIP_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatIP;
1327}
1328unsafe extern "C" {
1329 #[doc = " Opaque type for IndexFlatIP"]
1330 pub fn faiss_IndexFlatIP_free(obj: *mut FaissIndexFlatIP);
1331}
1332unsafe extern "C" {
1333 #[doc = " Opaque type for IndexFlatIP"]
1334 pub fn faiss_IndexFlatIP_new(p_index: *mut *mut FaissIndexFlatIP) -> ::std::os::raw::c_int;
1335}
1336unsafe extern "C" {
1337 pub fn faiss_IndexFlatIP_new_with(
1338 p_index: *mut *mut FaissIndexFlatIP,
1339 d: idx_t,
1340 ) -> ::std::os::raw::c_int;
1341}
1342#[doc = " Opaque type for IndexFlatL2"]
1343pub type FaissIndexFlatL2 = FaissIndex_H;
1344unsafe extern "C" {
1345 #[doc = " Opaque type for IndexFlatL2"]
1346 pub fn faiss_IndexFlatL2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatL2;
1347}
1348unsafe extern "C" {
1349 #[doc = " Opaque type for IndexFlatL2"]
1350 pub fn faiss_IndexFlatL2_free(obj: *mut FaissIndexFlatL2);
1351}
1352unsafe extern "C" {
1353 #[doc = " Opaque type for IndexFlatL2"]
1354 pub fn faiss_IndexFlatL2_new(p_index: *mut *mut FaissIndexFlatL2) -> ::std::os::raw::c_int;
1355}
1356unsafe extern "C" {
1357 pub fn faiss_IndexFlatL2_new_with(
1358 p_index: *mut *mut FaissIndexFlatL2,
1359 d: idx_t,
1360 ) -> ::std::os::raw::c_int;
1361}
1362#[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."]
1363pub type FaissIndexRefineFlat = FaissIndex_H;
1364unsafe extern "C" {
1365 #[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."]
1366 pub fn faiss_IndexRefineFlat_new(
1367 p_index: *mut *mut FaissIndexRefineFlat,
1368 base_index: *mut FaissIndex,
1369 ) -> ::std::os::raw::c_int;
1370}
1371unsafe extern "C" {
1372 pub fn faiss_IndexRefineFlat_free(obj: *mut FaissIndexRefineFlat);
1373}
1374unsafe extern "C" {
1375 pub fn faiss_IndexRefineFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexRefineFlat;
1376}
1377unsafe extern "C" {
1378 pub fn faiss_IndexRefineFlat_own_fields(
1379 arg1: *const FaissIndexRefineFlat,
1380 ) -> ::std::os::raw::c_int;
1381}
1382unsafe extern "C" {
1383 pub fn faiss_IndexRefineFlat_set_own_fields(
1384 arg1: *mut FaissIndexRefineFlat,
1385 arg2: ::std::os::raw::c_int,
1386 );
1387}
1388unsafe extern "C" {
1389 #[doc = " factor between k requested in search and the k requested from\n the base_index (should be >= 1)"]
1390 pub fn faiss_IndexRefineFlat_k_factor(arg1: *const FaissIndexRefineFlat) -> f32;
1391}
1392unsafe extern "C" {
1393 #[doc = " factor between k requested in search and the k requested from\n the base_index (should be >= 1)"]
1394 pub fn faiss_IndexRefineFlat_set_k_factor(arg1: *mut FaissIndexRefineFlat, arg2: f32);
1395}
1396#[doc = " Opaque type for IndexFlat1D\n\n optimized version for 1D \"vectors\""]
1397pub type FaissIndexFlat1D = FaissIndex_H;
1398unsafe extern "C" {
1399 #[doc = " Opaque type for IndexFlat1D\n\n optimized version for 1D \"vectors\""]
1400 pub fn faiss_IndexFlat1D_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlat1D;
1401}
1402unsafe extern "C" {
1403 #[doc = " Opaque type for IndexFlat1D\n\n optimized version for 1D \"vectors\""]
1404 pub fn faiss_IndexFlat1D_free(obj: *mut FaissIndexFlat1D);
1405}
1406unsafe extern "C" {
1407 #[doc = " Opaque type for IndexFlat1D\n\n optimized version for 1D \"vectors\""]
1408 pub fn faiss_IndexFlat1D_new(p_index: *mut *mut FaissIndexFlat1D) -> ::std::os::raw::c_int;
1409}
1410unsafe extern "C" {
1411 pub fn faiss_IndexFlat1D_new_with(
1412 p_index: *mut *mut FaissIndexFlat1D,
1413 continuous_update: ::std::os::raw::c_int,
1414 ) -> ::std::os::raw::c_int;
1415}
1416unsafe extern "C" {
1417 pub fn faiss_IndexFlat1D_update_permutation(
1418 index: *mut FaissIndexFlat1D,
1419 ) -> ::std::os::raw::c_int;
1420}
1421#[doc = " Inverted file with stored vectors. Here the inverted file\n pre-selects the vectors to be searched, but they are not otherwise\n encoded, the code array just contains the raw float entries."]
1422pub type FaissIndexIVFFlat = FaissIndex_H;
1423unsafe extern "C" {
1424 #[doc = " Inverted file with stored vectors. Here the inverted file\n pre-selects the vectors to be searched, but they are not otherwise\n encoded, the code array just contains the raw float entries."]
1425 pub fn faiss_IndexIVFFlat_free(obj: *mut FaissIndexIVFFlat);
1426}
1427unsafe extern "C" {
1428 #[doc = " Inverted file with stored vectors. Here the inverted file\n pre-selects the vectors to be searched, but they are not otherwise\n encoded, the code array just contains the raw float entries."]
1429 pub fn faiss_IndexIVFFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIVFFlat;
1430}
1431unsafe extern "C" {
1432 #[doc = " number of possible key values"]
1433 pub fn faiss_IndexIVFFlat_nlist(arg1: *const FaissIndexIVFFlat) -> usize;
1434}
1435unsafe extern "C" {
1436 #[doc = " number of probes at query time"]
1437 pub fn faiss_IndexIVFFlat_nprobe(arg1: *const FaissIndexIVFFlat) -> usize;
1438}
1439unsafe extern "C" {
1440 #[doc = " number of probes at query time"]
1441 pub fn faiss_IndexIVFFlat_set_nprobe(arg1: *mut FaissIndexIVFFlat, arg2: usize);
1442}
1443unsafe extern "C" {
1444 #[doc = " quantizer that maps vectors to inverted lists"]
1445 pub fn faiss_IndexIVFFlat_quantizer(arg1: *const FaissIndexIVFFlat) -> *mut FaissIndex;
1446}
1447unsafe extern "C" {
1448 #[doc = " = 0: use the quantizer as index in a kmeans training\n = 1: just pass on the training set to the train() of the quantizer\n = 2: kmeans training on a flat index + add the centroids to the quantizer"]
1449 pub fn faiss_IndexIVFFlat_quantizer_trains_alone(
1450 arg1: *const FaissIndexIVFFlat,
1451 ) -> ::std::os::raw::c_char;
1452}
1453unsafe extern "C" {
1454 #[doc = " whether object owns the quantizer"]
1455 pub fn faiss_IndexIVFFlat_own_fields(arg1: *const FaissIndexIVFFlat) -> ::std::os::raw::c_int;
1456}
1457unsafe extern "C" {
1458 #[doc = " whether object owns the quantizer"]
1459 pub fn faiss_IndexIVFFlat_set_own_fields(
1460 arg1: *mut FaissIndexIVFFlat,
1461 arg2: ::std::os::raw::c_int,
1462 );
1463}
1464unsafe extern "C" {
1465 #[doc = " whether object owns the quantizer"]
1466 pub fn faiss_IndexIVFFlat_new(p_index: *mut *mut FaissIndexIVFFlat) -> ::std::os::raw::c_int;
1467}
1468unsafe extern "C" {
1469 pub fn faiss_IndexIVFFlat_new_with(
1470 p_index: *mut *mut FaissIndexIVFFlat,
1471 quantizer: *mut FaissIndex,
1472 d: usize,
1473 nlist: usize,
1474 ) -> ::std::os::raw::c_int;
1475}
1476unsafe extern "C" {
1477 pub fn faiss_IndexIVFFlat_new_with_metric(
1478 p_index: *mut *mut FaissIndexIVFFlat,
1479 quantizer: *mut FaissIndex,
1480 d: usize,
1481 nlist: usize,
1482 metric: FaissMetricType,
1483 ) -> ::std::os::raw::c_int;
1484}
1485unsafe extern "C" {
1486 pub fn faiss_IndexIVFFlat_add_core(
1487 index: *mut FaissIndexIVFFlat,
1488 n: idx_t,
1489 x: *const f32,
1490 xids: *const idx_t,
1491 precomputed_idx: *const i64,
1492 ) -> ::std::os::raw::c_int;
1493}
1494unsafe extern "C" {
1495 #[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"]
1496 pub fn faiss_IndexIVFFlat_update_vectors(
1497 index: *mut FaissIndexIVFFlat,
1498 nv: ::std::os::raw::c_int,
1499 idx: *mut idx_t,
1500 v: *const f32,
1501 ) -> ::std::os::raw::c_int;
1502}
1503#[doc = " The sign of each vector component is put in a binary signature"]
1504pub type FaissIndexLSH = FaissIndex_H;
1505unsafe extern "C" {
1506 #[doc = " The sign of each vector component is put in a binary signature"]
1507 pub fn faiss_IndexLSH_free(obj: *mut FaissIndexLSH);
1508}
1509unsafe extern "C" {
1510 #[doc = " The sign of each vector component is put in a binary signature"]
1511 pub fn faiss_IndexLSH_cast(arg1: *mut FaissIndex) -> *mut FaissIndexLSH;
1512}
1513unsafe extern "C" {
1514 #[doc = " The sign of each vector component is put in a binary signature"]
1515 pub fn faiss_IndexLSH_nbits(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
1516}
1517unsafe extern "C" {
1518 #[doc = " The sign of each vector component is put in a binary signature"]
1519 pub fn faiss_IndexLSH_code_size(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
1520}
1521unsafe extern "C" {
1522 #[doc = " The sign of each vector component is put in a binary signature"]
1523 pub fn faiss_IndexLSH_rotate_data(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
1524}
1525unsafe extern "C" {
1526 #[doc = " The sign of each vector component is put in a binary signature"]
1527 pub fn faiss_IndexLSH_train_thresholds(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
1528}
1529unsafe extern "C" {
1530 #[doc = " The sign of each vector component is put in a binary signature"]
1531 pub fn faiss_IndexLSH_new(
1532 p_index: *mut *mut FaissIndexLSH,
1533 d: idx_t,
1534 nbits: ::std::os::raw::c_int,
1535 ) -> ::std::os::raw::c_int;
1536}
1537unsafe extern "C" {
1538 pub fn faiss_IndexLSH_new_with_options(
1539 p_index: *mut *mut FaissIndexLSH,
1540 d: idx_t,
1541 nbits: ::std::os::raw::c_int,
1542 rotate_data: ::std::os::raw::c_int,
1543 train_thresholds: ::std::os::raw::c_int,
1544 ) -> ::std::os::raw::c_int;
1545}
1546#[repr(C)]
1547#[derive(Debug, Copy, Clone)]
1548pub struct FaissVectorTransform_H {
1549 _unused: [u8; 0],
1550}
1551#[doc = " Opaque type for referencing to a VectorTransform object"]
1552pub type FaissVectorTransform = FaissVectorTransform_H;
1553unsafe extern "C" {
1554 #[doc = " Opaque type for referencing to a VectorTransform object"]
1555 pub fn faiss_VectorTransform_free(obj: *mut FaissVectorTransform);
1556}
1557unsafe extern "C" {
1558 #[doc = " Getter for is_trained"]
1559 pub fn faiss_VectorTransform_is_trained(
1560 arg1: *const FaissVectorTransform,
1561 ) -> ::std::os::raw::c_int;
1562}
1563unsafe extern "C" {
1564 #[doc = " Getter for input dimension"]
1565 pub fn faiss_VectorTransform_d_in(arg1: *const FaissVectorTransform) -> ::std::os::raw::c_int;
1566}
1567unsafe extern "C" {
1568 #[doc = " Getter for output dimension"]
1569 pub fn faiss_VectorTransform_d_out(arg1: *const FaissVectorTransform) -> ::std::os::raw::c_int;
1570}
1571unsafe extern "C" {
1572 #[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"]
1573 pub fn faiss_VectorTransform_train(
1574 vt: *mut FaissVectorTransform,
1575 n: idx_t,
1576 x: *const f32,
1577 ) -> ::std::os::raw::c_int;
1578}
1579unsafe extern "C" {
1580 #[doc = " apply the random rotation, return new allocated matrix\n @param x size n * d_in\n @return size n * d_out"]
1581 pub fn faiss_VectorTransform_apply(
1582 vt: *const FaissVectorTransform,
1583 n: idx_t,
1584 x: *const f32,
1585 ) -> *mut f32;
1586}
1587unsafe extern "C" {
1588 #[doc = " apply transformation and result is pre-allocated\n @param x size n * d_in\n @param xt size n * d_out"]
1589 pub fn faiss_VectorTransform_apply_noalloc(
1590 vt: *const FaissVectorTransform,
1591 n: idx_t,
1592 x: *const f32,
1593 xt: *mut f32,
1594 );
1595}
1596unsafe extern "C" {
1597 #[doc = " reverse transformation. May not be implemented or may return\n approximate result"]
1598 pub fn faiss_VectorTransform_reverse_transform(
1599 vt: *const FaissVectorTransform,
1600 n: idx_t,
1601 xt: *const f32,
1602 x: *mut f32,
1603 );
1604}
1605#[doc = " Opaque type for referencing to a LinearTransform object"]
1606pub type FaissLinearTransform = FaissVectorTransform_H;
1607unsafe extern "C" {
1608 #[doc = " Opaque type for referencing to a LinearTransform object"]
1609 pub fn faiss_LinearTransform_free(obj: *mut FaissLinearTransform);
1610}
1611unsafe extern "C" {
1612 #[doc = " compute x = A^T * (x - b)\n is reverse transform if A has orthonormal lines"]
1613 pub fn faiss_LinearTransform_transform_transpose(
1614 vt: *const FaissLinearTransform,
1615 n: idx_t,
1616 y: *const f32,
1617 x: *mut f32,
1618 );
1619}
1620unsafe extern "C" {
1621 #[doc = " compute A^T * A to set the is_orthonormal flag"]
1622 pub fn faiss_LinearTransform_set_is_orthonormal(vt: *mut FaissLinearTransform);
1623}
1624unsafe extern "C" {
1625 #[doc = " Getter for have_bias"]
1626 pub fn faiss_LinearTransform_have_bias(
1627 arg1: *const FaissLinearTransform,
1628 ) -> ::std::os::raw::c_int;
1629}
1630unsafe extern "C" {
1631 #[doc = " Getter for is_orthonormal"]
1632 pub fn faiss_LinearTransform_is_orthonormal(
1633 arg1: *const FaissLinearTransform,
1634 ) -> ::std::os::raw::c_int;
1635}
1636#[doc = " Getter for is_orthonormal"]
1637pub type FaissRandomRotationMatrix = FaissVectorTransform_H;
1638unsafe extern "C" {
1639 #[doc = " Getter for is_orthonormal"]
1640 pub fn faiss_RandomRotationMatrix_free(obj: *mut FaissRandomRotationMatrix);
1641}
1642unsafe extern "C" {
1643 #[doc = " Getter for is_orthonormal"]
1644 pub fn faiss_RandomRotationMatrix_new_with(
1645 p_vt: *mut *mut FaissRandomRotationMatrix,
1646 d_in: ::std::os::raw::c_int,
1647 d_out: ::std::os::raw::c_int,
1648 ) -> ::std::os::raw::c_int;
1649}
1650pub type FaissPCAMatrix = FaissVectorTransform_H;
1651unsafe extern "C" {
1652 pub fn faiss_PCAMatrix_free(obj: *mut FaissPCAMatrix);
1653}
1654unsafe extern "C" {
1655 pub fn faiss_PCAMatrix_new_with(
1656 p_vt: *mut *mut FaissPCAMatrix,
1657 d_in: ::std::os::raw::c_int,
1658 d_out: ::std::os::raw::c_int,
1659 eigen_power: f32,
1660 random_rotation: ::std::os::raw::c_int,
1661 ) -> ::std::os::raw::c_int;
1662}
1663unsafe extern "C" {
1664 #[doc = " Getter for eigen_power"]
1665 pub fn faiss_PCAMatrix_eigen_power(arg1: *const FaissPCAMatrix) -> f32;
1666}
1667unsafe extern "C" {
1668 #[doc = " Getter for random_rotation"]
1669 pub fn faiss_PCAMatrix_random_rotation(arg1: *const FaissPCAMatrix) -> ::std::os::raw::c_int;
1670}
1671#[doc = " Getter for random_rotation"]
1672pub type FaissITQMatrix = FaissVectorTransform_H;
1673unsafe extern "C" {
1674 #[doc = " Getter for random_rotation"]
1675 pub fn faiss_ITQMatrix_free(obj: *mut FaissITQMatrix);
1676}
1677unsafe extern "C" {
1678 #[doc = " Getter for random_rotation"]
1679 pub fn faiss_ITQMatrix_new_with(
1680 p_vt: *mut *mut FaissITQMatrix,
1681 d: ::std::os::raw::c_int,
1682 ) -> ::std::os::raw::c_int;
1683}
1684pub type FaissITQTransform = FaissVectorTransform_H;
1685unsafe extern "C" {
1686 pub fn faiss_ITQTransform_free(obj: *mut FaissITQTransform);
1687}
1688unsafe extern "C" {
1689 pub fn faiss_ITQTransform_new_with(
1690 p_vt: *mut *mut FaissITQTransform,
1691 d_in: ::std::os::raw::c_int,
1692 d_out: ::std::os::raw::c_int,
1693 do_pca: ::std::os::raw::c_int,
1694 ) -> ::std::os::raw::c_int;
1695}
1696unsafe extern "C" {
1697 #[doc = " Getter for do_pca"]
1698 pub fn faiss_ITQTransform_do_pca(arg1: *const FaissITQTransform) -> ::std::os::raw::c_int;
1699}
1700#[doc = " Getter for do_pca"]
1701pub type FaissOPQMatrix = FaissVectorTransform_H;
1702unsafe extern "C" {
1703 #[doc = " Getter for do_pca"]
1704 pub fn faiss_OPQMatrix_free(obj: *mut FaissOPQMatrix);
1705}
1706unsafe extern "C" {
1707 #[doc = " Getter for do_pca"]
1708 pub fn faiss_OPQMatrix_new_with(
1709 p_vt: *mut *mut FaissOPQMatrix,
1710 d: ::std::os::raw::c_int,
1711 M: ::std::os::raw::c_int,
1712 d2: ::std::os::raw::c_int,
1713 ) -> ::std::os::raw::c_int;
1714}
1715unsafe extern "C" {
1716 pub fn faiss_OPQMatrix_verbose(arg1: *const FaissOPQMatrix) -> ::std::os::raw::c_int;
1717}
1718unsafe extern "C" {
1719 pub fn faiss_OPQMatrix_set_verbose(arg1: *mut FaissOPQMatrix, arg2: ::std::os::raw::c_int);
1720}
1721unsafe extern "C" {
1722 pub fn faiss_OPQMatrix_niter(arg1: *const FaissOPQMatrix) -> ::std::os::raw::c_int;
1723}
1724unsafe extern "C" {
1725 pub fn faiss_OPQMatrix_set_niter(arg1: *mut FaissOPQMatrix, arg2: ::std::os::raw::c_int);
1726}
1727unsafe extern "C" {
1728 pub fn faiss_OPQMatrix_niter_pq(arg1: *const FaissOPQMatrix) -> ::std::os::raw::c_int;
1729}
1730unsafe extern "C" {
1731 pub fn faiss_OPQMatrix_set_niter_pq(arg1: *mut FaissOPQMatrix, arg2: ::std::os::raw::c_int);
1732}
1733pub type FaissRemapDimensionsTransform = FaissVectorTransform_H;
1734unsafe extern "C" {
1735 pub fn faiss_RemapDimensionsTransform_free(obj: *mut FaissRemapDimensionsTransform);
1736}
1737unsafe extern "C" {
1738 pub fn faiss_RemapDimensionsTransform_new_with(
1739 p_vt: *mut *mut FaissRemapDimensionsTransform,
1740 d_in: ::std::os::raw::c_int,
1741 d_out: ::std::os::raw::c_int,
1742 uniform: ::std::os::raw::c_int,
1743 ) -> ::std::os::raw::c_int;
1744}
1745pub type FaissNormalizationTransform = FaissVectorTransform_H;
1746unsafe extern "C" {
1747 pub fn faiss_NormalizationTransform_free(obj: *mut FaissNormalizationTransform);
1748}
1749unsafe extern "C" {
1750 pub fn faiss_NormalizationTransform_new_with(
1751 p_vt: *mut *mut FaissNormalizationTransform,
1752 d: ::std::os::raw::c_int,
1753 norm: f32,
1754 ) -> ::std::os::raw::c_int;
1755}
1756unsafe extern "C" {
1757 pub fn faiss_NormalizationTransform_norm(arg1: *const FaissNormalizationTransform) -> f32;
1758}
1759pub type FaissCenteringTransform = FaissVectorTransform_H;
1760unsafe extern "C" {
1761 pub fn faiss_CenteringTransform_free(obj: *mut FaissCenteringTransform);
1762}
1763unsafe extern "C" {
1764 pub fn faiss_CenteringTransform_new_with(
1765 p_vt: *mut *mut FaissCenteringTransform,
1766 d: ::std::os::raw::c_int,
1767 ) -> ::std::os::raw::c_int;
1768}
1769#[doc = " Index that applies a LinearTransform transform on vectors before\n handing them over to a sub-index"]
1770pub type FaissIndexPreTransform = FaissIndex_H;
1771unsafe extern "C" {
1772 #[doc = " Index that applies a LinearTransform transform on vectors before\n handing them over to a sub-index"]
1773 pub fn faiss_IndexPreTransform_free(obj: *mut FaissIndexPreTransform);
1774}
1775unsafe extern "C" {
1776 #[doc = " Index that applies a LinearTransform transform on vectors before\n handing them over to a sub-index"]
1777 pub fn faiss_IndexPreTransform_cast(arg1: *mut FaissIndex) -> *mut FaissIndexPreTransform;
1778}
1779unsafe extern "C" {
1780 #[doc = " Index that applies a LinearTransform transform on vectors before\n handing them over to a sub-index"]
1781 pub fn faiss_IndexPreTransform_index(arg1: *const FaissIndexPreTransform) -> *mut FaissIndex;
1782}
1783unsafe extern "C" {
1784 #[doc = " Index that applies a LinearTransform transform on vectors before\n handing them over to a sub-index"]
1785 pub fn faiss_IndexPreTransform_own_fields(
1786 arg1: *const FaissIndexPreTransform,
1787 ) -> ::std::os::raw::c_int;
1788}
1789unsafe extern "C" {
1790 #[doc = " Index that applies a LinearTransform transform on vectors before\n handing them over to a sub-index"]
1791 pub fn faiss_IndexPreTransform_set_own_fields(
1792 arg1: *mut FaissIndexPreTransform,
1793 arg2: ::std::os::raw::c_int,
1794 );
1795}
1796unsafe extern "C" {
1797 #[doc = " Index that applies a LinearTransform transform on vectors before\n handing them over to a sub-index"]
1798 pub fn faiss_IndexPreTransform_new(
1799 p_index: *mut *mut FaissIndexPreTransform,
1800 ) -> ::std::os::raw::c_int;
1801}
1802unsafe extern "C" {
1803 pub fn faiss_IndexPreTransform_new_with(
1804 p_index: *mut *mut FaissIndexPreTransform,
1805 index: *mut FaissIndex,
1806 ) -> ::std::os::raw::c_int;
1807}
1808unsafe extern "C" {
1809 pub fn faiss_IndexPreTransform_new_with_transform(
1810 p_index: *mut *mut FaissIndexPreTransform,
1811 ltrans: *mut FaissVectorTransform,
1812 index: *mut FaissIndex,
1813 ) -> ::std::os::raw::c_int;
1814}
1815unsafe extern "C" {
1816 pub fn faiss_IndexPreTransform_prepend_transform(
1817 index: *mut FaissIndexPreTransform,
1818 ltrans: *mut FaissVectorTransform,
1819 ) -> ::std::os::raw::c_int;
1820}
1821#[doc = " Index that concatenates the results from several sub-indexes"]
1822pub type FaissIndexReplicas = FaissIndex_H;
1823unsafe extern "C" {
1824 #[doc = " Index that concatenates the results from several sub-indexes"]
1825 pub fn faiss_IndexReplicas_free(obj: *mut FaissIndexReplicas);
1826}
1827unsafe extern "C" {
1828 #[doc = " Index that concatenates the results from several sub-indexes"]
1829 pub fn faiss_IndexReplicas_own_fields(arg1: *const FaissIndexReplicas)
1830 -> ::std::os::raw::c_int;
1831}
1832unsafe extern "C" {
1833 #[doc = " Index that concatenates the results from several sub-indexes"]
1834 pub fn faiss_IndexReplicas_set_own_fields(
1835 arg1: *mut FaissIndexReplicas,
1836 arg2: ::std::os::raw::c_int,
1837 );
1838}
1839unsafe extern "C" {
1840 #[doc = " Index that concatenates the results from several sub-indexes"]
1841 pub fn faiss_IndexReplicas_new(
1842 p_index: *mut *mut FaissIndexReplicas,
1843 d: idx_t,
1844 ) -> ::std::os::raw::c_int;
1845}
1846unsafe extern "C" {
1847 pub fn faiss_IndexReplicas_new_with_options(
1848 p_index: *mut *mut FaissIndexReplicas,
1849 d: idx_t,
1850 threaded: ::std::os::raw::c_int,
1851 ) -> ::std::os::raw::c_int;
1852}
1853unsafe extern "C" {
1854 pub fn faiss_IndexReplicas_add_replica(
1855 index: *mut FaissIndexReplicas,
1856 replica: *mut FaissIndex,
1857 ) -> ::std::os::raw::c_int;
1858}
1859unsafe extern "C" {
1860 pub fn faiss_IndexReplicas_remove_replica(
1861 index: *mut FaissIndexReplicas,
1862 replica: *mut FaissIndex,
1863 ) -> ::std::os::raw::c_int;
1864}
1865unsafe extern "C" {
1866 pub fn faiss_IndexReplicas_at(
1867 index: *mut FaissIndexReplicas,
1868 i: ::std::os::raw::c_int,
1869 ) -> *mut FaissIndex;
1870}
1871#[doc = "< 8 bits per component"]
1872pub const FaissQuantizerType_QT_8bit: FaissQuantizerType = 0;
1873#[doc = "< 4 bits per component"]
1874pub const FaissQuantizerType_QT_4bit: FaissQuantizerType = 1;
1875#[doc = "< same, shared range for all dimensions"]
1876pub const FaissQuantizerType_QT_8bit_uniform: FaissQuantizerType = 2;
1877pub const FaissQuantizerType_QT_4bit_uniform: FaissQuantizerType = 3;
1878pub const FaissQuantizerType_QT_fp16: FaissQuantizerType = 4;
1879#[doc = "< fast indexing of uint8s"]
1880pub const FaissQuantizerType_QT_8bit_direct: FaissQuantizerType = 5;
1881#[doc = "< 6 bits per component"]
1882pub const FaissQuantizerType_QT_6bit: FaissQuantizerType = 6;
1883pub const FaissQuantizerType_QT_bf16: FaissQuantizerType = 7;
1884#[doc = "< fast indexing of signed int8s ranging from [-128\n< to 127]"]
1885pub const FaissQuantizerType_QT_8bit_direct_signed: FaissQuantizerType = 8;
1886pub type FaissQuantizerType = ::std::os::raw::c_uint;
1887#[doc = " Opaque type for IndexScalarQuantizer"]
1888pub type FaissIndexScalarQuantizer = FaissIndex_H;
1889unsafe extern "C" {
1890 #[doc = " Opaque type for IndexScalarQuantizer"]
1891 pub fn faiss_IndexScalarQuantizer_new(
1892 p_index: *mut *mut FaissIndexScalarQuantizer,
1893 ) -> ::std::os::raw::c_int;
1894}
1895unsafe extern "C" {
1896 pub fn faiss_IndexScalarQuantizer_new_with(
1897 p_index: *mut *mut FaissIndexScalarQuantizer,
1898 d: idx_t,
1899 qt: FaissQuantizerType,
1900 metric: FaissMetricType,
1901 ) -> ::std::os::raw::c_int;
1902}
1903unsafe extern "C" {
1904 pub fn faiss_IndexScalarQuantizer_cast(arg1: *mut FaissIndex)
1905 -> *mut FaissIndexScalarQuantizer;
1906}
1907unsafe extern "C" {
1908 pub fn faiss_IndexScalarQuantizer_free(obj: *mut FaissIndexScalarQuantizer);
1909}
1910#[doc = " Opaque type for IndexIVFScalarQuantizer"]
1911pub type FaissIndexIVFScalarQuantizer = FaissIndex_H;
1912unsafe extern "C" {
1913 #[doc = " Opaque type for IndexIVFScalarQuantizer"]
1914 pub fn faiss_IndexIVFScalarQuantizer_cast(
1915 arg1: *mut FaissIndex,
1916 ) -> *mut FaissIndexIVFScalarQuantizer;
1917}
1918unsafe extern "C" {
1919 #[doc = " Opaque type for IndexIVFScalarQuantizer"]
1920 pub fn faiss_IndexIVFScalarQuantizer_free(obj: *mut FaissIndexIVFScalarQuantizer);
1921}
1922unsafe extern "C" {
1923 #[doc = " Opaque type for IndexIVFScalarQuantizer"]
1924 pub fn faiss_IndexIVFScalarQuantizer_new(
1925 p_index: *mut *mut FaissIndexIVFScalarQuantizer,
1926 ) -> ::std::os::raw::c_int;
1927}
1928unsafe extern "C" {
1929 pub fn faiss_IndexIVFScalarQuantizer_new_with(
1930 p_index: *mut *mut FaissIndexIVFScalarQuantizer,
1931 quantizer: *mut FaissIndex,
1932 d: idx_t,
1933 nlist: usize,
1934 qt: FaissQuantizerType,
1935 ) -> ::std::os::raw::c_int;
1936}
1937unsafe extern "C" {
1938 pub fn faiss_IndexIVFScalarQuantizer_new_with_metric(
1939 p_index: *mut *mut FaissIndexIVFScalarQuantizer,
1940 quantizer: *mut FaissIndex,
1941 d: usize,
1942 nlist: usize,
1943 qt: FaissQuantizerType,
1944 metric: FaissMetricType,
1945 encode_residual: ::std::os::raw::c_int,
1946 ) -> ::std::os::raw::c_int;
1947}
1948unsafe extern "C" {
1949 #[doc = " number of possible key values"]
1950 pub fn faiss_IndexIVFScalarQuantizer_nlist(arg1: *const FaissIndexIVFScalarQuantizer) -> usize;
1951}
1952unsafe extern "C" {
1953 #[doc = " number of probes at query time"]
1954 pub fn faiss_IndexIVFScalarQuantizer_nprobe(arg1: *const FaissIndexIVFScalarQuantizer)
1955 -> usize;
1956}
1957unsafe extern "C" {
1958 #[doc = " number of probes at query time"]
1959 pub fn faiss_IndexIVFScalarQuantizer_set_nprobe(
1960 arg1: *mut FaissIndexIVFScalarQuantizer,
1961 arg2: usize,
1962 );
1963}
1964unsafe extern "C" {
1965 #[doc = " quantizer that maps vectors to inverted lists"]
1966 pub fn faiss_IndexIVFScalarQuantizer_quantizer(
1967 arg1: *const FaissIndexIVFScalarQuantizer,
1968 ) -> *mut FaissIndex;
1969}
1970unsafe extern "C" {
1971 #[doc = " whether object owns the quantizer"]
1972 pub fn faiss_IndexIVFScalarQuantizer_own_fields(
1973 arg1: *const FaissIndexIVFScalarQuantizer,
1974 ) -> ::std::os::raw::c_int;
1975}
1976unsafe extern "C" {
1977 #[doc = " whether object owns the quantizer"]
1978 pub fn faiss_IndexIVFScalarQuantizer_set_own_fields(
1979 arg1: *mut FaissIndexIVFScalarQuantizer,
1980 arg2: ::std::os::raw::c_int,
1981 );
1982}
1983unsafe extern "C" {
1984 #[doc = " whether object owns the quantizer"]
1985 pub fn faiss_IndexIVFScalarQuantizer_add_core(
1986 index: *mut FaissIndexIVFScalarQuantizer,
1987 n: idx_t,
1988 x: *const f32,
1989 xids: *const idx_t,
1990 precomputed_idx: *const idx_t,
1991 ) -> ::std::os::raw::c_int;
1992}
1993#[doc = " Index that concatenates the results from several sub-indexes"]
1994pub type FaissIndexShards = FaissIndex_H;
1995unsafe extern "C" {
1996 #[doc = " Index that concatenates the results from several sub-indexes"]
1997 pub fn faiss_IndexShards_free(obj: *mut FaissIndexShards);
1998}
1999unsafe extern "C" {
2000 #[doc = " Index that concatenates the results from several sub-indexes"]
2001 pub fn faiss_IndexShards_own_fields(arg1: *const FaissIndexShards) -> ::std::os::raw::c_int;
2002}
2003unsafe extern "C" {
2004 #[doc = " Index that concatenates the results from several sub-indexes"]
2005 pub fn faiss_IndexShards_set_own_fields(
2006 arg1: *mut FaissIndexShards,
2007 arg2: ::std::os::raw::c_int,
2008 );
2009}
2010unsafe extern "C" {
2011 #[doc = " Index that concatenates the results from several sub-indexes"]
2012 pub fn faiss_IndexShards_successive_ids(arg1: *const FaissIndexShards)
2013 -> ::std::os::raw::c_int;
2014}
2015unsafe extern "C" {
2016 #[doc = " Index that concatenates the results from several sub-indexes"]
2017 pub fn faiss_IndexShards_set_successive_ids(
2018 arg1: *mut FaissIndexShards,
2019 arg2: ::std::os::raw::c_int,
2020 );
2021}
2022unsafe extern "C" {
2023 #[doc = " Index that concatenates the results from several sub-indexes"]
2024 pub fn faiss_IndexShards_new(
2025 p_index: *mut *mut FaissIndexShards,
2026 d: idx_t,
2027 ) -> ::std::os::raw::c_int;
2028}
2029unsafe extern "C" {
2030 pub fn faiss_IndexShards_new_with_options(
2031 p_index: *mut *mut FaissIndexShards,
2032 d: idx_t,
2033 threaded: ::std::os::raw::c_int,
2034 successive_ids: ::std::os::raw::c_int,
2035 ) -> ::std::os::raw::c_int;
2036}
2037unsafe extern "C" {
2038 pub fn faiss_IndexShards_add_shard(
2039 index: *mut FaissIndexShards,
2040 shard: *mut FaissIndex,
2041 ) -> ::std::os::raw::c_int;
2042}
2043unsafe extern "C" {
2044 pub fn faiss_IndexShards_remove_shard(
2045 index: *mut FaissIndexShards,
2046 shard: *mut FaissIndex,
2047 ) -> ::std::os::raw::c_int;
2048}
2049unsafe extern "C" {
2050 pub fn faiss_IndexShards_at(
2051 index: *mut FaissIndexShards,
2052 i: ::std::os::raw::c_int,
2053 ) -> *mut FaissIndex;
2054}
2055#[doc = " Index that translates search results to ids"]
2056pub type FaissIndexIDMap = FaissIndex_H;
2057unsafe extern "C" {
2058 #[doc = " Index that translates search results to ids"]
2059 pub fn faiss_IndexIDMap_own_fields(arg1: *const FaissIndexIDMap) -> ::std::os::raw::c_int;
2060}
2061unsafe extern "C" {
2062 #[doc = " Index that translates search results to ids"]
2063 pub fn faiss_IndexIDMap_set_own_fields(arg1: *mut FaissIndexIDMap, arg2: ::std::os::raw::c_int);
2064}
2065unsafe extern "C" {
2066 #[doc = " Index that translates search results to ids"]
2067 pub fn faiss_IndexIDMap_new(
2068 p_index: *mut *mut FaissIndexIDMap,
2069 index: *mut FaissIndex,
2070 ) -> ::std::os::raw::c_int;
2071}
2072unsafe extern "C" {
2073 #[doc = " attempt a dynamic cast to a IDMap, thus checking\n check whether the underlying index type is `IndexIDMap`.\n\n @param index opaque pointer to index object\n @return the same pointer if the index is a IDMap index, NULL otherwise"]
2074 pub fn faiss_IndexIDMap_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap;
2075}
2076unsafe extern "C" {
2077 #[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`."]
2078 pub fn faiss_IndexIDMap_id_map(
2079 index: *mut FaissIndexIDMap,
2080 p_id_map: *mut *mut idx_t,
2081 p_size: *mut usize,
2082 );
2083}
2084unsafe extern "C" {
2085 #[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"]
2086 pub fn faiss_IndexIDMap_sub_index(index: *mut FaissIndexIDMap) -> *mut FaissIndex;
2087}
2088#[doc = " same as IndexIDMap but also provides an efficient reconstruction\nimplementation via a 2-way index"]
2089pub type FaissIndexIDMap2 = FaissIndex_H;
2090unsafe extern "C" {
2091 #[doc = " same as IndexIDMap but also provides an efficient reconstruction\nimplementation via a 2-way index"]
2092 pub fn faiss_IndexIDMap2_own_fields(arg1: *const FaissIndexIDMap2) -> ::std::os::raw::c_int;
2093}
2094unsafe extern "C" {
2095 #[doc = " same as IndexIDMap but also provides an efficient reconstruction\nimplementation via a 2-way index"]
2096 pub fn faiss_IndexIDMap2_set_own_fields(
2097 arg1: *mut FaissIndexIDMap2,
2098 arg2: ::std::os::raw::c_int,
2099 );
2100}
2101unsafe extern "C" {
2102 #[doc = " same as IndexIDMap but also provides an efficient reconstruction\nimplementation via a 2-way index"]
2103 pub fn faiss_IndexIDMap2_new(
2104 p_index: *mut *mut FaissIndexIDMap2,
2105 index: *mut FaissIndex,
2106 ) -> ::std::os::raw::c_int;
2107}
2108unsafe extern "C" {
2109 #[doc = " make the rev_map from scratch"]
2110 pub fn faiss_IndexIDMap2_construct_rev_map(
2111 index: *mut FaissIndexIDMap2,
2112 ) -> ::std::os::raw::c_int;
2113}
2114unsafe extern "C" {
2115 #[doc = " attempt a dynamic cast to a IDMap2, thus checking\n check whether the underlying index type is `IndexIDMap`.\n\n @param index opaque pointer to index object\n @return the same pointer if the index is a IDMap2 index, NULL otherwise"]
2116 pub fn faiss_IndexIDMap2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap2;
2117}
2118unsafe extern "C" {
2119 #[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`."]
2120 pub fn faiss_IndexIDMap2_id_map(
2121 index: *mut FaissIndexIDMap2,
2122 p_id_map: *mut *mut idx_t,
2123 p_size: *mut usize,
2124 );
2125}
2126unsafe extern "C" {
2127 #[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"]
2128 pub fn faiss_IndexIDMap2_sub_index(index: *mut FaissIndexIDMap2) -> *mut FaissIndex;
2129}
2130pub type FILE = __BindgenOpaqueArray<u64, 27usize>;
2131unsafe extern "C" {
2132 #[doc = " Clone an index. This is equivalent to `faiss::clone_index`"]
2133 pub fn faiss_clone_index(
2134 arg1: *const FaissIndex,
2135 p_out: *mut *mut FaissIndex,
2136 ) -> ::std::os::raw::c_int;
2137}
2138unsafe extern "C" {
2139 #[doc = " Clone a binary index. This is equivalent to `faiss::clone_index_binary`"]
2140 pub fn faiss_clone_index_binary(
2141 arg1: *const FaissIndexBinary,
2142 p_out: *mut *mut FaissIndexBinary,
2143 ) -> ::std::os::raw::c_int;
2144}
2145#[doc = " No error"]
2146pub const FaissErrorCode_OK: FaissErrorCode = 0;
2147#[doc = " Any exception other than Faiss or standard C++ library exceptions"]
2148pub const FaissErrorCode_UNKNOWN_EXCEPT: FaissErrorCode = -1;
2149#[doc = " Faiss library exception"]
2150pub const FaissErrorCode_FAISS_EXCEPT: FaissErrorCode = -2;
2151#[doc = " Standard C++ library exception"]
2152pub const FaissErrorCode_STD_EXCEPT: FaissErrorCode = -4;
2153#[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."]
2154pub type FaissErrorCode = ::std::os::raw::c_int;
2155unsafe extern "C" {
2156 #[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."]
2157 pub fn faiss_get_last_error() -> *const ::std::os::raw::c_char;
2158}
2159#[repr(C)]
2160#[derive(Debug, Copy, Clone)]
2161pub struct FaissIOReader_H {
2162 _unused: [u8; 0],
2163}
2164pub type FaissIOReader = FaissIOReader_H;
2165unsafe extern "C" {
2166 pub fn faiss_IOReader_free(obj: *mut FaissIOReader);
2167}
2168#[repr(C)]
2169#[derive(Debug, Copy, Clone)]
2170pub struct FaissIOWriter_H {
2171 _unused: [u8; 0],
2172}
2173pub type FaissIOWriter = FaissIOWriter_H;
2174unsafe extern "C" {
2175 pub fn faiss_IOWriter_free(obj: *mut FaissIOWriter);
2176}
2177#[repr(C)]
2178#[derive(Debug, Copy, Clone)]
2179pub struct FaissCustomIOReader_H {
2180 _unused: [u8; 0],
2181}
2182#[doc = " Custom reader + writer\n\n Reader and writer which wraps a function pointer,\n primarily for FFI use."]
2183pub type FaissCustomIOReader = FaissCustomIOReader_H;
2184unsafe extern "C" {
2185 #[doc = " Custom reader + writer\n\n Reader and writer which wraps a function pointer,\n primarily for FFI use."]
2186 pub fn faiss_CustomIOReader_free(obj: *mut FaissCustomIOReader);
2187}
2188unsafe extern "C" {
2189 #[doc = " Custom reader + writer\n\n Reader and writer which wraps a function pointer,\n primarily for FFI use."]
2190 pub fn faiss_CustomIOReader_new(
2191 p_out: *mut *mut FaissCustomIOReader,
2192 func_in: ::std::option::Option<
2193 unsafe extern "C" fn(
2194 ptr: *mut ::std::os::raw::c_void,
2195 size: usize,
2196 nitems: usize,
2197 ) -> usize,
2198 >,
2199 ) -> ::std::os::raw::c_int;
2200}
2201#[repr(C)]
2202#[derive(Debug, Copy, Clone)]
2203pub struct FaissCustomIOWriter_H {
2204 _unused: [u8; 0],
2205}
2206pub type FaissCustomIOWriter = FaissCustomIOWriter_H;
2207unsafe extern "C" {
2208 pub fn faiss_CustomIOWriter_free(obj: *mut FaissCustomIOWriter);
2209}
2210unsafe extern "C" {
2211 pub fn faiss_CustomIOWriter_new(
2212 p_out: *mut *mut FaissCustomIOWriter,
2213 func_in: ::std::option::Option<
2214 unsafe extern "C" fn(
2215 ptr: *const ::std::os::raw::c_void,
2216 size: usize,
2217 nitems: usize,
2218 ) -> usize,
2219 >,
2220 ) -> ::std::os::raw::c_int;
2221}
2222unsafe extern "C" {
2223 #[doc = " Build an index with the sequence of processing steps described in\n the string."]
2224 pub fn faiss_index_factory(
2225 p_index: *mut *mut FaissIndex,
2226 d: ::std::os::raw::c_int,
2227 description: *const ::std::os::raw::c_char,
2228 metric: FaissMetricType,
2229 ) -> ::std::os::raw::c_int;
2230}
2231unsafe extern "C" {
2232 #[doc = " Build a binary index with the sequence of processing steps described in\n the string."]
2233 pub fn faiss_index_binary_factory(
2234 p_index: *mut *mut FaissIndexBinary,
2235 d: ::std::os::raw::c_int,
2236 description: *const ::std::os::raw::c_char,
2237 ) -> ::std::os::raw::c_int;
2238}
2239unsafe extern "C" {
2240 #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index` when a file descriptor is\n provided."]
2241 pub fn faiss_write_index(idx: *const FaissIndex, f: *mut FILE) -> ::std::os::raw::c_int;
2242}
2243unsafe extern "C" {
2244 #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index` when a file path is provided."]
2245 pub fn faiss_write_index_fname(
2246 idx: *const FaissIndex,
2247 fname: *const ::std::os::raw::c_char,
2248 ) -> ::std::os::raw::c_int;
2249}
2250unsafe extern "C" {
2251 #[doc = " Write index to a custom writer."]
2252 pub fn faiss_write_index_custom(
2253 idx: *const FaissIndex,
2254 io_writer: *mut FaissIOWriter,
2255 io_flags: ::std::os::raw::c_int,
2256 ) -> ::std::os::raw::c_int;
2257}
2258unsafe extern "C" {
2259 #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index` when a file descriptor is given."]
2260 pub fn faiss_read_index(
2261 f: *mut FILE,
2262 io_flags: ::std::os::raw::c_int,
2263 p_out: *mut *mut FaissIndex,
2264 ) -> ::std::os::raw::c_int;
2265}
2266unsafe extern "C" {
2267 #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index` when a file path is given."]
2268 pub fn faiss_read_index_fname(
2269 fname: *const ::std::os::raw::c_char,
2270 io_flags: ::std::os::raw::c_int,
2271 p_out: *mut *mut FaissIndex,
2272 ) -> ::std::os::raw::c_int;
2273}
2274unsafe extern "C" {
2275 #[doc = " Read index from a custom reader."]
2276 pub fn faiss_read_index_custom(
2277 io_reader: *mut FaissIOReader,
2278 io_flags: ::std::os::raw::c_int,
2279 p_out: *mut *mut FaissIndex,
2280 ) -> ::std::os::raw::c_int;
2281}
2282unsafe extern "C" {
2283 #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index_binary` when a file descriptor is\n provided."]
2284 pub fn faiss_write_index_binary(
2285 idx: *const FaissIndexBinary,
2286 f: *mut FILE,
2287 ) -> ::std::os::raw::c_int;
2288}
2289unsafe extern "C" {
2290 #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index_binary` when a file path is\n provided."]
2291 pub fn faiss_write_index_binary_fname(
2292 idx: *const FaissIndexBinary,
2293 fname: *const ::std::os::raw::c_char,
2294 ) -> ::std::os::raw::c_int;
2295}
2296unsafe extern "C" {
2297 #[doc = " Write binary index to a custom writer."]
2298 pub fn faiss_write_index_binary_custom(
2299 idx: *const FaissIndexBinary,
2300 io_writer: *mut FaissIOWriter,
2301 ) -> ::std::os::raw::c_int;
2302}
2303unsafe extern "C" {
2304 #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index_binary` when a file descriptor is\n given."]
2305 pub fn faiss_read_index_binary(
2306 f: *mut FILE,
2307 io_flags: ::std::os::raw::c_int,
2308 p_out: *mut *mut FaissIndexBinary,
2309 ) -> ::std::os::raw::c_int;
2310}
2311unsafe extern "C" {
2312 #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index_binary` when a file path is given."]
2313 pub fn faiss_read_index_binary_fname(
2314 fname: *const ::std::os::raw::c_char,
2315 io_flags: ::std::os::raw::c_int,
2316 p_out: *mut *mut FaissIndexBinary,
2317 ) -> ::std::os::raw::c_int;
2318}
2319unsafe extern "C" {
2320 #[doc = " Read binary index from a custom reader."]
2321 pub fn faiss_read_index_binary_custom(
2322 io_reader: *mut FaissIOReader,
2323 io_flags: ::std::os::raw::c_int,
2324 p_out: *mut *mut FaissIndexBinary,
2325 ) -> ::std::os::raw::c_int;
2326}
2327unsafe extern "C" {
2328 #[doc = " Read vector transform from a file.\n This is equivalent to `faiss:read_VectorTransform` when a file path is given."]
2329 pub fn faiss_read_VectorTransform_fname(
2330 fname: *const ::std::os::raw::c_char,
2331 p_out: *mut *mut FaissVectorTransform,
2332 ) -> ::std::os::raw::c_int;
2333}
2334unsafe extern "C" {
2335 #[doc = " Compute pairwise distances between sets of vectors"]
2336 pub fn faiss_pairwise_L2sqr(
2337 d: i64,
2338 nq: i64,
2339 xq: *const f32,
2340 nb: i64,
2341 xb: *const f32,
2342 dis: *mut f32,
2343 ldq: i64,
2344 ldb: i64,
2345 ldd: i64,
2346 );
2347}
2348unsafe extern "C" {
2349 #[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"]
2350 pub fn faiss_pairwise_L2sqr_with_defaults(
2351 d: i64,
2352 nq: i64,
2353 xq: *const f32,
2354 nb: i64,
2355 xb: *const f32,
2356 dis: *mut f32,
2357 );
2358}
2359unsafe extern "C" {
2360 #[doc = " compute the inner product between nx vectors x and one y"]
2361 pub fn faiss_fvec_inner_products_ny(
2362 ip: *mut f32,
2363 x: *const f32,
2364 y: *const f32,
2365 d: usize,
2366 ny: usize,
2367 );
2368}
2369unsafe extern "C" {
2370 #[doc = " compute ny square L2 distance between x and a set of contiguous y vectors"]
2371 pub fn faiss_fvec_L2sqr_ny(dis: *mut f32, x: *const f32, y: *const f32, d: usize, ny: usize);
2372}
2373unsafe extern "C" {
2374 #[doc = " squared norm of a vector"]
2375 pub fn faiss_fvec_norm_L2sqr(x: *const f32, d: usize) -> f32;
2376}
2377unsafe extern "C" {
2378 #[doc = " compute the L2 norms for a set of vectors"]
2379 pub fn faiss_fvec_norms_L2(norms: *mut f32, x: *const f32, d: usize, nx: usize);
2380}
2381unsafe extern "C" {
2382 #[doc = " same as fvec_norms_L2, but computes squared norms"]
2383 pub fn faiss_fvec_norms_L2sqr(norms: *mut f32, x: *const f32, d: usize, nx: usize);
2384}
2385unsafe extern "C" {
2386 #[doc = " L2-renormalize a set of vector. Nothing done if the vector is 0-normed"]
2387 pub fn faiss_fvec_renorm_L2(d: usize, nx: usize, x: *mut f32);
2388}
2389unsafe extern "C" {
2390 #[doc = " Setter of threshold value on nx above which we switch to BLAS to compute\n distances"]
2391 pub fn faiss_set_distance_compute_blas_threshold(value: ::std::os::raw::c_int);
2392}
2393unsafe extern "C" {
2394 #[doc = " Getter of threshold value on nx above which we switch to BLAS to compute\n distances"]
2395 pub fn faiss_get_distance_compute_blas_threshold() -> ::std::os::raw::c_int;
2396}
2397unsafe extern "C" {
2398 #[doc = " Setter of block sizes value for BLAS distance computations"]
2399 pub fn faiss_set_distance_compute_blas_query_bs(value: ::std::os::raw::c_int);
2400}
2401unsafe extern "C" {
2402 #[doc = " Getter of block sizes value for BLAS distance computations"]
2403 pub fn faiss_get_distance_compute_blas_query_bs() -> ::std::os::raw::c_int;
2404}
2405unsafe extern "C" {
2406 #[doc = " Setter of block sizes value for BLAS distance computations"]
2407 pub fn faiss_set_distance_compute_blas_database_bs(value: ::std::os::raw::c_int);
2408}
2409unsafe extern "C" {
2410 #[doc = " Getter of block sizes value for BLAS distance computations"]
2411 pub fn faiss_get_distance_compute_blas_database_bs() -> ::std::os::raw::c_int;
2412}
2413unsafe extern "C" {
2414 #[doc = " Setter of number of results we switch to a reservoir to collect results\n rather than a heap"]
2415 pub fn faiss_set_distance_compute_min_k_reservoir(value: ::std::os::raw::c_int);
2416}
2417unsafe extern "C" {
2418 #[doc = " Getter of number of results we switch to a reservoir to collect results\n rather than a heap"]
2419 pub fn faiss_get_distance_compute_min_k_reservoir() -> ::std::os::raw::c_int;
2420}
2421unsafe extern "C" {
2422 pub fn faiss_get_version() -> *const ::std::os::raw::c_char;
2423}
2424#[repr(C)]
2425#[derive(Debug, Copy, Clone)]
2426pub struct CUstream_st {
2427 _unused: [u8; 0],
2428}
2429#[doc = " CUDA stream"]
2430pub type cudaStream_t = *mut CUstream_st;
2431#[repr(C)]
2432#[derive(Debug, Copy, Clone)]
2433pub struct cublasContext {
2434 _unused: [u8; 0],
2435}
2436pub type cublasHandle_t = *mut cublasContext;
2437unsafe extern "C" {
2438 #[doc = " Returns the number of available GPU devices"]
2439 pub fn faiss_get_num_gpus(p_output: *mut ::std::os::raw::c_int) -> ::std::os::raw::c_int;
2440}
2441unsafe extern "C" {
2442 #[doc = " Starts the CUDA profiler (exposed via SWIG)"]
2443 pub fn faiss_gpu_profiler_start() -> ::std::os::raw::c_int;
2444}
2445unsafe extern "C" {
2446 #[doc = " Stops the CUDA profiler (exposed via SWIG)"]
2447 pub fn faiss_gpu_profiler_stop() -> ::std::os::raw::c_int;
2448}
2449unsafe extern "C" {
2450 #[doc = " Synchronizes the CPU against all devices (equivalent to\n cudaDeviceSynchronize for each device)"]
2451 pub fn faiss_gpu_sync_all_devices() -> ::std::os::raw::c_int;
2452}
2453#[doc = " The user indices are only stored on the CPU; the GPU returns\n (inverted list, offset) to the CPU which is then translated to\n the real user index."]
2454pub const FaissIndicesOptions_INDICES_CPU: FaissIndicesOptions = 0;
2455#[doc = " The indices are not stored at all, on either the CPU or\n GPU. Only (inverted list, offset) is returned to the user as the\n index."]
2456pub const FaissIndicesOptions_INDICES_IVF: FaissIndicesOptions = 1;
2457#[doc = " Indices are stored as 32 bit integers on the GPU, but returned\n as 64 bit integers"]
2458pub const FaissIndicesOptions_INDICES_32_BIT: FaissIndicesOptions = 2;
2459#[doc = " Indices are stored as 64 bit integers on the GPU"]
2460pub const FaissIndicesOptions_INDICES_64_BIT: FaissIndicesOptions = 3;
2461#[doc = " How user vector index data is stored on the GPU"]
2462pub type FaissIndicesOptions = ::std::os::raw::c_uint;
2463#[repr(C)]
2464#[derive(Debug, Copy, Clone)]
2465pub struct FaissGpuClonerOptions_H {
2466 _unused: [u8; 0],
2467}
2468pub type FaissGpuClonerOptions = FaissGpuClonerOptions_H;
2469unsafe extern "C" {
2470 pub fn faiss_GpuClonerOptions_free(obj: *mut FaissGpuClonerOptions);
2471}
2472unsafe extern "C" {
2473 #[doc = " Default constructor for GpuClonerOptions"]
2474 pub fn faiss_GpuClonerOptions_new(
2475 arg1: *mut *mut FaissGpuClonerOptions,
2476 ) -> ::std::os::raw::c_int;
2477}
2478unsafe extern "C" {
2479 #[doc = " how should indices be stored on index types that support indices\n (anything but GpuIndexFlat*)?"]
2480 pub fn faiss_GpuClonerOptions_indicesOptions(
2481 arg1: *const FaissGpuClonerOptions,
2482 ) -> FaissIndicesOptions;
2483}
2484unsafe extern "C" {
2485 #[doc = " how should indices be stored on index types that support indices\n (anything but GpuIndexFlat*)?"]
2486 pub fn faiss_GpuClonerOptions_set_indicesOptions(
2487 arg1: *mut FaissGpuClonerOptions,
2488 arg2: FaissIndicesOptions,
2489 );
2490}
2491unsafe extern "C" {
2492 #[doc = " (boolean) is the coarse quantizer in float16?"]
2493 pub fn faiss_GpuClonerOptions_useFloat16CoarseQuantizer(
2494 arg1: *const FaissGpuClonerOptions,
2495 ) -> ::std::os::raw::c_int;
2496}
2497unsafe extern "C" {
2498 #[doc = " (boolean) is the coarse quantizer in float16?"]
2499 pub fn faiss_GpuClonerOptions_set_useFloat16CoarseQuantizer(
2500 arg1: *mut FaissGpuClonerOptions,
2501 arg2: ::std::os::raw::c_int,
2502 );
2503}
2504unsafe extern "C" {
2505 #[doc = " (boolean) for GpuIndexIVFFlat, is storage in float16?\n for GpuIndexIVFPQ, are intermediate calculations in float16?"]
2506 pub fn faiss_GpuClonerOptions_useFloat16(
2507 arg1: *const FaissGpuClonerOptions,
2508 ) -> ::std::os::raw::c_int;
2509}
2510unsafe extern "C" {
2511 #[doc = " (boolean) for GpuIndexIVFFlat, is storage in float16?\n for GpuIndexIVFPQ, are intermediate calculations in float16?"]
2512 pub fn faiss_GpuClonerOptions_set_useFloat16(
2513 arg1: *mut FaissGpuClonerOptions,
2514 arg2: ::std::os::raw::c_int,
2515 );
2516}
2517unsafe extern "C" {
2518 #[doc = " (boolean) use precomputed tables?"]
2519 pub fn faiss_GpuClonerOptions_usePrecomputed(
2520 arg1: *const FaissGpuClonerOptions,
2521 ) -> ::std::os::raw::c_int;
2522}
2523unsafe extern "C" {
2524 #[doc = " (boolean) use precomputed tables?"]
2525 pub fn faiss_GpuClonerOptions_set_usePrecomputed(
2526 arg1: *mut FaissGpuClonerOptions,
2527 arg2: ::std::os::raw::c_int,
2528 );
2529}
2530unsafe extern "C" {
2531 #[doc = " reserve vectors in the invfiles?"]
2532 pub fn faiss_GpuClonerOptions_reserveVecs(
2533 arg1: *const FaissGpuClonerOptions,
2534 ) -> ::std::os::raw::c_long;
2535}
2536unsafe extern "C" {
2537 #[doc = " reserve vectors in the invfiles?"]
2538 pub fn faiss_GpuClonerOptions_set_reserveVecs(
2539 arg1: *mut FaissGpuClonerOptions,
2540 arg2: ::std::os::raw::c_long,
2541 );
2542}
2543unsafe extern "C" {
2544 #[doc = " (boolean) For GpuIndexFlat, store data in transposed layout?"]
2545 pub fn faiss_GpuClonerOptions_storeTransposed(
2546 arg1: *const FaissGpuClonerOptions,
2547 ) -> ::std::os::raw::c_int;
2548}
2549unsafe extern "C" {
2550 #[doc = " (boolean) For GpuIndexFlat, store data in transposed layout?"]
2551 pub fn faiss_GpuClonerOptions_set_storeTransposed(
2552 arg1: *mut FaissGpuClonerOptions,
2553 arg2: ::std::os::raw::c_int,
2554 );
2555}
2556unsafe extern "C" {
2557 #[doc = " (boolean) Set verbose options on the index"]
2558 pub fn faiss_GpuClonerOptions_verbose(
2559 arg1: *const FaissGpuClonerOptions,
2560 ) -> ::std::os::raw::c_int;
2561}
2562unsafe extern "C" {
2563 #[doc = " (boolean) Set verbose options on the index"]
2564 pub fn faiss_GpuClonerOptions_set_verbose(
2565 arg1: *mut FaissGpuClonerOptions,
2566 arg2: ::std::os::raw::c_int,
2567 );
2568}
2569#[doc = " (boolean) Set verbose options on the index"]
2570pub type FaissGpuMultipleClonerOptions = FaissGpuClonerOptions_H;
2571unsafe extern "C" {
2572 #[doc = " (boolean) Set verbose options on the index"]
2573 pub fn faiss_GpuMultipleClonerOptions_free(obj: *mut FaissGpuMultipleClonerOptions);
2574}
2575unsafe extern "C" {
2576 #[doc = " Default constructor for GpuMultipleClonerOptions"]
2577 pub fn faiss_GpuMultipleClonerOptions_new(
2578 arg1: *mut *mut FaissGpuMultipleClonerOptions,
2579 ) -> ::std::os::raw::c_int;
2580}
2581unsafe extern "C" {
2582 #[doc = " (boolean) Whether to shard the index across GPUs, versus replication\n across GPUs"]
2583 pub fn faiss_GpuMultipleClonerOptions_shard(
2584 arg1: *const FaissGpuMultipleClonerOptions,
2585 ) -> ::std::os::raw::c_int;
2586}
2587unsafe extern "C" {
2588 #[doc = " (boolean) Whether to shard the index across GPUs, versus replication\n across GPUs"]
2589 pub fn faiss_GpuMultipleClonerOptions_set_shard(
2590 arg1: *mut FaissGpuMultipleClonerOptions,
2591 arg2: ::std::os::raw::c_int,
2592 );
2593}
2594unsafe extern "C" {
2595 #[doc = " IndexIVF::copy_subset_to subset type"]
2596 pub fn faiss_GpuMultipleClonerOptions_shard_type(
2597 arg1: *const FaissGpuMultipleClonerOptions,
2598 ) -> ::std::os::raw::c_int;
2599}
2600unsafe extern "C" {
2601 #[doc = " IndexIVF::copy_subset_to subset type"]
2602 pub fn faiss_GpuMultipleClonerOptions_set_shard_type(
2603 arg1: *mut FaissGpuMultipleClonerOptions,
2604 arg2: ::std::os::raw::c_int,
2605 );
2606}
2607#[repr(C)]
2608#[derive(Debug, Copy, Clone)]
2609pub struct FaissGpuIndexConfig_H {
2610 _unused: [u8; 0],
2611}
2612pub type FaissGpuIndexConfig = FaissGpuIndexConfig_H;
2613unsafe extern "C" {
2614 pub fn faiss_GpuIndexConfig_device(arg1: *const FaissGpuIndexConfig) -> ::std::os::raw::c_int;
2615}
2616pub type FaissGpuIndex = FaissIndex_H;
2617#[repr(C)]
2618#[derive(Debug, Copy, Clone)]
2619pub struct FaissGpuResources_H {
2620 _unused: [u8; 0],
2621}
2622#[doc = " Base class of GPU-side resource provider; hides provision of\n cuBLAS handles, CUDA streams and a temporary memory manager"]
2623pub type FaissGpuResources = FaissGpuResources_H;
2624unsafe extern "C" {
2625 #[doc = " Base class of GPU-side resource provider; hides provision of\n cuBLAS handles, CUDA streams and a temporary memory manager"]
2626 pub fn faiss_GpuResources_free(obj: *mut FaissGpuResources);
2627}
2628unsafe extern "C" {
2629 #[doc = " Call to pre-allocate resources for a particular device. If this is\n not called, then resources will be allocated at the first time\n of demand"]
2630 pub fn faiss_GpuResources_initializeForDevice(
2631 arg1: *mut FaissGpuResources,
2632 arg2: ::std::os::raw::c_int,
2633 ) -> ::std::os::raw::c_int;
2634}
2635unsafe extern "C" {
2636 #[doc = " Returns the cuBLAS handle that we use for the given device"]
2637 pub fn faiss_GpuResources_getBlasHandle(
2638 arg1: *mut FaissGpuResources,
2639 arg2: ::std::os::raw::c_int,
2640 arg3: *mut cublasHandle_t,
2641 ) -> ::std::os::raw::c_int;
2642}
2643unsafe extern "C" {
2644 #[doc = " Returns the stream that we order all computation on for the\n given device"]
2645 pub fn faiss_GpuResources_getDefaultStream(
2646 arg1: *mut FaissGpuResources,
2647 arg2: ::std::os::raw::c_int,
2648 arg3: *mut cudaStream_t,
2649 ) -> ::std::os::raw::c_int;
2650}
2651unsafe extern "C" {
2652 #[doc = " Returns the available CPU pinned memory buffer"]
2653 pub fn faiss_GpuResources_getPinnedMemory(
2654 arg1: *mut FaissGpuResources,
2655 arg2: *mut *mut ::std::os::raw::c_void,
2656 arg3: *mut usize,
2657 ) -> ::std::os::raw::c_int;
2658}
2659unsafe extern "C" {
2660 #[doc = " Returns the stream on which we perform async CPU <-> GPU copies"]
2661 pub fn faiss_GpuResources_getAsyncCopyStream(
2662 arg1: *mut FaissGpuResources,
2663 arg2: ::std::os::raw::c_int,
2664 arg3: *mut cudaStream_t,
2665 ) -> ::std::os::raw::c_int;
2666}
2667unsafe extern "C" {
2668 #[doc = " Calls getBlasHandle with the current device"]
2669 pub fn faiss_GpuResources_getBlasHandleCurrentDevice(
2670 arg1: *mut FaissGpuResources,
2671 arg2: *mut cublasHandle_t,
2672 ) -> ::std::os::raw::c_int;
2673}
2674unsafe extern "C" {
2675 #[doc = " Calls getDefaultStream with the current device"]
2676 pub fn faiss_GpuResources_getDefaultStreamCurrentDevice(
2677 arg1: *mut FaissGpuResources,
2678 arg2: *mut cudaStream_t,
2679 ) -> ::std::os::raw::c_int;
2680}
2681unsafe extern "C" {
2682 #[doc = " Synchronizes the CPU with respect to the default stream for the\n given device"]
2683 pub fn faiss_GpuResources_syncDefaultStream(
2684 arg1: *mut FaissGpuResources,
2685 arg2: ::std::os::raw::c_int,
2686 ) -> ::std::os::raw::c_int;
2687}
2688unsafe extern "C" {
2689 #[doc = " Calls syncDefaultStream for the current device"]
2690 pub fn faiss_GpuResources_syncDefaultStreamCurrentDevice(
2691 arg1: *mut FaissGpuResources,
2692 ) -> ::std::os::raw::c_int;
2693}
2694unsafe extern "C" {
2695 #[doc = " Calls getAsyncCopyStream for the current device"]
2696 pub fn faiss_GpuResources_getAsyncCopyStreamCurrentDevice(
2697 arg1: *mut FaissGpuResources,
2698 arg2: *mut cudaStream_t,
2699 ) -> ::std::os::raw::c_int;
2700}
2701#[repr(C)]
2702#[derive(Debug, Copy, Clone)]
2703pub struct FaissGpuResourcesProvider_H {
2704 _unused: [u8; 0],
2705}
2706pub type FaissGpuResourcesProvider = FaissGpuResourcesProvider_H;
2707unsafe extern "C" {
2708 pub fn faiss_GpuResourcesProvider_free(obj: *mut FaissGpuResourcesProvider);
2709}
2710unsafe extern "C" {
2711 pub fn faiss_GpuResourcesProvider_getResources(
2712 arg1: *mut FaissGpuResourcesProvider,
2713 arg2: *mut *mut FaissGpuResources,
2714 ) -> ::std::os::raw::c_int;
2715}
2716unsafe extern "C" {
2717 #[doc = " converts any GPU index inside gpu_index to a CPU index"]
2718 pub fn faiss_index_gpu_to_cpu(
2719 gpu_index: *const FaissIndex,
2720 p_out: *mut *mut FaissIndex,
2721 ) -> ::std::os::raw::c_int;
2722}
2723unsafe extern "C" {
2724 #[doc = " converts any CPU index that can be converted to GPU"]
2725 pub fn faiss_index_cpu_to_gpu(
2726 provider: *mut FaissGpuResourcesProvider,
2727 device: ::std::os::raw::c_int,
2728 index: *const FaissIndex,
2729 p_out: *mut *mut FaissGpuIndex,
2730 ) -> ::std::os::raw::c_int;
2731}
2732unsafe extern "C" {
2733 #[doc = " converts any CPU index that can be converted to GPU"]
2734 pub fn faiss_index_cpu_to_gpu_with_options(
2735 provider: *mut FaissGpuResourcesProvider,
2736 device: ::std::os::raw::c_int,
2737 index: *const FaissIndex,
2738 options: *const FaissGpuClonerOptions,
2739 p_out: *mut *mut FaissGpuIndex,
2740 ) -> ::std::os::raw::c_int;
2741}
2742unsafe extern "C" {
2743 #[doc = " converts any CPU index that can be converted to GPU"]
2744 pub fn faiss_index_cpu_to_gpu_multiple(
2745 providers_vec: *const *mut FaissGpuResourcesProvider,
2746 devices: *const ::std::os::raw::c_int,
2747 devices_size: usize,
2748 index: *const FaissIndex,
2749 p_out: *mut *mut FaissGpuIndex,
2750 ) -> ::std::os::raw::c_int;
2751}
2752unsafe extern "C" {
2753 #[doc = " converts any CPU index that can be converted to GPU"]
2754 pub fn faiss_index_cpu_to_gpu_multiple_with_options(
2755 providers_vec: *const *mut FaissGpuResourcesProvider,
2756 providers_vec_size: usize,
2757 devices: *const ::std::os::raw::c_int,
2758 devices_size: usize,
2759 index: *const FaissIndex,
2760 options: *const FaissGpuMultipleClonerOptions,
2761 p_out: *mut *mut FaissGpuIndex,
2762 ) -> ::std::os::raw::c_int;
2763}
2764#[doc = " parameter space and setters for GPU indexes"]
2765pub type FaissGpuParameterSpace = FaissParameterSpace_H;
2766#[doc = " Default implementation of GpuResourcesProvider that allocates a cuBLAS\n stream and 2 streams for use, as well as temporary memory"]
2767pub type FaissStandardGpuResources = FaissGpuResourcesProvider_H;
2768unsafe extern "C" {
2769 #[doc = " Default implementation of GpuResourcesProvider that allocates a cuBLAS\n stream and 2 streams for use, as well as temporary memory"]
2770 pub fn faiss_StandardGpuResources_free(obj: *mut FaissStandardGpuResources);
2771}
2772unsafe extern "C" {
2773 #[doc = " Default constructor for StandardGpuResources"]
2774 pub fn faiss_StandardGpuResources_new(
2775 arg1: *mut *mut FaissStandardGpuResources,
2776 ) -> ::std::os::raw::c_int;
2777}
2778unsafe extern "C" {
2779 #[doc = " Disable allocation of temporary memory; all temporary memory\n requests will call cudaMalloc / cudaFree at the point of use"]
2780 pub fn faiss_StandardGpuResources_noTempMemory(
2781 arg1: *mut FaissStandardGpuResources,
2782 ) -> ::std::os::raw::c_int;
2783}
2784unsafe extern "C" {
2785 #[doc = " Specify that we wish to use a certain fixed size of memory on\n all devices as temporary memory"]
2786 pub fn faiss_StandardGpuResources_setTempMemory(
2787 arg1: *mut FaissStandardGpuResources,
2788 size: usize,
2789 ) -> ::std::os::raw::c_int;
2790}
2791unsafe extern "C" {
2792 #[doc = " Set amount of pinned memory to allocate, for async GPU <-> CPU\n transfers"]
2793 pub fn faiss_StandardGpuResources_setPinnedMemory(
2794 arg1: *mut FaissStandardGpuResources,
2795 size: usize,
2796 ) -> ::std::os::raw::c_int;
2797}
2798unsafe extern "C" {
2799 #[doc = " Called to change the stream for work ordering"]
2800 pub fn faiss_StandardGpuResources_setDefaultStream(
2801 arg1: *mut FaissStandardGpuResources,
2802 device: ::std::os::raw::c_int,
2803 stream: cudaStream_t,
2804 ) -> ::std::os::raw::c_int;
2805}
2806unsafe extern "C" {
2807 #[doc = " Called to change the work ordering streams to the null stream\n for all devices"]
2808 pub fn faiss_StandardGpuResources_setDefaultNullStreamAllDevices(
2809 arg1: *mut FaissStandardGpuResources,
2810 ) -> ::std::os::raw::c_int;
2811}