From e09dedecb9c32645913bf047a6da491e6da9e8c8 Mon Sep 17 00:00:00 2001 From: Eduardo Pinho Date: Mon, 28 Mar 2022 09:25:17 +0100 Subject: [PATCH] [sys] Update bindings files against faiss v1.7.2 --- faiss-sys/src/bindings.rs | 234 +++++++++++++++++++++++++++++++--- faiss-sys/src/bindings_gpu.rs | 234 +++++++++++++++++++++++++++++++--- 2 files changed, 432 insertions(+), 36 deletions(-) diff --git a/faiss-sys/src/bindings.rs b/faiss-sys/src/bindings.rs index 2c4c102..f040041 100644 --- a/faiss-sys/src/bindings.rs +++ b/faiss-sys/src/bindings.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.57.0 */ +/* automatically generated by rust-bindgen 0.59.2 */ pub type __int64_t = ::std::os::raw::c_long; pub type faiss_idx_t = i64; @@ -77,7 +77,7 @@ extern "C" { #[doc = " Add n vectors of dimension d to the index."] #[doc = ""] #[doc = " Vectors are implicitly assigned labels ntotal .. ntotal + n - 1"] - #[doc = " This function slices the input vectors in chuncks smaller than"] + #[doc = " This function slices the input vectors in chunks smaller than"] #[doc = " blocksize_add and calls add_core."] #[doc = " @param index opaque pointer to index object"] #[doc = " @param x input matrix, size n * d"] @@ -176,7 +176,7 @@ extern "C" { #[doc = " this function may not be defined for some indexes"] #[doc = " @param index opaque pointer to index object"] #[doc = " @param key id of the vector to reconstruct"] - #[doc = " @param recons reconstucted vector (size d)"] + #[doc = " @param recons reconstructed vector (size d)"] pub fn faiss_Index_reconstruct( index: *const FaissIndex, key: idx_t, @@ -188,7 +188,7 @@ extern "C" { #[doc = ""] #[doc = " this function may not be defined for some indexes"] #[doc = " @param index opaque pointer to index object"] - #[doc = " @param recons reconstucted vector (size ni * d)"] + #[doc = " @param recons reconstructed vector (size ni * d)"] pub fn faiss_Index_reconstruct_n( index: *const FaissIndex, i0: idx_t, @@ -334,6 +334,8 @@ pub struct FaissClusteringParameters { 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"] @@ -345,17 +347,19 @@ pub struct FaissClusteringParameters { 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, } #[test] fn bindgen_test_layout_FaissClusteringParameters() { assert_eq!( ::std::mem::size_of::(), - 36usize, + 48usize, concat!("Size of: ", stringify!(FaissClusteringParameters)) ); assert_eq!( ::std::mem::align_of::(), - 4usize, + 8usize, concat!("Alignment of ", stringify!(FaissClusteringParameters)) ); assert_eq!( @@ -404,9 +408,21 @@ fn bindgen_test_layout_FaissClusteringParameters() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).update_index as *const _ as usize + &(*(::std::ptr::null::())).int_centroids as *const _ as usize }, 16usize, + concat!( + "Offset of field: ", + stringify!(FaissClusteringParameters), + "::", + stringify!(int_centroids) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).update_index as *const _ as usize + }, + 20usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -419,7 +435,7 @@ fn bindgen_test_layout_FaissClusteringParameters() { &(*(::std::ptr::null::())).frozen_centroids as *const _ as usize }, - 20usize, + 24usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -432,7 +448,7 @@ fn bindgen_test_layout_FaissClusteringParameters() { &(*(::std::ptr::null::())).min_points_per_centroid as *const _ as usize }, - 24usize, + 28usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -445,7 +461,7 @@ fn bindgen_test_layout_FaissClusteringParameters() { &(*(::std::ptr::null::())).max_points_per_centroid as *const _ as usize }, - 28usize, + 32usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -455,7 +471,7 @@ fn bindgen_test_layout_FaissClusteringParameters() { ); assert_eq!( unsafe { &(*(::std::ptr::null::())).seed as *const _ as usize }, - 32usize, + 36usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -463,6 +479,19 @@ fn bindgen_test_layout_FaissClusteringParameters() { stringify!(seed) ) ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).decode_block_size as *const _ + as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(FaissClusteringParameters), + "::", + stringify!(decode_block_size) + ) + ); } extern "C" { #[doc = " Sets the ClusteringParameters object with reasonable defaults"] @@ -486,6 +515,9 @@ extern "C" { extern "C" { pub fn faiss_Clustering_spherical(arg1: *const FaissClustering) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_Clustering_int_centroids(arg1: *const FaissClustering) -> ::std::os::raw::c_int; +} extern "C" { pub fn faiss_Clustering_update_index(arg1: *const FaissClustering) -> ::std::os::raw::c_int; } @@ -506,6 +538,9 @@ extern "C" { extern "C" { pub fn faiss_Clustering_seed(arg1: *const FaissClustering) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_Clustering_decode_block_size(arg1: *const FaissClustering) -> usize; +} extern "C" { pub fn faiss_Clustering_d(arg1: *const FaissClustering) -> usize; } @@ -647,6 +682,12 @@ extern "C" { ) -> ::std::os::raw::c_int; } pub type FaissIndexFlatIP = FaissIndex_H; +extern "C" { + pub fn faiss_IndexFlatIP_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatIP; +} +extern "C" { + pub fn faiss_IndexFlatIP_free(obj: *mut FaissIndexFlatIP); +} extern "C" { #[doc = " Opaque type for IndexFlatIP"] pub fn faiss_IndexFlatIP_new(p_index: *mut *mut FaissIndexFlatIP) -> ::std::os::raw::c_int; @@ -658,6 +699,12 @@ extern "C" { ) -> ::std::os::raw::c_int; } pub type FaissIndexFlatL2 = FaissIndex_H; +extern "C" { + pub fn faiss_IndexFlatL2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatL2; +} +extern "C" { + pub fn faiss_IndexFlatL2_free(obj: *mut FaissIndexFlatL2); +} extern "C" { #[doc = " Opaque type for IndexFlatL2"] pub fn faiss_IndexFlatL2_new(p_index: *mut *mut FaissIndexFlatL2) -> ::std::os::raw::c_int; @@ -682,6 +729,9 @@ extern "C" { extern "C" { pub fn faiss_IndexRefineFlat_free(obj: *mut FaissIndexRefineFlat); } +extern "C" { + pub fn faiss_IndexRefineFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexRefineFlat; +} extern "C" { pub fn faiss_IndexRefineFlat_own_fields( arg1: *const FaissIndexRefineFlat, @@ -700,6 +750,12 @@ extern "C" { pub fn faiss_IndexRefineFlat_set_k_factor(arg1: *mut FaissIndexRefineFlat, arg2: f32); } pub type FaissIndexFlat1D = FaissIndex_H; +extern "C" { + pub fn faiss_IndexFlat1D_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlat1D; +} +extern "C" { + pub fn faiss_IndexFlat1D_free(obj: *mut FaissIndexFlat1D); +} extern "C" { #[doc = " Opaque type for IndexFlat1D"] #[doc = ""] @@ -922,12 +978,15 @@ pub struct FaissIndexIVFStats { pub nq: usize, pub nlist: usize, pub ndis: usize, + pub nheap_updates: usize, + pub quantization_time: f64, + pub search_time: f64, } #[test] fn bindgen_test_layout_FaissIndexIVFStats() { assert_eq!( ::std::mem::size_of::(), - 24usize, + 48usize, concat!("Size of: ", stringify!(FaissIndexIVFStats)) ); assert_eq!( @@ -965,10 +1024,48 @@ fn bindgen_test_layout_FaissIndexIVFStats() { stringify!(ndis) ) ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nheap_updates as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(FaissIndexIVFStats), + "::", + stringify!(nheap_updates) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).quantization_time as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(FaissIndexIVFStats), + "::", + stringify!(quantization_time) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).search_time as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(FaissIndexIVFStats), + "::", + stringify!(search_time) + ) + ); } extern "C" { pub fn faiss_IndexIVFStats_reset(stats: *mut FaissIndexIVFStats); } +extern "C" { + #[doc = " global var that collects all statists"] + pub fn faiss_get_indexIVF_stats() -> *mut FaissIndexIVFStats; +} pub type FaissIndexLSH = FaissIndex_H; extern "C" { pub fn faiss_IndexLSH_free(obj: *mut FaissIndexLSH); @@ -980,7 +1077,7 @@ extern "C" { pub fn faiss_IndexLSH_nbits(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int; } extern "C" { - pub fn faiss_IndexLSH_bytes_per_vec(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int; + pub fn faiss_IndexLSH_code_size(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int; } extern "C" { pub fn faiss_IndexLSH_rotate_data(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int; @@ -1261,6 +1358,58 @@ extern "C" { index: *mut FaissIndex, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_IndexPreTransform_prepend_transform( + index: *mut FaissIndexPreTransform, + ltrans: *mut FaissVectorTransform, + ) -> ::std::os::raw::c_int; +} +pub type FaissIndexReplicas = FaissIndex_H; +extern "C" { + pub fn faiss_IndexReplicas_free(obj: *mut FaissIndexReplicas); +} +extern "C" { + pub fn faiss_IndexReplicas_own_fields(arg1: *const FaissIndexReplicas) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn faiss_IndexReplicas_set_own_fields( + arg1: *mut FaissIndexReplicas, + arg2: ::std::os::raw::c_int, + ); +} +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; +} +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; +} +extern "C" { + pub fn faiss_IndexReplicas_add_replica( + index: *mut FaissIndexReplicas, + replica: *mut FaissIndex, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn faiss_IndexReplicas_remove_replica( + index: *mut FaissIndexReplicas, + replica: *mut FaissIndex, + ) -> ::std::os::raw::c_int; +} +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"] @@ -1378,6 +1527,9 @@ extern "C" { ) -> ::std::os::raw::c_int; } pub type FaissIndexShards = FaissIndex_H; +extern "C" { + pub fn faiss_IndexShards_free(obj: *mut FaissIndexShards); +} extern "C" { pub fn faiss_IndexShards_own_fields(arg1: *const FaissIndexShards) -> ::std::os::raw::c_int; } @@ -1418,6 +1570,12 @@ extern "C" { shard: *mut FaissIndex, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_IndexShards_remove_shard( + index: *mut FaissIndexShards, + shard: *mut FaissIndex, + ) -> ::std::os::raw::c_int; +} extern "C" { pub fn faiss_IndexShards_at( index: *mut FaissIndexShards, @@ -1438,6 +1596,9 @@ extern "C" { index: *mut FaissIndex, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_IndexIDMap_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap; +} extern "C" { #[doc = " get a pointer to the index map's internal ID vector (the `id_map` field)."] #[doc = " The outputs of this function become invalid after any operation that can"] @@ -1452,12 +1613,24 @@ extern "C" { p_size: *mut usize, ); } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct FaissIndexIDMap_H { - _unused: [u8; 0], +extern "C" { + #[doc = " get a pointer to the sub-index (the `index` field)."] + #[doc = " The outputs of this function become invalid after any operation that can"] + #[doc = " modify the index."] + #[doc = ""] + #[doc = " @param index opaque pointer to index object"] + pub fn faiss_IndexIDMap_sub_index(index: *mut FaissIndexIDMap) -> *mut FaissIndex; +} +pub type FaissIndexIDMap2 = FaissIndex_H; +extern "C" { + pub fn faiss_IndexIDMap2_own_fields(arg1: *const FaissIndexIDMap2) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn faiss_IndexIDMap2_set_own_fields( + arg1: *mut FaissIndexIDMap2, + arg2: ::std::os::raw::c_int, + ); } -pub type FaissIndexIDMap2 = FaissIndexIDMap_H; extern "C" { #[doc = " same as IndexIDMap but also provides an efficient reconstruction"] #[doc = "implementation via a 2-way index"] @@ -1472,6 +1645,31 @@ extern "C" { index: *mut FaissIndexIDMap2, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_IndexIDMap2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap2; +} +extern "C" { + #[doc = " get a pointer to the index map's internal ID vector (the `id_map` field)."] + #[doc = " The outputs of this function become invalid after any operation that can"] + #[doc = " modify the index."] + #[doc = ""] + #[doc = " @param index opaque pointer to index object"] + #[doc = " @param p_id_map output, the pointer to the beginning of `id_map`."] + #[doc = " @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, + ); +} +extern "C" { + #[doc = " get a pointer to the sub-index (the `index` field)."] + #[doc = " The outputs of this function become invalid after any operation that can"] + #[doc = " modify the index."] + #[doc = ""] + #[doc = " @param index opaque pointer to index object"] + pub fn faiss_IndexIDMap2_sub_index(index: *mut FaissIndexIDMap2) -> *mut FaissIndex; +} pub type FILE = [u64; 27usize]; extern "C" { #[doc = " Clone an index. This is equivalent to `faiss::clone_index`"] diff --git a/faiss-sys/src/bindings_gpu.rs b/faiss-sys/src/bindings_gpu.rs index c6a3c03..581a4e4 100644 --- a/faiss-sys/src/bindings_gpu.rs +++ b/faiss-sys/src/bindings_gpu.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.57.0 */ +/* automatically generated by rust-bindgen 0.59.2 */ pub type __int64_t = ::std::os::raw::c_long; pub type faiss_idx_t = i64; @@ -77,7 +77,7 @@ extern "C" { #[doc = " Add n vectors of dimension d to the index."] #[doc = ""] #[doc = " Vectors are implicitly assigned labels ntotal .. ntotal + n - 1"] - #[doc = " This function slices the input vectors in chuncks smaller than"] + #[doc = " This function slices the input vectors in chunks smaller than"] #[doc = " blocksize_add and calls add_core."] #[doc = " @param index opaque pointer to index object"] #[doc = " @param x input matrix, size n * d"] @@ -176,7 +176,7 @@ extern "C" { #[doc = " this function may not be defined for some indexes"] #[doc = " @param index opaque pointer to index object"] #[doc = " @param key id of the vector to reconstruct"] - #[doc = " @param recons reconstucted vector (size d)"] + #[doc = " @param recons reconstructed vector (size d)"] pub fn faiss_Index_reconstruct( index: *const FaissIndex, key: idx_t, @@ -188,7 +188,7 @@ extern "C" { #[doc = ""] #[doc = " this function may not be defined for some indexes"] #[doc = " @param index opaque pointer to index object"] - #[doc = " @param recons reconstucted vector (size ni * d)"] + #[doc = " @param recons reconstructed vector (size ni * d)"] pub fn faiss_Index_reconstruct_n( index: *const FaissIndex, i0: idx_t, @@ -334,6 +334,8 @@ pub struct FaissClusteringParameters { 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"] @@ -345,17 +347,19 @@ pub struct FaissClusteringParameters { 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, } #[test] fn bindgen_test_layout_FaissClusteringParameters() { assert_eq!( ::std::mem::size_of::(), - 36usize, + 48usize, concat!("Size of: ", stringify!(FaissClusteringParameters)) ); assert_eq!( ::std::mem::align_of::(), - 4usize, + 8usize, concat!("Alignment of ", stringify!(FaissClusteringParameters)) ); assert_eq!( @@ -404,9 +408,21 @@ fn bindgen_test_layout_FaissClusteringParameters() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).update_index as *const _ as usize + &(*(::std::ptr::null::())).int_centroids as *const _ as usize }, 16usize, + concat!( + "Offset of field: ", + stringify!(FaissClusteringParameters), + "::", + stringify!(int_centroids) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).update_index as *const _ as usize + }, + 20usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -419,7 +435,7 @@ fn bindgen_test_layout_FaissClusteringParameters() { &(*(::std::ptr::null::())).frozen_centroids as *const _ as usize }, - 20usize, + 24usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -432,7 +448,7 @@ fn bindgen_test_layout_FaissClusteringParameters() { &(*(::std::ptr::null::())).min_points_per_centroid as *const _ as usize }, - 24usize, + 28usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -445,7 +461,7 @@ fn bindgen_test_layout_FaissClusteringParameters() { &(*(::std::ptr::null::())).max_points_per_centroid as *const _ as usize }, - 28usize, + 32usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -455,7 +471,7 @@ fn bindgen_test_layout_FaissClusteringParameters() { ); assert_eq!( unsafe { &(*(::std::ptr::null::())).seed as *const _ as usize }, - 32usize, + 36usize, concat!( "Offset of field: ", stringify!(FaissClusteringParameters), @@ -463,6 +479,19 @@ fn bindgen_test_layout_FaissClusteringParameters() { stringify!(seed) ) ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).decode_block_size as *const _ + as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(FaissClusteringParameters), + "::", + stringify!(decode_block_size) + ) + ); } extern "C" { #[doc = " Sets the ClusteringParameters object with reasonable defaults"] @@ -486,6 +515,9 @@ extern "C" { extern "C" { pub fn faiss_Clustering_spherical(arg1: *const FaissClustering) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_Clustering_int_centroids(arg1: *const FaissClustering) -> ::std::os::raw::c_int; +} extern "C" { pub fn faiss_Clustering_update_index(arg1: *const FaissClustering) -> ::std::os::raw::c_int; } @@ -506,6 +538,9 @@ extern "C" { extern "C" { pub fn faiss_Clustering_seed(arg1: *const FaissClustering) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_Clustering_decode_block_size(arg1: *const FaissClustering) -> usize; +} extern "C" { pub fn faiss_Clustering_d(arg1: *const FaissClustering) -> usize; } @@ -647,6 +682,12 @@ extern "C" { ) -> ::std::os::raw::c_int; } pub type FaissIndexFlatIP = FaissIndex_H; +extern "C" { + pub fn faiss_IndexFlatIP_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatIP; +} +extern "C" { + pub fn faiss_IndexFlatIP_free(obj: *mut FaissIndexFlatIP); +} extern "C" { #[doc = " Opaque type for IndexFlatIP"] pub fn faiss_IndexFlatIP_new(p_index: *mut *mut FaissIndexFlatIP) -> ::std::os::raw::c_int; @@ -658,6 +699,12 @@ extern "C" { ) -> ::std::os::raw::c_int; } pub type FaissIndexFlatL2 = FaissIndex_H; +extern "C" { + pub fn faiss_IndexFlatL2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlatL2; +} +extern "C" { + pub fn faiss_IndexFlatL2_free(obj: *mut FaissIndexFlatL2); +} extern "C" { #[doc = " Opaque type for IndexFlatL2"] pub fn faiss_IndexFlatL2_new(p_index: *mut *mut FaissIndexFlatL2) -> ::std::os::raw::c_int; @@ -682,6 +729,9 @@ extern "C" { extern "C" { pub fn faiss_IndexRefineFlat_free(obj: *mut FaissIndexRefineFlat); } +extern "C" { + pub fn faiss_IndexRefineFlat_cast(arg1: *mut FaissIndex) -> *mut FaissIndexRefineFlat; +} extern "C" { pub fn faiss_IndexRefineFlat_own_fields( arg1: *const FaissIndexRefineFlat, @@ -700,6 +750,12 @@ extern "C" { pub fn faiss_IndexRefineFlat_set_k_factor(arg1: *mut FaissIndexRefineFlat, arg2: f32); } pub type FaissIndexFlat1D = FaissIndex_H; +extern "C" { + pub fn faiss_IndexFlat1D_cast(arg1: *mut FaissIndex) -> *mut FaissIndexFlat1D; +} +extern "C" { + pub fn faiss_IndexFlat1D_free(obj: *mut FaissIndexFlat1D); +} extern "C" { #[doc = " Opaque type for IndexFlat1D"] #[doc = ""] @@ -922,12 +978,15 @@ pub struct FaissIndexIVFStats { pub nq: usize, pub nlist: usize, pub ndis: usize, + pub nheap_updates: usize, + pub quantization_time: f64, + pub search_time: f64, } #[test] fn bindgen_test_layout_FaissIndexIVFStats() { assert_eq!( ::std::mem::size_of::(), - 24usize, + 48usize, concat!("Size of: ", stringify!(FaissIndexIVFStats)) ); assert_eq!( @@ -965,10 +1024,48 @@ fn bindgen_test_layout_FaissIndexIVFStats() { stringify!(ndis) ) ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nheap_updates as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(FaissIndexIVFStats), + "::", + stringify!(nheap_updates) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).quantization_time as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(FaissIndexIVFStats), + "::", + stringify!(quantization_time) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).search_time as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(FaissIndexIVFStats), + "::", + stringify!(search_time) + ) + ); } extern "C" { pub fn faiss_IndexIVFStats_reset(stats: *mut FaissIndexIVFStats); } +extern "C" { + #[doc = " global var that collects all statists"] + pub fn faiss_get_indexIVF_stats() -> *mut FaissIndexIVFStats; +} pub type FaissIndexLSH = FaissIndex_H; extern "C" { pub fn faiss_IndexLSH_free(obj: *mut FaissIndexLSH); @@ -980,7 +1077,7 @@ extern "C" { pub fn faiss_IndexLSH_nbits(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int; } extern "C" { - pub fn faiss_IndexLSH_bytes_per_vec(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int; + pub fn faiss_IndexLSH_code_size(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int; } extern "C" { pub fn faiss_IndexLSH_rotate_data(arg1: *const FaissIndexLSH) -> ::std::os::raw::c_int; @@ -1261,6 +1358,58 @@ extern "C" { index: *mut FaissIndex, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_IndexPreTransform_prepend_transform( + index: *mut FaissIndexPreTransform, + ltrans: *mut FaissVectorTransform, + ) -> ::std::os::raw::c_int; +} +pub type FaissIndexReplicas = FaissIndex_H; +extern "C" { + pub fn faiss_IndexReplicas_free(obj: *mut FaissIndexReplicas); +} +extern "C" { + pub fn faiss_IndexReplicas_own_fields(arg1: *const FaissIndexReplicas) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn faiss_IndexReplicas_set_own_fields( + arg1: *mut FaissIndexReplicas, + arg2: ::std::os::raw::c_int, + ); +} +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; +} +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; +} +extern "C" { + pub fn faiss_IndexReplicas_add_replica( + index: *mut FaissIndexReplicas, + replica: *mut FaissIndex, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn faiss_IndexReplicas_remove_replica( + index: *mut FaissIndexReplicas, + replica: *mut FaissIndex, + ) -> ::std::os::raw::c_int; +} +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"] @@ -1378,6 +1527,9 @@ extern "C" { ) -> ::std::os::raw::c_int; } pub type FaissIndexShards = FaissIndex_H; +extern "C" { + pub fn faiss_IndexShards_free(obj: *mut FaissIndexShards); +} extern "C" { pub fn faiss_IndexShards_own_fields(arg1: *const FaissIndexShards) -> ::std::os::raw::c_int; } @@ -1418,6 +1570,12 @@ extern "C" { shard: *mut FaissIndex, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_IndexShards_remove_shard( + index: *mut FaissIndexShards, + shard: *mut FaissIndex, + ) -> ::std::os::raw::c_int; +} extern "C" { pub fn faiss_IndexShards_at( index: *mut FaissIndexShards, @@ -1438,6 +1596,9 @@ extern "C" { index: *mut FaissIndex, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_IndexIDMap_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap; +} extern "C" { #[doc = " get a pointer to the index map's internal ID vector (the `id_map` field)."] #[doc = " The outputs of this function become invalid after any operation that can"] @@ -1452,12 +1613,24 @@ extern "C" { p_size: *mut usize, ); } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct FaissIndexIDMap_H { - _unused: [u8; 0], +extern "C" { + #[doc = " get a pointer to the sub-index (the `index` field)."] + #[doc = " The outputs of this function become invalid after any operation that can"] + #[doc = " modify the index."] + #[doc = ""] + #[doc = " @param index opaque pointer to index object"] + pub fn faiss_IndexIDMap_sub_index(index: *mut FaissIndexIDMap) -> *mut FaissIndex; +} +pub type FaissIndexIDMap2 = FaissIndex_H; +extern "C" { + pub fn faiss_IndexIDMap2_own_fields(arg1: *const FaissIndexIDMap2) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn faiss_IndexIDMap2_set_own_fields( + arg1: *mut FaissIndexIDMap2, + arg2: ::std::os::raw::c_int, + ); } -pub type FaissIndexIDMap2 = FaissIndexIDMap_H; extern "C" { #[doc = " same as IndexIDMap but also provides an efficient reconstruction"] #[doc = "implementation via a 2-way index"] @@ -1472,6 +1645,31 @@ extern "C" { index: *mut FaissIndexIDMap2, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn faiss_IndexIDMap2_cast(arg1: *mut FaissIndex) -> *mut FaissIndexIDMap2; +} +extern "C" { + #[doc = " get a pointer to the index map's internal ID vector (the `id_map` field)."] + #[doc = " The outputs of this function become invalid after any operation that can"] + #[doc = " modify the index."] + #[doc = ""] + #[doc = " @param index opaque pointer to index object"] + #[doc = " @param p_id_map output, the pointer to the beginning of `id_map`."] + #[doc = " @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, + ); +} +extern "C" { + #[doc = " get a pointer to the sub-index (the `index` field)."] + #[doc = " The outputs of this function become invalid after any operation that can"] + #[doc = " modify the index."] + #[doc = ""] + #[doc = " @param index opaque pointer to index object"] + pub fn faiss_IndexIDMap2_sub_index(index: *mut FaissIndexIDMap2) -> *mut FaissIndex; +} pub type FILE = [u64; 27usize]; extern "C" { #[doc = " Clone an index. This is equivalent to `faiss::clone_index`"]