Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
AutoTune_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_AUTO_TUNE_C_H
13 #define FAISS_AUTO_TUNE_C_H
14 
15 #include "faiss_c.h"
16 #include "Index_c.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /** Build and index with the sequence of processing steps described in
23  * the string.
24  */
25 int faiss_index_factory(FaissIndex** p_index, int d, const char* description, FaissMetricType metric);
26 
27 /// possible values of a parameter, sorted from least to most expensive/accurate
28 FAISS_DECLARE_CLASS(ParameterRange)
29 
30 FAISS_DECLARE_GETTER(ParameterRange, const char*, name)
31 
32 /// Getter for the values in the range. The output values are invalidated
33 /// upon any other modification of the range.
34 void faiss_ParameterRange_values(FaissParameterRange*, double**, size_t*);
35 
36 /** Uses a-priori knowledge on the Faiss indexes to extract tunable parameters.
37  */
38 FAISS_DECLARE_CLASS(ParameterSpace)
39 
40 /// Parameter space default constructor
41 int faiss_ParameterSpace_new(FaissParameterSpace** space);
42 
43 /// nb of combinations, = product of values sizes
44 size_t faiss_ParameterSpace_n_combinations(const FaissParameterSpace*);
45 
46 /// get string representation of the combination
47 /// by writing it to the given character buffer.
48 /// A buffer size of 1000 ensures that the full name is collected.
49 int faiss_ParameterSpace_combination_name(const FaissParameterSpace*, size_t, char*, size_t);
50 
51 /// set a combination of parameters described by a string
52 int faiss_ParameterSpace_set_index_parameters(const FaissParameterSpace*, FaissIndex*, const char *);
53 
54 /// set a combination of parameters on an index
55 int faiss_ParameterSpace_set_index_parameters_cno(const FaissParameterSpace*, FaissIndex*, size_t);
56 
57 /// set one of the parameters
58 int faiss_ParameterSpace_set_index_parameter(const FaissParameterSpace*, FaissIndex*, const char *, double);
59 
60 /// print a description on stdout
61 void faiss_ParameterSpace_display(const FaissParameterSpace*);
62 
63 /// add a new parameter (or return it if it exists)
64 int faiss_ParameterSpace_add_range(FaissParameterSpace*, const char*, FaissParameterRange**);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif