### verifyPQSettings_ Source: https://faiss.ai/cpp_api/namespace/namespacefaiss_1_1gpu.html Verifies that the Product Quantizer settings are valid. Throws an exception if they are not. ```APIDOC ## verifyPQSettings_ ### Description Throws errors if configuration settings are improper. ### Throws An exception if PQ settings are improper. ``` -------------------------------- ### AlignedTable Utility Functions Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1AlignedTable.html Utility functions for managing the AlignedTable, including getting item size, resizing, clearing, getting the number of elements, getting the number of bytes, and accessing the data. ```APIDOC ## itemsize() ### Description Returns the size of a single item in bytes. ### Method `inline size_t itemsize() const` ``` ```APIDOC ## resize(size_t n) ### Description Resizes the table to hold `n` elements. If the new size is larger, memory is allocated. If smaller, memory is deallocated. ### Method `inline void resize(size_t n)` ### Parameters * **n** (size_t) - The new number of elements the table should hold. ``` ```APIDOC ## clear() ### Description Deallocates all memory and resets the table to an empty state. ### Method `inline void clear()` ``` ```APIDOC ## size() const ### Description Returns the current number of elements in the table. ### Method `inline size_t size() const` ``` ```APIDOC ## nbytes() const ### Description Returns the total number of bytes currently allocated for the table. ### Method `inline size_t nbytes() const` ``` -------------------------------- ### Initialization Methods Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexIVFLocalSearchQuantizerFastScan.html Methods for initializing and configuring the index. ```APIDOC ## void init(AdditiveQuantizer *aq, size_t nlist, MetricType metric, int bbs) ### Description Initializes the index with an AdditiveQuantizer and other parameters. ``` ```APIDOC ## void init_fastscan(size_t M, size_t nbits, size_t nlist, MetricType metric, int bbs) ### Description Initializes fast scan parameters for the index. ``` ```APIDOC ## void init_code_packer() ### Description Initializes the code packer for efficient code storage. ``` -------------------------------- ### Install Faiss with GPU support via Conda Source: https://faiss.ai/_sources/index.rst.txt Install the GPU-enabled version of Faiss using Conda. This package includes CUDA-accelerated indices for faster processing on compatible hardware. Ensure you have a compatible CUDA toolkit installed. ```bash $ conda install -c pytorch faiss-gpu ``` -------------------------------- ### HeapHandler begin method Source: https://faiss.ai/cpp_api/file/simd__result__handlers_8h.html Called at the beginning of a search operation. It can be used to initialize any necessary state, such as providing normalization factors. ```cpp inline virtual void begin(const float *norms) ``` -------------------------------- ### set_block_origin Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1simd__result__handlers_1_1ReservoirHandler.html Sets the origin of the sub-matrix currently being computed. Parameters: i0_in - starting row index, j0_in - starting column index. ```APIDOC ## void set_block_origin(size_t i0_in, size_t j0_in) ### Description Sets the sub-matrix that is being computed. ### Parameters - **i0_in** (size_t) - starting row index - **j0_in** (size_t) - starting column index ``` -------------------------------- ### Install Faiss GPU Version Source: https://faiss.ai/index.html Use this command to install the GPU-enabled version of Faiss via Conda. This package includes all CPU functionalities and adds CUDA support. ```bash $ conda install -c pytorch faiss-gpu ``` -------------------------------- ### ProductResidualQuantizer::init Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1ProductResidualQuantizer.html Initializes the ProductResidualQuantizer with sub-quantizers. ```APIDOC ## void init(size_t d, const std::vector &aqs, Search_type_t search_type) ### Description Initializes the product additive quantizer. ### Parameters * **d** (size_t) - dimensionality of the input vectors * **aqs** (const std::vector&) - vector of AdditiveQuantizer objects * **search_type** (Search_type_t) - AQ search type ``` -------------------------------- ### begin Method Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1simd__result__handlers_1_1HeapHandler.html Called at the beginning of the search process, potentially to initialize internal states or process norms. ```APIDOC ## begin Method ### Description Initializes the handler at the start of a search operation. ### Signature ```cpp inline virtual void begin(const float *norms) ``` ### Parameters * **norms** (const float *) - Pointer to an array of normalization factors, if applicable. ``` -------------------------------- ### Install Faiss with CPU support via Conda Source: https://faiss.ai/_sources/index.rst.txt Use this command to install the CPU-only version of Faiss using Conda. This package provides the core functionality for similarity search and clustering. ```bash $ conda install -c pytorch faiss-cpu ``` -------------------------------- ### profilerStart Source: https://faiss.ai/cpp_api/file/DeviceUtils_8h.html Starts the CUDA profiler. ```APIDOC ## profilerStart() ### Description Starts the CUDA profiler (exposed via SWIG). ``` -------------------------------- ### init_level_0_from_entry_points Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexHNSW2Level.html Alternative graph building using entry points. ```APIDOC ## init_level_0_from_entry_points ### Description Alternative graph building using entry points. ### Method void init_level_0_from_entry_points(int npt, const storage_idx_t *points, const storage_idx_t *nearests) ### Parameters * **npt** (*int*) * **points** (*const storage_idx_t* *) * **nearests** (*const storage_idx_t* *) ``` -------------------------------- ### get_distance_computer Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexHNSW2Level.html Gets the distance computer for the index. ```APIDOC ## get_distance_computer ### Description Get a DistanceComputer (defined in AuxIndexStructures) object for this kind of index. DistanceComputer is implemented for indexes that support random access of their vectors. ### Method virtual DistanceComputer *get_distance_computer() const override ### Returns *DistanceComputer* object ``` -------------------------------- ### IndexHNSW::init_level_0_from_entry_points Source: https://faiss.ai/cpp_api/file/IndexHNSW_8h.html Alternative graph building method using entry points. ```APIDOC ## init_level_0_from_entry_points ### Description alternative graph building ### Parameters * **npt** (int) - number of entry points * **points** (const storage_idx_t *) - entry points * **nearests** (const storage_idx_t *) - nearest neighbors ``` -------------------------------- ### Initialization Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexIVFProductLocalSearchQuantizerFastScan.html Methods for initializing the quantizer and related structures. ```APIDOC ## void init(AdditiveQuantizer *aq, size_t nlist, MetricType metric, int bbs) ### Description Initializes the additive quantizer, number of lists, metric, and block size. ### Parameters * **aq** (AdditiveQuantizer *) - Pointer to the AdditiveQuantizer. * **nlist** (size_t) - The number of lists. * **metric** (MetricType) - The distance metric. * **bbs** (int) - The block size for fast scanning. ``` ```APIDOC ## void init_fastscan(size_t M, size_t nbits, size_t nlist, MetricType metric, int bbs) ### Description Initializes the fast scan parameters. ### Parameters * **M** (size_t) - The number of subquantizers. * **nbits** (size_t) - The number of bits per subquantizer. * **nlist** (size_t) - The number of lists. * **metric** (MetricType) - The distance metric. * **bbs** (int) - The block size for fast scanning. ``` ```APIDOC ## void init_code_packer() ### Description Initializes the code packer for efficient code storage. ``` -------------------------------- ### combination_name Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1ParameterSpace.html Gets the string representation of a parameter combination. ```APIDOC ## std::string combination_name(size_t cno) const ### Description Retrieves the string representation of a specific parameter combination identified by its index. ### Method `const` member function ### Endpoint N/A ### Parameters - **cno** (size_t) - The index of the combination. ### Request Example None ### Response - **return value** (std::string) - The string name of the combination. ``` -------------------------------- ### Get Code Packer Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexFlatIP.html Retrieves a CodePacker object. ```APIDOC ## CodePacker *get_CodePacker() const ### Description Returns a pointer to a `CodePacker` object associated with this index. ``` -------------------------------- ### initializeForDevice Source: https://faiss.ai/cpp_api/file/StandardGpuResources_8h.html Initializes GPU resources for a specific device. This is an internal system call. ```APIDOC ## void initializeForDevice(int device) ### Description Internal system calls. Initialize resources for this device. ### Parameters #### Path Parameters - **device** (int) - The device ID to initialize. ### Method POST ``` -------------------------------- ### Constructor Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexProductLocalSearchQuantizerFastScan.html Initializes a new instance of IndexProductLocalSearchQuantizerFastScan. ```APIDOC ## IndexProductLocalSearchQuantizerFastScan(int d, size_t nsplits, size_t Msub, size_t nbits, MetricType metric = METRIC_L2, Search_type_t search_type = AdditiveQuantizer::ST_norm_rq2x4, int bbs = 32) ### Description Constructor for IndexProductLocalSearchQuantizerFastScan. ### Parameters * **d** (int) - Dimensionality of the input vectors. * **nsplits** (size_t) - Number of local search quantizers. * **Msub** (size_t) - Number of subquantizers per LSQ. * **nbits** (size_t) - Number of bits per subvector index. * **metric** (MetricType) - Metric type (default: METRIC_L2). * **search_type** (Search_type_t) - AQ search type (default: AdditiveQuantizer::ST_norm_rq2x4). * **bbs** (int) - Block size for batch processing (default: 32). ``` -------------------------------- ### filedescriptor Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1FileIOReader.html Gets the file descriptor associated with the reader. ```APIDOC ## int filedescriptor() ### Description Returns the underlying file descriptor for the opened file. ### Returns An integer representing the file descriptor. ``` -------------------------------- ### get_iterator Source: https://faiss.ai/cpp_api/file/InvertedLists_8h.html Gets an iterator for lists that support iteration. ```APIDOC ## get_iterator ### Description Get iterable for lists that use_iterator. ### Parameters - **list_no** (size_t) - The index of the list. - **inverted_list_context** (void *) - Optional context for the inverted list. ### Returns - InvertedListsIterator * - An iterator for the specified list. ``` -------------------------------- ### ProductLocalSearchQuantizer::init Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1ProductLocalSearchQuantizer.html Initializes the ProductLocalSearchQuantizer with a given dimensionality, a vector of AdditiveQuantizer pointers, and a search type. ```APIDOC ## void init(size_t d, const std::vector &aqs, Search_type_t search_type) ### Description Initializes the product additive quantizer. ### Parameters * **d** (size_t) - dimensionality of the input vectors * **aqs** (const std::vector&) - vector of additive quantizers * **search_type** (Search_type_t) - AQ search type ``` -------------------------------- ### get() Source: https://faiss.ai/cpp_api/class/classfaiss_1_1gpu_1_1CublasHandleScope.html Retrieves the underlying cublasHandle_t managed by the scope. ```APIDOC ## get() ### Description Returns the cublasHandle_t managed by this RAII scope. This handle can be used for subsequent CUBLAS operations. ### Method `inline cublasHandle_t get()` ### Parameters None ### Returns cublasHandle_t - The active CUBLAS handle. ``` -------------------------------- ### init Method Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexIVFProductResidualQuantizerFastScan.html Initializes the IndexIVFProductResidualQuantizerFastScan with an AdditiveQuantizer. ```APIDOC ## void init(AdditiveQuantizer *aq, size_t nlist, MetricType metric, int bbs) ### Description Initializes the quantizer with an AdditiveQuantizer. ### Parameters * **aq** (AdditiveQuantizer *) - The additive quantizer to use. * **nlist** (size_t) - The number of lists. * **metric** (MetricType) - The distance metric. * **bbs** (int) - Block size for fast scan. ``` -------------------------------- ### GpuIndexFlat Distance Computer Source: https://faiss.ai/cpp_api/namespace/namespacefaiss_1_1gpu.html Gets a distance computer for the index. ```APIDOC ## get_distance_computer() ### Description Get a `DistanceComputer` (defined in AuxIndexStructures) object for this kind of index. `DistanceComputer` is implemented for indexes that support random access of their vectors. ### Method `virtual DistanceComputer *get_distance_computer() const` ``` -------------------------------- ### void display() const Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexBinaryIVF.html Displays information about the IndexBinaryIVF class and its current state. ```APIDOC ## display ### Description Display the actual class name and some more info. ``` -------------------------------- ### get Method Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1gpu_1_1GpuIcmEncoderFactory.html Retrieves an IcmEncoder instance for GPU processing. ```APIDOC ## lsq::IcmEncoder *get(const LocalSearchQuantizer *lsq) override ### Description Returns an `IcmEncoder` object configured for GPU acceleration, based on the provided `LocalSearchQuantizer`. ### Parameters * **lsq** (const LocalSearchQuantizer *) - A pointer to the LocalSearchQuantizer object to be used for encoding. ``` -------------------------------- ### initialize Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1ParameterSpace.html Initializes the parameter space with reasonable default parameters for a given index. ```APIDOC ## virtual void initialize(const Index *index) ### Description Initializes the parameter space with sensible default values suitable for the provided Faiss index. ### Method `virtual` member function ### Endpoint N/A ### Parameters - **index** (const Index *) - A pointer to the Faiss index for which to initialize parameters. ### Request Example None ### Response None ``` -------------------------------- ### IndexIVFPQ Constructor Source: https://faiss.ai/cpp_api/file/IndexIVFPQ_8h.html Initializes an IndexIVFPQ object, which represents an inverted file index with Product Quantizer encoding. It sets up the index with a given quantizer, dimensionality, number of lists, product quantizer parameters, and metric type. ```APIDOC ## IndexIVFPQ(Index *quantizer, size_t d, size_t nlist, size_t M, size_t nbits_per_idx, MetricType metric = METRIC_L2) ### Description Inverted file with Product Quantizer encoding. Each residual vector is encoded as a product quantizer code. ### Parameters * **quantizer** (Index *) - The index used for coarse quantization. * **d** (size_t) - The dimensionality of the vectors. * **nlist** (size_t) - The number of inverted lists (clusters). * **M** (size_t) - The number of subquantizers in the Product Quantizer. * **nbits_per_idx** (size_t) - The number of bits per subquantizer index. * **metric** (MetricType) - The distance metric to use (default: METRIC_L2). ``` -------------------------------- ### Get Code Packer Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexAdditiveQuantizerFastScan.html Retrieves the CodePacker associated with the index. ```APIDOC ## CodePacker *get_CodePacker() const ### CodePacker *get_CodePacker() const ``` -------------------------------- ### GPU Resource Initialization and Handles Source: https://faiss.ai/cpp_api/namespace/namespacefaiss_1_1gpu.html Functions for initializing GPU resources and retrieving handles for cuBLAS and streams. ```APIDOC ## virtual void initializeForDevice(int device) ### Description Internal system calls. Initialize resources for this device. ### Method virtual void ``` ```APIDOC ## virtual cublasHandle_t getBlasHandle(int device) ### Description Returns the cuBLAS handle that we use for the given device. ### Method virtual cublasHandle_t ``` ```APIDOC ## cublasHandle_t getBlasHandleCurrentDevice() ### Description Calls getBlasHandle with the current device. ### Method cublasHandle_t ``` ```APIDOC ## cudaStream_t getDefaultStreamCurrentDevice() ### Description Calls getDefaultStream with the current device. ### Method cudaStream_t ``` ```APIDOC ## std::vector getAlternateStreamsCurrentDevice() ### Description Calls getAlternateStreams for the current device. ### Method std::vector ``` ```APIDOC ## cudaStream_t getAsyncCopyStreamCurrentDevice() ### Description Calls getAsyncCopyStream for the current device. ### Method cudaStream_t ``` -------------------------------- ### Get FlatCodesDistanceComputer Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexFlatIP.html Retrieves a distance computer for flat codes. ```APIDOC ## FlatCodesDistanceComputer *get_FlatCodesDistanceComputer() const override ### Description Returns a pointer to a `FlatCodesDistanceComputer` object. This computer offers a `distance_to_code` method. The default implementation explicitly decodes the vector using `sa_decode`. ``` -------------------------------- ### hashtable_int64_to_int64_init Source: https://faiss.ai/cpp_api/file/sorting_8h.html Initializes a hash table for int64 to int64 mapping with external storage. ```APIDOC ## hashtable_int64_to_int64_init ### Description Hashtable implementation for int64 -> int64 with external storage implemented for fast batch add and lookup. tab is of size 2 * (1 << log2_capacity) ### Parameters #### Parameters - **log2_capacity** (int) - log2 of the capacity of the hash table - **tab** (int64_t *) - pointer to the hash table storage ``` -------------------------------- ### get Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1DirectMap.html Retrieves an entry from the direct map given an ID. ```APIDOC ## idx_t get(idx_t id) const ### Description Retrieves an entry from the direct map using the provided ID. This is a core function for looking up mapped values. ### Method `idx_t` ### Parameters * **id** (idx_t) - The ID to look up. ### Returns The mapped entry for the given ID. ``` -------------------------------- ### pq4_get_packed_element Source: https://faiss.ai/cpp_api/file/pq4__fast__scan_8h.html Get a single element from a packed codes table. ```APIDOC ## pq4_get_packed_element ### Description Get a single element from a packed codes table. ### Parameters #### Path Parameters - **data** (const uint8_t *) - packed codes array - **bbs** (size_t) - size of database blocks (multiple of 32) - **nsq** (size_t) - number of sub-quantizers (multiple of 2) - **vector_id** (size_t) - vector id - **sq** (size_t) - subquantizer (< nsq). ``` -------------------------------- ### Constructors Source: https://faiss.ai/cpp_api/class/classfaiss_1_1gpu_1_1GpuIndexIVFPQ.html Constructors for GpuIndexIVFPQ allow initialization from existing faiss::IndexIVFPQ instances or by specifying parameters for a new index. ```APIDOC ## GpuIndexIVFPQ(GpuResourcesProvider *provider, const faiss::IndexIVFPQ *index, GpuIndexIVFPQConfig config = GpuIndexIVFPQConfig()) ### Description Construct from a pre-existing faiss::IndexIVFPQ instance, copying data over to the given GPU, if the input index is trained. ## GpuIndexIVFPQ(GpuResourcesProvider *provider, int dims, idx_t nlist, idx_t subQuantizers, idx_t bitsPerCode, faiss::MetricType metric = faiss::METRIC_L2, GpuIndexIVFPQConfig config = GpuIndexIVFPQConfig()) ### Description Constructs a new instance with an empty flat quantizer; the user provides the number of IVF lists desired. ## GpuIndexIVFPQ(GpuResourcesProvider *provider, Index *coarseQuantizer, int dims, idx_t nlist, idx_t subQuantizers, idx_t bitsPerCode, faiss::MetricType metric = faiss::METRIC_L2, GpuIndexIVFPQConfig config = GpuIndexIVFPQConfig()) ### Description Constructs a new instance with a provided CPU or GPU coarse quantizer; the user provides the number of IVF lists desired. ``` -------------------------------- ### GpuIndexIVFFlat Initialization Source: https://faiss.ai/cpp_api/file/GpuIndexIVFFlat_8h.html Initializes the GpuIndexIVFFlat with specified parameters. This method sets up the index structure on the GPU. ```APIDOC ## void setIndex_(GpuResources *resources, int dim, int nlist, faiss::MetricType metric, float metricArg, bool useResidual, faiss::ScalarQuantizer *scalarQ, bool interleavedLayout, IndicesOptions indicesOptions, MemorySpace space) ### Description Initialize appropriate index. ### Parameters - **resources** (GpuResources *) - Pointer to GPU resources. - **dim** (int) - The dimension of the vectors. - **nlist** (int) - The number of inverted lists. - **metric** (faiss::MetricType) - The distance metric to use. - **metricArg** (float) - Argument for the distance metric. - **useResidual** (bool) - Whether to use residual quantization. - **scalarQ** (faiss::ScalarQuantizer *) - Optional ScalarQuantizer for quantization. - **interleavedLayout** (bool) - Whether to use interleaved layout for data. - **indicesOptions** (IndicesOptions) - Options for index storage. - **space** (MemorySpace) - The memory space to use (e.g., GPU). ``` -------------------------------- ### Get Centroids Source: https://faiss.ai/cpp_api/file/ProductQuantizer_8h.html Retrieves the centroids associated with a specific subvector. ```APIDOC ## float *get_centroids(size_t m, size_t i) ### Description Returns a pointer to the centroids associated with subvector `m` and centroid index `i`. ### Method `float *get_centroids(size_t m, size_t i)` ### Parameters - **m** (size_t) - The index of the subquantizer. - **i** (size_t) - The index of the centroid within the subquantizer. ``` ```APIDOC ## const float *get_centroids(size_t m, size_t i) const ### Description Returns a const pointer to the centroids associated with subvector `m` and centroid index `i`. ### Method `const float *get_centroids(size_t m, size_t i) const` ### Parameters - **m** (size_t) - The index of the subquantizer. - **i** (size_t) - The index of the centroid within the subquantizer. ``` -------------------------------- ### ProductAdditiveQuantizer::init Source: https://faiss.ai/cpp_api/file/ProductAdditiveQuantizer_8h.html Initializes the product additive quantizer with specified parameters. ```APIDOC ## void init(size_t d, const std::vector &aqs, Search_type_t search_type) ### Description Initializes the product additive quantizer. ### Parameters * **d** (size_t) - dimensionality of the input vectors * **aqs** (const std::vector&) - sub-additive quantizers * **search_type** (Search_type_t) - AQ search type ``` -------------------------------- ### IndexFlatCodes::get_distance_computer Source: https://faiss.ai/cpp_api/file/IndexFlatCodes_8h.html Gets a distance computer object for the index. ```APIDOC ## DistanceComputer *get_distance_computer() const ### Description Retrieves a `DistanceComputer` object for this index. This is available for indexes that support random access to their vectors. The `DistanceComputer` is defined in `AuxIndexStructures`. ``` -------------------------------- ### begin Method Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1Top1BlockResultHandler_1_1SingleResultHandler.html Marks the beginning of results processing for a specific query. ```APIDOC ## begin Method ### Description Marks the beginning of results processing for a specific query. ### Signature `inline void begin(const size_t current_idx_2)` ### Parameters * **current_idx_2** (*const size_t*) - The index of the current query being processed. ``` -------------------------------- ### CpuTimer Constructor Source: https://faiss.ai/cpp_api/class/classfaiss_1_1gpu_1_1CpuTimer.html Creates and starts a new CpuTimer instance. ```APIDOC ## CpuTimer() ### Description Creates and starts a new timer. ### Method Constructor ### Parameters None ``` -------------------------------- ### begin Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1simd__result__handlers_1_1SingleResultHandler.html Called at the beginning of the result handling process, potentially receiving normalization factors. ```APIDOC ## begin ### Description Called at the beginning of the result handling process, potentially receiving normalization factors. ### Signature `inline virtual void begin(const float *norms)` ### Parameters - **norms** (const float *) - Pointer to normalization factors, if applicable. ``` -------------------------------- ### Get Code Packer Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexIVFFlatDedup.html Returns the `CodePacker` object used by this index. ```APIDOC ## get_CodePacker Returns the `CodePacker` object used by this index. ### Method virtual CodePacker *get_CodePacker() const ``` -------------------------------- ### Get Distance Computer Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexFlatIP.html Retrieves a distance computer object for this index. ```APIDOC ## DistanceComputer *get_distance_computer() const override ### Description Returns a `DistanceComputer` object for this index. This is available for indexes that support random access of their vectors. The `DistanceComputer` interface is defined in `AuxIndexStructures`. ``` -------------------------------- ### verifyIVFSettings_ Source: https://faiss.ai/cpp_api/namespace/namespacefaiss_1_1gpu.html Verifies the settings for the Inverted File (IVF) index. Throws an exception if settings are invalid. ```APIDOC ## verifyIVFSettings_ ### Description Verifies the settings for the Inverted File (IVF) index. Throws an exception if settings are invalid. ### Throws An exception if IVF settings are invalid. ``` -------------------------------- ### Get Code Size Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexFlatIP.html Returns the size of the encoded vectors in bytes. ```APIDOC ## size_t sa_code_size() const override ### Description Returns the size in bytes of the encoded representation for a single vector. ``` -------------------------------- ### Constructors Source: https://faiss.ai/cpp_api/class/classfaiss_1_1gpu_1_1GpuIndexIVFScalarQuantizer.html Provides different ways to construct a GpuIndexIVFScalarQuantizer, either from an existing CPU index, or by specifying parameters for a new index. ```APIDOC ## Constructor Overloads ### GpuIndexIVFScalarQuantizer(GpuResourcesProvider *provider, const faiss::IndexIVFScalarQuantizer *index, GpuIndexIVFScalarQuantizerConfig config = GpuIndexIVFScalarQuantizerConfig()) **Description**: Constructs from a pre-existing faiss::IndexIVFScalarQuantizer instance, copying data over to the given GPU, if the input index is trained. ### GpuIndexIVFScalarQuantizer(GpuResourcesProvider *provider, int dims, idx_t nlist, faiss::ScalarQuantizer::QuantizerType qtype, faiss::MetricType metric = MetricType::METRIC_L2, bool encodeResidual = true, GpuIndexIVFScalarQuantizerConfig config = GpuIndexIVFScalarQuantizerConfig()) **Description**: Constructs a new instance with an empty flat quantizer; the user provides the number of IVF lists desired. ### GpuIndexIVFScalarQuantizer(GpuResourcesProvider *provider, Index *coarseQuantizer, int dims, idx_t nlist, faiss::ScalarQuantizer::QuantizerType qtype, faiss::MetricType metric = MetricType::METRIC_L2, bool encodeResidual = true, GpuIndexIVFScalarQuantizerConfig config = GpuIndexIVFScalarQuantizerConfig()) **Description**: Constructs a new instance with a provided CPU or GPU coarse quantizer; the user provides the number of IVF lists desired. ``` -------------------------------- ### Get Base Vectors Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexFlatIP.html Provides access to the underlying base vectors. ```APIDOC ## float *get_xb() ### Description Returns a pointer to the beginning of the underlying base vectors array. ``` ```APIDOC ## const float *get_xb() const ### Description Returns a const pointer to the beginning of the underlying base vectors array. ``` -------------------------------- ### Constructors Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1simd64uint8.html Various constructors are available to initialize a simd64uint8 object. ```APIDOC ## Constructors ### Default Constructor ```cpp inline simd64uint8() ``` ### Constructor from __m512i ```cpp inline explicit simd64uint8(__m512i i) ``` ### Constructor from int ```cpp inline explicit simd64uint8(int x) ``` ### Constructor from uint8_t ```cpp inline explicit simd64uint8(uint8_t x) ``` ### Constructor from simd256bit (low part) ```cpp inline explicit simd64uint8(simd256bit lo) ``` ### Constructor from two simd256bit vectors ```cpp inline explicit simd64uint8(simd256bit lo, simd256bit hi) ``` ### Constructor from simd512bit ```cpp inline explicit simd64uint8(simd512bit x) ``` ### Constructor from const uint8_t pointer ```cpp inline explicit simd64uint8(const uint8_t *x) ``` ``` -------------------------------- ### reconstruct_n Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexProductResidualQuantizer.html Reconstructs a sequence of vectors from the index, starting from a given index. ```APIDOC ## void reconstruct_n(idx_t i0, idx_t ni, float *recons) const ### Description Reconstruct vectors i0 to i0 + ni - 1. This function may not be defined for some indexes. ### Parameters - **i0** (idx_t) - index of the first vector in the sequence - **ni** (idx_t) - number of vectors in the sequence - **recons** (float *) - reconstructed vector (size ni * d) ``` -------------------------------- ### begin Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1simd__result__handlers_1_1ReservoirHandler.html Called at the beginning of processing, potentially with normalization information. ```APIDOC ## virtual void begin(const float *norms) ### Description Called at the beginning of processing, potentially with normalization information. ### Parameters - **norms** (const float *) - pointer to normalization values. ``` -------------------------------- ### add Source: https://faiss.ai/cpp_api/namespace/namespacefaiss_1_1gpu.html `x` can be resident on the CPU or any GPU; copies are performed as needed. Handles paged adds if the add set is too large; calls addInternal_. ```APIDOC ## add ### Description Adds vectors to the index. `x` can be resident on the CPU or any GPU; copies are performed as needed. Handles paged adds if the add set is too large; calls addInternal_. ### Method `virtual void add(idx_t, const float *x) override` ``` -------------------------------- ### get() Method Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1InvertedLists_1_1ScopedIds.html Retrieves a raw pointer to the beginning of the inverted list IDs. ```APIDOC ## get() Method ### Description Returns a const pointer to the array of IDs for the specified inverted list. ### Signature `inline const idx_t *get()` ### Returns `const idx_t *` - A pointer to the first ID in the list. ``` -------------------------------- ### Get List Size Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexIVFFlatDedup.html Returns the number of vectors in a specific inverted list. ```APIDOC ## get_list_size Returns the number of vectors in a specific inverted list. ### Method inline size_t get_list_size(size_t list_no) const ### Parameters * **list_no** (size_t) - The index of the inverted list. ``` -------------------------------- ### Constructor Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexIVFProductLocalSearchQuantizer.html Constructs an IndexIVFProductLocalSearchQuantizer. This constructor initializes the index with a given quantizer, dimensionality, number of lists, number of splits for local search, subquantizer configuration, bit depth, metric type, and search type. ```APIDOC ## IndexIVFProductLocalSearchQuantizer(Index *quantizer, size_t d, size_t nlist, size_t nsplits, size_t Msub, size_t nbits, MetricType metric = METRIC_L2, Search_type_t search_type = AdditiveQuantizer::ST_decompress) ### Description Constructor for IndexIVFProductLocalSearchQuantizer. ### Parameters * **quantizer** - The main quantizer index. * **d** - Dimensionality of the input vectors. * **nlist** - Number of inverted lists. * **nsplits** - Number of local search quantizers. * **Msub** - Number of subquantizers per Local Search Quantizer (LSQ). * **nbits** - Number of bits per subvector index. * **metric** - The distance metric to use (default: METRIC_L2). * **search_type** - The type of search to perform (default: AdditiveQuantizer::ST_decompress). ``` -------------------------------- ### Constructors Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1simd32uint16.html Various constructors are available to initialize a simd32uint16 object. ```APIDOC ## Constructors ### Default Constructor ```cpp inline simd32uint16() ``` ### Constructor from __m512i ```cpp inline explicit simd32uint16(__m512i i) ``` ### Constructor from int ```cpp inline explicit simd32uint16(int x) ``` ### Constructor from uint16_t ```cpp inline explicit simd32uint16(uint16_t x) ``` ### Constructor from simd512bit ```cpp inline explicit simd32uint16(simd512bit x) ``` ### Constructor from const uint16_t* ```cpp inline explicit simd32uint16(const uint16_t *x) ``` ### Constructor from simd256bit (low) ```cpp inline explicit simd32uint16(simd256bit lo) ``` ### Constructor from two simd256bit (low and high) ```cpp inline explicit simd32uint16(simd256bit lo, simd256bit hi) ``` ``` -------------------------------- ### SliceInvertedLists::list_size Source: https://faiss.ai/cpp_api/file/InvertedLists_8h.html Gets the size of a specific list within the sliced `InvertedLists`. ```APIDOC ## SliceInvertedLists::list_size ### Description Gets the size of a list within the slice. ### Signature virtual size_t list_size(size_t list_no) const override ``` -------------------------------- ### IndexPQStats Constructor Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexPQStats.html Initializes a new instance of the IndexPQStats struct. ```APIDOC ## IndexPQStats() ### Description Constructs a new IndexPQStats object with default values. ### Method `inline IndexPQStats()` ### Parameters None ``` -------------------------------- ### LSQTimerScope Constructor Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1lsq_1_1LSQTimerScope.html Constructs an LSQTimerScope object, starting the timer with a given name. ```APIDOC ## LSQTimerScope(LSQTimer *timer, std::string name) ### Description Initializes a new instance of the LSQTimerScope class, associating it with a timer and a name for the timed operation. ### Parameters #### Path Parameters - **timer** (LSQTimer *) - A pointer to the LSQTimer object to be used for timing. - **name** (std::string) - The name of the operation being timed. ``` -------------------------------- ### search_level_0 Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexHNSW2Level.html Performs search only on level 0, given the starting points for each vertex. ```APIDOC ## search_level_0 ### Description Perform search only on level 0, given the starting points for each vertex. ### Method void search_level_0(idx_t n, const float *x, idx_t k, const storage_idx_t *nearest, const float *nearest_d, float *distances, idx_t *labels, int nprobe = 1, int search_type = 1, const SearchParameters *params = nullptr) const ### Parameters * **n** (*idx_t*) * **x** (*const float* *) * **k** (*idx_t*) * **nearest** (*const storage_idx_t* *) * **nearest_d** (*const float* *) * **distances** (*float* *) * **labels** (*idx_t* *) * **nprobe** (*int*) - Defaults to 1 * **search_type** (*int*) - 1:perform one search per nprobe, 2: enqueue all entry points. Defaults to 1 * **params** (*const SearchParameters* *) - Optional search parameters ``` -------------------------------- ### Constructors Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1simd16uint16.html Various constructors for initializing simd16uint16 objects. ```APIDOC ## Constructors ### Default Constructor ```cpp simd16uint16() ``` ### Constructor from __m256i ```cpp explicit simd16uint16(__m256i i) ``` ### Constructor from int ```cpp explicit simd16uint16(int x) ``` ### Constructor from uint16_t ```cpp explicit simd16uint16(uint16_t x) ``` ### Constructor from simd256bit ```cpp explicit simd16uint16(simd256bit x) ``` ### Constructor from const uint16_t pointer ```cpp explicit simd16uint16(const uint16_t *x) ``` ### Constructor with 16 uint16_t values ```cpp simd16uint16(uint16_t u0, uint16_t u1, uint16_t u2, uint16_t u3, uint16_t u4, uint16_t u5, uint16_t u6, uint16_t u7, uint16_t u8, uint16_t u9, uint16_t u10, uint16_t u11, uint16_t u12, uint16_t u13, uint16_t u14, uint16_t u15) ``` ### Constructor from uint16x8x2_t ```cpp explicit simd16uint16(const uint16x8x2_t &v) ``` ### Template Constructor from any simd256bit type ```cpp template::value, std::nullptr_t>::type = nullptr> inline explicit simd16uint16(const T &x) ``` ``` -------------------------------- ### Constructors Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1simd16uint16.html Various constructors for initializing simd16uint16 objects. ```APIDOC ## Constructors ### Default Constructor ```cpp inline simd16uint16() ``` ### Integer Constructor ```cpp inline explicit simd16uint16(int x) ``` ### Unsigned 16-bit Integer Constructor ```cpp inline explicit simd16uint16(uint16_t x) ``` ### 256-bit SIMD Constructor ```cpp inline explicit simd16uint16(const simd256bit &x) ``` ### Pointer Constructor (uint16_t) ```cpp inline explicit simd16uint16(const uint16_t *x) ``` ### Variadic Constructor (16 uint16_t values) ```cpp inline explicit simd16uint16(uint16_t u0, uint16_t u1, uint16_t u2, uint16_t u3, uint16_t u4, uint16_t u5, uint16_t u6, uint16_t u7, uint16_t u8, uint16_t u9, uint16_t u10, uint16_t u11, uint16_t u12, uint16_t u13, uint16_t u14, uint16_t u15) ``` ``` -------------------------------- ### Get most significant bits of each byte Source: https://faiss.ai/cpp_api/file/simdlib__emulated_8h.html Extracts the most significant bit from each byte of a simd32uint8 vector. ```cpp inline uint32_t get_MSBs(const simd32uint8 &a) { } ``` -------------------------------- ### Constructor Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexProductResidualQuantizerFastScan.html Initializes a new instance of the IndexProductResidualQuantizerFastScan struct. ```APIDOC ## IndexProductResidualQuantizerFastScan(int d, size_t nsplits, size_t Msub, size_t nbits, MetricType metric = METRIC_L2, Search_type_t search_type = AdditiveQuantizer::ST_norm_rq2x4, int bbs = 32) ### Description Constructor for IndexProductResidualQuantizerFastScan. ### Parameters * **d** (int) - dimensionality of the input vectors * **nsplits** (size_t) - number of residual quantizers * **Msub** (size_t) - number of subquantizers per RQ * **nbits** (size_t) - number of bit per subvector index * **metric** (MetricType) - metric type (default: METRIC_L2) * **search_type** (Search_type_t) - AQ search type (default: AdditiveQuantizer::ST_norm_rq2x4) * **bbs** (int) - block size for search (default: 32) ``` -------------------------------- ### IcmEncoderFactory::get Source: https://faiss.ai/cpp_api/file/LocalSearchQuantizer_8h.html Factory method to get an IcmEncoder instance. This is an inline virtual function. ```APIDOC ## get ### Description Factory method to get an IcmEncoder instance. ### Signature `inline virtual IcmEncoder *get(const LocalSearchQuantizer *lsq)` ### Parameters * **lsq** (const LocalSearchQuantizer *) - Pointer to the LocalSearchQuantizer object. ``` -------------------------------- ### ProductQuantizer Constructor Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1ProductQuantizer.html Constructs a ProductQuantizer object. You can initialize it with dimensions or use the default constructor. ```APIDOC ## ProductQuantizer Constructor ### Description Constructs a ProductQuantizer object. You can initialize it with dimensions or use the default constructor. ### Signature ProductQuantizer(size_t d, size_t M, size_t nbits) ProductQuantizer() ### Parameters - **d** (size_t) - The total dimensionality of the vectors. - **M** (size_t) - The number of subquantizers (subvectors). - **nbits** (size_t) - The number of bits to use for each subquantizer's code. ### Usage ```cpp // Example with dimensions faiss::ProductQuantizer pq(d, M, nbits); // Example with default constructor (dimensions must be set later) faiss::ProductQuantizer pq_default; ``` ``` -------------------------------- ### get_InvertedListScanner Source: https://faiss.ai/cpp_api/file/IndexIVFFlat_8h.html Gets a scanner for this index. The default search implementation uses this to compute the distances. ```APIDOC ## get_InvertedListScanner ### Description Gets a scanner for this index. The default search implementation uses this to compute the distances. ### Signature `virtual InvertedListScanner *get_InvertedListScanner(bool store_pairs, const IDSelector *sel) const override` ### Parameters * **store_pairs** (bool) - If true, ignore labels. * **sel** (const IDSelector *) - The ID selector. ``` -------------------------------- ### ProductQuantizer Constructor Source: https://faiss.ai/cpp_api/file/ProductQuantizer_8h.html Constructs a ProductQuantizer object. The default constructor initializes an empty quantizer. ```APIDOC ## ProductQuantizer() ### Description Default constructor for ProductQuantizer. ### Method ProductQuantizer() ### Parameters None ``` -------------------------------- ### reconstruct_n Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexNSGPQ.html Reconstructs a contiguous sequence of vectors from the index, specified by a starting index and a count. ```APIDOC ## void reconstruct_n(idx_t i0, idx_t ni, float *recons) const ### Description Reconstructs vectors from index i0 to i0 + ni - 1. This function may not be defined for some indexes. ### Method `void reconstruct_n(idx_t i0, idx_t ni, float *recons) const` ### Parameters: * **i0** - The index of the first vector in the sequence. * **ni** - The number of vectors in the sequence. * **recons** - Output buffer for the reconstructed vectors (size ni * d). ``` -------------------------------- ### Constructors Source: https://faiss.ai/cpp_api/class/classfaiss_1_1gpu_1_1GpuIndexFlat.html Constructs a GpuIndexFlat instance. It can be initialized from an existing faiss::IndexFlat, or as an empty instance. ```APIDOC ## Constructors ### GpuIndexFlat(GpuResourcesProvider *provider, const faiss::IndexFlat *index, GpuIndexFlatConfig config = GpuIndexFlatConfig()) Construct from a pre-existing faiss::IndexFlat instance, copying data over to the given GPU. ### GpuIndexFlat(std::shared_ptr resources, const faiss::IndexFlat *index, GpuIndexFlatConfig config = GpuIndexFlatConfig()) ### GpuIndexFlat(GpuResourcesProvider *provider, int dims, faiss::MetricType metric, GpuIndexFlatConfig config = GpuIndexFlatConfig()) Construct an empty instance that can be added to. ### GpuIndexFlat(std::shared_ptr resources, int dims, faiss::MetricType metric, GpuIndexFlatConfig config = GpuIndexFlatConfig()) ``` -------------------------------- ### IndexHNSWSQ::search_level_0 Source: https://faiss.ai/cpp_api/file/IndexHNSW_8h.html Performs a search only on level 0, given the starting points for each vertex. ```APIDOC ## search_level_0 ### Description Perform search only on level 0, given the starting points for each vertex. ### Parameters * **n** (idx_t) - number of vectors * **x** (const float *) - input vectors to search, size n * d * **k** (idx_t) - number of nearest neighbors to search for * **nearest** (const storage_idx_t *) - starting points for each vertex * **nearest_d** (const float *) - distances to the starting points * **distances** (float *) - output array for distances * **labels** (idx_t *) - output array for labels * **nprobe** (int) - number of probes (default: 1) * **search_type** (int) - type of search (1: perform one search per nprobe, 2: enqueue all entry points) (default: 1) * **params** (const SearchParameters *) - additional search parameters (default: nullptr) ``` -------------------------------- ### IndexHNSW::search_level_0 Source: https://faiss.ai/cpp_api/file/IndexHNSW_8h.html Performs a search only on level 0, given the starting points for each vertex. ```APIDOC ## search_level_0 ### Description Perform search only on level 0, given the starting points for each vertex. ### Parameters * **n** (idx_t) - number of vectors * **x** (const float *) - input vectors to search, size n * d * **k** (idx_t) - number of nearest neighbors to search for * **nearest** (const storage_idx_t *) - starting points for each vertex * **nearest_d** (const float *) - distances to the starting points * **distances** (float *) - output array for distances * **labels** (idx_t *) - output array for labels * **nprobe** (int) - number of probes (default: 1) * **search_type** (int) - type of search (1: one search per nprobe, 2: enqueue all entry points) (default: 1) * **params** (const SearchParameters *) - additional search parameters (default: nullptr) ``` -------------------------------- ### Constructor Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1CodePackerFlat.html Constructs a CodePackerFlat object with a specified code size. ```APIDOC ## Constructor ### Description Initializes a new instance of the `CodePackerFlat` class. ### Signature `explicit CodePackerFlat(size_t code_size)` ### Parameters * **code_size** (size_t) - The size of each code to be packed or unpacked. ``` -------------------------------- ### Information and Code Size Source: https://faiss.ai/cpp_api/struct/structfaiss_1_1IndexBinaryFromFloat.html Methods to display index information and get the size of the produced codes. ```APIDOC ## Information and Code Size ### `void display() const` Display the actual class name and some more info. ### `virtual size_t sa_code_size() const` Size of the produced codes in bytes. ```