faiss-sys 0.7.0

Native bindings for Faiss
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
/* automatically generated by rust-bindgen 0.72.0 */

#[doc = r" If Bindgen could only determine the size and alignment of a"]
#[doc = r" type, it is represented like this."]
#[derive(PartialEq, Copy, Clone, Debug, Hash)]
#[repr(C)]
pub struct __BindgenOpaqueArray<T: Copy, const N: usize>(pub [T; N]);
impl<T: Copy + Default, const N: usize> Default for __BindgenOpaqueArray<T, N> {
    fn default() -> Self {
        Self([<T as Default>::default(); N])
    }
}
pub type faiss_idx_t = i64;
pub type idx_t = faiss_idx_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissRangeSearchResult_H {
    _unused: [u8; 0],
}
pub type FaissRangeSearchResult = FaissRangeSearchResult_H;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIDSelector_H {
    _unused: [u8; 0],
}
#[doc = " Encapsulates a set of ids to remove."]
pub type FaissIDSelector = FaissIDSelector_H;
#[doc = "< maximum inner product search"]
pub const FaissMetricType_METRIC_INNER_PRODUCT: FaissMetricType = 0;
#[doc = "< squared L2 search"]
pub const FaissMetricType_METRIC_L2: FaissMetricType = 1;
#[doc = "< L1 (aka cityblock)"]
pub const FaissMetricType_METRIC_L1: FaissMetricType = 2;
#[doc = "< infinity distance"]
pub const FaissMetricType_METRIC_Linf: FaissMetricType = 3;
#[doc = "< L_p distance, p is given by metric_arg"]
pub const FaissMetricType_METRIC_Lp: FaissMetricType = 4;
#[doc = " some additional metrics defined in scipy.spatial.distance"]
pub const FaissMetricType_METRIC_Canberra: FaissMetricType = 20;
#[doc = " some additional metrics defined in scipy.spatial.distance"]
pub const FaissMetricType_METRIC_BrayCurtis: FaissMetricType = 21;
#[doc = " some additional metrics defined in scipy.spatial.distance"]
pub const FaissMetricType_METRIC_JensenShannon: FaissMetricType = 22;
#[doc = " Some algorithms support both an inner product version and a L2 search\n version."]
pub type FaissMetricType = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissSearchParameters_H {
    _unused: [u8; 0],
}
pub type FaissSearchParameters = FaissSearchParameters_H;
unsafe extern "C" {
    pub fn faiss_SearchParameters_free(obj: *mut FaissSearchParameters);
}
unsafe extern "C" {
    pub fn faiss_SearchParameters_new(
        p_sp: *mut *mut FaissSearchParameters,
        sel: *mut FaissIDSelector,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIndex_H {
    _unused: [u8; 0],
}
#[doc = " Opaque type for referencing to an index object"]
pub type FaissIndex = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Opaque type for referencing to an index object"]
    pub fn faiss_Index_free(obj: *mut FaissIndex);
}
unsafe extern "C" {
    #[doc = " Getter for d"]
    pub fn faiss_Index_d(arg1: *const FaissIndex) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for is_trained"]
    pub fn faiss_Index_is_trained(arg1: *const FaissIndex) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for ntotal"]
    pub fn faiss_Index_ntotal(arg1: *const FaissIndex) -> idx_t;
}
unsafe extern "C" {
    #[doc = " Getter for metric_type"]
    pub fn faiss_Index_metric_type(arg1: *const FaissIndex) -> FaissMetricType;
}
unsafe extern "C" {
    #[doc = " Getter for metric_type"]
    pub fn faiss_Index_verbose(arg1: *const FaissIndex) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for metric_type"]
    pub fn faiss_Index_set_verbose(arg1: *mut FaissIndex, arg2: ::std::os::raw::c_int);
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_train(
        index: *mut FaissIndex,
        n: idx_t,
        x: *const f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_add(
        index: *mut FaissIndex,
        n: idx_t,
        x: *const f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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)"]
    pub fn faiss_Index_add_with_ids(
        index: *mut FaissIndex,
        n: idx_t,
        x: *const f32,
        xids: *const idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_search(
        index: *const FaissIndex,
        n: idx_t,
        x: *const f32,
        k: idx_t,
        distances: *mut f32,
        labels: *mut idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_search_with_params(
        index: *const FaissIndex,
        n: idx_t,
        x: *const f32,
        k: idx_t,
        params: *const FaissSearchParameters,
        distances: *mut f32,
        labels: *mut idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_range_search(
        index: *const FaissIndex,
        n: idx_t,
        x: *const f32,
        radius: f32,
        result: *mut FaissRangeSearchResult,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_assign(
        index: *mut FaissIndex,
        n: idx_t,
        x: *const f32,
        labels: *mut idx_t,
        k: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " removes all elements from the database.\n @param index       opaque pointer to index object"]
    pub fn faiss_Index_reset(index: *mut FaissIndex) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_remove_ids(
        index: *mut FaissIndex,
        sel: *const FaissIDSelector,
        n_removed: *mut usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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)"]
    pub fn faiss_Index_reconstruct(
        index: *const FaissIndex,
        key: idx_t,
        recons: *mut f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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)"]
    pub fn faiss_Index_reconstruct_n(
        index: *const FaissIndex,
        i0: idx_t,
        ni: idx_t,
        recons: *mut f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_compute_residual(
        index: *const FaissIndex,
        x: *const f32,
        residual: *mut f32,
        key: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_compute_residual_n(
        index: *const FaissIndex,
        n: idx_t,
        x: *const f32,
        residuals: *mut f32,
        keys: *const idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_sa_code_size(
        index: *const FaissIndex,
        size: *mut usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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()"]
    pub fn faiss_Index_sa_encode(
        index: *const FaissIndex,
        n: idx_t,
        x: *const f32,
        bytes: *mut u8,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_Index_sa_decode(
        index: *const FaissIndex,
        n: idx_t,
        bytes: *const u8,
        x: *mut f32,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissParameterRange_H {
    _unused: [u8; 0],
}
#[doc = " possible values of a parameter, sorted from least to most expensive/accurate"]
pub type FaissParameterRange = FaissParameterRange_H;
unsafe extern "C" {
    #[doc = " possible values of a parameter, sorted from least to most expensive/accurate"]
    pub fn faiss_ParameterRange_name(
        arg1: *const FaissParameterRange,
    ) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " Getter for the values in the range. The output values are invalidated\n upon any other modification of the range."]
    pub fn faiss_ParameterRange_values(
        arg1: *mut FaissParameterRange,
        arg2: *mut *mut f64,
        arg3: *mut usize,
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissParameterSpace_H {
    _unused: [u8; 0],
}
#[doc = " Uses a-priori knowledge on the Faiss indexes to extract tunable parameters."]
pub type FaissParameterSpace = FaissParameterSpace_H;
unsafe extern "C" {
    #[doc = " Uses a-priori knowledge on the Faiss indexes to extract tunable parameters."]
    pub fn faiss_ParameterSpace_free(obj: *mut FaissParameterSpace);
}
unsafe extern "C" {
    #[doc = " Parameter space default constructor"]
    pub fn faiss_ParameterSpace_new(space: *mut *mut FaissParameterSpace) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " nb of combinations, = product of values sizes"]
    pub fn faiss_ParameterSpace_n_combinations(arg1: *const FaissParameterSpace) -> usize;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_ParameterSpace_combination_name(
        arg1: *const FaissParameterSpace,
        arg2: usize,
        arg3: *mut ::std::os::raw::c_char,
        arg4: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " set a combination of parameters described by a string"]
    pub fn faiss_ParameterSpace_set_index_parameters(
        arg1: *const FaissParameterSpace,
        arg2: *mut FaissIndex,
        arg3: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " set a combination of parameters on an index"]
    pub fn faiss_ParameterSpace_set_index_parameters_cno(
        arg1: *const FaissParameterSpace,
        arg2: *mut FaissIndex,
        arg3: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " set one of the parameters"]
    pub fn faiss_ParameterSpace_set_index_parameter(
        arg1: *const FaissParameterSpace,
        arg2: *mut FaissIndex,
        arg3: *const ::std::os::raw::c_char,
        arg4: f64,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " print a description on stdout"]
    pub fn faiss_ParameterSpace_display(arg1: *const FaissParameterSpace);
}
unsafe extern "C" {
    #[doc = " add a new parameter (or return it if it exists)"]
    pub fn faiss_ParameterSpace_add_range(
        arg1: *mut FaissParameterSpace,
        arg2: *const ::std::os::raw::c_char,
        arg3: *mut *mut FaissParameterRange,
    ) -> ::std::os::raw::c_int;
}
#[doc = " Class for the clustering parameters. Can be passed to the\n constructor of the Clustering object."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissClusteringParameters {
    #[doc = "< clustering iterations"]
    pub niter: ::std::os::raw::c_int,
    #[doc = "< redo clustering this many times and keep best"]
    pub nredo: ::std::os::raw::c_int,
    #[doc = "< (bool)"]
    pub verbose: ::std::os::raw::c_int,
    #[doc = "< (bool) do we want normalized centroids?"]
    pub spherical: ::std::os::raw::c_int,
    #[doc = "< (bool) round centroids coordinates to integer"]
    pub int_centroids: ::std::os::raw::c_int,
    #[doc = "< (bool) update index after each iteration?"]
    pub update_index: ::std::os::raw::c_int,
    #[doc = "< (bool) use the centroids provided as input and do\n< not change them during iterations"]
    pub frozen_centroids: ::std::os::raw::c_int,
    #[doc = "< otherwise you get a warning"]
    pub min_points_per_centroid: ::std::os::raw::c_int,
    #[doc = "< to limit size of dataset"]
    pub max_points_per_centroid: ::std::os::raw::c_int,
    #[doc = "< seed for the random number generator"]
    pub seed: ::std::os::raw::c_int,
    #[doc = "< how many vectors at a time to decode"]
    pub decode_block_size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of FaissClusteringParameters"]
        [::std::mem::size_of::<FaissClusteringParameters>() - 48usize];
    ["Alignment of FaissClusteringParameters"]
        [::std::mem::align_of::<FaissClusteringParameters>() - 8usize];
    ["Offset of field: FaissClusteringParameters::niter"]
        [::std::mem::offset_of!(FaissClusteringParameters, niter) - 0usize];
    ["Offset of field: FaissClusteringParameters::nredo"]
        [::std::mem::offset_of!(FaissClusteringParameters, nredo) - 4usize];
    ["Offset of field: FaissClusteringParameters::verbose"]
        [::std::mem::offset_of!(FaissClusteringParameters, verbose) - 8usize];
    ["Offset of field: FaissClusteringParameters::spherical"]
        [::std::mem::offset_of!(FaissClusteringParameters, spherical) - 12usize];
    ["Offset of field: FaissClusteringParameters::int_centroids"]
        [::std::mem::offset_of!(FaissClusteringParameters, int_centroids) - 16usize];
    ["Offset of field: FaissClusteringParameters::update_index"]
        [::std::mem::offset_of!(FaissClusteringParameters, update_index) - 20usize];
    ["Offset of field: FaissClusteringParameters::frozen_centroids"]
        [::std::mem::offset_of!(FaissClusteringParameters, frozen_centroids) - 24usize];
    ["Offset of field: FaissClusteringParameters::min_points_per_centroid"]
        [::std::mem::offset_of!(FaissClusteringParameters, min_points_per_centroid) - 28usize];
    ["Offset of field: FaissClusteringParameters::max_points_per_centroid"]
        [::std::mem::offset_of!(FaissClusteringParameters, max_points_per_centroid) - 32usize];
    ["Offset of field: FaissClusteringParameters::seed"]
        [::std::mem::offset_of!(FaissClusteringParameters, seed) - 36usize];
    ["Offset of field: FaissClusteringParameters::decode_block_size"]
        [::std::mem::offset_of!(FaissClusteringParameters, decode_block_size) - 40usize];
};
unsafe extern "C" {
    #[doc = " Sets the ClusteringParameters object with reasonable defaults"]
    pub fn faiss_ClusteringParameters_init(params: *mut FaissClusteringParameters);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissClustering_H {
    _unused: [u8; 0],
}
#[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."]
pub type FaissClustering = FaissClustering_H;
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_niter(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_nredo(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_verbose(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_spherical(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_int_centroids(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_update_index(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_frozen_centroids(arg1: *const FaissClustering)
        -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_min_points_per_centroid(
        arg1: *const FaissClustering,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_max_points_per_centroid(
        arg1: *const FaissClustering,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_seed(arg1: *const FaissClustering) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_Clustering_decode_block_size(arg1: *const FaissClustering) -> usize;
}
unsafe extern "C" {
    #[doc = " getter for d"]
    pub fn faiss_Clustering_d(arg1: *const FaissClustering) -> usize;
}
unsafe extern "C" {
    #[doc = " getter for k"]
    pub fn faiss_Clustering_k(arg1: *const FaissClustering) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissClusteringIterationStats_H {
    _unused: [u8; 0],
}
#[doc = " getter for k"]
pub type FaissClusteringIterationStats = FaissClusteringIterationStats_H;
unsafe extern "C" {
    #[doc = " getter for k"]
    pub fn faiss_ClusteringIterationStats_obj(arg1: *const FaissClusteringIterationStats) -> f32;
}
unsafe extern "C" {
    #[doc = " getter for k"]
    pub fn faiss_ClusteringIterationStats_time(arg1: *const FaissClusteringIterationStats) -> f64;
}
unsafe extern "C" {
    #[doc = " getter for k"]
    pub fn faiss_ClusteringIterationStats_time_search(
        arg1: *const FaissClusteringIterationStats,
    ) -> f64;
}
unsafe extern "C" {
    #[doc = " getter for k"]
    pub fn faiss_ClusteringIterationStats_imbalance_factor(
        arg1: *const FaissClusteringIterationStats,
    ) -> f64;
}
unsafe extern "C" {
    #[doc = " getter for k"]
    pub fn faiss_ClusteringIterationStats_nsplit(
        arg1: *const FaissClusteringIterationStats,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " getter for centroids (size = k * d)"]
    pub fn faiss_Clustering_centroids(
        clustering: *mut FaissClustering,
        centroids: *mut *mut f32,
        size: *mut usize,
    );
}
unsafe extern "C" {
    #[doc = " getter for iteration stats"]
    pub fn faiss_Clustering_iteration_stats(
        clustering: *mut FaissClustering,
        iteration_stats: *mut *mut FaissClusteringIterationStats,
        size: *mut usize,
    );
}
unsafe extern "C" {
    #[doc = " the only mandatory parameters are k and d"]
    pub fn faiss_Clustering_new(
        p_clustering: *mut *mut FaissClustering,
        d: ::std::os::raw::c_int,
        k: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_Clustering_new_with_params(
        p_clustering: *mut *mut FaissClustering,
        d: ::std::os::raw::c_int,
        k: ::std::os::raw::c_int,
        cp: *const FaissClusteringParameters,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_Clustering_train(
        clustering: *mut FaissClustering,
        n: idx_t,
        x: *const f32,
        index: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_Clustering_free(clustering: *mut FaissClustering);
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_kmeans_clustering(
        d: usize,
        n: usize,
        k: usize,
        x: *const f32,
        centroids: *mut f32,
        q_error: *mut f32,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIndexBinary_H {
    _unused: [u8; 0],
}
#[doc = " Opaque type for referencing to a binary index object"]
pub type FaissIndexBinary = FaissIndexBinary_H;
unsafe extern "C" {
    #[doc = " Opaque type for referencing to a binary index object"]
    pub fn faiss_IndexBinary_free(obj: *mut FaissIndexBinary);
}
unsafe extern "C" {
    #[doc = " Getter for d"]
    pub fn faiss_IndexBinary_d(arg1: *const FaissIndexBinary) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for is_trained"]
    pub fn faiss_IndexBinary_is_trained(arg1: *const FaissIndexBinary) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for ntotal"]
    pub fn faiss_IndexBinary_ntotal(arg1: *const FaissIndexBinary) -> idx_t;
}
unsafe extern "C" {
    #[doc = " Getter for metric_type"]
    pub fn faiss_IndexBinary_metric_type(arg1: *const FaissIndexBinary) -> FaissMetricType;
}
unsafe extern "C" {
    #[doc = " Getter for metric_type"]
    pub fn faiss_IndexBinary_verbose(arg1: *const FaissIndexBinary) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for metric_type"]
    pub fn faiss_IndexBinary_set_verbose(arg1: *mut FaissIndexBinary, arg2: ::std::os::raw::c_int);
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinary_train(
        index: *mut FaissIndexBinary,
        n: idx_t,
        x: *const u8,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinary_add(
        index: *mut FaissIndexBinary,
        n: idx_t,
        x: *const u8,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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)"]
    pub fn faiss_IndexBinary_add_with_ids(
        index: *mut FaissIndexBinary,
        n: idx_t,
        x: *const u8,
        xids: *const idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinary_search(
        index: *const FaissIndexBinary,
        n: idx_t,
        x: *const u8,
        k: idx_t,
        distances: *mut i32,
        labels: *mut idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinary_range_search(
        index: *const FaissIndexBinary,
        n: idx_t,
        x: *const u8,
        radius: ::std::os::raw::c_int,
        result: *mut FaissRangeSearchResult,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinary_assign(
        index: *mut FaissIndexBinary,
        n: idx_t,
        x: *const u8,
        labels: *mut idx_t,
        k: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " removes all elements from the database.\n @param index       opaque pointer to index object"]
    pub fn faiss_IndexBinary_reset(index: *mut FaissIndexBinary) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinary_remove_ids(
        index: *mut FaissIndexBinary,
        sel: *const FaissIDSelector,
        n_removed: *mut usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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)"]
    pub fn faiss_IndexBinary_reconstruct(
        index: *const FaissIndexBinary,
        key: idx_t,
        recons: *mut u8,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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)"]
    pub fn faiss_IndexBinary_reconstruct_n(
        index: *const FaissIndexBinary,
        i0: idx_t,
        ni: idx_t,
        recons: *mut u8,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_RangeSearchResult_nq(arg1: *const FaissRangeSearchResult) -> usize;
}
unsafe extern "C" {
    pub fn faiss_RangeSearchResult_new(
        p_rsr: *mut *mut FaissRangeSearchResult,
        nq: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_RangeSearchResult_new_with(
        p_rsr: *mut *mut FaissRangeSearchResult,
        nq: idx_t,
        alloc_lims: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " called when lims contains the nb of elements result entries\n for each query"]
    pub fn faiss_RangeSearchResult_do_allocation(
        rsr: *mut FaissRangeSearchResult,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_RangeSearchResult_free(obj: *mut FaissRangeSearchResult);
}
unsafe extern "C" {
    #[doc = " getter for buffer_size"]
    pub fn faiss_RangeSearchResult_buffer_size(arg1: *const FaissRangeSearchResult) -> usize;
}
unsafe extern "C" {
    #[doc = " getter for lims: size (nq + 1)"]
    pub fn faiss_RangeSearchResult_lims(rsr: *mut FaissRangeSearchResult, lims: *mut *mut usize);
}
unsafe extern "C" {
    #[doc = " getter for labels and respective distances (not sorted):\n result for query i is labels[lims[i]:lims[i+1]]"]
    pub fn faiss_RangeSearchResult_labels(
        rsr: *mut FaissRangeSearchResult,
        labels: *mut *mut idx_t,
        distances: *mut *mut f32,
    );
}
unsafe extern "C" {
    #[doc = " Encapsulates a set of ids to remove."]
    pub fn faiss_IDSelector_free(obj: *mut FaissIDSelector);
}
unsafe extern "C" {
    #[doc = " Encapsulates a set of ids to remove."]
    pub fn faiss_IDSelector_is_member(
        sel: *const FaissIDSelector,
        id: idx_t,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIDSelectorRange_H {
    _unused: [u8; 0],
}
#[doc = " remove ids between [imni, imax)"]
pub type FaissIDSelectorRange = FaissIDSelectorRange_H;
unsafe extern "C" {
    #[doc = " remove ids between [imni, imax)"]
    pub fn faiss_IDSelectorRange_free(obj: *mut FaissIDSelectorRange);
}
unsafe extern "C" {
    #[doc = " remove ids between [imni, imax)"]
    pub fn faiss_IDSelectorRange_imin(arg1: *const FaissIDSelectorRange) -> idx_t;
}
unsafe extern "C" {
    #[doc = " remove ids between [imni, imax)"]
    pub fn faiss_IDSelectorRange_imax(arg1: *const FaissIDSelectorRange) -> idx_t;
}
unsafe extern "C" {
    #[doc = " remove ids between [imni, imax)"]
    pub fn faiss_IDSelectorRange_new(
        p_sel: *mut *mut FaissIDSelectorRange,
        imin: idx_t,
        imax: idx_t,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIDSelectorBatch_H {
    _unused: [u8; 0],
}
#[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"]
pub type FaissIDSelectorBatch = FaissIDSelectorBatch_H;
unsafe extern "C" {
    #[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"]
    pub fn faiss_IDSelectorBatch_nbits(arg1: *const FaissIDSelectorBatch) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IDSelectorBatch_mask(arg1: *const FaissIDSelectorBatch) -> idx_t;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IDSelectorBatch_new(
        p_sel: *mut *mut FaissIDSelectorBatch,
        n: usize,
        indices: *const idx_t,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIDSelectorBitmap_H {
    _unused: [u8; 0],
}
pub type FaissIDSelectorBitmap = FaissIDSelectorBitmap_H;
unsafe extern "C" {
    pub fn faiss_IDSelectorBitmap_free(obj: *mut FaissIDSelectorBitmap);
}
unsafe extern "C" {
    pub fn faiss_IDSelectorBitmap_n(arg1: *const FaissIDSelectorBitmap) -> usize;
}
unsafe extern "C" {
    pub fn faiss_IDSelectorBitmap_bitmap(arg1: *const FaissIDSelectorBitmap) -> *const u8;
}
unsafe extern "C" {
    pub fn faiss_IDSelectorBitmap_new(
        p_sel: *mut *mut FaissIDSelectorBitmap,
        n: usize,
        bitmap: *const u8,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIDSelectorNot_H {
    _unused: [u8; 0],
}
pub type FaissIDSelectorNot = FaissIDSelectorNot_H;
unsafe extern "C" {
    pub fn faiss_IDSelectorNot_new(
        p_sel: *mut *mut FaissIDSelectorNot,
        sel: *const FaissIDSelector,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIDSelectorAnd_H {
    _unused: [u8; 0],
}
pub type FaissIDSelectorAnd = FaissIDSelectorAnd_H;
unsafe extern "C" {
    pub fn faiss_IDSelectorAnd_new(
        p_sel: *mut *mut FaissIDSelectorAnd,
        lhs_sel: *const FaissIDSelector,
        rhs_sel: *const FaissIDSelector,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIDSelectorOr_H {
    _unused: [u8; 0],
}
pub type FaissIDSelectorOr = FaissIDSelectorOr_H;
unsafe extern "C" {
    pub fn faiss_IDSelectorOr_new(
        p_sel: *mut *mut FaissIDSelectorOr,
        lhs_sel: *const FaissIDSelector,
        rhs_sel: *const FaissIDSelector,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIDSelectorXOr_H {
    _unused: [u8; 0],
}
pub type FaissIDSelectorXOr = FaissIDSelectorXOr_H;
unsafe extern "C" {
    pub fn faiss_IDSelectorXOr_new(
        p_sel: *mut *mut FaissIDSelectorXOr,
        lhs_sel: *const FaissIDSelector,
        rhs_sel: *const FaissIDSelector,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissBufferList_H {
    _unused: [u8; 0],
}
#[doc = " List of temporary buffers used to store results before they are\n  copied to the RangeSearchResult object."]
pub type FaissBufferList = FaissBufferList_H;
unsafe extern "C" {
    #[doc = " List of temporary buffers used to store results before they are\n  copied to the RangeSearchResult object."]
    pub fn faiss_BufferList_free(obj: *mut FaissBufferList);
}
unsafe extern "C" {
    #[doc = " List of temporary buffers used to store results before they are\n  copied to the RangeSearchResult object."]
    pub fn faiss_BufferList_buffer_size(arg1: *const FaissBufferList) -> usize;
}
unsafe extern "C" {
    #[doc = " List of temporary buffers used to store results before they are\n  copied to the RangeSearchResult object."]
    pub fn faiss_BufferList_wp(arg1: *const FaissBufferList) -> usize;
}
#[doc = " List of temporary buffers used to store results before they are\n  copied to the RangeSearchResult object."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissBuffer {
    pub ids: *mut idx_t,
    pub dis: *mut f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of FaissBuffer"][::std::mem::size_of::<FaissBuffer>() - 16usize];
    ["Alignment of FaissBuffer"][::std::mem::align_of::<FaissBuffer>() - 8usize];
    ["Offset of field: FaissBuffer::ids"][::std::mem::offset_of!(FaissBuffer, ids) - 0usize];
    ["Offset of field: FaissBuffer::dis"][::std::mem::offset_of!(FaissBuffer, dis) - 8usize];
};
unsafe extern "C" {
    pub fn faiss_BufferList_append_buffer(bl: *mut FaissBufferList) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_BufferList_new(
        p_bl: *mut *mut FaissBufferList,
        buffer_size: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_BufferList_add(
        bl: *mut FaissBufferList,
        id: idx_t,
        dis: f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " copy elemnts ofs:ofs+n-1 seen as linear data in the buffers to\n tables dest_ids, dest_dis"]
    pub fn faiss_BufferList_copy_range(
        bl: *mut FaissBufferList,
        ofs: usize,
        n: usize,
        dest_ids: *mut idx_t,
        dest_dis: *mut f32,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissRangeSearchPartialResult_H {
    _unused: [u8; 0],
}
#[doc = " the entries in the buffers are split per query"]
pub type FaissRangeSearchPartialResult = FaissRangeSearchPartialResult_H;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissRangeQueryResult_H {
    _unused: [u8; 0],
}
#[doc = " result structure for a single query"]
pub type FaissRangeQueryResult = FaissRangeQueryResult_H;
unsafe extern "C" {
    #[doc = " result structure for a single query"]
    pub fn faiss_RangeQueryResult_qno(arg1: *const FaissRangeQueryResult) -> idx_t;
}
unsafe extern "C" {
    #[doc = " result structure for a single query"]
    pub fn faiss_RangeQueryResult_nres(arg1: *const FaissRangeQueryResult) -> usize;
}
unsafe extern "C" {
    #[doc = " result structure for a single query"]
    pub fn faiss_RangeQueryResult_pres(
        arg1: *const FaissRangeQueryResult,
    ) -> *mut FaissRangeSearchPartialResult;
}
unsafe extern "C" {
    #[doc = " result structure for a single query"]
    pub fn faiss_RangeQueryResult_add(
        qr: *mut FaissRangeQueryResult,
        dis: f32,
        id: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_RangeSearchPartialResult_res(
        arg1: *const FaissRangeSearchPartialResult,
    ) -> *mut FaissRangeSearchResult;
}
unsafe extern "C" {
    pub fn faiss_RangeSearchPartialResult_new(
        p_res: *mut *mut FaissRangeSearchPartialResult,
        res_in: *mut FaissRangeSearchResult,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_RangeSearchPartialResult_finalize(
        res: *mut FaissRangeSearchPartialResult,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " called by range_search before do_allocation"]
    pub fn faiss_RangeSearchPartialResult_set_lims(
        res: *mut FaissRangeSearchPartialResult,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_RangeSearchPartialResult_new_result(
        res: *mut FaissRangeSearchPartialResult,
        qno: idx_t,
        qr: *mut *mut FaissRangeQueryResult,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissDistanceComputer_H {
    _unused: [u8; 0],
}
pub type FaissDistanceComputer = FaissDistanceComputer_H;
unsafe extern "C" {
    #[doc = " called before computing distances"]
    pub fn faiss_DistanceComputer_set_query(
        dc: *mut FaissDistanceComputer,
        x: *const f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Compute distance of vector i to current query.\n This function corresponds to the function call operator:\n DistanceComputer::operator()"]
    pub fn faiss_DistanceComputer_vector_to_query_dis(
        dc: *mut FaissDistanceComputer,
        i: idx_t,
        qd: *mut f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " compute distance between two stored vectors"]
    pub fn faiss_DistanceComputer_symmetric_dis(
        dc: *mut FaissDistanceComputer,
        i: idx_t,
        j: idx_t,
        vd: *mut f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_DistanceComputer_free(obj: *mut FaissDistanceComputer);
}
pub type FaissSearchParametersIVF = FaissSearchParameters_H;
unsafe extern "C" {
    pub fn faiss_SearchParametersIVF_free(obj: *mut FaissSearchParametersIVF);
}
unsafe extern "C" {
    pub fn faiss_SearchParametersIVF_cast(
        arg1: *mut FaissSearchParameters,
    ) -> *mut FaissSearchParametersIVF;
}
unsafe extern "C" {
    pub fn faiss_SearchParametersIVF_new(
        p_sp: *mut *mut FaissSearchParametersIVF,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_SearchParametersIVF_new_with(
        p_sp: *mut *mut FaissSearchParametersIVF,
        sel: *mut FaissIDSelector,
        nprobe: usize,
        max_codes: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_SearchParametersIVF_sel(
        arg1: *const FaissSearchParametersIVF,
    ) -> *const FaissIDSelector;
}
unsafe extern "C" {
    pub fn faiss_SearchParametersIVF_nprobe(arg1: *const FaissSearchParametersIVF) -> usize;
}
unsafe extern "C" {
    pub fn faiss_SearchParametersIVF_set_nprobe(arg1: *mut FaissSearchParametersIVF, arg2: usize);
}
unsafe extern "C" {
    pub fn faiss_SearchParametersIVF_max_codes(arg1: *const FaissSearchParametersIVF) -> usize;
}
unsafe extern "C" {
    pub fn faiss_SearchParametersIVF_set_max_codes(
        arg1: *mut FaissSearchParametersIVF,
        arg2: usize,
    );
}
#[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."]
pub type FaissIndexIVF = FaissIndex_H;
unsafe extern "C" {
    #[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."]
    pub fn faiss_IndexIVF_free(obj: *mut FaissIndexIVF);
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_IndexIVF_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIVF;
}
unsafe extern "C" {
    #[doc = " number of possible key values"]
    pub fn faiss_IndexIVF_nlist(arg1: *const FaissIndexIVF) -> usize;
}
unsafe extern "C" {
    #[doc = " number of probes at query time"]
    pub fn faiss_IndexIVF_nprobe(arg1: *const FaissIndexIVF) -> usize;
}
unsafe extern "C" {
    #[doc = " number of probes at query time"]
    pub fn faiss_IndexIVF_set_nprobe(arg1: *mut FaissIndexIVF, arg2: usize);
}
unsafe extern "C" {
    #[doc = " quantizer that maps vectors to inverted lists"]
    pub fn faiss_IndexIVF_quantizer(arg1: *const FaissIndexIVF) -> *mut FaissIndex;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexIVF_quantizer_trains_alone(
        arg1: *const FaissIndexIVF,
    ) -> ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexIVF_own_fields(arg1: *const FaissIndexIVF) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexIVF_set_own_fields(arg1: *mut FaissIndexIVF, arg2: ::std::os::raw::c_int);
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexIVF_merge_from(
        index: *mut FaissIndexIVF,
        other: *mut FaissIndexIVF,
        add_id: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexIVF_copy_subset_to(
        index: *const FaissIndexIVF,
        other: *mut FaissIndexIVF,
        subset_type: ::std::os::raw::c_int,
        a1: idx_t,
        a2: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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)."]
    pub fn faiss_IndexIVF_search_preassigned(
        index: *const FaissIndexIVF,
        n: idx_t,
        x: *const f32,
        k: idx_t,
        assign: *const idx_t,
        centroid_dis: *const f32,
        distances: *mut f32,
        labels: *mut idx_t,
        store_pairs: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexIVF_get_list_size(index: *const FaissIndexIVF, list_no: usize) -> usize;
}
unsafe extern "C" {
    #[doc = " initialize a direct map\n\n @param new_maintain_direct_map    if true, create a direct map,\n                                   else clear it"]
    pub fn faiss_IndexIVF_make_direct_map(
        index: *mut FaissIndexIVF,
        new_maintain_direct_map: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Check the inverted lists' imbalance factor.\n\n 1= perfectly balanced, >1: imbalanced"]
    pub fn faiss_IndexIVF_imbalance_factor(index: *const FaissIndexIVF) -> f64;
}
unsafe extern "C" {
    #[doc = " display some stats about the inverted lists of the index"]
    pub fn faiss_IndexIVF_print_stats(index: *const FaissIndexIVF);
}
unsafe extern "C" {
    #[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)"]
    pub fn faiss_IndexIVF_invlists_get_ids(
        index: *const FaissIndexIVF,
        list_no: usize,
        invlist: *mut idx_t,
    );
}
unsafe extern "C" {
    pub fn faiss_IndexIVF_train_encoder(
        index: *mut FaissIndexIVF,
        n: idx_t,
        x: *const f32,
        assign: *const idx_t,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIndexIVFStats {
    pub nq: usize,
    pub nlist: usize,
    pub ndis: usize,
    pub nheap_updates: usize,
    pub quantization_time: f64,
    pub search_time: f64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of FaissIndexIVFStats"][::std::mem::size_of::<FaissIndexIVFStats>() - 48usize];
    ["Alignment of FaissIndexIVFStats"][::std::mem::align_of::<FaissIndexIVFStats>() - 8usize];
    ["Offset of field: FaissIndexIVFStats::nq"]
        [::std::mem::offset_of!(FaissIndexIVFStats, nq) - 0usize];
    ["Offset of field: FaissIndexIVFStats::nlist"]
        [::std::mem::offset_of!(FaissIndexIVFStats, nlist) - 8usize];
    ["Offset of field: FaissIndexIVFStats::ndis"]
        [::std::mem::offset_of!(FaissIndexIVFStats, ndis) - 16usize];
    ["Offset of field: FaissIndexIVFStats::nheap_updates"]
        [::std::mem::offset_of!(FaissIndexIVFStats, nheap_updates) - 24usize];
    ["Offset of field: FaissIndexIVFStats::quantization_time"]
        [::std::mem::offset_of!(FaissIndexIVFStats, quantization_time) - 32usize];
    ["Offset of field: FaissIndexIVFStats::search_time"]
        [::std::mem::offset_of!(FaissIndexIVFStats, search_time) - 40usize];
};
unsafe extern "C" {
    pub fn faiss_IndexIVFStats_reset(stats: *mut FaissIndexIVFStats);
}
unsafe extern "C" {
    #[doc = " global var that collects all statists"]
    pub fn faiss_get_indexIVF_stats() -> *mut FaissIndexIVFStats;
}
#[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"]
pub type FaissIndexBinaryIVF = FaissIndexBinary_H;
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinaryIVF_free(obj: *mut FaissIndexBinaryIVF);
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinaryIVF_cast(arg1: *mut FaissIndexBinary) -> *mut FaissIndexBinaryIVF;
}
unsafe extern "C" {
    #[doc = " number of possible key values"]
    pub fn faiss_IndexBinaryIVF_nlist(arg1: *const FaissIndexBinaryIVF) -> usize;
}
unsafe extern "C" {
    #[doc = " number of probes at query time"]
    pub fn faiss_IndexBinaryIVF_nprobe(arg1: *const FaissIndexBinaryIVF) -> usize;
}
unsafe extern "C" {
    #[doc = " number of probes at query time"]
    pub fn faiss_IndexBinaryIVF_set_nprobe(arg1: *mut FaissIndexBinaryIVF, arg2: usize);
}
unsafe extern "C" {
    #[doc = " quantizer that maps vectors to inverted lists"]
    pub fn faiss_IndexBinaryIVF_quantizer(
        arg1: *const FaissIndexBinaryIVF,
    ) -> *mut FaissIndexBinary;
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexBinaryIVF_own_fields(
        arg1: *const FaissIndexBinaryIVF,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexBinaryIVF_set_own_fields(
        arg1: *mut FaissIndexBinaryIVF,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " max nb of codes to visit to do a query"]
    pub fn faiss_IndexBinaryIVF_max_codes(arg1: *const FaissIndexBinaryIVF) -> usize;
}
unsafe extern "C" {
    #[doc = " max nb of codes to visit to do a query"]
    pub fn faiss_IndexBinaryIVF_set_max_codes(arg1: *mut FaissIndexBinaryIVF, arg2: usize);
}
unsafe extern "C" {
    #[doc = " Select between using a heap or counting to select the k smallest values\n when scanning inverted lists."]
    pub fn faiss_IndexBinaryIVF_use_heap(arg1: *const FaissIndexBinaryIVF)
        -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Select between using a heap or counting to select the k smallest values\n when scanning inverted lists."]
    pub fn faiss_IndexBinaryIVF_set_use_heap(
        arg1: *mut FaissIndexBinaryIVF,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " collect computations per batch"]
    pub fn faiss_IndexBinaryIVF_per_invlist_search(
        arg1: *const FaissIndexBinaryIVF,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " collect computations per batch"]
    pub fn faiss_IndexBinaryIVF_set_per_invlist_search(
        arg1: *mut FaissIndexBinaryIVF,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinaryIVF_merge_from(
        index: *mut FaissIndexBinaryIVF,
        other: *mut FaissIndexBinaryIVF,
        add_id: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexBinaryIVF_search_preassigned(
        index: *const FaissIndexBinaryIVF,
        n: idx_t,
        x: *const u8,
        k: idx_t,
        cidx: *const idx_t,
        cdis: *const i32,
        dis: *mut i32,
        idx: *mut idx_t,
        store_pairs: ::std::os::raw::c_int,
        params: *const FaissSearchParametersIVF,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexBinaryIVF_get_list_size(
        index: *const FaissIndexBinaryIVF,
        list_no: usize,
    ) -> usize;
}
unsafe extern "C" {
    #[doc = " initialize a direct map\n\n @param new_maintain_direct_map    if true, create a direct map,\n                                   else clear it"]
    pub fn faiss_IndexBinaryIVF_make_direct_map(
        index: *mut FaissIndexBinaryIVF,
        new_maintain_direct_map: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Check the inverted lists' imbalance factor.\n\n 1= perfectly balanced, >1: imbalanced"]
    pub fn faiss_IndexBinaryIVF_imbalance_factor(index: *const FaissIndexBinaryIVF) -> f64;
}
unsafe extern "C" {
    #[doc = " display some stats about the inverted lists of the index"]
    pub fn faiss_IndexBinaryIVF_print_stats(index: *const FaissIndexBinaryIVF);
}
#[doc = " Opaque type for IndexFlat"]
pub type FaissIndexFlat = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlat"]
    pub fn faiss_IndexFlat_new(p_index: *mut *mut FaissIndexFlat) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexFlat_new_with(
        p_index: *mut *mut FaissIndexFlat,
        d: idx_t,
        metric: FaissMetricType,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_IndexFlat_xb(index: *mut FaissIndexFlat, p_xb: *mut *mut f32, p_size: *mut usize);
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlat;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexFlat_free(obj: *mut FaissIndexFlat);
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexFlat_compute_distance_subset(
        index: *mut FaissIndex,
        n: idx_t,
        x: *const f32,
        k: idx_t,
        distances: *mut f32,
        labels: *const idx_t,
    ) -> ::std::os::raw::c_int;
}
#[doc = " Opaque type for IndexFlatIP"]
pub type FaissIndexFlatIP = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlatIP"]
    pub fn faiss_IndexFlatIP_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatIP;
}
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlatIP"]
    pub fn faiss_IndexFlatIP_free(obj: *mut FaissIndexFlatIP);
}
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlatIP"]
    pub fn faiss_IndexFlatIP_new(p_index: *mut *mut FaissIndexFlatIP) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexFlatIP_new_with(
        p_index: *mut *mut FaissIndexFlatIP,
        d: idx_t,
    ) -> ::std::os::raw::c_int;
}
#[doc = " Opaque type for IndexFlatL2"]
pub type FaissIndexFlatL2 = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlatL2"]
    pub fn faiss_IndexFlatL2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatL2;
}
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlatL2"]
    pub fn faiss_IndexFlatL2_free(obj: *mut FaissIndexFlatL2);
}
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlatL2"]
    pub fn faiss_IndexFlatL2_new(p_index: *mut *mut FaissIndexFlatL2) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexFlatL2_new_with(
        p_index: *mut *mut FaissIndexFlatL2,
        d: idx_t,
    ) -> ::std::os::raw::c_int;
}
#[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."]
pub type FaissIndexRefineFlat = FaissIndex_H;
unsafe extern "C" {
    #[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."]
    pub fn faiss_IndexRefineFlat_new(
        p_index: *mut *mut FaissIndexRefineFlat,
        base_index: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexRefineFlat_free(obj: *mut FaissIndexRefineFlat);
}
unsafe extern "C" {
    pub fn faiss_IndexRefineFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexRefineFlat;
}
unsafe extern "C" {
    pub fn faiss_IndexRefineFlat_own_fields(
        arg1: *const FaissIndexRefineFlat,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexRefineFlat_set_own_fields(
        arg1: *mut FaissIndexRefineFlat,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " factor between k requested in search and the k requested from\n the base_index (should be >= 1)"]
    pub fn faiss_IndexRefineFlat_k_factor(arg1: *const FaissIndexRefineFlat) -> f32;
}
unsafe extern "C" {
    #[doc = " factor between k requested in search and the k requested from\n the base_index (should be >= 1)"]
    pub fn faiss_IndexRefineFlat_set_k_factor(arg1: *mut FaissIndexRefineFlat, arg2: f32);
}
#[doc = " Opaque type for IndexFlat1D\n\n optimized version for 1D \"vectors\""]
pub type FaissIndexFlat1D = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlat1D\n\n optimized version for 1D \"vectors\""]
    pub fn faiss_IndexFlat1D_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlat1D;
}
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlat1D\n\n optimized version for 1D \"vectors\""]
    pub fn faiss_IndexFlat1D_free(obj: *mut FaissIndexFlat1D);
}
unsafe extern "C" {
    #[doc = " Opaque type for IndexFlat1D\n\n optimized version for 1D \"vectors\""]
    pub fn faiss_IndexFlat1D_new(p_index: *mut *mut FaissIndexFlat1D) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexFlat1D_new_with(
        p_index: *mut *mut FaissIndexFlat1D,
        continuous_update: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexFlat1D_update_permutation(
        index: *mut FaissIndexFlat1D,
    ) -> ::std::os::raw::c_int;
}
#[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."]
pub type FaissIndexIVFFlat = FaissIndex_H;
unsafe extern "C" {
    #[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."]
    pub fn faiss_IndexIVFFlat_free(obj: *mut FaissIndexIVFFlat);
}
unsafe extern "C" {
    #[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."]
    pub fn faiss_IndexIVFFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIVFFlat;
}
unsafe extern "C" {
    #[doc = " number of possible key values"]
    pub fn faiss_IndexIVFFlat_nlist(arg1: *const FaissIndexIVFFlat) -> usize;
}
unsafe extern "C" {
    #[doc = " number of probes at query time"]
    pub fn faiss_IndexIVFFlat_nprobe(arg1: *const FaissIndexIVFFlat) -> usize;
}
unsafe extern "C" {
    #[doc = " number of probes at query time"]
    pub fn faiss_IndexIVFFlat_set_nprobe(arg1: *mut FaissIndexIVFFlat, arg2: usize);
}
unsafe extern "C" {
    #[doc = " quantizer that maps vectors to inverted lists"]
    pub fn faiss_IndexIVFFlat_quantizer(arg1: *const FaissIndexIVFFlat) -> *mut FaissIndex;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexIVFFlat_quantizer_trains_alone(
        arg1: *const FaissIndexIVFFlat,
    ) -> ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexIVFFlat_own_fields(arg1: *const FaissIndexIVFFlat) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexIVFFlat_set_own_fields(
        arg1: *mut FaissIndexIVFFlat,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexIVFFlat_new(p_index: *mut *mut FaissIndexIVFFlat) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexIVFFlat_new_with(
        p_index: *mut *mut FaissIndexIVFFlat,
        quantizer: *mut FaissIndex,
        d: usize,
        nlist: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexIVFFlat_new_with_metric(
        p_index: *mut *mut FaissIndexIVFFlat,
        quantizer: *mut FaissIndex,
        d: usize,
        nlist: usize,
        metric: FaissMetricType,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexIVFFlat_add_core(
        index: *mut FaissIndexIVFFlat,
        n: idx_t,
        x: *const f32,
        xids: *const idx_t,
        precomputed_idx: *const i64,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexIVFFlat_update_vectors(
        index: *mut FaissIndexIVFFlat,
        nv: ::std::os::raw::c_int,
        idx: *mut idx_t,
        v: *const f32,
    ) -> ::std::os::raw::c_int;
}
#[doc = " The sign of each vector component is put in a binary signature"]
pub type FaissIndexLSH = FaissIndex_H;
unsafe extern "C" {
    #[doc = " The sign of each vector component is put in a binary signature"]
    pub fn faiss_IndexLSH_free(obj: *mut FaissIndexLSH);
}
unsafe extern "C" {
    #[doc = " The sign of each vector component is put in a binary signature"]
    pub fn faiss_IndexLSH_cast(arg1: *mut FaissIndex) -> *mut FaissIndexLSH;
}
unsafe extern "C" {
    #[doc = " The sign of each vector component is put in a binary signature"]
    pub fn faiss_IndexLSH_nbits(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " The sign of each vector component is put in a binary signature"]
    pub fn faiss_IndexLSH_code_size(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " The sign of each vector component is put in a binary signature"]
    pub fn faiss_IndexLSH_rotate_data(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " The sign of each vector component is put in a binary signature"]
    pub fn faiss_IndexLSH_train_thresholds(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " The sign of each vector component is put in a binary signature"]
    pub fn faiss_IndexLSH_new(
        p_index: *mut *mut FaissIndexLSH,
        d: idx_t,
        nbits: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexLSH_new_with_options(
        p_index: *mut *mut FaissIndexLSH,
        d: idx_t,
        nbits: ::std::os::raw::c_int,
        rotate_data: ::std::os::raw::c_int,
        train_thresholds: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissVectorTransform_H {
    _unused: [u8; 0],
}
#[doc = " Opaque type for referencing to a VectorTransform object"]
pub type FaissVectorTransform = FaissVectorTransform_H;
unsafe extern "C" {
    #[doc = " Opaque type for referencing to a VectorTransform object"]
    pub fn faiss_VectorTransform_free(obj: *mut FaissVectorTransform);
}
unsafe extern "C" {
    #[doc = " Getter for is_trained"]
    pub fn faiss_VectorTransform_is_trained(
        arg1: *const FaissVectorTransform,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for input dimension"]
    pub fn faiss_VectorTransform_d_in(arg1: *const FaissVectorTransform) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for output dimension"]
    pub fn faiss_VectorTransform_d_out(arg1: *const FaissVectorTransform) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_VectorTransform_train(
        vt: *mut FaissVectorTransform,
        n: idx_t,
        x: *const f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " apply the random rotation, return new allocated matrix\n @param     x size n * d_in\n @return    size n * d_out"]
    pub fn faiss_VectorTransform_apply(
        vt: *const FaissVectorTransform,
        n: idx_t,
        x: *const f32,
    ) -> *mut f32;
}
unsafe extern "C" {
    #[doc = " apply transformation and result is pre-allocated\n @param     x size n * d_in\n @param     xt size n * d_out"]
    pub fn faiss_VectorTransform_apply_noalloc(
        vt: *const FaissVectorTransform,
        n: idx_t,
        x: *const f32,
        xt: *mut f32,
    );
}
unsafe extern "C" {
    #[doc = " reverse transformation. May not be implemented or may return\n approximate result"]
    pub fn faiss_VectorTransform_reverse_transform(
        vt: *const FaissVectorTransform,
        n: idx_t,
        xt: *const f32,
        x: *mut f32,
    );
}
#[doc = " Opaque type for referencing to a LinearTransform object"]
pub type FaissLinearTransform = FaissVectorTransform_H;
unsafe extern "C" {
    #[doc = " Opaque type for referencing to a LinearTransform object"]
    pub fn faiss_LinearTransform_free(obj: *mut FaissLinearTransform);
}
unsafe extern "C" {
    #[doc = " compute x = A^T * (x - b)\n is reverse transform if A has orthonormal lines"]
    pub fn faiss_LinearTransform_transform_transpose(
        vt: *const FaissLinearTransform,
        n: idx_t,
        y: *const f32,
        x: *mut f32,
    );
}
unsafe extern "C" {
    #[doc = " compute A^T * A to set the is_orthonormal flag"]
    pub fn faiss_LinearTransform_set_is_orthonormal(vt: *mut FaissLinearTransform);
}
unsafe extern "C" {
    #[doc = " Getter for have_bias"]
    pub fn faiss_LinearTransform_have_bias(
        arg1: *const FaissLinearTransform,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for is_orthonormal"]
    pub fn faiss_LinearTransform_is_orthonormal(
        arg1: *const FaissLinearTransform,
    ) -> ::std::os::raw::c_int;
}
#[doc = " Getter for is_orthonormal"]
pub type FaissRandomRotationMatrix = FaissVectorTransform_H;
unsafe extern "C" {
    #[doc = " Getter for is_orthonormal"]
    pub fn faiss_RandomRotationMatrix_free(obj: *mut FaissRandomRotationMatrix);
}
unsafe extern "C" {
    #[doc = " Getter for is_orthonormal"]
    pub fn faiss_RandomRotationMatrix_new_with(
        p_vt: *mut *mut FaissRandomRotationMatrix,
        d_in: ::std::os::raw::c_int,
        d_out: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
pub type FaissPCAMatrix = FaissVectorTransform_H;
unsafe extern "C" {
    pub fn faiss_PCAMatrix_free(obj: *mut FaissPCAMatrix);
}
unsafe extern "C" {
    pub fn faiss_PCAMatrix_new_with(
        p_vt: *mut *mut FaissPCAMatrix,
        d_in: ::std::os::raw::c_int,
        d_out: ::std::os::raw::c_int,
        eigen_power: f32,
        random_rotation: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for eigen_power"]
    pub fn faiss_PCAMatrix_eigen_power(arg1: *const FaissPCAMatrix) -> f32;
}
unsafe extern "C" {
    #[doc = " Getter for random_rotation"]
    pub fn faiss_PCAMatrix_random_rotation(arg1: *const FaissPCAMatrix) -> ::std::os::raw::c_int;
}
#[doc = " Getter for random_rotation"]
pub type FaissITQMatrix = FaissVectorTransform_H;
unsafe extern "C" {
    #[doc = " Getter for random_rotation"]
    pub fn faiss_ITQMatrix_free(obj: *mut FaissITQMatrix);
}
unsafe extern "C" {
    #[doc = " Getter for random_rotation"]
    pub fn faiss_ITQMatrix_new_with(
        p_vt: *mut *mut FaissITQMatrix,
        d: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
pub type FaissITQTransform = FaissVectorTransform_H;
unsafe extern "C" {
    pub fn faiss_ITQTransform_free(obj: *mut FaissITQTransform);
}
unsafe extern "C" {
    pub fn faiss_ITQTransform_new_with(
        p_vt: *mut *mut FaissITQTransform,
        d_in: ::std::os::raw::c_int,
        d_out: ::std::os::raw::c_int,
        do_pca: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Getter for do_pca"]
    pub fn faiss_ITQTransform_do_pca(arg1: *const FaissITQTransform) -> ::std::os::raw::c_int;
}
#[doc = " Getter for do_pca"]
pub type FaissOPQMatrix = FaissVectorTransform_H;
unsafe extern "C" {
    #[doc = " Getter for do_pca"]
    pub fn faiss_OPQMatrix_free(obj: *mut FaissOPQMatrix);
}
unsafe extern "C" {
    #[doc = " Getter for do_pca"]
    pub fn faiss_OPQMatrix_new_with(
        p_vt: *mut *mut FaissOPQMatrix,
        d: ::std::os::raw::c_int,
        M: ::std::os::raw::c_int,
        d2: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_OPQMatrix_verbose(arg1: *const FaissOPQMatrix) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_OPQMatrix_set_verbose(arg1: *mut FaissOPQMatrix, arg2: ::std::os::raw::c_int);
}
unsafe extern "C" {
    pub fn faiss_OPQMatrix_niter(arg1: *const FaissOPQMatrix) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_OPQMatrix_set_niter(arg1: *mut FaissOPQMatrix, arg2: ::std::os::raw::c_int);
}
unsafe extern "C" {
    pub fn faiss_OPQMatrix_niter_pq(arg1: *const FaissOPQMatrix) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_OPQMatrix_set_niter_pq(arg1: *mut FaissOPQMatrix, arg2: ::std::os::raw::c_int);
}
pub type FaissRemapDimensionsTransform = FaissVectorTransform_H;
unsafe extern "C" {
    pub fn faiss_RemapDimensionsTransform_free(obj: *mut FaissRemapDimensionsTransform);
}
unsafe extern "C" {
    pub fn faiss_RemapDimensionsTransform_new_with(
        p_vt: *mut *mut FaissRemapDimensionsTransform,
        d_in: ::std::os::raw::c_int,
        d_out: ::std::os::raw::c_int,
        uniform: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
pub type FaissNormalizationTransform = FaissVectorTransform_H;
unsafe extern "C" {
    pub fn faiss_NormalizationTransform_free(obj: *mut FaissNormalizationTransform);
}
unsafe extern "C" {
    pub fn faiss_NormalizationTransform_new_with(
        p_vt: *mut *mut FaissNormalizationTransform,
        d: ::std::os::raw::c_int,
        norm: f32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_NormalizationTransform_norm(arg1: *const FaissNormalizationTransform) -> f32;
}
pub type FaissCenteringTransform = FaissVectorTransform_H;
unsafe extern "C" {
    pub fn faiss_CenteringTransform_free(obj: *mut FaissCenteringTransform);
}
unsafe extern "C" {
    pub fn faiss_CenteringTransform_new_with(
        p_vt: *mut *mut FaissCenteringTransform,
        d: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
#[doc = " Index that applies a LinearTransform transform on vectors before\n  handing them over to a sub-index"]
pub type FaissIndexPreTransform = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Index that applies a LinearTransform transform on vectors before\n  handing them over to a sub-index"]
    pub fn faiss_IndexPreTransform_free(obj: *mut FaissIndexPreTransform);
}
unsafe extern "C" {
    #[doc = " Index that applies a LinearTransform transform on vectors before\n  handing them over to a sub-index"]
    pub fn faiss_IndexPreTransform_cast(arg1: *mut FaissIndex) -> *mut FaissIndexPreTransform;
}
unsafe extern "C" {
    #[doc = " Index that applies a LinearTransform transform on vectors before\n  handing them over to a sub-index"]
    pub fn faiss_IndexPreTransform_index(arg1: *const FaissIndexPreTransform) -> *mut FaissIndex;
}
unsafe extern "C" {
    #[doc = " Index that applies a LinearTransform transform on vectors before\n  handing them over to a sub-index"]
    pub fn faiss_IndexPreTransform_own_fields(
        arg1: *const FaissIndexPreTransform,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Index that applies a LinearTransform transform on vectors before\n  handing them over to a sub-index"]
    pub fn faiss_IndexPreTransform_set_own_fields(
        arg1: *mut FaissIndexPreTransform,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " Index that applies a LinearTransform transform on vectors before\n  handing them over to a sub-index"]
    pub fn faiss_IndexPreTransform_new(
        p_index: *mut *mut FaissIndexPreTransform,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexPreTransform_new_with(
        p_index: *mut *mut FaissIndexPreTransform,
        index: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexPreTransform_new_with_transform(
        p_index: *mut *mut FaissIndexPreTransform,
        ltrans: *mut FaissVectorTransform,
        index: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexPreTransform_prepend_transform(
        index: *mut FaissIndexPreTransform,
        ltrans: *mut FaissVectorTransform,
    ) -> ::std::os::raw::c_int;
}
#[doc = " Index that concatenates the results from several sub-indexes"]
pub type FaissIndexReplicas = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexReplicas_free(obj: *mut FaissIndexReplicas);
}
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexReplicas_own_fields(arg1: *const FaissIndexReplicas)
        -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexReplicas_set_own_fields(
        arg1: *mut FaissIndexReplicas,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexReplicas_new(
        p_index: *mut *mut FaissIndexReplicas,
        d: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexReplicas_new_with_options(
        p_index: *mut *mut FaissIndexReplicas,
        d: idx_t,
        threaded: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexReplicas_add_replica(
        index: *mut FaissIndexReplicas,
        replica: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexReplicas_remove_replica(
        index: *mut FaissIndexReplicas,
        replica: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexReplicas_at(
        index: *mut FaissIndexReplicas,
        i: ::std::os::raw::c_int,
    ) -> *mut FaissIndex;
}
#[doc = "< 8 bits per component"]
pub const FaissQuantizerType_QT_8bit: FaissQuantizerType = 0;
#[doc = "< 4 bits per component"]
pub const FaissQuantizerType_QT_4bit: FaissQuantizerType = 1;
#[doc = "< same, shared range for all dimensions"]
pub const FaissQuantizerType_QT_8bit_uniform: FaissQuantizerType = 2;
pub const FaissQuantizerType_QT_4bit_uniform: FaissQuantizerType = 3;
pub const FaissQuantizerType_QT_fp16: FaissQuantizerType = 4;
#[doc = "< fast indexing of uint8s"]
pub const FaissQuantizerType_QT_8bit_direct: FaissQuantizerType = 5;
#[doc = "< 6 bits per component"]
pub const FaissQuantizerType_QT_6bit: FaissQuantizerType = 6;
pub const FaissQuantizerType_QT_bf16: FaissQuantizerType = 7;
#[doc = "< fast indexing of signed int8s ranging from [-128\n< to 127]"]
pub const FaissQuantizerType_QT_8bit_direct_signed: FaissQuantizerType = 8;
pub type FaissQuantizerType = ::std::os::raw::c_uint;
#[doc = " Opaque type for IndexScalarQuantizer"]
pub type FaissIndexScalarQuantizer = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Opaque type for IndexScalarQuantizer"]
    pub fn faiss_IndexScalarQuantizer_new(
        p_index: *mut *mut FaissIndexScalarQuantizer,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexScalarQuantizer_new_with(
        p_index: *mut *mut FaissIndexScalarQuantizer,
        d: idx_t,
        qt: FaissQuantizerType,
        metric: FaissMetricType,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexScalarQuantizer_cast(arg1: *mut FaissIndex)
        -> *mut FaissIndexScalarQuantizer;
}
unsafe extern "C" {
    pub fn faiss_IndexScalarQuantizer_free(obj: *mut FaissIndexScalarQuantizer);
}
#[doc = " Opaque type for IndexIVFScalarQuantizer"]
pub type FaissIndexIVFScalarQuantizer = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Opaque type for IndexIVFScalarQuantizer"]
    pub fn faiss_IndexIVFScalarQuantizer_cast(
        arg1: *mut FaissIndex,
    ) -> *mut FaissIndexIVFScalarQuantizer;
}
unsafe extern "C" {
    #[doc = " Opaque type for IndexIVFScalarQuantizer"]
    pub fn faiss_IndexIVFScalarQuantizer_free(obj: *mut FaissIndexIVFScalarQuantizer);
}
unsafe extern "C" {
    #[doc = " Opaque type for IndexIVFScalarQuantizer"]
    pub fn faiss_IndexIVFScalarQuantizer_new(
        p_index: *mut *mut FaissIndexIVFScalarQuantizer,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexIVFScalarQuantizer_new_with(
        p_index: *mut *mut FaissIndexIVFScalarQuantizer,
        quantizer: *mut FaissIndex,
        d: idx_t,
        nlist: usize,
        qt: FaissQuantizerType,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexIVFScalarQuantizer_new_with_metric(
        p_index: *mut *mut FaissIndexIVFScalarQuantizer,
        quantizer: *mut FaissIndex,
        d: usize,
        nlist: usize,
        qt: FaissQuantizerType,
        metric: FaissMetricType,
        encode_residual: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " number of possible key values"]
    pub fn faiss_IndexIVFScalarQuantizer_nlist(arg1: *const FaissIndexIVFScalarQuantizer) -> usize;
}
unsafe extern "C" {
    #[doc = " number of probes at query time"]
    pub fn faiss_IndexIVFScalarQuantizer_nprobe(arg1: *const FaissIndexIVFScalarQuantizer)
        -> usize;
}
unsafe extern "C" {
    #[doc = " number of probes at query time"]
    pub fn faiss_IndexIVFScalarQuantizer_set_nprobe(
        arg1: *mut FaissIndexIVFScalarQuantizer,
        arg2: usize,
    );
}
unsafe extern "C" {
    #[doc = " quantizer that maps vectors to inverted lists"]
    pub fn faiss_IndexIVFScalarQuantizer_quantizer(
        arg1: *const FaissIndexIVFScalarQuantizer,
    ) -> *mut FaissIndex;
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexIVFScalarQuantizer_own_fields(
        arg1: *const FaissIndexIVFScalarQuantizer,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexIVFScalarQuantizer_set_own_fields(
        arg1: *mut FaissIndexIVFScalarQuantizer,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " whether object owns the quantizer"]
    pub fn faiss_IndexIVFScalarQuantizer_add_core(
        index: *mut FaissIndexIVFScalarQuantizer,
        n: idx_t,
        x: *const f32,
        xids: *const idx_t,
        precomputed_idx: *const idx_t,
    ) -> ::std::os::raw::c_int;
}
#[doc = " Index that concatenates the results from several sub-indexes"]
pub type FaissIndexShards = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexShards_free(obj: *mut FaissIndexShards);
}
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexShards_own_fields(arg1: *const FaissIndexShards) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexShards_set_own_fields(
        arg1: *mut FaissIndexShards,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexShards_successive_ids(arg1: *const FaissIndexShards)
        -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexShards_set_successive_ids(
        arg1: *mut FaissIndexShards,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " Index that concatenates the results from several sub-indexes"]
    pub fn faiss_IndexShards_new(
        p_index: *mut *mut FaissIndexShards,
        d: idx_t,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexShards_new_with_options(
        p_index: *mut *mut FaissIndexShards,
        d: idx_t,
        threaded: ::std::os::raw::c_int,
        successive_ids: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexShards_add_shard(
        index: *mut FaissIndexShards,
        shard: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexShards_remove_shard(
        index: *mut FaissIndexShards,
        shard: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_IndexShards_at(
        index: *mut FaissIndexShards,
        i: ::std::os::raw::c_int,
    ) -> *mut FaissIndex;
}
#[doc = " Index that translates search results to ids"]
pub type FaissIndexIDMap = FaissIndex_H;
unsafe extern "C" {
    #[doc = " Index that translates search results to ids"]
    pub fn faiss_IndexIDMap_own_fields(arg1: *const FaissIndexIDMap) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Index that translates search results to ids"]
    pub fn faiss_IndexIDMap_set_own_fields(arg1: *mut FaissIndexIDMap, arg2: ::std::os::raw::c_int);
}
unsafe extern "C" {
    #[doc = " Index that translates search results to ids"]
    pub fn faiss_IndexIDMap_new(
        p_index: *mut *mut FaissIndexIDMap,
        index: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexIDMap_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap;
}
unsafe extern "C" {
    #[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`."]
    pub fn faiss_IndexIDMap_id_map(
        index: *mut FaissIndexIDMap,
        p_id_map: *mut *mut idx_t,
        p_size: *mut usize,
    );
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexIDMap_sub_index(index: *mut FaissIndexIDMap) -> *mut FaissIndex;
}
#[doc = " same as IndexIDMap but also provides an efficient reconstruction\nimplementation via a 2-way index"]
pub type FaissIndexIDMap2 = FaissIndex_H;
unsafe extern "C" {
    #[doc = " same as IndexIDMap but also provides an efficient reconstruction\nimplementation via a 2-way index"]
    pub fn faiss_IndexIDMap2_own_fields(arg1: *const FaissIndexIDMap2) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " same as IndexIDMap but also provides an efficient reconstruction\nimplementation via a 2-way index"]
    pub fn faiss_IndexIDMap2_set_own_fields(
        arg1: *mut FaissIndexIDMap2,
        arg2: ::std::os::raw::c_int,
    );
}
unsafe extern "C" {
    #[doc = " same as IndexIDMap but also provides an efficient reconstruction\nimplementation via a 2-way index"]
    pub fn faiss_IndexIDMap2_new(
        p_index: *mut *mut FaissIndexIDMap2,
        index: *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " make the rev_map from scratch"]
    pub fn faiss_IndexIDMap2_construct_rev_map(
        index: *mut FaissIndexIDMap2,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexIDMap2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap2;
}
unsafe extern "C" {
    #[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`."]
    pub fn faiss_IndexIDMap2_id_map(
        index: *mut FaissIndexIDMap2,
        p_id_map: *mut *mut idx_t,
        p_size: *mut usize,
    );
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_IndexIDMap2_sub_index(index: *mut FaissIndexIDMap2) -> *mut FaissIndex;
}
pub type FILE = __BindgenOpaqueArray<u64, 27usize>;
unsafe extern "C" {
    #[doc = " Clone an index. This is equivalent to `faiss::clone_index`"]
    pub fn faiss_clone_index(
        arg1: *const FaissIndex,
        p_out: *mut *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Clone a binary index. This is equivalent to `faiss::clone_index_binary`"]
    pub fn faiss_clone_index_binary(
        arg1: *const FaissIndexBinary,
        p_out: *mut *mut FaissIndexBinary,
    ) -> ::std::os::raw::c_int;
}
#[doc = " No error"]
pub const FaissErrorCode_OK: FaissErrorCode = 0;
#[doc = " Any exception other than Faiss or standard C++ library exceptions"]
pub const FaissErrorCode_UNKNOWN_EXCEPT: FaissErrorCode = -1;
#[doc = " Faiss library exception"]
pub const FaissErrorCode_FAISS_EXCEPT: FaissErrorCode = -2;
#[doc = " Standard C++ library exception"]
pub const FaissErrorCode_STD_EXCEPT: FaissErrorCode = -4;
#[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."]
pub type FaissErrorCode = ::std::os::raw::c_int;
unsafe extern "C" {
    #[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."]
    pub fn faiss_get_last_error() -> *const ::std::os::raw::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIOReader_H {
    _unused: [u8; 0],
}
pub type FaissIOReader = FaissIOReader_H;
unsafe extern "C" {
    pub fn faiss_IOReader_free(obj: *mut FaissIOReader);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissIOWriter_H {
    _unused: [u8; 0],
}
pub type FaissIOWriter = FaissIOWriter_H;
unsafe extern "C" {
    pub fn faiss_IOWriter_free(obj: *mut FaissIOWriter);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissCustomIOReader_H {
    _unused: [u8; 0],
}
#[doc = " Custom reader + writer\n\n Reader and writer which wraps a function pointer,\n primarily for FFI use."]
pub type FaissCustomIOReader = FaissCustomIOReader_H;
unsafe extern "C" {
    #[doc = " Custom reader + writer\n\n Reader and writer which wraps a function pointer,\n primarily for FFI use."]
    pub fn faiss_CustomIOReader_free(obj: *mut FaissCustomIOReader);
}
unsafe extern "C" {
    #[doc = " Custom reader + writer\n\n Reader and writer which wraps a function pointer,\n primarily for FFI use."]
    pub fn faiss_CustomIOReader_new(
        p_out: *mut *mut FaissCustomIOReader,
        func_in: ::std::option::Option<
            unsafe extern "C" fn(
                ptr: *mut ::std::os::raw::c_void,
                size: usize,
                nitems: usize,
            ) -> usize,
        >,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FaissCustomIOWriter_H {
    _unused: [u8; 0],
}
pub type FaissCustomIOWriter = FaissCustomIOWriter_H;
unsafe extern "C" {
    pub fn faiss_CustomIOWriter_free(obj: *mut FaissCustomIOWriter);
}
unsafe extern "C" {
    pub fn faiss_CustomIOWriter_new(
        p_out: *mut *mut FaissCustomIOWriter,
        func_in: ::std::option::Option<
            unsafe extern "C" fn(
                ptr: *const ::std::os::raw::c_void,
                size: usize,
                nitems: usize,
            ) -> usize,
        >,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Build an index with the sequence of processing steps described in\n  the string."]
    pub fn faiss_index_factory(
        p_index: *mut *mut FaissIndex,
        d: ::std::os::raw::c_int,
        description: *const ::std::os::raw::c_char,
        metric: FaissMetricType,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Build a binary index with the sequence of processing steps described in\n  the string."]
    pub fn faiss_index_binary_factory(
        p_index: *mut *mut FaissIndexBinary,
        d: ::std::os::raw::c_int,
        description: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index` when a file descriptor is\n provided."]
    pub fn faiss_write_index(idx: *const FaissIndex, f: *mut FILE) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index` when a file path is provided."]
    pub fn faiss_write_index_fname(
        idx: *const FaissIndex,
        fname: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Write index to a custom writer."]
    pub fn faiss_write_index_custom(
        idx: *const FaissIndex,
        io_writer: *mut FaissIOWriter,
        io_flags: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index` when a file descriptor is given."]
    pub fn faiss_read_index(
        f: *mut FILE,
        io_flags: ::std::os::raw::c_int,
        p_out: *mut *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index` when a file path is given."]
    pub fn faiss_read_index_fname(
        fname: *const ::std::os::raw::c_char,
        io_flags: ::std::os::raw::c_int,
        p_out: *mut *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Read index from a custom reader."]
    pub fn faiss_read_index_custom(
        io_reader: *mut FaissIOReader,
        io_flags: ::std::os::raw::c_int,
        p_out: *mut *mut FaissIndex,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index_binary` when a file descriptor is\n provided."]
    pub fn faiss_write_index_binary(
        idx: *const FaissIndexBinary,
        f: *mut FILE,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Write index to a file.\n This is equivalent to `faiss::write_index_binary` when a file path is\n provided."]
    pub fn faiss_write_index_binary_fname(
        idx: *const FaissIndexBinary,
        fname: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Write binary index to a custom writer."]
    pub fn faiss_write_index_binary_custom(
        idx: *const FaissIndexBinary,
        io_writer: *mut FaissIOWriter,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index_binary` when a file descriptor is\n given."]
    pub fn faiss_read_index_binary(
        f: *mut FILE,
        io_flags: ::std::os::raw::c_int,
        p_out: *mut *mut FaissIndexBinary,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Read index from a file.\n This is equivalent to `faiss:read_index_binary` when a file path is given."]
    pub fn faiss_read_index_binary_fname(
        fname: *const ::std::os::raw::c_char,
        io_flags: ::std::os::raw::c_int,
        p_out: *mut *mut FaissIndexBinary,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Read binary index from a custom reader."]
    pub fn faiss_read_index_binary_custom(
        io_reader: *mut FaissIOReader,
        io_flags: ::std::os::raw::c_int,
        p_out: *mut *mut FaissIndexBinary,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Read vector transform from a file.\n This is equivalent to `faiss:read_VectorTransform` when a file path is given."]
    pub fn faiss_read_VectorTransform_fname(
        fname: *const ::std::os::raw::c_char,
        p_out: *mut *mut FaissVectorTransform,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Compute pairwise distances between sets of vectors"]
    pub fn faiss_pairwise_L2sqr(
        d: i64,
        nq: i64,
        xq: *const f32,
        nb: i64,
        xb: *const f32,
        dis: *mut f32,
        ldq: i64,
        ldb: i64,
        ldd: i64,
    );
}
unsafe extern "C" {
    #[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"]
    pub fn faiss_pairwise_L2sqr_with_defaults(
        d: i64,
        nq: i64,
        xq: *const f32,
        nb: i64,
        xb: *const f32,
        dis: *mut f32,
    );
}
unsafe extern "C" {
    #[doc = " compute the inner product between nx vectors x and one y"]
    pub fn faiss_fvec_inner_products_ny(
        ip: *mut f32,
        x: *const f32,
        y: *const f32,
        d: usize,
        ny: usize,
    );
}
unsafe extern "C" {
    #[doc = " compute ny square L2 distance between x and a set of contiguous y vectors"]
    pub fn faiss_fvec_L2sqr_ny(dis: *mut f32, x: *const f32, y: *const f32, d: usize, ny: usize);
}
unsafe extern "C" {
    #[doc = " squared norm of a vector"]
    pub fn faiss_fvec_norm_L2sqr(x: *const f32, d: usize) -> f32;
}
unsafe extern "C" {
    #[doc = " compute the L2 norms for a set of vectors"]
    pub fn faiss_fvec_norms_L2(norms: *mut f32, x: *const f32, d: usize, nx: usize);
}
unsafe extern "C" {
    #[doc = " same as fvec_norms_L2, but computes squared norms"]
    pub fn faiss_fvec_norms_L2sqr(norms: *mut f32, x: *const f32, d: usize, nx: usize);
}
unsafe extern "C" {
    #[doc = " L2-renormalize a set of vector. Nothing done if the vector is 0-normed"]
    pub fn faiss_fvec_renorm_L2(d: usize, nx: usize, x: *mut f32);
}
unsafe extern "C" {
    #[doc = " Setter of threshold value on nx above which we switch to BLAS to compute\n distances"]
    pub fn faiss_set_distance_compute_blas_threshold(value: ::std::os::raw::c_int);
}
unsafe extern "C" {
    #[doc = " Getter of threshold value on nx above which we switch to BLAS to compute\n distances"]
    pub fn faiss_get_distance_compute_blas_threshold() -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Setter of block sizes value for BLAS distance computations"]
    pub fn faiss_set_distance_compute_blas_query_bs(value: ::std::os::raw::c_int);
}
unsafe extern "C" {
    #[doc = " Getter of block sizes value for BLAS distance computations"]
    pub fn faiss_get_distance_compute_blas_query_bs() -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Setter of block sizes value for BLAS distance computations"]
    pub fn faiss_set_distance_compute_blas_database_bs(value: ::std::os::raw::c_int);
}
unsafe extern "C" {
    #[doc = " Getter of block sizes value for BLAS distance computations"]
    pub fn faiss_get_distance_compute_blas_database_bs() -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    #[doc = " Setter of number of results we switch to a reservoir to collect results\n rather than a heap"]
    pub fn faiss_set_distance_compute_min_k_reservoir(value: ::std::os::raw::c_int);
}
unsafe extern "C" {
    #[doc = " Getter of number of results we switch to a reservoir to collect results\n rather than a heap"]
    pub fn faiss_get_distance_compute_min_k_reservoir() -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn faiss_get_version() -> *const ::std::os::raw::c_char;
}