Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
IndexIVFFlat_c.h
1 /**
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD+Patents license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 // Copyright 2004-present Facebook. All Rights Reserved.
10 // -*- c -*-
11 
12 #ifndef FAISS_INDEX_IVF_FLAT_C_H
13 #define FAISS_INDEX_IVF_FLAT_C_H
14 
15 #include "faiss_c.h"
16 #include "Index_c.h"
17 #include "Clustering_c.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /** Inverted file with stored vectors. Here the inverted file
24  * pre-selects the vectors to be searched, but they are not otherwise
25  * encoded, the code array just contains the raw float entries.
26  */
27 FAISS_DECLARE_CLASS(IndexIVFFlat)
28 FAISS_DECLARE_DESTRUCTOR(IndexIVFFlat)
29 FAISS_DECLARE_INDEX_DOWNCAST(IndexIVFFlat)
30 
31 int faiss_IndexIVFFlat_new(FaissIndexIVFFlat** p_index);
32 
33 int faiss_IndexIVFFlat_new_with(FaissIndexIVFFlat** p_index,
34  FaissIndex* quantizer, size_t d, size_t nlist);
35 
36 int faiss_IndexIVFFlat_new_with_metric(
37  FaissIndexIVFFlat** p_index, FaissIndex* quantizer, size_t d, size_t nlist,
38  FaissMetricType metric);
39 
40 int faiss_IndexIVFFlat_add_core(FaissIndexIVFFlat* index, idx_t n,
41  const float * x, const long *xids, const long *precomputed_idx);
42 
43 /** Update a subset of vectors.
44  *
45  * The index must have a direct_map
46  *
47  * @param nv nb of vectors to update
48  * @param idx vector indices to update, size nv
49  * @param v vectors of new values, size nv*d
50  */
51 int faiss_IndexIVFFlat_update_vectors(FaissIndexIVFFlat* index, int nv,
52  idx_t *idx, const float *v);
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 
58 
59 #endif