Debian Codegraph @

c_api/AutoTune_c.h

raw
1 /*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 // -*- c -*-
9
10 #ifndef FAISS_AUTO_TUNE_C_H
11 #define FAISS_AUTO_TUNE_C_H
12
13 #include "Index_c.h"
14 #include "faiss_c.h"
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 /// possible values of a parameter, sorted from least to most expensive/accurate
21 FAISS_DECLARE_CLASS(ParameterRange)
22
23 FAISS_DECLARE_GETTER(ParameterRange, const char*, name)
24
25 /// Getter for the values in the range. The output values are invalidated
26 /// upon any other modification of the range.
27 void faiss_ParameterRange_values(FaissParameterRange*, double**, size_t*);
28
29 /** Uses a-priori knowledge on the Faiss indexes to extract tunable parameters.
30 */
31 FAISS_DECLARE_CLASS(ParameterSpace)
32
33 FAISS_DECLARE_DESTRUCTOR(ParameterSpace)
34
35 /// Parameter space default constructor
36 int faiss_ParameterSpace_new(FaissParameterSpace** space);
37
38 /// nb of combinations, = product of values sizes
39 size_t faiss_ParameterSpace_n_combinations(const FaissParameterSpace*);
40
41 /// get string representation of the combination
42 /// by writing it to the given character buffer.
43 /// A buffer size of 1000 ensures that the full name is collected.
44 int faiss_ParameterSpace_combination_name(
45 const FaissParameterSpace*,
46 size_t,
47 char*,
48 size_t);
49
50 /// set a combination of parameters described by a string
51 int faiss_ParameterSpace_set_index_parameters(
52 const FaissParameterSpace*,
53 FaissIndex*,
54 const char*);
55
56 /// set a combination of parameters on an index
57 int faiss_ParameterSpace_set_index_parameters_cno(
58 const FaissParameterSpace*,
59 FaissIndex*,
60 size_t);
61
62 /// set one of the parameters
63 int faiss_ParameterSpace_set_index_parameter(
64 const FaissParameterSpace*,
65 FaissIndex*,
66 const char*,
67 double);
68
69 /// print a description on stdout
70 void faiss_ParameterSpace_display(const FaissParameterSpace*);
71
72 /// add a new parameter (or return it if it exists)
73 int faiss_ParameterSpace_add_range(
74 FaissParameterSpace*,
75 const char*,
76 FaissParameterRange**);
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif